@herodevs/cli 1.1.0-beta.1 → 1.3.0-beta.1

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 (38) hide show
  1. package/README.md +16 -309
  2. package/bin/dev.js +6 -5
  3. package/bin/run.js +3 -2
  4. package/dist/api/client.d.ts +0 -2
  5. package/dist/api/client.js +19 -18
  6. package/dist/api/nes/nes.client.d.ts +10 -3
  7. package/dist/api/nes/nes.client.js +89 -2
  8. package/dist/api/queries/nes/sbom.js +5 -0
  9. package/dist/api/types/hd-cli.types.d.ts +29 -0
  10. package/dist/api/types/hd-cli.types.js +10 -0
  11. package/dist/api/types/nes.types.d.ts +39 -22
  12. package/dist/api/types/nes.types.js +1 -1
  13. package/dist/commands/report/committers.js +45 -28
  14. package/dist/commands/report/purls.js +42 -29
  15. package/dist/commands/scan/eol.d.ts +16 -4
  16. package/dist/commands/scan/eol.js +144 -41
  17. package/dist/commands/scan/sbom.d.ts +1 -0
  18. package/dist/commands/scan/sbom.js +53 -32
  19. package/dist/service/committers.svc.js +24 -3
  20. package/dist/service/eol/cdx.svc.d.ts +2 -8
  21. package/dist/service/eol/cdx.svc.js +2 -18
  22. package/dist/service/eol/eol.svc.d.ts +1 -23
  23. package/dist/service/eol/eol.svc.js +0 -61
  24. package/dist/service/error.svc.d.ts +8 -0
  25. package/dist/service/error.svc.js +28 -0
  26. package/dist/service/nes/nes.svc.d.ts +4 -3
  27. package/dist/service/nes/nes.svc.js +5 -4
  28. package/dist/service/purls.svc.d.ts +6 -0
  29. package/dist/service/purls.svc.js +26 -0
  30. package/dist/ui/date.ui.d.ts +1 -0
  31. package/dist/ui/date.ui.js +15 -0
  32. package/dist/ui/eol.ui.d.ts +5 -3
  33. package/dist/ui/eol.ui.js +56 -15
  34. package/dist/ui/shared.us.d.ts +3 -0
  35. package/dist/ui/shared.us.js +13 -0
  36. package/package.json +10 -9
  37. package/dist/service/line.svc.d.ts +0 -24
  38. package/dist/service/line.svc.js +0 -61
@@ -1,24 +0,0 @@
1
- import type { ComponentStatus, ScanResultComponent } from '../api/types/nes.types.ts';
2
- export interface Line {
3
- daysEol: number | null;
4
- purl: ScanResultComponent['purl'];
5
- info: {
6
- eolAt: Date | null;
7
- isEol: boolean;
8
- };
9
- status: ComponentStatus;
10
- }
11
- export declare function getStatusFromComponent(component: ScanResultComponent, daysEol: number | null): ComponentStatus;
12
- export declare function daysBetween(date1: Date, date2: Date): number;
13
- export declare function getDaysEolFromEolAt(eolAt: Date | null): number | null;
14
- export declare function getMessageAndStatus(status: string, daysEol: number | null): {
15
- stat: string;
16
- msg: string;
17
- };
18
- export declare function formatLine(l: Line, idx: number, ctx: {
19
- longest: number;
20
- total: number;
21
- }): {
22
- name: string;
23
- value: Line;
24
- };
@@ -1,61 +0,0 @@
1
- export function getStatusFromComponent(component, daysEol) {
2
- const { info } = component;
3
- if (component.status) {
4
- if (info.isEol && component.status && component.status !== 'EOL') {
5
- throw new Error(`isEol is true but status is not EOL: ${component.purl}`);
6
- }
7
- return component.status;
8
- }
9
- // If API fails to set status, we derive it based on other properties
10
- if (daysEol === null) {
11
- return info.isEol ? 'EOL' : 'OK';
12
- }
13
- if (daysEol > 0) {
14
- // daysEol is positive means we're past the EOL date
15
- return 'EOL';
16
- }
17
- // daysEol is zero or negative means we haven't reached EOL yet
18
- return 'LTS';
19
- }
20
- export function daysBetween(date1, date2) {
21
- const msPerDay = 1000 * 60 * 60 * 24 + 15; // milliseconds in a day plus 15 ms
22
- return Math.round((date2.getTime() - date1.getTime()) / msPerDay);
23
- }
24
- export function getDaysEolFromEolAt(eolAt) {
25
- return eolAt ? Math.abs(daysBetween(new Date(), eolAt)) : null;
26
- }
27
- export function getMessageAndStatus(status, daysEol) {
28
- let msg = '';
29
- let stat = '';
30
- const stringifiedDaysEol = daysEol ? daysEol.toString() : 'unknown';
31
- switch (status) {
32
- case 'EOL': {
33
- stat = 'EOL';
34
- msg = `EOL'd ${stringifiedDaysEol} days ago.`;
35
- break;
36
- }
37
- case 'LTS': {
38
- stat = 'LTS';
39
- msg = `Will go EOL in ${stringifiedDaysEol} days.`;
40
- break;
41
- }
42
- case 'OK': {
43
- stat = 'OK';
44
- break;
45
- }
46
- default:
47
- throw new Error(`Unknown status: ${status}`);
48
- }
49
- return { stat, msg };
50
- }
51
- export function formatLine(l, idx, ctx) {
52
- const { daysEol, purl, status } = l;
53
- const { stat, msg } = getMessageAndStatus(status, daysEol);
54
- const padlen = ctx.total.toString().length;
55
- const rownum = `${idx + 1}`.padStart(padlen, ' ');
56
- const name = purl.padEnd(ctx.longest, ' ');
57
- return {
58
- name: `${rownum}. [${stat}] ${name} | ${msg}`,
59
- value: l,
60
- };
61
- }