@fabasoad/sarif-to-slack 0.2.5 → 1.1.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 (192) hide show
  1. package/.github/workflows/release.yml +1 -1
  2. package/.github/workflows/security.yml +0 -1
  3. package/.github/workflows/send-sarif-to-slack.yml +145 -73
  4. package/.gitleaksignore +8 -0
  5. package/.pre-commit-config.yaml +3 -3
  6. package/.tool-versions +1 -1
  7. package/dist/Logger.js +4 -1
  8. package/dist/SarifToSlackClient.d.ts +33 -0
  9. package/dist/SarifToSlackClient.d.ts.map +1 -0
  10. package/dist/SarifToSlackClient.js +178 -0
  11. package/dist/SlackMessageBuilder.js +34 -82
  12. package/dist/System.d.ts +1 -3
  13. package/dist/System.d.ts.map +1 -1
  14. package/dist/System.js +10 -3
  15. package/dist/index.cjs +826 -472
  16. package/dist/index.d.ts +35 -12
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +36 -12
  19. package/dist/model/Color.d.ts +80 -0
  20. package/dist/model/Color.d.ts.map +1 -0
  21. package/dist/model/Color.js +106 -0
  22. package/dist/model/Finding.d.ts +2 -0
  23. package/dist/model/Finding.d.ts.map +1 -0
  24. package/dist/model/Finding.js +93 -0
  25. package/dist/model/FindingsArray.d.ts +2 -0
  26. package/dist/model/FindingsArray.d.ts.map +1 -0
  27. package/dist/model/FindingsArray.js +24 -0
  28. package/dist/processors/CodeQLProcessor.d.ts +2 -0
  29. package/dist/processors/CodeQLProcessor.d.ts.map +1 -0
  30. package/dist/processors/CodeQLProcessor.js +17 -0
  31. package/dist/processors/CommonProcessor.d.ts +2 -0
  32. package/dist/processors/CommonProcessor.d.ts.map +1 -0
  33. package/dist/processors/CommonProcessor.js +84 -0
  34. package/dist/processors/ProcessorFactory.d.ts +2 -0
  35. package/dist/processors/ProcessorFactory.d.ts.map +1 -0
  36. package/dist/processors/ProcessorFactory.js +22 -0
  37. package/dist/processors/SnykProcessor.d.ts +2 -0
  38. package/dist/processors/SnykProcessor.d.ts.map +1 -0
  39. package/dist/processors/SnykProcessor.js +18 -0
  40. package/dist/representations/CompactGroupByRepresentation.d.ts +2 -0
  41. package/dist/representations/CompactGroupByRepresentation.d.ts.map +1 -0
  42. package/dist/representations/CompactGroupByRepresentation.js +58 -0
  43. package/dist/representations/CompactGroupByRunPerLevelRepresentation.d.ts +2 -0
  44. package/dist/representations/CompactGroupByRunPerLevelRepresentation.d.ts.map +1 -0
  45. package/dist/representations/CompactGroupByRunPerLevelRepresentation.js +13 -0
  46. package/dist/representations/CompactGroupByRunPerSeverityRepresentation.d.ts +2 -0
  47. package/dist/representations/CompactGroupByRunPerSeverityRepresentation.d.ts.map +1 -0
  48. package/dist/representations/CompactGroupByRunPerSeverityRepresentation.js +13 -0
  49. package/dist/representations/CompactGroupByRunRepresentation.d.ts +2 -0
  50. package/dist/representations/CompactGroupByRunRepresentation.d.ts.map +1 -0
  51. package/dist/representations/CompactGroupByRunRepresentation.js +39 -0
  52. package/dist/representations/CompactGroupBySarifPerLevelRepresentation.d.ts +2 -0
  53. package/dist/representations/CompactGroupBySarifPerLevelRepresentation.d.ts.map +1 -0
  54. package/dist/representations/CompactGroupBySarifPerLevelRepresentation.js +13 -0
  55. package/dist/representations/CompactGroupBySarifPerSeverityRepresentation.d.ts +2 -0
  56. package/dist/representations/CompactGroupBySarifPerSeverityRepresentation.d.ts.map +1 -0
  57. package/dist/representations/CompactGroupBySarifPerSeverityRepresentation.js +13 -0
  58. package/dist/representations/CompactGroupBySarifRepresentation.d.ts +2 -0
  59. package/dist/representations/CompactGroupBySarifRepresentation.d.ts.map +1 -0
  60. package/dist/representations/CompactGroupBySarifRepresentation.js +40 -0
  61. package/dist/representations/CompactGroupByToolNamePerLevelRepresentation.d.ts +2 -0
  62. package/dist/representations/CompactGroupByToolNamePerLevelRepresentation.d.ts.map +1 -0
  63. package/dist/representations/CompactGroupByToolNamePerLevelRepresentation.js +13 -0
  64. package/dist/representations/CompactGroupByToolNamePerSeverityRepresentation.d.ts +2 -0
  65. package/dist/representations/CompactGroupByToolNamePerSeverityRepresentation.d.ts.map +1 -0
  66. package/dist/representations/CompactGroupByToolNamePerSeverityRepresentation.js +13 -0
  67. package/dist/representations/CompactGroupByToolNameRepresentation.d.ts +2 -0
  68. package/dist/representations/CompactGroupByToolNameRepresentation.d.ts.map +1 -0
  69. package/dist/representations/CompactGroupByToolNameRepresentation.js +39 -0
  70. package/dist/representations/CompactTotalPerLevelRepresentation.d.ts +2 -0
  71. package/dist/representations/CompactTotalPerLevelRepresentation.d.ts.map +1 -0
  72. package/dist/representations/CompactTotalPerLevelRepresentation.js +13 -0
  73. package/dist/representations/CompactTotalPerSeverityRepresentation.d.ts +2 -0
  74. package/dist/representations/CompactTotalPerSeverityRepresentation.d.ts.map +1 -0
  75. package/dist/representations/CompactTotalPerSeverityRepresentation.js +13 -0
  76. package/dist/representations/CompactTotalRepresentation.d.ts +2 -0
  77. package/dist/representations/CompactTotalRepresentation.d.ts.map +1 -0
  78. package/dist/representations/CompactTotalRepresentation.js +25 -0
  79. package/dist/representations/Representation.d.ts +2 -0
  80. package/dist/representations/Representation.d.ts.map +1 -0
  81. package/dist/representations/Representation.js +28 -0
  82. package/dist/representations/RepresentationFactory.d.ts +2 -0
  83. package/dist/representations/RepresentationFactory.d.ts.map +1 -0
  84. package/dist/representations/RepresentationFactory.js +37 -0
  85. package/dist/sarif-to-slack.d.ts +347 -85
  86. package/dist/tsdoc-metadata.json +1 -1
  87. package/dist/types.d.ts +215 -51
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/types.js +225 -33
  90. package/dist/utils/Comparators.d.ts +2 -0
  91. package/dist/utils/Comparators.d.ts.map +1 -0
  92. package/dist/utils/Comparators.js +18 -0
  93. package/dist/utils/ExtendedArray.d.ts +2 -0
  94. package/dist/utils/ExtendedArray.d.ts.map +1 -0
  95. package/dist/utils/ExtendedArray.js +11 -0
  96. package/dist/utils/FileUtils.d.ts +2 -0
  97. package/dist/utils/FileUtils.d.ts.map +1 -0
  98. package/dist/utils/FileUtils.js +51 -0
  99. package/dist/utils/SarifUtils.js +20 -54
  100. package/etc/sarif-to-slack.api.md +162 -99
  101. package/jest.config.json +2 -2
  102. package/package.json +7 -7
  103. package/scripts/save-metadata.sh +12 -10
  104. package/src/Logger.ts +4 -0
  105. package/src/SarifToSlackClient.ts +202 -0
  106. package/src/SlackMessageBuilder.ts +35 -115
  107. package/src/System.ts +9 -2
  108. package/src/index.ts +47 -20
  109. package/src/model/Color.ts +195 -0
  110. package/src/model/Finding.ts +137 -0
  111. package/src/model/FindingsArray.ts +27 -0
  112. package/src/processors/CodeQLProcessor.ts +19 -0
  113. package/src/processors/CommonProcessor.ts +103 -0
  114. package/src/processors/ProcessorFactory.ts +23 -0
  115. package/src/processors/SnykProcessor.ts +19 -0
  116. package/src/representations/CompactGroupByRepresentation.ts +67 -0
  117. package/src/representations/CompactGroupByRunPerLevelRepresentation.ts +14 -0
  118. package/src/representations/CompactGroupByRunPerSeverityRepresentation.ts +14 -0
  119. package/src/representations/CompactGroupByRunRepresentation.ts +44 -0
  120. package/src/representations/CompactGroupBySarifPerLevelRepresentation.ts +15 -0
  121. package/src/representations/CompactGroupBySarifPerSeverityRepresentation.ts +15 -0
  122. package/src/representations/CompactGroupBySarifRepresentation.ts +45 -0
  123. package/src/representations/CompactGroupByToolNamePerLevelRepresentation.ts +15 -0
  124. package/src/representations/CompactGroupByToolNamePerSeverityRepresentation.ts +15 -0
  125. package/src/representations/CompactGroupByToolNameRepresentation.ts +44 -0
  126. package/src/representations/CompactTotalPerLevelRepresentation.ts +14 -0
  127. package/src/representations/CompactTotalPerSeverityRepresentation.ts +14 -0
  128. package/src/representations/CompactTotalRepresentation.ts +27 -0
  129. package/src/representations/Representation.ts +35 -0
  130. package/src/representations/RepresentationFactory.ts +49 -0
  131. package/src/types.ts +270 -53
  132. package/src/utils/Comparators.ts +19 -0
  133. package/src/utils/ExtendedArray.ts +11 -0
  134. package/src/utils/FileUtils.ts +60 -0
  135. package/src/utils/SarifUtils.ts +20 -72
  136. package/test-data/sarif/codeql-python.sarif +1448 -1
  137. package/test-data/sarif/codeql-typescript.sarif +3474 -1
  138. package/test-data/sarif/grype-github-actions.sarif +65 -0
  139. package/test-data/sarif/osv-scanner-composer.sarif +972 -0
  140. package/test-data/sarif/osv-scanner-container.sarif +2278 -0
  141. package/test-data/sarif/osv-scanner-gomodules.sarif +813 -0
  142. package/test-data/sarif/osv-scanner-hex.sarif +147 -0
  143. package/test-data/sarif/osv-scanner-maven.sarif +171 -0
  144. package/test-data/sarif/osv-scanner-npm.sarif +627 -0
  145. package/test-data/sarif/osv-scanner-pip.sarif +206 -0
  146. package/test-data/sarif/osv-scanner-pipenv.sarif +243 -0
  147. package/test-data/sarif/osv-scanner-pnpm.sarif +174 -0
  148. package/test-data/sarif/osv-scanner-poetry.sarif +1893 -0
  149. package/test-data/sarif/osv-scanner-rubygems.sarif +402 -0
  150. package/test-data/sarif/osv-scanner-uv.sarif +206 -0
  151. package/test-data/sarif/osv-scanner-yarn.sarif +5207 -0
  152. package/test-data/sarif/runs-0.sarif +5 -0
  153. package/test-data/sarif/runs-2-tools-2-results-0.sarif +1 -1
  154. package/test-data/sarif/runs-2-tools-2.sarif +1 -1
  155. package/test-data/sarif/runs-3-tools-2-results-0.sarif +1 -1
  156. package/test-data/sarif/runs-3-tools-2.sarif +1 -1
  157. package/test-data/sarif/tmp/codeql-csharp.sarif +1 -0
  158. package/test-data/sarif/tmp/grype-container.sarif +1774 -0
  159. package/test-data/sarif/tmp/runs-1-tools-1-results-0.sarif +18 -0
  160. package/test-data/sarif/tmp/runs-2-tools-2.sarif +686 -0
  161. package/test-data/sarif/trivy-iac.sarif +1 -1
  162. package/tests/integration/SendSarifToSlack.spec.ts +95 -27
  163. package/tsconfig.json +2 -0
  164. package/dist/Processors.d.ts +0 -2
  165. package/dist/Processors.d.ts.map +0 -1
  166. package/dist/Processors.js +0 -61
  167. package/dist/SarifToSlackService.d.ts +0 -39
  168. package/dist/SarifToSlackService.d.ts.map +0 -1
  169. package/dist/SarifToSlackService.js +0 -104
  170. package/dist/metadata.d.ts +0 -2
  171. package/dist/metadata.d.ts.map +0 -1
  172. package/dist/metadata.js +0 -11
  173. package/dist/model/SarifModelPerRun.d.ts +0 -2
  174. package/dist/model/SarifModelPerRun.d.ts.map +0 -1
  175. package/dist/model/SarifModelPerRun.js +0 -90
  176. package/dist/model/SarifModelPerSarif.d.ts +0 -2
  177. package/dist/model/SarifModelPerSarif.d.ts.map +0 -1
  178. package/dist/model/SarifModelPerSarif.js +0 -102
  179. package/dist/model/types.d.ts +0 -2
  180. package/dist/model/types.d.ts.map +0 -1
  181. package/dist/model/types.js +0 -49
  182. package/dist/utils/SortUtils.d.ts +0 -2
  183. package/dist/utils/SortUtils.d.ts.map +0 -1
  184. package/dist/utils/SortUtils.js +0 -20
  185. package/src/Processors.ts +0 -68
  186. package/src/SarifToSlackService.ts +0 -117
  187. package/src/metadata.ts +0 -10
  188. package/src/model/SarifModelPerRun.ts +0 -120
  189. package/src/model/SarifModelPerSarif.ts +0 -126
  190. package/src/model/types.ts +0 -50
  191. package/src/utils/SortUtils.ts +0 -33
  192. package/tests/Processors.spec.ts +0 -76
