@utilix-tech/sdk 0.61.0 → 0.63.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.
@@ -25,6 +25,7 @@
25
25
  * - editorconfig-validator (validateEditorConfig)
26
26
  * - tsconfig-validator (validateTsconfig)
27
27
  * - package-json-exports-validator (validatePackageExports)
28
+ * - package-json-dependency-auditor (auditDependencyRanges)
28
29
  */
29
30
  type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
30
31
  declare const ALL_FLAGS: RegexFlag[];
@@ -471,6 +472,45 @@ interface ExportsValidationResult {
471
472
  declare function validatePackageExports(packageJsonText: string): ExportsValidationResult | {
472
473
  error: string;
473
474
  };
475
+ type DependencyRangeType = 'exact' | 'caret' | 'tilde' | 'range' | 'wildcard' | 'tag' | 'git' | 'url' | 'file' | 'link' | 'workspace' | 'unknown';
476
+ type DependencySection = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
477
+ interface DependencyAuditEntry {
478
+ name: string;
479
+ version: string;
480
+ section: DependencySection;
481
+ rangeType: DependencyRangeType;
482
+ issues: string[];
483
+ }
484
+ interface DependencyAuditIssue {
485
+ severity: 'error' | 'warning';
486
+ name: string;
487
+ message: string;
488
+ }
489
+ interface DependencyAuditDuplicate {
490
+ name: string;
491
+ sections: DependencySection[];
492
+ sameVersion: boolean;
493
+ }
494
+ interface DependencyAuditResult {
495
+ parsed: true;
496
+ sections: DependencySection[];
497
+ totalDependencies: number;
498
+ dependencies: DependencyAuditEntry[];
499
+ duplicates: DependencyAuditDuplicate[];
500
+ rangeTypeCounts: Partial<Record<DependencyRangeType, number>>;
501
+ issues: DependencyAuditIssue[];
502
+ }
503
+ /**
504
+ * Parse a package.json's dependencies, devDependencies, peerDependencies,
505
+ * and optionalDependencies fields, classify each version specifier's range
506
+ * type, and flag common risks: wildcard/"*" ranges with no real constraint,
507
+ * the non-reproducible "latest" tag, git/URL/file/link dependencies that
508
+ * bypass the registry, and the same package listed in more than one section
509
+ * (a conflict if the ranges differ, redundant if they match).
510
+ */
511
+ declare function auditDependencyRanges(packageJsonText: string): DependencyAuditResult | {
512
+ error: string;
513
+ };
474
514
 
475
515
  declare const code_ALL_FLAGS: typeof ALL_FLAGS;
476
516
  type code_ApiEndpoint = ApiEndpoint;
@@ -485,6 +525,12 @@ type code_ConventionalCommitResult = ConventionalCommitResult;
485
525
  type code_ConventionalCommitSeverity = ConventionalCommitSeverity;
486
526
  type code_CssResult = CssResult;
487
527
  declare const code_DEFAULT_COMMIT_TYPES: typeof DEFAULT_COMMIT_TYPES;
528
+ type code_DependencyAuditDuplicate = DependencyAuditDuplicate;
529
+ type code_DependencyAuditEntry = DependencyAuditEntry;
530
+ type code_DependencyAuditIssue = DependencyAuditIssue;
531
+ type code_DependencyAuditResult = DependencyAuditResult;
532
+ type code_DependencyRangeType = DependencyRangeType;
533
+ type code_DependencySection = DependencySection;
488
534
  type code_DockerImageRef = DockerImageRef;
489
535
  type code_EditorConfigIssue = EditorConfigIssue;
490
536
  type code_EditorConfigProperty = EditorConfigProperty;
@@ -529,6 +575,7 @@ type code_SqlFormatOptions = SqlFormatOptions;
529
575
  type code_TestPatternResult = TestPatternResult;
530
576
  type code_TsconfigIssue = TsconfigIssue;
531
577
  type code_TsconfigValidationResult = TsconfigValidationResult;
578
+ declare const code_auditDependencyRanges: typeof auditDependencyRanges;
532
579
  declare const code_buildDockerPull: typeof buildDockerPull;
533
580
  declare const code_buildDockerRun: typeof buildDockerRun;
534
581
  declare const code_buildGitCommand: typeof buildGitCommand;
@@ -579,7 +626,7 @@ declare const code_validateEnvKey: typeof validateEnvKey;
579
626
  declare const code_validatePackageExports: typeof validatePackageExports;
580
627
  declare const code_validateTsconfig: typeof validateTsconfig;
581
628
  declare namespace code {
582
- export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
629
+ export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DependencyAuditDuplicate as DependencyAuditDuplicate, type code_DependencyAuditEntry as DependencyAuditEntry, type code_DependencyAuditIssue as DependencyAuditIssue, type code_DependencyAuditResult as DependencyAuditResult, type code_DependencyRangeType as DependencyRangeType, type code_DependencySection as DependencySection, type code_DockerImageRef as DockerImageRef, type code_EditorConfigIssue as EditorConfigIssue, type code_EditorConfigProperty as EditorConfigProperty, type code_EditorConfigSection as EditorConfigSection, type code_EditorConfigValidationResult as EditorConfigValidationResult, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_ExportsIssue as ExportsIssue, type code_ExportsShape as ExportsShape, type code_ExportsValidationResult as ExportsValidationResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GitignoreTestResult as GitignoreTestResult, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, type code_TsconfigIssue as TsconfigIssue, type code_TsconfigValidationResult as TsconfigValidationResult, code_auditDependencyRanges as auditDependencyRanges, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testGitignorePatterns as testGitignorePatterns, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEditorConfig as validateEditorConfig, code_validateEnvKey as validateEnvKey, code_validatePackageExports as validatePackageExports, code_validateTsconfig as validateTsconfig };
583
630
  }
