@uapkg/diagnostics 1.3.0 → 1.3.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 (81) hide show
  1. package/dist/base/Diagnostic.d.ts +22 -19
  2. package/dist/base/Diagnostic.d.ts.map +1 -1
  3. package/dist/base/Diagnostic.js +23 -24
  4. package/dist/base/Diagnostic.js.map +1 -1
  5. package/dist/base/DiagnosticBag.d.ts +32 -29
  6. package/dist/base/DiagnosticBag.d.ts.map +1 -1
  7. package/dist/base/DiagnosticBag.js +75 -76
  8. package/dist/base/DiagnosticBag.js.map +1 -1
  9. package/dist/base/DiagnosticFingerprint.d.ts +10 -8
  10. package/dist/base/DiagnosticFingerprint.d.ts.map +1 -1
  11. package/dist/base/DiagnosticFingerprint.js +18 -19
  12. package/dist/base/DiagnosticFingerprint.js.map +1 -1
  13. package/dist/base/DiagnosticLevel.d.ts +4 -1
  14. package/dist/base/DiagnosticLevel.d.ts.map +1 -1
  15. package/dist/base/DiagnosticLevel.js +1 -2
  16. package/dist/base/Result.d.ts +15 -12
  17. package/dist/base/Result.d.ts.map +1 -1
  18. package/dist/base/Result.js +28 -16
  19. package/dist/base/Result.js.map +1 -1
  20. package/dist/config/ConfigDiagnostics.d.ts +36 -33
  21. package/dist/config/ConfigDiagnostics.d.ts.map +1 -1
  22. package/dist/config/ConfigDiagnostics.js +51 -41
  23. package/dist/config/ConfigDiagnostics.js.map +1 -1
  24. package/dist/controlPlane/ControlPlaneDiagnostics.d.ts +22 -19
  25. package/dist/controlPlane/ControlPlaneDiagnostics.d.ts.map +1 -1
  26. package/dist/controlPlane/ControlPlaneDiagnostics.js +11 -7
  27. package/dist/controlPlane/ControlPlaneDiagnostics.js.map +1 -1
  28. package/dist/general/GeneralDiagnostics.d.ts +16 -13
  29. package/dist/general/GeneralDiagnostics.d.ts.map +1 -1
  30. package/dist/general/GeneralDiagnostics.js +34 -27
  31. package/dist/general/GeneralDiagnostics.js.map +1 -1
  32. package/dist/index.d.ts +20 -33
  33. package/dist/index.js +19 -20
  34. package/dist/installer/InstallerDiagnostics.d.ts +41 -38
  35. package/dist/installer/InstallerDiagnostics.d.ts.map +1 -1
  36. package/dist/installer/InstallerDiagnostics.js +86 -56
  37. package/dist/installer/InstallerDiagnostics.js.map +1 -1
  38. package/dist/manifest/ManifestDiagnostics.d.ts +50 -47
  39. package/dist/manifest/ManifestDiagnostics.d.ts.map +1 -1
  40. package/dist/manifest/ManifestDiagnostics.js +99 -80
  41. package/dist/manifest/ManifestDiagnostics.js.map +1 -1
  42. package/dist/pack/PackDiagnostics.d.ts +31 -28
  43. package/dist/pack/PackDiagnostics.d.ts.map +1 -1
  44. package/dist/pack/PackDiagnostics.js +70 -64
  45. package/dist/pack/PackDiagnostics.js.map +1 -1
  46. package/dist/postinstall/PostinstallDiagnostics.d.ts +35 -32
  47. package/dist/postinstall/PostinstallDiagnostics.d.ts.map +1 -1
  48. package/dist/postinstall/PostinstallDiagnostics.js +75 -52
  49. package/dist/postinstall/PostinstallDiagnostics.js.map +1 -1
  50. package/dist/publishing/PublishingDiagnostics.d.ts +78 -0
  51. package/dist/publishing/PublishingDiagnostics.d.ts.map +1 -0
  52. package/dist/publishing/PublishingDiagnostics.js +14 -0
  53. package/dist/publishing/PublishingDiagnostics.js.map +1 -0
  54. package/dist/registry/RegistryDiagnostics.d.ts +51 -48
  55. package/dist/registry/RegistryDiagnostics.d.ts.map +1 -1
  56. package/dist/registry/RegistryDiagnostics.js +106 -82
  57. package/dist/registry/RegistryDiagnostics.js.map +1 -1
  58. package/dist/registryTools/RegistryToolsDiagnostics.d.ts +97 -94
  59. package/dist/registryTools/RegistryToolsDiagnostics.d.ts.map +1 -1
  60. package/dist/registryTools/RegistryToolsDiagnostics.js +91 -40
  61. package/dist/registryTools/RegistryToolsDiagnostics.js.map +1 -1
  62. package/dist/resolver/ResolverDiagnostics.d.ts +27 -24
  63. package/dist/resolver/ResolverDiagnostics.d.ts.map +1 -1
  64. package/dist/resolver/ResolverDiagnostics.js +59 -43
  65. package/dist/resolver/ResolverDiagnostics.js.map +1 -1
  66. package/dist/safety/SafetyDiagnostics.d.ts +19 -16
  67. package/dist/safety/SafetyDiagnostics.d.ts.map +1 -1
  68. package/dist/safety/SafetyDiagnostics.js +38 -26
  69. package/dist/safety/SafetyDiagnostics.js.map +1 -1
  70. package/dist/spec/SpecDiagnostics.d.ts +17 -14
  71. package/dist/spec/SpecDiagnostics.d.ts.map +1 -1
  72. package/dist/spec/SpecDiagnostics.js +37 -27
  73. package/dist/spec/SpecDiagnostics.js.map +1 -1
  74. package/dist/types.d.ts +20 -16
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/types.js +1 -2
  77. package/package.json +14 -16
  78. package/dist/base/DiagnosticLevel.js.map +0 -1
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/types.js.map +0 -1
@@ -1,59 +1,82 @@
1
- // ---------------------------------------------------------------------------
2
- // Factories
3
- // ---------------------------------------------------------------------------
4
- export function createPostinstallPolicyDeniedDiagnostic(packageName, registry, policy, resolvedFrom) {
5
- return {
6
- level: 'info',
7
- code: 'POSTINSTALL_POLICY_DENIED',
8
- message: `Postinstall skipped for "${packageName}" (policy=${policy}, from ${resolvedFrom}).`,
9
- hint: resolvedFrom === 'registry'
10
- ? `Override per-registry via \`registries.${registry}.postInstallPolicy = "allow"\`.`
11
- : 'Override globally via `install.postInstallPolicy = "allow"` in your uapkg config.',
12
- data: { packageName, registry, policy, resolvedFrom },
13
- };
1
+ //#region src/postinstall/PostinstallDiagnostics.ts
2
+ function createPostinstallPolicyDeniedDiagnostic(packageName, registry, policy, resolvedFrom) {
3
+ return {
4
+ level: "info",
5
+ code: "POSTINSTALL_POLICY_DENIED",
6
+ message: `Postinstall skipped for "${packageName}" (policy=${policy}, from ${resolvedFrom}).`,
7
+ hint: resolvedFrom === "registry" ? `Override per-registry via \`registries.${registry}.postInstallPolicy = "allow"\`.` : "Override globally via `install.postInstallPolicy = \"allow\"` in your uapkg config.",
8
+ data: {
9
+ packageName,
10
+ registry,
11
+ policy,
12
+ resolvedFrom
13
+ }
14
+ };
14
15
  }
15
- export function createPostinstallLoadFailedDiagnostic(packageName, entryFile, reason) {
16
- return {
17
- level: 'error',
18
- code: 'POSTINSTALL_LOAD_FAILED',
19
- message: `Failed to load postinstall for "${packageName}" from "${entryFile}": ${reason}.`,
20
- data: { packageName, entryFile, reason },
21
- };
16
+ function createPostinstallLoadFailedDiagnostic(packageName, entryFile, reason) {
17
+ return {
18
+ level: "error",
19
+ code: "POSTINSTALL_LOAD_FAILED",
20
+ message: `Failed to load postinstall for "${packageName}" from "${entryFile}": ${reason}.`,
21
+ data: {
22
+ packageName,
23
+ entryFile,
24
+ reason
25
+ }
26
+ };
22
27
  }
23
- export function createPostinstallInvalidExportDiagnostic(packageName, entryFile, issues) {
24
- return {
25
- level: 'error',
26
- code: 'POSTINSTALL_INVALID_EXPORT',
27
- message: `Postinstall default export for "${packageName}" is invalid.`,
28
- hint: 'Use `definePostinstall({...})` and export the result as default.',
29
- data: { packageName, entryFile, issues },
30
- };
28
+ function createPostinstallInvalidExportDiagnostic(packageName, entryFile, issues) {
29
+ return {
30
+ level: "error",
31
+ code: "POSTINSTALL_INVALID_EXPORT",
32
+ message: `Postinstall default export for "${packageName}" is invalid.`,
33
+ hint: "Use `definePostinstall({...})` and export the result as default.",
34
+ data: {
35
+ packageName,
36
+ entryFile,
37
+ issues
38
+ }
39
+ };
31
40
  }
32
- export function createPostinstallDuplicateEntryDiagnostic(packageName, candidates) {
33
- return {
34
- level: 'error',
35
- code: 'POSTINSTALL_DUPLICATE_ENTRY',
36
- message: `Multiple postinstall entry files found for "${packageName}".`,
37
- hint: 'Keep only one of `.uapkg/postinstall.ts|.js|.mjs`.',
38
- data: { packageName, candidates },
39
- };
41
+ function createPostinstallDuplicateEntryDiagnostic(packageName, candidates) {
42
+ return {
43
+ level: "error",
44
+ code: "POSTINSTALL_DUPLICATE_ENTRY",
45
+ message: `Multiple postinstall entry files found for "${packageName}".`,
46
+ hint: "Keep only one of `.uapkg/postinstall.ts|.js|.mjs`.",
47
+ data: {
48
+ packageName,
49
+ candidates
50
+ }
51
+ };
40
52
  }
41
- export function createPostinstallMarkerCorruptDiagnostic(packageName, file, reason) {
42
- return {
43
- level: 'error',
44
- code: 'POSTINSTALL_MARKER_CORRUPT',
45
- message: `Postinstall marker block corrupt in "${file}" for "${packageName}": ${reason}.`,
46
- hint: 'Restore the UAPKG-BEGIN/END markers or remove them manually and re-run.',
47
- data: { packageName, file, reason },
48
- };
53
+ function createPostinstallMarkerCorruptDiagnostic(packageName, file, reason) {
54
+ return {
55
+ level: "error",
56
+ code: "POSTINSTALL_MARKER_CORRUPT",
57
+ message: `Postinstall marker block corrupt in "${file}" for "${packageName}": ${reason}.`,
58
+ hint: "Restore the UAPKG-BEGIN/END markers or remove them manually and re-run.",
59
+ data: {
60
+ packageName,
61
+ file,
62
+ reason
63
+ }
64
+ };
49
65
  }
50
- export function createPostinstallEsbuildErrorDiagnostic(packageName, entryFile, reason) {
51
- return {
52
- level: 'error',
53
- code: 'POSTINSTALL_ESBUILD_ERROR',
54
- message: `esbuild failed on "${entryFile}" for "${packageName}": ${reason}.`,
55
- hint: 'Note: uapkg transpiles but does not type-check; fix the file in your IDE.',
56
- data: { packageName, entryFile, reason },
57
- };
66
+ function createPostinstallEsbuildErrorDiagnostic(packageName, entryFile, reason) {
67
+ return {
68
+ level: "error",
69
+ code: "POSTINSTALL_ESBUILD_ERROR",
70
+ message: `esbuild failed on "${entryFile}" for "${packageName}": ${reason}.`,
71
+ hint: "Note: uapkg transpiles but does not type-check; fix the file in your IDE.",
72
+ data: {
73
+ packageName,
74
+ entryFile,
75
+ reason
76
+ }
77
+ };
58
78
  }
79
+
80
+ //#endregion
81
+ export { createPostinstallDuplicateEntryDiagnostic, createPostinstallEsbuildErrorDiagnostic, createPostinstallInvalidExportDiagnostic, createPostinstallLoadFailedDiagnostic, createPostinstallMarkerCorruptDiagnostic, createPostinstallPolicyDeniedDiagnostic };
59
82
  //# sourceMappingURL=PostinstallDiagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostinstallDiagnostics.js","sourceRoot":"","sources":["../../src/postinstall/PostinstallDiagnostics.ts"],"names":[],"mappings":"AA0EA,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,UAAU,uCAAuC,CACrD,WAAmB,EACnB,QAAgB,EAChB,MAAwB,EACxB,YAAoC;IAEpC,OAAO;QACL,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,2BAA2B;QACjC,OAAO,EAAE,4BAA4B,WAAW,aAAa,MAAM,UAAU,YAAY,IAAI;QAC7F,IAAI,EACF,YAAY,KAAK,UAAU;YACzB,CAAC,CAAC,0CAA0C,QAAQ,iCAAiC;YACrF,CAAC,CAAC,mFAAmF;QACzF,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE;KACtD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC,CACnD,WAAmB,EACnB,SAAiB,EACjB,MAAc;IAEd,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,mCAAmC,WAAW,WAAW,SAAS,MAAM,MAAM,GAAG;QAC1F,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,WAAmB,EACnB,SAAiB,EACjB,MAAyB;IAEzB,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,mCAAmC,WAAW,eAAe;QACtE,IAAI,EAAE,kEAAkE;QACxE,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yCAAyC,CACvD,WAAmB,EACnB,UAA6B;IAE7B,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,+CAA+C,WAAW,IAAI;QACvE,IAAI,EAAE,oDAAoD;QAC1D,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE;KAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wCAAwC,CACtD,WAAmB,EACnB,IAAY,EACZ,MAAc;IAEd,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,wCAAwC,IAAI,UAAU,WAAW,MAAM,MAAM,GAAG;QACzF,IAAI,EAAE,yEAAyE;QAC/E,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,WAAmB,EACnB,SAAiB,EACjB,MAAc;IAEd,OAAO;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,2BAA2B;QACjC,OAAO,EAAE,sBAAsB,SAAS,UAAU,WAAW,MAAM,MAAM,GAAG;QAC5E,IAAI,EAAE,2EAA2E;QACjF,IAAI,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE;KACzC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"PostinstallDiagnostics.js","names":[],"sources":["../../src/postinstall/PostinstallDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Postinstall diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** Postinstall was denied by policy (install.postInstallPolicy or per-registry override). */\nexport type PostinstallPolicyDeniedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_POLICY_DENIED',\n {\n readonly packageName: string;\n readonly registry: string;\n readonly policy: 'allow' | 'deny';\n readonly resolvedFrom: 'registry' | 'install';\n }\n>;\n\n/** Loading the postinstall module failed (e.g. import error). */\nexport type PostinstallLoadFailedDiagnostic = DiagnosticBase<\n 'POSTINSTALL_LOAD_FAILED',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\n/** The postinstall module's default export failed Zod validation. */\nexport type PostinstallInvalidExportDiagnostic = DiagnosticBase<\n 'POSTINSTALL_INVALID_EXPORT',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** More than one candidate postinstall entry file exists (e.g. both .ts and .js). */\nexport type PostinstallDuplicateEntryDiagnostic = DiagnosticBase<\n 'POSTINSTALL_DUPLICATE_ENTRY',\n {\n readonly packageName: string;\n readonly candidates: readonly string[];\n }\n>;\n\n/** Marker-block in a generated file is corrupt or was edited manually. */\nexport type PostinstallMarkerCorruptDiagnostic = DiagnosticBase<\n 'POSTINSTALL_MARKER_CORRUPT',\n {\n readonly packageName: string;\n readonly file: string;\n readonly reason: string;\n }\n>;\n\n/** esbuild failed to transpile a `.ts` postinstall entry file. */\nexport type PostinstallEsbuildErrorDiagnostic = DiagnosticBase<\n 'POSTINSTALL_ESBUILD_ERROR',\n {\n readonly packageName: string;\n readonly entryFile: string;\n readonly reason: string;\n }\n>;\n\nexport type PostinstallDiagnostic =\n | PostinstallPolicyDeniedDiagnostic\n | PostinstallLoadFailedDiagnostic\n | PostinstallInvalidExportDiagnostic\n | PostinstallDuplicateEntryDiagnostic\n | PostinstallMarkerCorruptDiagnostic\n | PostinstallEsbuildErrorDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createPostinstallPolicyDeniedDiagnostic(\n packageName: string,\n registry: string,\n policy: 'allow' | 'deny',\n resolvedFrom: 'registry' | 'install',\n): PostinstallPolicyDeniedDiagnostic {\n return {\n level: 'info',\n code: 'POSTINSTALL_POLICY_DENIED',\n message: `Postinstall skipped for \"${packageName}\" (policy=${policy}, from ${resolvedFrom}).`,\n hint:\n resolvedFrom === 'registry'\n ? `Override per-registry via \\`registries.${registry}.postInstallPolicy = \"allow\"\\`.`\n : 'Override globally via `install.postInstallPolicy = \"allow\"` in your uapkg config.',\n data: { packageName, registry, policy, resolvedFrom },\n };\n}\n\nexport function createPostinstallLoadFailedDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallLoadFailedDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_LOAD_FAILED',\n message: `Failed to load postinstall for \"${packageName}\" from \"${entryFile}\": ${reason}.`,\n data: { packageName, entryFile, reason },\n };\n}\n\nexport function createPostinstallInvalidExportDiagnostic(\n packageName: string,\n entryFile: string,\n issues: readonly string[],\n): PostinstallInvalidExportDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_INVALID_EXPORT',\n message: `Postinstall default export for \"${packageName}\" is invalid.`,\n hint: 'Use `definePostinstall({...})` and export the result as default.',\n data: { packageName, entryFile, issues },\n };\n}\n\nexport function createPostinstallDuplicateEntryDiagnostic(\n packageName: string,\n candidates: readonly string[],\n): PostinstallDuplicateEntryDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_DUPLICATE_ENTRY',\n message: `Multiple postinstall entry files found for \"${packageName}\".`,\n hint: 'Keep only one of `.uapkg/postinstall.ts|.js|.mjs`.',\n data: { packageName, candidates },\n };\n}\n\nexport function createPostinstallMarkerCorruptDiagnostic(\n packageName: string,\n file: string,\n reason: string,\n): PostinstallMarkerCorruptDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_MARKER_CORRUPT',\n message: `Postinstall marker block corrupt in \"${file}\" for \"${packageName}\": ${reason}.`,\n hint: 'Restore the UAPKG-BEGIN/END markers or remove them manually and re-run.',\n data: { packageName, file, reason },\n };\n}\n\nexport function createPostinstallEsbuildErrorDiagnostic(\n packageName: string,\n entryFile: string,\n reason: string,\n): PostinstallEsbuildErrorDiagnostic {\n return {\n level: 'error',\n code: 'POSTINSTALL_ESBUILD_ERROR',\n message: `esbuild failed on \"${entryFile}\" for \"${packageName}\": ${reason}.`,\n hint: 'Note: uapkg transpiles but does not type-check; fix the file in your IDE.',\n data: { packageName, entryFile, reason },\n };\n}\n"],"mappings":";AA8EA,SAAgB,wCACd,aACA,UACA,QACA,cACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,YAAY,YAAY,OAAO,SAAS,aAAa;EAC1F,MACE,iBAAiB,aACb,0CAA0C,SAAS,mCACnD;EACN,MAAM;GAAE;GAAa;GAAU;GAAQ;EAAa;CACtD;AACF;AAEA,SAAgB,sCACd,aACA,WACA,QACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY,UAAU,UAAU,KAAK,OAAO;EACxF,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,yCACd,aACA,WACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,mCAAmC,YAAY;EACxD,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF;AAEA,SAAgB,0CACd,aACA,YACqC;CACrC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,+CAA+C,YAAY;EACpE,MAAM;EACN,MAAM;GAAE;GAAa;EAAW;CAClC;AACF;AAEA,SAAgB,yCACd,aACA,MACA,QACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,wCAAwC,KAAK,SAAS,YAAY,KAAK,OAAO;EACvF,MAAM;EACN,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,wCACd,aACA,WACA,QACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,SAAS,YAAY,KAAK,OAAO;EAC1E,MAAM;EACN,MAAM;GAAE;GAAa;GAAW;EAAO;CACzC;AACF"}
@@ -0,0 +1,78 @@
1
+ import { DiagnosticBase } from "../base/Diagnostic.js";
2
+ //#region src/publishing/PublishingDiagnostics.d.ts
3
+ /**
4
+ * Safe, user-facing context for a failed publish request. The fixed set of
5
+ * kinds prevents arbitrary control-plane details from leaking into output.
6
+ */
7
+ type PublishDiagnosticFact = {
8
+ readonly kind: 'package';
9
+ readonly value: string;
10
+ } | {
11
+ readonly kind: 'version';
12
+ readonly value: string;
13
+ } | {
14
+ readonly kind: 'registry';
15
+ readonly value: string;
16
+ } | {
17
+ readonly kind: 'credential-kind';
18
+ readonly value: string;
19
+ } | {
20
+ readonly kind: 'requested-owner';
21
+ readonly value: string;
22
+ } | {
23
+ readonly kind: 'token-owner';
24
+ readonly value: string;
25
+ } | {
26
+ readonly kind: 'allowed-owner';
27
+ readonly value: string;
28
+ } | {
29
+ readonly kind: 'actual-access-mode';
30
+ readonly value: string;
31
+ } | {
32
+ readonly kind: 'required-access-mode';
33
+ readonly value: string;
34
+ } | {
35
+ readonly kind: 'repository';
36
+ readonly value: string;
37
+ } | {
38
+ readonly kind: 'requested-repository';
39
+ readonly value: string;
40
+ } | {
41
+ readonly kind: 'trusted-repository';
42
+ readonly value: string;
43
+ } | {
44
+ readonly kind: 'request-id';
45
+ readonly value: string;
46
+ } | {
47
+ readonly kind: 'retry-after';
48
+ readonly value: string;
49
+ } | {
50
+ readonly kind: 'missing-capability';
51
+ readonly value: string;
52
+ };
53
+ /** A CLI command or account page that can help resolve a publish failure. */
54
+ type PublishDiagnosticResource = {
55
+ readonly kind: 'command';
56
+ readonly command: string;
57
+ readonly label?: string;
58
+ } | {
59
+ readonly kind: 'url';
60
+ readonly url: string;
61
+ readonly label?: string;
62
+ };
63
+ interface PublishRequestFailedDiagnosticData {
64
+ /** Stable control-plane error code, when a response was received. */
65
+ readonly serverCode?: string;
66
+ /** HTTP response status, when a response was received. */
67
+ readonly status?: number;
68
+ /** Validated facts that are safe to show to the user. */
69
+ readonly facts: readonly PublishDiagnosticFact[];
70
+ /** Commands and account pages that can help the user recover. */
71
+ readonly resources: readonly PublishDiagnosticResource[];
72
+ }
73
+ type PublishRequestFailedDiagnostic = DiagnosticBase<'PUBLISH_REQUEST_FAILED', PublishRequestFailedDiagnosticData>;
74
+ type PublishingDiagnostic = PublishRequestFailedDiagnostic;
75
+ declare function createPublishRequestFailedDiagnostic(message: string, data: PublishRequestFailedDiagnosticData, hint?: string): PublishRequestFailedDiagnostic;
76
+ //#endregion
77
+ export { PublishDiagnosticFact, PublishDiagnosticResource, PublishRequestFailedDiagnostic, PublishRequestFailedDiagnosticData, PublishingDiagnostic, createPublishRequestFailedDiagnostic };
78
+ //# sourceMappingURL=PublishingDiagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublishingDiagnostics.d.ts","names":[],"sources":["../../src/publishing/PublishingDiagnostics.ts"],"mappings":";;;;;;KAMY;WACG;WAA0B;;WAC1B;WAA0B;;WAC1B;WAA2B;;WAC3B;WAAkC;;WAClC;WAAkC;;WAClC;WAA8B;;WAC9B;WAAgC;;WAChC;WAAqC;;WACrC;WAAuC;;WACvC;WAA6B;;WAC7B;WAAuC;;WACvC;WAAqC;;WACrC;WAA6B;;WAC7B;WAA8B;;WAC9B;WAAqC;;;KAGxC;WAEG;WACA;WACA;;WAGA;WACA;WACA;;UAGE;;WAEN;;WAEA;;WAEA,gBAAgB;;WAEhB,oBAAoB;;KAGnB,iCAAiC,yCAE3C;KAGU,uBAAuB;iBAEnB,qCACd,iBACA,MAAM,oCACN,gBACC"}
@@ -0,0 +1,14 @@
1
+ //#region src/publishing/PublishingDiagnostics.ts
2
+ function createPublishRequestFailedDiagnostic(message, data, hint) {
3
+ return {
4
+ level: "error",
5
+ code: "PUBLISH_REQUEST_FAILED",
6
+ message,
7
+ hint,
8
+ data
9
+ };
10
+ }
11
+
12
+ //#endregion
13
+ export { createPublishRequestFailedDiagnostic };
14
+ //# sourceMappingURL=PublishingDiagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublishingDiagnostics.js","names":[],"sources":["../../src/publishing/PublishingDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n/**\n * Safe, user-facing context for a failed publish request. The fixed set of\n * kinds prevents arbitrary control-plane details from leaking into output.\n */\nexport type PublishDiagnosticFact =\n | { readonly kind: 'package'; readonly value: string }\n | { readonly kind: 'version'; readonly value: string }\n | { readonly kind: 'registry'; readonly value: string }\n | { readonly kind: 'credential-kind'; readonly value: string }\n | { readonly kind: 'requested-owner'; readonly value: string }\n | { readonly kind: 'token-owner'; readonly value: string }\n | { readonly kind: 'allowed-owner'; readonly value: string }\n | { readonly kind: 'actual-access-mode'; readonly value: string }\n | { readonly kind: 'required-access-mode'; readonly value: string }\n | { readonly kind: 'repository'; readonly value: string }\n | { readonly kind: 'requested-repository'; readonly value: string }\n | { readonly kind: 'trusted-repository'; readonly value: string }\n | { readonly kind: 'request-id'; readonly value: string }\n | { readonly kind: 'retry-after'; readonly value: string }\n | { readonly kind: 'missing-capability'; readonly value: string };\n\n/** A CLI command or account page that can help resolve a publish failure. */\nexport type PublishDiagnosticResource =\n | {\n readonly kind: 'command';\n readonly command: string;\n readonly label?: string;\n }\n | {\n readonly kind: 'url';\n readonly url: string;\n readonly label?: string;\n };\n\nexport interface PublishRequestFailedDiagnosticData {\n /** Stable control-plane error code, when a response was received. */\n readonly serverCode?: string;\n /** HTTP response status, when a response was received. */\n readonly status?: number;\n /** Validated facts that are safe to show to the user. */\n readonly facts: readonly PublishDiagnosticFact[];\n /** Commands and account pages that can help the user recover. */\n readonly resources: readonly PublishDiagnosticResource[];\n}\n\nexport type PublishRequestFailedDiagnostic = DiagnosticBase<\n 'PUBLISH_REQUEST_FAILED',\n PublishRequestFailedDiagnosticData\n>;\n\nexport type PublishingDiagnostic = PublishRequestFailedDiagnostic;\n\nexport function createPublishRequestFailedDiagnostic(\n message: string,\n data: PublishRequestFailedDiagnosticData,\n hint?: string,\n): PublishRequestFailedDiagnostic {\n return {\n level: 'error',\n code: 'PUBLISH_REQUEST_FAILED',\n message,\n hint,\n data,\n };\n}\n"],"mappings":";AAsDA,SAAgB,qCACd,SACA,MACA,MACgC;CAChC,OAAO;EACL,OAAO;EACP,MAAM;EACN;EACA;EACA;CACF;AACF"}
@@ -1,69 +1,72 @@
1
- import type { DiagnosticBase } from '../base/Diagnostic.js';
1
+ import { DiagnosticBase } from "../base/Diagnostic.js";
2
+ //#region src/registry/RegistryDiagnostics.d.ts
2
3
  /** A network-level error when communicating with a registry. */
3
- export type NetworkErrorDiagnostic = DiagnosticBase<'NETWORK_ERROR', {
4
- readonly url: string;
5
- readonly reason: string;
4
+ type NetworkErrorDiagnostic = DiagnosticBase<'NETWORK_ERROR', {
5
+ readonly url: string;
6
+ readonly reason: string;
6
7
  }>;
7
8
  /** A git operation failed. */
8
- export type GitErrorDiagnostic = DiagnosticBase<'GIT_ERROR', {
9
- readonly command: string;
10
- readonly stderr: string;
11
- readonly exitCode: number;
9
+ type GitErrorDiagnostic = DiagnosticBase<'GIT_ERROR', {
10
+ readonly command: string;
11
+ readonly stderr: string;
12
+ readonly exitCode: number;
12
13
  }>;
13
14
  /** A registry document did not pass schema validation. */
14
- export type SchemaInvalidDiagnostic = DiagnosticBase<'SCHEMA_INVALID', {
15
- readonly filePath: string;
16
- readonly issues: readonly string[];
15
+ type SchemaInvalidDiagnostic = DiagnosticBase<'SCHEMA_INVALID', {
16
+ readonly filePath: string;
17
+ readonly issues: readonly string[];
17
18
  }>;
18
19
  /** A referenced registry name is not found in configuration. */
19
- export type RegistryNotFoundDiagnostic = DiagnosticBase<'REGISTRY_NOT_FOUND', {
20
- readonly registryName: string;
20
+ type RegistryNotFoundDiagnostic = DiagnosticBase<'REGISTRY_NOT_FOUND', {
21
+ readonly registryName: string;
21
22
  }>;
22
23
  /** Failed to acquire the registry update lock. */
23
- export type LockAcquisitionFailedDiagnostic = DiagnosticBase<'LOCK_ACQUISITION_FAILED', {
24
- readonly lockPath: string;
25
- readonly ownerPid: number;
24
+ type LockAcquisitionFailedDiagnostic = DiagnosticBase<'LOCK_ACQUISITION_FAILED', {
25
+ readonly lockPath: string;
26
+ readonly ownerPid: number;
26
27
  }>;
27
28
  /** Registry cache could not be read. */
28
- export type CacheReadErrorDiagnostic = DiagnosticBase<'CACHE_READ_ERROR', {
29
- readonly cachePath: string;
30
- readonly reason: string;
29
+ type CacheReadErrorDiagnostic = DiagnosticBase<'CACHE_READ_ERROR', {
30
+ readonly cachePath: string;
31
+ readonly reason: string;
31
32
  }>;
32
33
  /** Registry cache state is internally inconsistent or malformed. */
33
- export type CacheCorruptDiagnostic = DiagnosticBase<'CACHE_CORRUPT', {
34
- readonly cachePath: string;
35
- readonly reason: string;
34
+ type CacheCorruptDiagnostic = DiagnosticBase<'CACHE_CORRUPT', {
35
+ readonly cachePath: string;
36
+ readonly reason: string;
36
37
  }>;
37
38
  /** A shortened cache path belongs to a different full registry identifier. */
38
- export type CacheIdentifierCollisionDiagnostic = DiagnosticBase<'CACHE_IDENTIFIER_COLLISION', {
39
- readonly cachePath: string;
40
- readonly expectedIdentifier: string;
41
- readonly actualIdentifier: string;
39
+ type CacheIdentifierCollisionDiagnostic = DiagnosticBase<'CACHE_IDENTIFIER_COLLISION', {
40
+ readonly cachePath: string;
41
+ readonly expectedIdentifier: string;
42
+ readonly actualIdentifier: string;
42
43
  }>;
43
44
  /** Registry could not be reached, optionally with cached state available. */
44
- export type RegistryUnreachableDiagnostic = DiagnosticBase<'REGISTRY_UNREACHABLE', {
45
- readonly registryName: string;
46
- readonly url: string;
47
- readonly httpStatus?: number;
48
- readonly cause: string;
49
- readonly initialized: boolean;
45
+ type RegistryUnreachableDiagnostic = DiagnosticBase<'REGISTRY_UNREACHABLE', {
46
+ readonly registryName: string;
47
+ readonly url: string;
48
+ readonly httpStatus?: number;
49
+ readonly cause: string;
50
+ readonly initialized: boolean;
50
51
  }>;
51
52
  /** Union of all registry diagnostics. */
52
- export type RegistryDiagnostic = NetworkErrorDiagnostic | GitErrorDiagnostic | SchemaInvalidDiagnostic | RegistryNotFoundDiagnostic | LockAcquisitionFailedDiagnostic | CacheReadErrorDiagnostic | CacheCorruptDiagnostic | CacheIdentifierCollisionDiagnostic | RegistryUnreachableDiagnostic;
53
- export declare function createNetworkErrorDiagnostic(url: string, reason: string): NetworkErrorDiagnostic;
54
- export declare function createGitErrorDiagnostic(command: string, stderr: string, exitCode: number): GitErrorDiagnostic;
55
- export declare function createSchemaInvalidDiagnostic(filePath: string, issues: readonly string[]): SchemaInvalidDiagnostic;
56
- export declare function createRegistryNotFoundDiagnostic(registryName: string): RegistryNotFoundDiagnostic;
57
- export declare function createLockAcquisitionFailedDiagnostic(lockPath: string, ownerPid: number): LockAcquisitionFailedDiagnostic;
58
- export declare function createCacheReadErrorDiagnostic(cachePath: string, reason: string): CacheReadErrorDiagnostic;
59
- export declare function createCacheCorruptDiagnostic(cachePath: string, reason: string): CacheCorruptDiagnostic;
60
- export declare function createCacheIdentifierCollisionDiagnostic(cachePath: string, expectedIdentifier: string, actualIdentifier: string): CacheIdentifierCollisionDiagnostic;
61
- export declare function createRegistryUnreachableDiagnostic(input: {
62
- readonly registryName: string;
63
- readonly url: string;
64
- readonly cause: string;
65
- readonly initialized: boolean;
66
- readonly httpStatus?: number;
67
- readonly level?: 'error' | 'warning';
53
+ type RegistryDiagnostic = NetworkErrorDiagnostic | GitErrorDiagnostic | SchemaInvalidDiagnostic | RegistryNotFoundDiagnostic | LockAcquisitionFailedDiagnostic | CacheReadErrorDiagnostic | CacheCorruptDiagnostic | CacheIdentifierCollisionDiagnostic | RegistryUnreachableDiagnostic;
54
+ declare function createNetworkErrorDiagnostic(url: string, reason: string): NetworkErrorDiagnostic;
55
+ declare function createGitErrorDiagnostic(command: string, stderr: string, exitCode: number): GitErrorDiagnostic;
56
+ declare function createSchemaInvalidDiagnostic(filePath: string, issues: readonly string[]): SchemaInvalidDiagnostic;
57
+ declare function createRegistryNotFoundDiagnostic(registryName: string): RegistryNotFoundDiagnostic;
58
+ declare function createLockAcquisitionFailedDiagnostic(lockPath: string, ownerPid: number): LockAcquisitionFailedDiagnostic;
59
+ declare function createCacheReadErrorDiagnostic(cachePath: string, reason: string): CacheReadErrorDiagnostic;
60
+ declare function createCacheCorruptDiagnostic(cachePath: string, reason: string): CacheCorruptDiagnostic;
61
+ declare function createCacheIdentifierCollisionDiagnostic(cachePath: string, expectedIdentifier: string, actualIdentifier: string): CacheIdentifierCollisionDiagnostic;
62
+ declare function createRegistryUnreachableDiagnostic(input: {
63
+ readonly registryName: string;
64
+ readonly url: string;
65
+ readonly cause: string;
66
+ readonly initialized: boolean;
67
+ readonly httpStatus?: number;
68
+ readonly level?: 'error' | 'warning';
68
69
  }): RegistryUnreachableDiagnostic;
70
+ //#endregion
71
+ export { CacheCorruptDiagnostic, CacheIdentifierCollisionDiagnostic, CacheReadErrorDiagnostic, GitErrorDiagnostic, LockAcquisitionFailedDiagnostic, NetworkErrorDiagnostic, RegistryDiagnostic, RegistryNotFoundDiagnostic, RegistryUnreachableDiagnostic, SchemaInvalidDiagnostic, createCacheCorruptDiagnostic, createCacheIdentifierCollisionDiagnostic, createCacheReadErrorDiagnostic, createGitErrorDiagnostic, createLockAcquisitionFailedDiagnostic, createNetworkErrorDiagnostic, createRegistryNotFoundDiagnostic, createRegistryUnreachableDiagnostic, createSchemaInvalidDiagnostic };
69
72
  //# sourceMappingURL=RegistryDiagnostics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryDiagnostics.d.ts","sourceRoot":"","sources":["../../src/registry/RegistryDiagnostics.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"RegistryDiagnostics.d.ts","names":[],"sources":["../../src/registry/RegistryDiagnostics.ts"],"mappings":";;;KAOY,yBAAyB;WAGxB;WACA;;;KAKD,qBAAqB;WAGpB;WACA;WACA;;;KAKD,0BAA0B;WAGzB;WACA;;;KAKD,6BAA6B;WAG5B;;;KAKD,kCAAkC;WAGjC;WACA;;;KAKD,2BAA2B;WAG1B;WACA;;;KAKD,yBAAyB;WAGxB;WACA;;;KAKD,qCAAqC;WAGpC;WACA;WACA;;;KAKD,gCAAgC;WAG/B;WACA;WACA;WACA;WACA;;;KAKD,qBACR,yBACA,qBACA,0BACA,6BACA,kCACA,2BACA,yBACA,qCACA;iBAMY,6BAA6B,aAAa,iBAAiB;iBAU3D,yBAAyB,iBAAiB,gBAAgB,mBAAmB;iBAU7E,8BAA8B,kBAAkB,4BAA4B;iBAU5E,iCAAiC,uBAAuB;iBAgBxD,sCACd,kBACA,mBACC;iBAUa,+BAA+B,mBAAmB,iBAAiB;iBAUnE,6BAA6B,mBAAmB,iBAAiB;iBAUjE,yCACd,mBACA,4BACA,2BACC;iBAUa,oCAAoC;WACzC;WACA;WACA;WACA;WACA;WACA;IACP"}
@@ -1,99 +1,123 @@
1
- // ---------------------------------------------------------------------------
2
- // Factory helpers
3
- // ---------------------------------------------------------------------------
4
- export function createNetworkErrorDiagnostic(url, reason) {
5
- return {
6
- level: 'error',
7
- code: 'NETWORK_ERROR',
8
- message: `Network error for "${url}": ${reason}.`,
9
- hint: 'Check your network connection and retry.',
10
- data: { url, reason },
11
- };
1
+ //#region src/registry/RegistryDiagnostics.ts
2
+ function createNetworkErrorDiagnostic(url, reason) {
3
+ return {
4
+ level: "error",
5
+ code: "NETWORK_ERROR",
6
+ message: `Network error for "${url}": ${reason}.`,
7
+ hint: "Check your network connection and retry.",
8
+ data: {
9
+ url,
10
+ reason
11
+ }
12
+ };
12
13
  }
13
- export function createGitErrorDiagnostic(command, stderr, exitCode) {
14
- return {
15
- level: 'error',
16
- code: 'GIT_ERROR',
17
- message: `Git command failed (exit ${exitCode}): ${command}.`,
18
- hint: 'Ensure git is installed and the registry URL is reachable.',
19
- data: { command, stderr, exitCode },
20
- };
14
+ function createGitErrorDiagnostic(command, stderr, exitCode) {
15
+ return {
16
+ level: "error",
17
+ code: "GIT_ERROR",
18
+ message: `Git command failed (exit ${exitCode}): ${command}.`,
19
+ hint: "Ensure git is installed and the registry URL is reachable.",
20
+ data: {
21
+ command,
22
+ stderr,
23
+ exitCode
24
+ }
25
+ };
21
26
  }
22
- export function createSchemaInvalidDiagnostic(filePath, issues) {
23
- return {
24
- level: 'error',
25
- code: 'SCHEMA_INVALID',
26
- message: `Schema validation failed for "${filePath}".`,
27
- hint: 'Review the file against the expected schema.',
28
- data: { filePath, issues },
29
- };
27
+ function createSchemaInvalidDiagnostic(filePath, issues) {
28
+ return {
29
+ level: "error",
30
+ code: "SCHEMA_INVALID",
31
+ message: `Schema validation failed for "${filePath}".`,
32
+ hint: "Review the file against the expected schema.",
33
+ data: {
34
+ filePath,
35
+ issues
36
+ }
37
+ };
30
38
  }
31
- export function createRegistryNotFoundDiagnostic(registryName) {
32
- return {
33
- level: 'error',
34
- code: 'REGISTRY_NOT_FOUND',
35
- message: `Registry "${registryName}" is not defined in configuration.`,
36
- hint: `Add the registry. Example:
39
+ function createRegistryNotFoundDiagnostic(registryName) {
40
+ return {
41
+ level: "error",
42
+ code: "REGISTRY_NOT_FOUND",
43
+ message: `Registry "${registryName}" is not defined in configuration.`,
44
+ hint: `Add the registry. Example:
37
45
  uapkg registry add ${registryName} https://registry.example.com
38
46
 
39
47
  Or configure manually:
40
48
  uapkg config set registries.${registryName}.url https://registry.example.com
41
49
  uapkg config set registries.${registryName}.ref.type branch
42
50
  uapkg config set registries.${registryName}.ref.value main`,
43
- data: { registryName },
44
- };
51
+ data: { registryName }
52
+ };
45
53
  }
46
- export function createLockAcquisitionFailedDiagnostic(lockPath, ownerPid) {
47
- return {
48
- level: 'error',
49
- code: 'LOCK_ACQUISITION_FAILED',
50
- message: `Could not acquire registry lock at "${lockPath}" (held by PID ${ownerPid}).`,
51
- hint: 'Another uapkg process may be updating this registry. Wait or remove the stale lock.',
52
- data: { lockPath, ownerPid },
53
- };
54
+ function createLockAcquisitionFailedDiagnostic(lockPath, ownerPid) {
55
+ return {
56
+ level: "error",
57
+ code: "LOCK_ACQUISITION_FAILED",
58
+ message: `Could not acquire registry lock at "${lockPath}" (held by PID ${ownerPid}).`,
59
+ hint: "Another uapkg process may be updating this registry. Wait or remove the stale lock.",
60
+ data: {
61
+ lockPath,
62
+ ownerPid
63
+ }
64
+ };
54
65
  }
55
- export function createCacheReadErrorDiagnostic(cachePath, reason) {
56
- return {
57
- level: 'error',
58
- code: 'CACHE_READ_ERROR',
59
- message: `Failed to read registry cache at "${cachePath}": ${reason}.`,
60
- hint: 'The cache may be corrupted. Try running `uapkg update` to refresh.',
61
- data: { cachePath, reason },
62
- };
66
+ function createCacheReadErrorDiagnostic(cachePath, reason) {
67
+ return {
68
+ level: "error",
69
+ code: "CACHE_READ_ERROR",
70
+ message: `Failed to read registry cache at "${cachePath}": ${reason}.`,
71
+ hint: "The cache may be corrupted. Try running `uapkg update` to refresh.",
72
+ data: {
73
+ cachePath,
74
+ reason
75
+ }
76
+ };
63
77
  }
64
- export function createCacheCorruptDiagnostic(cachePath, reason) {
65
- return {
66
- level: 'error',
67
- code: 'CACHE_CORRUPT',
68
- message: `Registry cache at "${cachePath}" is corrupt: ${reason}.`,
69
- hint: 'Remove this registry cache directory and retry. Registry caches contain only disposable local data.',
70
- data: { cachePath, reason },
71
- };
78
+ function createCacheCorruptDiagnostic(cachePath, reason) {
79
+ return {
80
+ level: "error",
81
+ code: "CACHE_CORRUPT",
82
+ message: `Registry cache at "${cachePath}" is corrupt: ${reason}.`,
83
+ hint: "Remove this registry cache directory and retry. Registry caches contain only disposable local data.",
84
+ data: {
85
+ cachePath,
86
+ reason
87
+ }
88
+ };
72
89
  }
73
- export function createCacheIdentifierCollisionDiagnostic(cachePath, expectedIdentifier, actualIdentifier) {
74
- return {
75
- level: 'error',
76
- code: 'CACHE_IDENTIFIER_COLLISION',
77
- message: `Registry cache identifier collision at "${cachePath}".`,
78
- hint: 'Remove this registry cache directory and retry. If the collision recurs, report it to the uapkg maintainers.',
79
- data: { cachePath, expectedIdentifier, actualIdentifier },
80
- };
90
+ function createCacheIdentifierCollisionDiagnostic(cachePath, expectedIdentifier, actualIdentifier) {
91
+ return {
92
+ level: "error",
93
+ code: "CACHE_IDENTIFIER_COLLISION",
94
+ message: `Registry cache identifier collision at "${cachePath}".`,
95
+ hint: "Remove this registry cache directory and retry. If the collision recurs, report it to the uapkg maintainers.",
96
+ data: {
97
+ cachePath,
98
+ expectedIdentifier,
99
+ actualIdentifier
100
+ }
101
+ };
81
102
  }
82
- export function createRegistryUnreachableDiagnostic(input) {
83
- return {
84
- level: input.level ?? (input.initialized ? 'warning' : 'error'),
85
- code: 'REGISTRY_UNREACHABLE',
86
- message: `The "${input.registryName}" registry could not be reached at ${input.url}.`,
87
- emitPolicy: 'once',
88
- hint: `Verify the registry URL with 'uapkg config get registries.${input.registryName}.url --trace'.
103
+ function createRegistryUnreachableDiagnostic(input) {
104
+ return {
105
+ level: input.level ?? (input.initialized ? "warning" : "error"),
106
+ code: "REGISTRY_UNREACHABLE",
107
+ message: `The "${input.registryName}" registry could not be reached at ${input.url}.`,
108
+ emitPolicy: "once",
109
+ hint: `Verify the registry URL with 'uapkg config get registries.${input.registryName}.url --trace'.
89
110
  The registry may also be temporarily unavailable.`,
90
- data: {
91
- registryName: input.registryName,
92
- url: input.url,
93
- cause: input.cause,
94
- initialized: input.initialized,
95
- httpStatus: input.httpStatus,
96
- },
97
- };
111
+ data: {
112
+ registryName: input.registryName,
113
+ url: input.url,
114
+ cause: input.cause,
115
+ initialized: input.initialized,
116
+ httpStatus: input.httpStatus
117
+ }
118
+ };
98
119
  }
120
+
121
+ //#endregion
122
+ export { createCacheCorruptDiagnostic, createCacheIdentifierCollisionDiagnostic, createCacheReadErrorDiagnostic, createGitErrorDiagnostic, createLockAcquisitionFailedDiagnostic, createNetworkErrorDiagnostic, createRegistryNotFoundDiagnostic, createRegistryUnreachableDiagnostic, createSchemaInvalidDiagnostic };
99
123
  //# sourceMappingURL=RegistryDiagnostics.js.map