package/dist/types.d.ts CHANGED
@@ -1,9 +1,4 @@
1
- import type { Log } from 'sarif';
2
- /**
3
- * Type representing a SARIF log.
4
- * @public
5
- */
6
- export type SarifLog = Log;
1
+ import { ColorOptions } from './model/Color';
7
2
  /**
8
3
  * Interface for a Slack message that can be sent.
9
4
  * @public
@@ -14,10 +9,10 @@ export interface SlackMessage {
14
9
  * @returns A promise that resolves to the response from the Slack webhook.
15
10
  */
16
11
  send: () => Promise<string>;
17
- /**
18
- * The SARIF log associated with this Slack message.
19
- */
20
- sarif: SarifLog;
12
+ withActor(actor?: string): void;
13
+ withFooter(text?: string, type?: FooterType): void;
14
+ withHeader(header?: string): void;
15
+ withRun(): void;
21
16
  }
22
17
  /**
23
18
  * Enum representing log levels for the service.
@@ -99,55 +94,93 @@ export type FooterOptions = IncludeAwareWithValueOptions & {
99
94
  type?: FooterType;
100
95
  };
101
96
  /**
102
- * Enum representing how to group results.
97
+ * This represents what type of message should be sent. There are various options
98
+ * to show information from SARIF in Slack message.
103
99
  * @public
104
100
  */