584
631
 
585
- export { type SqlDialect as $, ALL_FLAGS as A, type HtmlMinifyOptions as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type HtmlMinifyResult as F, type GitCommandConfig as G, type HtmlFormatResult as H, type JsMinifyResult as I, type JsMinifyOptions as J, type MatchResult as K, type MimeEntry as L, MIME_TABLE as M, type MimeLookupResult as N, OPERATIONS as O, type ParsedSpec as P, type RedosResult as Q, type RedosFinding as R, type RedosSeverity as S, type RegexError as T, type RegexFlag as U, type RegexMatch as V, type RegexResult as W, type RegexSuccess as X, SQL_DEFAULT_OPTIONS as Y, type Segment as Z, type SpecVersion as _, type ApiEndpoint as a, type SqlFormatOptions as a0, type TestPatternResult as a1, type TsconfigIssue as a2, type TsconfigValidationResult as a3, buildDockerPull as a4, buildDockerRun as a5, buildGitCommand as a6, collapseHtmlWhitespace as a7, collapseJsWhitespace as a8, countProperties as a9, parseGithubUrl as aA, parseSpec as aB, removeConsoleCalls as aC, removeEmptyAttributes as aD, removeHtmlComments as aE, removeJsComments as aF, removeRedundantAttributes as aG, searchCheatsheet as aH, searchEndpoints as aI, splitStatements as aJ, testGitignorePatterns as aK, testPattern as aL, testRegex as aM, validateEditorConfig as aN, validateEnvKey as aO, validatePackageExports as aP, validateTsconfig as aQ, countRules as aa, detectDialect as ab, detectOperationType as ac, detectRedos as ad, envToExport as ae, envToJson as af, formatCss as ag, formatGql as ah, formatHtml as ai, formatSql as aj, getEndpointsByTag as ak, getHtmlStats as al, getJsStats as am, getMethodColor as an, isValidTag as ao, lintConventionalCommit as ap, lookupMime as aq, minifyCss as ar, minifyGql as as, minifyHtml as at, minifyJs as au, minifySql as av, normalizeRef as aw, parseDockerImage as ax, parseEnv as ay, parseGitCommand as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DockerImageRef as l, type EditorConfigProperty as m, type EditorConfigSection as n, type EditorConfigValidationResult as o, type EnvEntry as p, type EnvParseResult as q, type ExportsIssue as r, type ExportsShape as s, type ExportsValidationResult as t, type GitCommandResult as u, type GitOperation as v, type GithubUrlInfo as w, type GithubUrlType as x, type GitignoreTestResult as y, type GqlFormatResult as z };
632
+ export { type RegexMatch as $, ALL_FLAGS as A, type GitCommandResult as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EditorConfigIssue as E, type GitOperation as F, type GitCommandConfig as G, type GithubUrlInfo as H, type GithubUrlType as I, type GitignoreTestResult as J, type GqlFormatResult as K, type HtmlFormatResult as L, type HtmlMinifyOptions as M, type HtmlMinifyResult as N, type JsMinifyOptions as O, type JsMinifyResult as P, MIME_TABLE as Q, type MatchResult as R, type MimeEntry as S, type MimeLookupResult as T, OPERATIONS as U, type ParsedSpec as V, type RedosFinding as W, type RedosResult as X, type RedosSeverity as Y, type RegexError as Z, type RegexFlag as _, type ApiEndpoint as a, type RegexResult as a0, type RegexSuccess as a1, SQL_DEFAULT_OPTIONS as a2, type Segment as a3, type SpecVersion as a4, type SqlDialect as a5, type SqlFormatOptions as a6, type TestPatternResult as a7, type TsconfigIssue as a8, type TsconfigValidationResult as a9, minifyHtml as aA, minifyJs as aB, minifySql as aC, normalizeRef as aD, parseDockerImage as aE, parseEnv as aF, parseGitCommand as aG, parseGithubUrl as aH, parseSpec as aI, removeConsoleCalls as aJ, removeEmptyAttributes as aK, removeHtmlComments as aL, removeJsComments as aM, removeRedundantAttributes as aN, searchCheatsheet as aO, searchEndpoints as aP, splitStatements as aQ, testGitignorePatterns as aR, testPattern as aS, testRegex as aT, validateEditorConfig as aU, validateEnvKey as aV, validatePackageExports as aW, validateTsconfig as aX, auditDependencyRanges as aa, buildDockerPull as ab, buildDockerRun as ac, buildGitCommand as ad, collapseHtmlWhitespace as ae, collapseJsWhitespace as af, countProperties as ag, countRules as ah, detectDialect as ai, detectOperationType as aj, detectRedos as ak, envToExport as al, envToJson as am, formatCss as an, formatGql as ao, formatHtml as ap, formatSql as aq, getEndpointsByTag as ar, getHtmlStats as as, getJsStats as at, getMethodColor as au, isValidTag as av, lintConventionalCommit as aw, lookupMime as ax, minifyCss as ay, minifyGql as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DependencyAuditDuplicate as l, type DependencyAuditEntry as m, type DependencyAuditIssue as n, type DependencyAuditResult as o, type DependencyRangeType as p, type DependencySection as q, type DockerImageRef as r, type EditorConfigProperty as s, type EditorConfigSection as t, type EditorConfigValidationResult as u, type EnvEntry as v, type EnvParseResult as w, type ExportsIssue as x, type ExportsShape as y, type ExportsValidationResult as z };
package/dist/index.cjs CHANGED
@@ -8485,6 +8485,7 @@ __export(units_exports, {
8485
8485
  permissionsToChmod: () => permissionsToChmod,
8486
8486
  permissionsToOctal: () => permissionsToOctal,
8487
8487
  permissionsToSymbolic: () => permissionsToSymbolic,
8488
+ planDebtPayoff: () => planDebtPayoff,
8488
8489
  ptToPx: () => ptToPx,
8489
8490
  pxToAll: () => pxToAll,
8490
8491
  pxToViewport: () => pxToViewport,
@@ -10779,6 +10780,105 @@ function calculateFreelancerRate(input) {
10779
10780
  monthlyRevenueTarget: round23(requiredAnnualRevenue / 12)
10780
10781
  };
10781
10782
  }
10783
+ var DEBT_PAYOFF_MAX_MONTHS = 1200;
10784
+ function _simulateDebtPayoff(debts, order, extraMonthlyPayment) {
10785
+ const round23 = (n) => Math.round(n * 100) / 100;
10786
+ const balances = debts.map((d) => d.balance);
10787
+ const totalMinPayment = debts.reduce((sum, d) => sum + d.minPayment, 0);
10788
+ const totalBudget = totalMinPayment + extraMonthlyPayment;
10789
+ let totalInterestPaid = 0;
10790
+ let totalPaid = 0;
10791
+ const schedule = [];
10792
+ let month = 0;
10793
+ while (balances.some((b) => b > 5e-3) && month < DEBT_PAYOFF_MAX_MONTHS) {
10794
+ month++;
10795
+ for (let i = 0; i < balances.length; i++) {
10796
+ if (balances[i] <= 0) continue;
10797
+ const interest = balances[i] * debts[i].ratePercent / 100 / 12;
10798
+ balances[i] += interest;
10799
+ totalInterestPaid += interest;
10800
+ }
10801
+ let remainingBudget = totalBudget;
10802
+ for (let i = 0; i < balances.length; i++) {
10803
+ if (balances[i] <= 0) continue;
10804
+ const pay = Math.min(balances[i], debts[i].minPayment);
10805
+ balances[i] -= pay;
10806
+ remainingBudget -= pay;
10807
+ totalPaid += pay;
10808
+ }
10809
+ for (const i of order) {
10810
+ if (remainingBudget <= 0) break;
10811
+ if (balances[i] <= 0) continue;
10812
+ const pay = Math.min(balances[i], remainingBudget);
10813
+ balances[i] -= pay;
10814
+ remainingBudget -= pay;
10815
+ totalPaid += pay;
10816
+ }
10817
+ for (const i of order) {
10818
+ if (balances[i] <= 5e-3 && !schedule.some((s) => s.label === debts[i].label)) {
10819
+ schedule.push({ label: debts[i].label, monthPaidOff: month });
10820
+ }
10821
+ }
10822
+ }
10823
+ if (balances.some((b) => b > 5e-3)) return null;
10824
+ return {
10825
+ order: order.map((i) => debts[i].label),
10826
+ monthsToPayoff: month,
10827
+ totalInterestPaid: round23(totalInterestPaid),
10828
+ totalPaid: round23(totalPaid),
10829
+ schedule
10830
+ };
10831
+ }
10832
+ function planDebtPayoff(debts, extraMonthlyPayment = 0) {
10833
+ if (!Array.isArray(debts) || debts.length === 0) {
10834
+ return { error: "debts must be a non-empty array" };
10835
+ }
10836
+ if (!Number.isFinite(extraMonthlyPayment) || extraMonthlyPayment < 0) {
10837
+ return { error: "extraMonthlyPayment must be a finite, non-negative number" };
10838
+ }
10839
+ const normalized = [];
10840
+ for (let i = 0; i < debts.length; i++) {
10841
+ const d = debts[i];
10842
+ if (typeof d.balance !== "number" || !Number.isFinite(d.balance) || d.balance <= 0) {
10843
+ return { error: `debt ${i + 1}: balance must be a finite number greater than zero` };
10844
+ }
10845
+ if (typeof d.ratePercent !== "number" || !Number.isFinite(d.ratePercent) || d.ratePercent < 0) {
10846
+ return { error: `debt ${i + 1}: ratePercent must be a finite, non-negative number` };
10847
+ }
10848
+ if (typeof d.minPayment !== "number" || !Number.isFinite(d.minPayment) || d.minPayment <= 0) {
10849
+ return { error: `debt ${i + 1}: minPayment must be a finite number greater than zero` };
10850
+ }
10851
+ normalized.push({
10852
+ label: d.label?.trim() || `Debt ${i + 1}`,
10853
+ balance: d.balance,
10854
+ ratePercent: d.ratePercent,
10855
+ minPayment: d.minPayment
10856
+ });
10857
+ }
10858
+ const snowballOrder = normalized.map((_, i) => i).sort((a, b) => normalized[a].balance - normalized[b].balance);
10859
+ const avalancheOrder = normalized.map((_, i) => i).sort((a, b) => normalized[b].ratePercent - normalized[a].ratePercent);
10860
+ const snowball = _simulateDebtPayoff(normalized, snowballOrder, extraMonthlyPayment);
10861
+ const avalanche = _simulateDebtPayoff(normalized, avalancheOrder, extraMonthlyPayment);
10862
+ if (!snowball || !avalanche) {
10863
+ return { error: `debts cannot be paid off within ${DEBT_PAYOFF_MAX_MONTHS} months at this payment level; increase a minimum payment or the extra monthly payment` };
10864
+ }
10865
+ const round23 = (n) => Math.round(n * 100) / 100;
10866
+ const monthsDifference = Math.abs(snowball.monthsToPayoff - avalanche.monthsToPayoff);
10867
+ const interestDifference = round23(Math.abs(snowball.totalInterestPaid - avalanche.totalInterestPaid));
10868
+ return {
10869
+ debts: normalized,
10870
+ totalMonthlyBudget: round23(normalized.reduce((sum, d) => sum + d.minPayment, 0) + extraMonthlyPayment),
10871
+ extraMonthlyPayment,
10872
+ snowball,
10873
+ avalanche,
10874
+ comparison: {
10875
+ fasterStrategy: snowball.monthsToPayoff === avalanche.monthsToPayoff ? "tie" : snowball.monthsToPayoff < avalanche.monthsToPayoff ? "snowball" : "avalanche",
10876
+ monthsDifference,
10877
+ cheaperStrategy: snowball.totalInterestPaid === avalanche.totalInterestPaid ? "tie" : snowball.totalInterestPaid < avalanche.totalInterestPaid ? "snowball" : "avalanche",
10878
+ interestDifference
10879
+ }
10880
+ };
10881
+ }
10782
10882
 
10783
10883
  // src/tools/network.ts
10784
10884
  var network_exports = {};
@@ -10803,6 +10903,7 @@ __export(network_exports, {
10803
10903
  buildMapUrl: () => buildMapUrl,
10804
10904
  buildPermissionsPolicy: () => buildPermissionsPolicy,
10805
10905
  buildPreferHeader: () => buildPreferHeader,
10906
+ buildPriorityHeader: () => buildPriorityHeader,
10806
10907
  buildRangeHeader: () => buildRangeHeader,
10807
10908
  buildReferrerPolicy: () => buildReferrerPolicy,
10808
10909
  buildRetryAfterHeader: () => buildRetryAfterHeader,
@@ -10823,6 +10924,8 @@ __export(network_exports, {
10823
10924
  isValidIp: () => isValidIp2,
10824
10925
  isValidIpv4: () => isValidIpv42,
10825
10926
  isValidIpv6: () => isValidIpv6,
10927
+ listCloseCodes: () => listCloseCodes,
10928
+ lookupCloseCode: () => lookupCloseCode,
10826
10929
  parseAcceptLanguage: () => parseAcceptLanguage,
10827
10930
  parseClientHintHeaders: () => parseClientHintHeaders,
10828
10931
  parseContentDisposition: () => parseContentDisposition,
@@ -10833,6 +10936,7 @@ __export(network_exports, {
10833
10936
  parseIpv6Address: () => parseIpv6Address,
10834
10937
  parsePermissionsPolicy: () => parsePermissionsPolicy,
10835
10938
  parsePreferHeader: () => parsePreferHeader,
10939
+ parsePriorityHeader: () => parsePriorityHeader,
10836
10940
  parseRetryAfterHeader: () => parseRetryAfterHeader,
10837
10941
  parseUserAgent: () => parseUserAgent,
10838
10942
  parseVaryHeader: () => parseVaryHeader,
@@ -13799,6 +13903,97 @@ function parseRetryAfterHeader(raw) {
13799
13903
  const httpDate = parsed.toUTCString();
13800
13904
  return { header: `Retry-After: ${httpDate}`, headerValue: httpDate, type: "http-date", httpDate, iso: parsed.toISOString() };
13801
13905
  }
13906
+ function isValidUrgency(n) {
13907
+ return typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 7;
13908
+ }
13909
+ function buildPriorityHeader(input) {
13910
+ const { urgency, incremental } = input ?? {};
13911
+ if (urgency === void 0 && incremental === void 0) {
13912
+ return { error: "Provide at least one of urgency or incremental" };
13913
+ }
13914
+ if (urgency !== void 0 && !isValidUrgency(urgency)) {
13915
+ return { error: "urgency must be an integer between 0 and 7" };
13916
+ }
13917
+ const parts = [];
13918
+ if (urgency !== void 0) parts.push(`u=${urgency}`);
13919
+ if (incremental === true) parts.push("i");
13920
+ else if (incremental === false) parts.push("i=?0");
13921
+ const headerValue = parts.join(", ");
13922
+ return {
13923
+ header: `Priority: ${headerValue}`,
13924
+ headerValue,
13925
+ urgency: urgency ?? 3,
13926
+ incremental: incremental ?? false
13927
+ };
13928
+ }
13929
+ function parsePriorityHeader(raw) {
13930
+ if (!raw || raw.trim() === "") return { error: "Input is empty" };
13931
+ const withoutLabel = raw.trim().replace(/^priority:\s*/i, "");
13932
+ const parts = withoutLabel.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
13933
+ if (parts.length === 0) return { error: "Input is empty" };
13934
+ let urgency = 3;
13935
+ let incremental = false;
13936
+ for (const part of parts) {
13937
+ const eq = part.indexOf("=");
13938
+ const key = (eq === -1 ? part : part.slice(0, eq)).trim();
13939
+ const rawValue = eq === -1 ? void 0 : part.slice(eq + 1).trim();
13940
+ if (key === "u") {
13941
+ if (rawValue === void 0 || !/^\d+$/.test(rawValue)) return { error: `Invalid urgency value in "${part}"` };
13942
+ const n = Number(rawValue);
13943
+ if (n < 0 || n > 7) return { error: `urgency must be between 0 and 7, got ${n}` };
13944
+ urgency = n;
13945
+ } else if (key === "i") {
13946
+ if (rawValue === void 0 || rawValue === "?1") incremental = true;
13947
+ else if (rawValue === "?0") incremental = false;
13948
+ else return { error: `Invalid incremental value in "${part}"` };
13949
+ }
13950
+ }
13951
+ const headerValue = incremental ? `u=${urgency}, i` : `u=${urgency}, i=?0`;
13952
+ return { header: `Priority: ${headerValue}`, headerValue, urgency, incremental };
13953
+ }
13954
+ var WELL_KNOWN_CLOSE_CODES = {
13955
+ 1e3: { name: "Normal Closure", description: "The connection successfully completed the purpose for which it was created.", sentOnWire: true },
13956
+ 1001: { name: "Going Away", description: "An endpoint is going away, such as a server shutting down or a browser navigating away from the page.", sentOnWire: true },
13957
+ 1002: { name: "Protocol Error", description: "An endpoint is terminating the connection due to a protocol error.", sentOnWire: true },
13958
+ 1003: { name: "Unsupported Data", description: "An endpoint received a data type it cannot accept, such as a binary-only endpoint receiving a text message.", sentOnWire: true },
13959
+ 1004: { name: "Reserved", description: "Reserved. A meaning might be defined in the future.", sentOnWire: true },
13960
+ 1005: { name: "No Status Received", description: "A reserved value used internally by libraries to indicate no status code was actually present in the close frame. Must not be sent on the wire.", sentOnWire: false },
13961
+ 1006: { name: "Abnormal Closure", description: "A reserved value used internally by libraries to indicate the connection closed without a close frame, e.g. the TCP connection dropped. Must not be sent on the wire.", sentOnWire: false },
13962
+ 1007: { name: "Invalid frame payload data", description: "An endpoint is terminating the connection because it received data inconsistent with the message type, such as non-UTF-8 data in a text message.", sentOnWire: true },
13963
+ 1008: { name: "Policy Violation", description: "A generic status code used when no other code fits and the endpoint does not want to reveal further details, or a message violated its policy.", sentOnWire: true },
13964
+ 1009: { name: "Message Too Big", description: "An endpoint is terminating the connection because it received a message too large to process.", sentOnWire: true },
13965
+ 1010: { name: "Mandatory Extension", description: "A client is terminating the connection because the server did not negotiate one or more extensions the client required.", sentOnWire: true },
13966
+ 1011: { name: "Internal Error", description: "A server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.", sentOnWire: true },
13967
+ 1012: { name: "Service Restart", description: "The server is terminating the connection because it is restarting.", sentOnWire: true },
13968
+ 1013: { name: "Try Again Later", description: "The server is terminating the connection due to a temporary condition, such as being overloaded, and the client should reconnect later.", sentOnWire: true },
13969
+ 1014: { name: "Bad Gateway", description: "The server, acting as a gateway or proxy, received an invalid response from an upstream server it connected to while processing the request.", sentOnWire: true },
13970
+ 1015: { name: "TLS Handshake", description: "A reserved value used internally by libraries to indicate the TLS handshake failed. Must not be sent on the wire.", sentOnWire: false }
13971
+ };
13972
+ function listCloseCodes() {
13973
+ return Object.entries(WELL_KNOWN_CLOSE_CODES).map(([code, info]) => ({ code: Number(code), name: info.name, description: info.description, range: "standard", sentOnWire: info.sentOnWire })).sort((a, b) => a.code - b.code);
13974
+ }
13975
+ function lookupCloseCode(code) {
13976
+ if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > 65535) {
13977
+ return { error: "code must be an integer between 0 and 65535" };
13978
+ }
13979
+ const known = WELL_KNOWN_CLOSE_CODES[code];
13980
+ if (known) {
13981
+ return { code, name: known.name, description: known.description, range: "standard", sentOnWire: known.sentOnWire };
13982
+ }
13983
+ if (code < 1e3) {
13984
+ return { error: `${code} is not a valid WebSocket close code; codes below 1000 are not permitted on the wire` };
13985
+ }
13986
+ if (code <= 2999) {
13987
+ return { code, name: "Unassigned", description: "Reserved for future use by the WebSocket protocol specification. No meaning is defined yet.", range: "reserved-future", sentOnWire: true };
13988
+ }
13989
+ if (code <= 3999) {
13990
+ return { code, name: "Library/Framework Use", description: "Reserved for use by libraries, frameworks, and applications. Codes in this range are meant to be registered directly with IANA in the WebSocket Close Code Number Registry, so their meaning depends on which library or application defined them.", range: "library-framework", sentOnWire: true };
13991
+ }
13992
+ if (code <= 4999) {
13993
+ return { code, name: "Private Use", description: "Reserved for private use between a specific client and server implementation. These codes cannot be registered with IANA, so their meaning is defined entirely by the application using them.", range: "private-use", sentOnWire: true };
13994
+ }
13995
+ return { error: `${code} is outside the defined close code ranges (0-4999); codes 5000 and above have no assigned meaning` };
13996
+ }
13802
13997
 
13803
13998
  // src/tools/api.ts
13804
13999
  var api_exports = {};
@@ -15117,6 +15312,7 @@ __export(code_exports, {
15117
15312
  MIME_TABLE: () => MIME_TABLE,
15118
15313
  OPERATIONS: () => OPERATIONS,
15119
15314
  SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
15315
+ auditDependencyRanges: () => auditDependencyRanges,
15120
15316
  buildDockerPull: () => buildDockerPull,
15121
15317
  buildDockerRun: () => buildDockerRun,
15122
15318
  buildGitCommand: () => buildGitCommand,
@@ -18501,6 +18697,96 @@ function validatePackageExports(packageJsonText) {
18501
18697
  const valid = !issues.some((i) => i.severity === "error");
18502
18698
  return { parsed: true, exportsShape, subpaths, issues, valid };
18503
18699
  }
18700
+ var DEPENDENCY_SECTIONS = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
18701
+ var EXACT_SEMVER_RE = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
18702
+ function classifyDependencyRange(version2) {
18703
+ const v = version2.trim();
18704
+ if (v === "" || v === "*" || v.toLowerCase() === "x") return "wildcard";
18705
+ if (v.startsWith("workspace:")) return "workspace";
18706
+ if (v.startsWith("file:")) return "file";
18707
+ if (v.startsWith("link:")) return "link";
18708
+ if (v.startsWith("http://") || v.startsWith("https://")) return "url";
18709
+ if (v.startsWith("git+") || v.startsWith("git://") || v.startsWith("github:") || v.endsWith(".git") || /^[\w-]+\/[\w.-]+$/.test(v)) return "git";
18710
+ if (v.startsWith("^")) return "caret";
18711
+ if (v.startsWith("~")) return "tilde";
18712
+ if (v.includes("||") || v.includes(" ") || v.startsWith(">") || v.startsWith("<") || v.startsWith("=")) return "range";
18713
+ if (EXACT_SEMVER_RE.test(v)) return "exact";
18714
+ if (/^[A-Za-z][\w.-]*$/.test(v)) return "tag";
18715
+ return "unknown";
18716
+ }
18717
+ function auditDependencyRanges(packageJsonText) {
18718
+ if (!packageJsonText || !packageJsonText.trim()) return { error: "Input is empty" };
18719
+ let parsed;
18720
+ try {
18721
+ parsed = JSON.parse(packageJsonText);
18722
+ } catch (e) {
18723
+ return { error: `Invalid JSON: ${e.message}` };
18724
+ }
18725
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
18726
+ return { error: "Root of package.json must be an object" };
18727
+ }
18728
+ const obj = parsed;
18729
+ const presentSections = DEPENDENCY_SECTIONS.filter((s) => obj[s] && typeof obj[s] === "object");
18730
+ if (presentSections.length === 0) {
18731
+ return { error: "package.json has no dependencies, devDependencies, peerDependencies, or optionalDependencies field" };
18732
+ }
18733
+ const dependencies = [];
18734
+ const issues = [];
18735
+ const byName = /* @__PURE__ */ new Map();
18736
+ for (const section of presentSections) {
18737
+ const map = obj[section];
18738
+ for (const [name, versionRaw] of Object.entries(map)) {
18739
+ const version2 = typeof versionRaw === "string" ? versionRaw : String(versionRaw);
18740
+ const rangeType = classifyDependencyRange(version2);
18741
+ const entryIssues = [];
18742
+ if (rangeType === "wildcard") {
18743
+ entryIssues.push("no real version constraint; any version, including breaking ones, could be installed");
18744
+ }
18745
+ if (rangeType === "tag" && version2.trim().toLowerCase() === "latest") {
18746
+ entryIssues.push('"latest" is not reproducible; a fresh install can pull in a different, potentially breaking version at any time');
18747
+ }
18748
+ if (rangeType === "git" || rangeType === "url") {
18749
+ entryIssues.push(`not resolved from the npm registry (${rangeType}); can't be checked against registry advisories the same way`);
18750
+ }
18751
+ if (rangeType === "file" || rangeType === "link") {
18752
+ entryIssues.push(`local ${rangeType === "file" ? "path" : "symlink"} dependency; not portable to a machine or CI runner without the same local path`);
18753
+ }
18754
+ const entry = { name, version: version2, section, rangeType, issues: entryIssues };
18755
+ dependencies.push(entry);
18756
+ for (const issue of entryIssues) {
18757
+ issues.push({ severity: "warning", name, message: issue });
18758
+ }
18759
+ const existing = byName.get(name);
18760
+ if (existing) existing.push(entry);
18761
+ else byName.set(name, [entry]);
18762
+ }
18763
+ }
18764
+ const duplicates = [];
18765
+ for (const [name, entries] of byName) {
18766
+ if (entries.length < 2) continue;
18767
+ const versions = new Set(entries.map((e) => e.version));
18768
+ const sameVersion = versions.size === 1;
18769
+ duplicates.push({ name, sections: entries.map((e) => e.section), sameVersion });
18770
+ if (!sameVersion) {
18771
+ issues.push({ severity: "error", name, message: `listed with different version ranges in ${entries.map((e) => `${e.section} ("${e.version}")`).join(" and ")}` });
18772
+ } else {
18773
+ issues.push({ severity: "warning", name, message: `listed in more than one section (${entries.map((e) => e.section).join(", ")}) with the same range; redundant` });
18774
+ }
18775
+ }
18776
+ const rangeTypeCounts = {};
18777
+ for (const dep of dependencies) {
18778
+ rangeTypeCounts[dep.rangeType] = (rangeTypeCounts[dep.rangeType] ?? 0) + 1;
18779
+ }
18780
+ return {
18781
+ parsed: true,
18782
+ sections: presentSections,
18783
+ totalDependencies: dependencies.length,
18784
+ dependencies,
18785
+ duplicates,
18786
+ rangeTypeCounts,
18787
+ issues
18788
+ };
18789
+ }
18504
18790
 
18505
18791
  // src/tools/color.ts
18506
18792
  var color_exports = {};
package/dist/index.d.cts CHANGED
@@ -5,10 +5,10 @@ export { t as text } from './text-DWUcY8H1.cjs';
5
5
  export { d as data } from './data-vxXrBlWh.cjs';
6
6
  export { g as generators } from './generators-DAXXrMvG.cjs';
7
7
  export { t as time } from './time-KqJjdqII.cjs';
8
- export { u as units } from './units-izyUpUAb.cjs';
9
- export { n as network } from './network-CXt69chQ.cjs';
8
+ export { u as units } from './units-CLJ16Zzv.cjs';
9
+ export { n as network } from './network-DewFJy4E.cjs';
10
10
  export { a as api } from './api-DmTNE4c1.cjs';
11
- export { c as code } from './code-rxidGgvB.cjs';
11
+ export { c as code } from './code-CKI2Z_NM.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
14
  export { m as misc } from './misc-CA3N198T.cjs';
package/dist/index.d.ts CHANGED
@@ -5,10 +5,10 @@ export { t as text } from './text-DWUcY8H1.js';
5
5
  export { d as data } from './data-vxXrBlWh.js';
6
6
  export { g as generators } from './generators-DAXXrMvG.js';
7
7
  export { t as time } from './time-KqJjdqII.js';
8
- export { u as units } from './units-izyUpUAb.js';
9
- export { n as network } from './network-CXt69chQ.js';
8
+ export { u as units } from './units-CLJ16Zzv.js';
9
+ export { n as network } from './network-DewFJy4E.js';
10
10
  export { a as api } from './api-DmTNE4c1.js';
11
- export { c as code } from './code-rxidGgvB.js';
11
+ export { c as code } from './code-CKI2Z_NM.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
14
  export { m as misc } from './misc-CA3N198T.js';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export { media_exports as media } from './chunk-226EH3ZI.js';
2
- export { units_exports as units } from './chunk-43WFN3CW.js';
3
- export { network_exports as network } from './chunk-2WT347WO.js';
2
+ export { units_exports as units } from './chunk-YTH76KAF.js';
3
+ export { network_exports as network } from './chunk-43L7H3L2.js';
4
4
  export { api_exports as api } from './chunk-52ZDKSIX.js';
5
- export { code_exports as code } from './chunk-JW4NG2GN.js';
5
+ export { code_exports as code } from './chunk-JPFHEZ4P.js';
6
6
  export { color_exports as color } from './chunk-BPVAB4P2.js';
7
7
  export { css_exports as css } from './chunk-6YPV2AB5.js';
8
8
  export { misc_exports as misc } from './chunk-GX7H6TAX.js';