105
- export declare enum GroupResultsBy {
101
+ export declare enum RepresentationType {
106
102
  /**
107
- * Groups results by the tool name. Particularly, groups by the runs[].tool.driver.name
108
- * property from the SARIF file(s).
103
+ * Compact information about findings grouped by Run with the level representation.
104
+ * @example
105
+ * ```text
106
+ * [Run 1] Grype
107
+ * Error: 1, Warning: 4
108
+ * [Run 2] Grype
109
+ * Warning: 1, Note: 20
110
+ * ```
109
111
  */
110
- ToolName = 0,
112
+ CompactGroupByRunPerLevel = 0,
111
113
  /**
112
- * Groups results by the run. It provides the result from each run individually.
114
+ * Compact information about findings grouped by Run with the severity representation.
115
+ * @example
116
+ * ```text
117
+ * [Run 1] Grype
118
+ * Critical: 1, High: 3, Medium: 1
119
+ * [Run 2] Grype
120
+ * Medium: 1, Low: 20
121
+ * ```
113
122
  */
114
- Run = 1,
123
+ CompactGroupByRunPerSeverity = 1,
115
124
  /**
116
- * Does not group results. It provides the result from all the runs from all
117
- * the provided SARIF files.
125
+ * Compact information about findings grouped by tool name with the level representation.
126
+ * @example
127
+ * ```text
128
+ * Grype
129
+ * Error: 1, Warning: 5, Note: 20
130
+ * ```
118
131
  */
119
- Total = 2
120
- }
121
- /**
122
- * Enum representing how to calculate results.
123
- * @public
124
- */
125
- export declare enum CalculateResultsBy {
132
+ CompactGroupByToolNamePerLevel = 2,
133
+ /**
134
+ * Compact information about findings grouped by tool name with the severity representation.
135
+ * @example
136
+ * ```text
137
+ * Grype
138
+ * Critical: 1, High: 3, Medium: 2, Low: 20
139
+ * ```
140
+ */
141
+ CompactGroupByToolNamePerSeverity = 3,
142
+ /**
143
+ * Compact information about findings grouped by SARIF file with the level representation.
144
+ * @example
145
+ * ```text
146
+ * grype-results-01.sarif
147
+ * Error: 1, Warning: 2, Note: 1
148
+ * grype-results-02.sarif
149
+ * Warning: 3, Note: 19
150
+ * ```
151
+ */
152
+ CompactGroupBySarifPerLevel = 4,
153
+ /**
154
+ * Compact information about findings grouped by SARIF file with the severity
155
+ * representation.
156
+ * @example
157
+ * ```text
158
+ * grype-results-01.sarif
159
+ * High: 3, Medium: 1, Low: 11
160
+ * grype-results-02.sarif
161
+ * Critical: 1, Medium: 1, Low: 9
162
+ * ```
163
+ */
164
+ CompactGroupBySarifPerSeverity = 5,
126
165
  /**
127
- * Calculates results by the security level of the findings: Error, Warning,
128
- * Note and Unknown. At first, it tries to get the security level from runs[].results[].level
129
- * property. If it is not defined, it tries to get the security level from the
130
- * respective rule of each result, using the rules[].properties['problem.severity']
131
- * property.
166
+ * Compact information about findings with the level representation.
167
+ * @example
168
+ * ```text
169
+ * Total
170
+ * Error: 1, Warning: 5, Note: 20
171
+ * ```
132
172
  */
133
- Level = 0,
173
+ CompactTotalPerLevel = 6,
134
174
  /**
135
- * Calculates results by the security severity of the findings: Critical, High,
136
- * Medium, Low, None and Unknown. it tries to get the security severity from the
137
- * respective rule of each result, using the rules[].properties['security-severity']
138
- * property. This property contains CVSS score, which is then mapped to the
139
- * security severity value.
175
+ * Compact information about findings with the severity representation.
176
+ * @example
177
+ * ```text
178
+ * Total
179
+ * Critical: 1, High: 3, Medium: 2, Low: 20
180
+ * ```
140
181
  */
141
- Severity = 1
182
+ CompactTotalPerSeverity = 7
142
183
  }
143
- /**
144
- * Options for how to output the results in the Slack message.
145
- * @public
146
- */
147
- export type SarifToSlackOutput = {
148
- groupBy?: GroupResultsBy;
149
- calculateBy?: CalculateResultsBy;
150
- };
151
184
  /**
152
185
  * Options for logging.
153
186
  * @public
@@ -161,20 +194,151 @@ export type LogOptions = {
161
194
  colored?: boolean;
162
195
  };
163
196
  /**
164
- * Options for the SarifToSlackService.
197
+ * SARIF file extension.
198
+ * @public
199
+ */
200
+ export type SarifFileExtension = 'sarif' | 'json';
201
+ /**
202
+ * Represents options for the provided SARIF file(s), such as path, should files
203
+ * from this path be retrieved recursively or not, and file extension.
204
+ * @public
205
+ */
206
+ export type SarifOptions = {
207
+ path: string;
208
+ recursive?: boolean;
209
+ extension?: SarifFileExtension;
210
+ };
211
+ /**
212
+ * This enum represents the condition on when message should be sent. If this
213
+ * condition is satisfied then message is sent, otherwise - message is not sent.
214
+ * @public
215
+ */
216
+ export declare enum SendIf {
217
+ /**
218
+ * Send message only if there is at least one finding with "Critical" severity.
219
+ * Since it is the higher possible severity, it is the same as "Critical" or
220
+ * higher.
221
+ */
222
+ SeverityCritical = 0,
223
+ /**
224
+ * Send message only if there is at least one finding with "High" severity.
225
+ */
226
+ SeverityHigh = 1,
227
+ /**
228
+ * Send message only if there is at least one finding with "High" severity or
229
+ * higher, that includes "High" and "Critical".
230
+ */
231
+ SeverityHighOrHigher = 2,
232
+ /**
233
+ * Send message only if there is at least one finding with "Medium" severity.
234
+ */
235
+ SeverityMedium = 3,
236
+ /**
237
+ * Send message only if there is at least one finding with "Medium" severity
238
+ * or higher, that includes "Medium", "High" and "Critical".
239
+ */
240
+ SeverityMediumOrHigher = 4,
241
+ /**
242
+ * Send message only if there is at least one finding with "Low" severity.
243
+ */
244
+ SeverityLow = 5,
245
+ /**
246
+ * Send message only if there is at least one finding with "Low" severity or
247
+ * higher, that includes "Low", "Medium", "High" and "Critical".
248
+ */
249
+ SeverityLowOrHigher = 6,
250
+ /**
251
+ * Send message only if there is at least one finding with "None" severity.
252
+ */
253
+ SeverityNone = 7,
254
+ /**
255
+ * Send message only if there is at least one finding with "None" severity or
256
+ * higher, that includes "None", "Low", "Medium", "High" and "Critical".
257
+ */
258
+ SeverityNoneOrHigher = 8,
259
+ /**
260
+ * Send message only if there is at least one finding with "Unknown" severity.
261
+ */
262
+ SeverityUnknown = 9,
263
+ /**
264
+ * Send message only if there is at least one finding with "Unknown" severity
265
+ * or higher, that includes "Unknown", "None", "Low", "Medium", "High" and "Critical".
266
+ */
267
+ SeverityUnknownOrHigher = 10,
268
+ /**
269
+ * Send message only if there is at least one finding with "Error" level.
270
+ * Since it is the higher possible level, it is the same as "Error" or higher.
271
+ */
272
+ LevelError = 11,
273
+ /**
274
+ * Send message only if there is at least one finding with "Warning" level.
275
+ */
276
+ LevelWarning = 12,
277
+ /**
278
+ * Send message only if there is at least one finding with "Warning" level or
279
+ * higher, that includes "Warning" and "Error".
280
+ */
281
+ LevelWarningOrHigher = 13,
282
+ /**
283
+ * Send message only if there is at least one finding with "Note" level.
284
+ */
285
+ LevelNote = 14,
286
+ /**
287
+ * Send message only if there is at least one finding with "Note" level or
288
+ * higher, that includes "Note", "Warning" and "Error.
289
+ */
290
+ LevelNoteOrHigher = 15,
291
+ /**
292
+ * Send message only if there is at least one finding with "None" level.
293
+ */
294
+ LevelNone = 16,
295
+ /**
296
+ * Send message only if there is at least one finding with "None" level or
297
+ * higher, that includes "None", "Note", "Warning" and "Error.
298
+ */
299
+ LevelNoneOrHigher = 17,
300
+ /**
301
+ * Send message only if there is at least one finding with "Unknown" level.
302
+ */
303
+ LevelUnknown = 18,
304
+ /**
305
+ * Send message only if there is at least one finding with "Unknown" level or
306
+ * higher, that includes "Unknown", "None", "Note", "Warning" and "Error.
307
+ */
308
+ LevelUnknownOrHigher = 19,
309
+ /**
310
+ * Always send a message.
311
+ */
312
+ Always = 20,
313
+ /**
314
+ * Send a message if at least 1 vulnerability is found.
315
+ */
316
+ Some = 21,
317
+ /**
318
+ * Send a message only if no vulnerabilities are found.
319
+ */
320
+ Empty = 22,
321
+ /**
322
+ * Never send a message.
323
+ */
324
+ Never = 23
325
+ }
326
+ /**
327
+ * Options for the SarifToSlackClient.
165
328
  * @public
166
329
  */
167
- export type SarifToSlackServiceOptions = {
330
+ export type SarifToSlackClientOptions = {
168
331
  webhookUrl: string;
169
- sarifPath: string;
332
+ sarif: SarifOptions;
170
333
  username?: string;
171
334
  iconUrl?: string;
172
- color?: string;
335
+ color?: ColorOptions;
173
336
  log?: LogOptions;
174
337
  header?: IncludeAwareWithValueOptions;
175
338
  footer?: FooterOptions;
176
339
  actor?: IncludeAwareWithValueOptions;
177
340
  run?: IncludeAwareOptions;
178
- output?: SarifToSlackOutput;
341
+ representation?: RepresentationType;
342
+ sendIf?: SendIf;
179
343
  };
180
344
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAA;AAE1B;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAC3B;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAA;CAChB;AAED;;;GAGG;AACH,oBAAY,QAAQ;IAClB;;;OAGG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,KAAK,IAAI;IACT;;;OAGG;IACH,KAAK,IAAI;IACT;;;OAGG;IACH,IAAI,IAAI;IACR;;;OAGG;IACH,OAAO,IAAI;IACX;;;OAGG;IACH,KAAK,IAAI;IACT;;;OAGG;IACH,KAAK,IAAI;CACV;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,GAAG;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;GAGG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,SAAS,eAAe;IACxB;;;OAGG;IACH,QAAQ,WAAW;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,4BAA4B,GAAG;IACzD,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB;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,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,4BAA4B,CAAC;IACtC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,4BAA4B,CAAC;IACrC,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA"}
package/dist/types.js CHANGED
@@ -56,47 +56,239 @@ export var FooterType;
56
56
  FooterType["Markdown"] = "mrkdwn";
57
57
  })(FooterType || (FooterType = {}));
58
58
  /**
59
- * Enum representing how to group results.
59
+ * This represents what type of message should be sent. There are various options
60
+ * to show information from SARIF in Slack message.
60
61
  * @public
61
62
  */
62
- export var GroupResultsBy;
63
- (function (GroupResultsBy) {
63
+ export var RepresentationType;
64
+ (function (RepresentationType) {
64
65
  /**
65
- * Groups results by the tool name. Particularly, groups by the runs[].tool.driver.name
66
- * property from the SARIF file(s).
66
+ * Compact information about findings grouped by Run with the level representation.
67
+ * @example
68
+ * ```text
69
+ * [Run 1] Grype
70
+ * Error: 1, Warning: 4
71
+ * [Run 2] Grype
72
+ * Warning: 1, Note: 20
73
+ * ```
67
74
  */
68
- GroupResultsBy[GroupResultsBy["ToolName"] = 0] = "ToolName";
75
+ RepresentationType[RepresentationType["CompactGroupByRunPerLevel"] = 0] = "CompactGroupByRunPerLevel";
69
76
  /**
70
- * Groups results by the run. It provides the result from each run individually.
77
+ * Compact information about findings grouped by Run with the severity representation.
78
+ * @example
79
+ * ```text
80
+ * [Run 1] Grype
81
+ * Critical: 1, High: 3, Medium: 1
82
+ * [Run 2] Grype
83
+ * Medium: 1, Low: 20
84
+ * ```
71
85
  */
72
- GroupResultsBy[GroupResultsBy["Run"] = 1] = "Run";
86
+ RepresentationType[RepresentationType["CompactGroupByRunPerSeverity"] = 1] = "CompactGroupByRunPerSeverity";
73
87
  /**
74
- * Does not group results. It provides the result from all the runs from all
75
- * the provided SARIF files.
88
+ * Compact information about findings grouped by tool name with the level representation.
89
+ * @example
90
+ * ```text
91
+ * Grype
92
+ * Error: 1, Warning: 5, Note: 20
93
+ * ```
76
94
  */
77
- GroupResultsBy[GroupResultsBy["Total"] = 2] = "Total";
78
- })(GroupResultsBy || (GroupResultsBy = {}));
95
+ RepresentationType[RepresentationType["CompactGroupByToolNamePerLevel"] = 2] = "CompactGroupByToolNamePerLevel";
96
+ /**
97
+ * Compact information about findings grouped by tool name with the severity representation.
98
+ * @example
99
+ * ```text
100
+ * Grype
101
+ * Critical: 1, High: 3, Medium: 2, Low: 20
102
+ * ```
103
+ */
104
+ RepresentationType[RepresentationType["CompactGroupByToolNamePerSeverity"] = 3] = "CompactGroupByToolNamePerSeverity";
105
+ /**
106
+ * Compact information about findings grouped by SARIF file with the level representation.
107
+ * @example
108
+ * ```text
109
+ * grype-results-01.sarif
110
+ * Error: 1, Warning: 2, Note: 1
111
+ * grype-results-02.sarif
112
+ * Warning: 3, Note: 19
113
+ * ```
114
+ */
115
+ RepresentationType[RepresentationType["CompactGroupBySarifPerLevel"] = 4] = "CompactGroupBySarifPerLevel";
116
+ /**
117
+ * Compact information about findings grouped by SARIF file with the severity
118
+ * representation.
119
+ * @example
120
+ * ```text
121
+ * grype-results-01.sarif
122
+ * High: 3, Medium: 1, Low: 11
123
+ * grype-results-02.sarif
124
+ * Critical: 1, Medium: 1, Low: 9
125
+ * ```
126
+ */
127
+ RepresentationType[RepresentationType["CompactGroupBySarifPerSeverity"] = 5] = "CompactGroupBySarifPerSeverity";
128
+ /**
129
+ * Compact information about findings with the level representation.
130
+ * @example
131
+ * ```text
132
+ * Total
133
+ * Error: 1, Warning: 5, Note: 20
134
+ * ```
135
+ */
136
+ RepresentationType[RepresentationType["CompactTotalPerLevel"] = 6] = "CompactTotalPerLevel";
137
+ /**
138
+ * Compact information about findings with the severity representation.
139
+ * @example
140
+ * ```text
141
+ * Total
142
+ * Critical: 1, High: 3, Medium: 2, Low: 20
143
+ * ```
144
+ */
145
+ RepresentationType[RepresentationType["CompactTotalPerSeverity"] = 7] = "CompactTotalPerSeverity";
146
+ })(RepresentationType || (RepresentationType = {}));
79
147
  /**
80
- * Enum representing how to calculate results.
148
+ * This enum represents the condition on when message should be sent. If this
149
+ * condition is satisfied then message is sent, otherwise - message is not sent.
81
150
  * @public
82
151
  */
83
- export var CalculateResultsBy;
84
- (function (CalculateResultsBy) {
85
- /**
86
- * Calculates results by the security level of the findings: Error, Warning,
87
- * Note and Unknown. At first, it tries to get the security level from runs[].results[].level
88
- * property. If it is not defined, it tries to get the security level from the
89
- * respective rule of each result, using the rules[].properties['problem.severity']
90
- * property.
91
- */
92
- CalculateResultsBy[CalculateResultsBy["Level"] = 0] = "Level";
93
- /**
94
- * Calculates results by the security severity of the findings: Critical, High,
95
- * Medium, Low, None and Unknown. it tries to get the security severity from the
96
- * respective rule of each result, using the rules[].properties['security-severity']
97
- * property. This property contains CVSS score, which is then mapped to the
98
- * security severity value.
99
- */
100
- CalculateResultsBy[CalculateResultsBy["Severity"] = 1] = "Severity";
101
- })(CalculateResultsBy || (CalculateResultsBy = {}));
102
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBd0JBOzs7R0FHRztBQUNILE1BQU0sQ0FBTixJQUFZLFFBbUNYO0FBbkNELFdBQVksUUFBUTtJQUNsQjs7O09BR0c7SUFDSCx5Q0FBUyxDQUFBO0lBQ1Q7O09BRUc7SUFDSCx5Q0FBUyxDQUFBO0lBQ1Q7OztPQUdHO0lBQ0gseUNBQVMsQ0FBQTtJQUNUOzs7T0FHRztJQUNILHVDQUFRLENBQUE7SUFDUjs7O09BR0c7SUFDSCw2Q0FBVyxDQUFBO0lBQ1g7OztPQUdHO0lBQ0gseUNBQVMsQ0FBQTtJQUNUOzs7T0FHRztJQUNILHlDQUFTLENBQUE7QUFDWCxDQUFDLEVBbkNXLFFBQVEsS0FBUixRQUFRLFFBbUNuQjtBQW9CRDs7O0dBR0c7QUFDSCxNQUFNLENBQU4sSUFBWSxVQVVYO0FBVkQsV0FBWSxVQUFVO0lBQ3BCOztPQUVHO0lBQ0gsc0NBQXdCLENBQUE7SUFDeEI7OztPQUdHO0lBQ0gsaUNBQW1CLENBQUE7QUFDckIsQ0FBQyxFQVZXLFVBQVUsS0FBVixVQUFVLFFBVXJCO0FBV0Q7OztHQUdHO0FBQ0gsTUFBTSxDQUFOLElBQVksY0FlWDtBQWZELFdBQVksY0FBYztJQUN4Qjs7O09BR0c7SUFDSCwyREFBWSxDQUFBO0lBQ1o7O09BRUc7SUFDSCxpREFBTyxDQUFBO0lBQ1A7OztPQUdHO0lBQ0gscURBQVMsQ0FBQTtBQUNYLENBQUMsRUFmVyxjQUFjLEtBQWQsY0FBYyxRQWV6QjtBQUVEOzs7R0FHRztBQUNILE1BQU0sQ0FBTixJQUFZLGtCQWlCWDtBQWpCRCxXQUFZLGtCQUFrQjtJQUM1Qjs7Ozs7O09BTUc7SUFDSCw2REFBUyxDQUFBO0lBQ1Q7Ozs7OztPQU1HO0lBQ0gsbUVBQVksQ0FBQTtBQUNkLENBQUMsRUFqQlcsa0JBQWtCLEtBQWxCLGtCQUFrQixRQWlCN0IifQ==
152
+ export var SendIf;
153
+ (function (SendIf) {
154
+ /**
155
+ * Send message only if there is at least one finding with "Critical" severity.
156
+ * Since it is the higher possible severity, it is the same as "Critical" or
157
+ * higher.
158
+ */
159
+ SendIf[SendIf["SeverityCritical"] = 0] = "SeverityCritical";
160
+ /**
161
+ * Send message only if there is at least one finding with "High" severity.
162
+ */
163
+ SendIf[SendIf["SeverityHigh"] = 1] = "SeverityHigh";
164
+ /**
165
+ * Send message only if there is at least one finding with "High" severity or
166
+ * higher, that includes "High" and "Critical".
167
+ */
168
+ SendIf[SendIf["SeverityHighOrHigher"] = 2] = "SeverityHighOrHigher";
169
+ /**
170
+ * Send message only if there is at least one finding with "Medium" severity.
171
+ */
172
+ SendIf[SendIf["SeverityMedium"] = 3] = "SeverityMedium";
173
+ /**
174
+ * Send message only if there is at least one finding with "Medium" severity
175
+ * or higher, that includes "Medium", "High" and "Critical".
176
+ */
177
+ SendIf[SendIf["SeverityMediumOrHigher"] = 4] = "SeverityMediumOrHigher";
178
+ /**
179
+ * Send message only if there is at least one finding with "Low" severity.
180
+ */
181
+ SendIf[SendIf["SeverityLow"] = 5] = "SeverityLow";
182
+ /**
183
+ * Send message only if there is at least one finding with "Low" severity or
184
+ * higher, that includes "Low", "Medium", "High" and "Critical".
185
+ */
186
+ SendIf[SendIf["SeverityLowOrHigher"] = 6] = "SeverityLowOrHigher";
187
+ /**
188
+ * Send message only if there is at least one finding with "None" severity.
189
+ */
190
+ SendIf[SendIf["SeverityNone"] = 7] = "SeverityNone";
191
+ /**
192
+ * Send message only if there is at least one finding with "None" severity or
193
+ * higher, that includes "None", "Low", "Medium", "High" and "Critical".
194
+ */
195
+ SendIf[SendIf["SeverityNoneOrHigher"] = 8] = "SeverityNoneOrHigher";
196
+ /**
197
+ * Send message only if there is at least one finding with "Unknown" severity.
198
+ */
199
+ SendIf[SendIf["SeverityUnknown"] = 9] = "SeverityUnknown";
200
+ /**
201
+ * Send message only if there is at least one finding with "Unknown" severity
202
+ * or higher, that includes "Unknown", "None", "Low", "Medium", "High" and "Critical".
203
+ */
204
+ SendIf[SendIf["SeverityUnknownOrHigher"] = 10] = "SeverityUnknownOrHigher";
205
+ /**
206
+ * Send message only if there is at least one finding with "Error" level.
207
+ * Since it is the higher possible level, it is the same as "Error" or higher.
208
+ */
209
+ SendIf[SendIf["LevelError"] = 11] = "LevelError";
210
+ /**
211
+ * Send message only if there is at least one finding with "Warning" level.
212
+ */
213
+ SendIf[SendIf["LevelWarning"] = 12] = "LevelWarning";
214
+ /**
215
+ * Send message only if there is at least one finding with "Warning" level or
216
+ * higher, that includes "Warning" and "Error".
217
+ */
218
+ SendIf[SendIf["LevelWarningOrHigher"] = 13] = "LevelWarningOrHigher";
219
+ /**
220
+ * Send message only if there is at least one finding with "Note" level.
221
+ */
222
+ SendIf[SendIf["LevelNote"] = 14] = "LevelNote";
223
+ /**
224
+ * Send message only if there is at least one finding with "Note" level or
225
+ * higher, that includes "Note", "Warning" and "Error.
226
+ */
227
+ SendIf[SendIf["LevelNoteOrHigher"] = 15] = "LevelNoteOrHigher";
228
+ /**
229
+ * Send message only if there is at least one finding with "None" level.
230
+ */
231
+ SendIf[SendIf["LevelNone"] = 16] = "LevelNone";
232
+ /**
233
+ * Send message only if there is at least one finding with "None" level or
234
+ * higher, that includes "None", "Note", "Warning" and "Error.
235
+ */
236
+ SendIf[SendIf["LevelNoneOrHigher"] = 17] = "LevelNoneOrHigher";
237
+ /**
238
+ * Send message only if there is at least one finding with "Unknown" level.
239
+ */
240
+ SendIf[SendIf["LevelUnknown"] = 18] = "LevelUnknown";
241
+ /**
242
+ * Send message only if there is at least one finding with "Unknown" level or
243
+ * higher, that includes "Unknown", "None", "Note", "Warning" and "Error.
244
+ */
245
+ SendIf[SendIf["LevelUnknownOrHigher"] = 19] = "LevelUnknownOrHigher";
246
+ /**
247
+ * Always send a message.
248
+ */
249
+ SendIf[SendIf["Always"] = 20] = "Always";
250
+ /**
251
+ * Send a message if at least 1 vulnerability is found.
252
+ */
253
+ SendIf[SendIf["Some"] = 21] = "Some";
254
+ /**
255
+ * Send a message only if no vulnerabilities are found.
256
+ */
257
+ SendIf[SendIf["Empty"] = 22] = "Empty";
258
+ /**
259
+ * Never send a message.
260
+ */
261
+ SendIf[SendIf["Never"] = 23] = "Never";
262
+ })(SendIf || (SendIf = {}));
263
+ /**
264
+ * Enum of security severity.
265
+ * @privateRemarks Order should remain unchanged. It is used in multiple places,
266
+ * such as sorting in Slack message (more important come first) and to identify
267
+ * provided severity if it is requested severity or higher.
268
+ * @internal
269
+ */
270
+ export var SecuritySeverity;
271
+ (function (SecuritySeverity) {
272
+ SecuritySeverity[SecuritySeverity["Unknown"] = 0] = "Unknown";
273
+ SecuritySeverity[SecuritySeverity["None"] = 1] = "None";
274
+ SecuritySeverity[SecuritySeverity["Low"] = 2] = "Low";
275
+ SecuritySeverity[SecuritySeverity["Medium"] = 3] = "Medium";
276
+ SecuritySeverity[SecuritySeverity["High"] = 4] = "High";
277
+ SecuritySeverity[SecuritySeverity["Critical"] = 5] = "Critical";
278
+ })(SecuritySeverity || (SecuritySeverity = {}));
279
+ /**
280
+ * Enum of security level.
281
+ * @privateRemarks Order should remain unchanged. It is used in multiple places,
282
+ * such as sorting in Slack message (more important come first) and to identify
283
+ * provided level if it is requested level or higher.
284
+ * @internal
285
+ */
286
+ export var SecurityLevel;
287
+ (function (SecurityLevel) {
288
+ SecurityLevel[SecurityLevel["Unknown"] = 0] = "Unknown";
289
+ SecurityLevel[SecurityLevel["None"] = 1] = "None";
290
+ SecurityLevel[SecurityLevel["Note"] = 2] = "Note";
291
+ SecurityLevel[SecurityLevel["Warning"] = 3] = "Warning";
292
+ SecurityLevel[SecurityLevel["Error"] = 4] = "Error";
293
+ })(SecurityLevel || (SecurityLevel = {}));
294
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0JBOzs7R0FHRztBQUNILE1BQU0sQ0FBTixJQUFZLFFBbUNYO0FBbkNELFdBQVksUUFBUTtJQUNsQjs7O09BR0c7SUFDSCx5Q0FBUyxDQUFBO0lBQ1Q7O09BRUc7SUFDSCx5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Z0I7SUFDMUIsNkRBQVcsQ0FBQTtJQUNYLHVEQUFRLENBQUE7SUFDUixxREFBTyxDQUFBO0lBQ1AsMkRBQVUsQ0FBQTtJQUNWLHVEQUFRLENBQUE7SUFDUiwrREFBWSxDQUFBO0FBQ2QsQ0FBQyxFQVBXLGdCQUFnQixLQUFoQixnQkFBZ0IsUUFPM0I7QUFFRDs7Ozs7O0dBTUc7QUFDSCxNQUFNLENBQU4sSUFBWSxhQU1YO0FBTkQsV0FBWSxhQUFhO0lBQ3ZCLHVEQUFXLENBQUE7SUFDWCxpREFBUSxDQUFBO0lBQ1IsaURBQVEsQ0FBQTtJQUNSLHVEQUFXLENBQUE7SUFDWCxtREFBUyxDQUFBO0FBQ1gsQ0FBQyxFQU5XLGFBQWEsS0FBYixhQUFhLFFBTXhCIn0=
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Comparators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Comparators.d.ts","sourceRoot":"","sources":["../../src/utils/Comparators.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This function returns a comparator function based on the property of the
3
+ * {@link Finding} object.
4
+ * @param key Property name of the {@link Finding} object.
5
+ * @internal
6
+ */
7
+ export function findingsComparatorByKey(key) {
8
+ return (a, b) => {
9
+ switch (key) {
10
+ case 'severity': return b.severity - a.severity;
11
+ case 'level': return b.level - a.level;
12
+ case 'runId': return a.runId - b.runId;
13
+ case 'toolName': return a.toolName.toLowerCase().localeCompare(b.toolName.toLowerCase());
14
+ default: return 1;
15
+ }
16
+ };
17
+ }
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29tcGFyYXRvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvQ29tcGFyYXRvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUE7Ozs7O0dBS0c7QUFDSCxNQUFNLFVBQVUsdUJBQXVCLENBQTBCLEdBQU07SUFDckUsT0FBTyxDQUFDLENBQVUsRUFBRSxDQUFVLEVBQVUsRUFBRTtRQUN4QyxRQUFRLEdBQUcsRUFBRSxDQUFDO1lBQ1osS0FBSyxVQUFVLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxRQUFRLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQTtZQUMvQyxLQUFLLE9BQU8sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLEtBQUssR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFBO1lBQ3RDLEtBQUssT0FBTyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQyxLQUFLLENBQUE7WUFDdEMsS0FBSyxVQUFVLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FBQTtZQUN4RixPQUFPLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQTtRQUNuQixDQUFDO0lBQ0gsQ0FBQyxDQUFBO0FBQ0gsQ0FBQyJ9
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExtendedArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtendedArray.d.ts","sourceRoot":"","sources":["../../src/utils/ExtendedArray.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This class is an extension for the {@link Array} class. It adds some additional
3
+ * useful methods.
4
+ * @internal
5
+ */
6
+ export default class ExtendedArray extends Array {
7
+ findByProperty(prop, value) {
8
+ return this.find((v) => v[prop] === value);
9
+ }
10
+ }
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXh0ZW5kZWRBcnJheS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9FeHRlbmRlZEFycmF5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7O0dBSUc7QUFDSCxNQUFNLENBQUMsT0FBTyxPQUFPLGFBQWlCLFNBQVEsS0FBUTtJQUU3QyxjQUFjLENBQW9CLElBQU8sRUFBRSxLQUFXO1FBQzNELE9BQU8sSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUksRUFBVyxFQUFFLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLEtBQUssQ0FBQyxDQUFBO0lBQ3hELENBQUM7Q0FDRiJ9
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FileUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FileUtils.ts"],"names":[],"mappings":""}