@uapkg/diagnostics 1.3.0 → 1.3.2
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.
- package/dist/base/Diagnostic.d.ts +22 -19
- package/dist/base/Diagnostic.d.ts.map +1 -1
- package/dist/base/Diagnostic.js +23 -24
- package/dist/base/Diagnostic.js.map +1 -1
- package/dist/base/DiagnosticBag.d.ts +32 -29
- package/dist/base/DiagnosticBag.d.ts.map +1 -1
- package/dist/base/DiagnosticBag.js +75 -76
- package/dist/base/DiagnosticBag.js.map +1 -1
- package/dist/base/DiagnosticFingerprint.d.ts +10 -8
- package/dist/base/DiagnosticFingerprint.d.ts.map +1 -1
- package/dist/base/DiagnosticFingerprint.js +18 -19
- package/dist/base/DiagnosticFingerprint.js.map +1 -1
- package/dist/base/DiagnosticLevel.d.ts +4 -1
- package/dist/base/DiagnosticLevel.d.ts.map +1 -1
- package/dist/base/DiagnosticLevel.js +1 -2
- package/dist/base/Result.d.ts +15 -12
- package/dist/base/Result.d.ts.map +1 -1
- package/dist/base/Result.js +28 -16
- package/dist/base/Result.js.map +1 -1
- package/dist/config/ConfigDiagnostics.d.ts +36 -33
- package/dist/config/ConfigDiagnostics.d.ts.map +1 -1
- package/dist/config/ConfigDiagnostics.js +51 -41
- package/dist/config/ConfigDiagnostics.js.map +1 -1
- package/dist/controlPlane/ControlPlaneDiagnostics.d.ts +22 -19
- package/dist/controlPlane/ControlPlaneDiagnostics.d.ts.map +1 -1
- package/dist/controlPlane/ControlPlaneDiagnostics.js +11 -7
- package/dist/controlPlane/ControlPlaneDiagnostics.js.map +1 -1
- package/dist/general/GeneralDiagnostics.d.ts +16 -13
- package/dist/general/GeneralDiagnostics.d.ts.map +1 -1
- package/dist/general/GeneralDiagnostics.js +34 -27
- package/dist/general/GeneralDiagnostics.js.map +1 -1
- package/dist/index.d.ts +20 -33
- package/dist/index.js +19 -20
- package/dist/installer/InstallerDiagnostics.d.ts +41 -38
- package/dist/installer/InstallerDiagnostics.d.ts.map +1 -1
- package/dist/installer/InstallerDiagnostics.js +86 -56
- package/dist/installer/InstallerDiagnostics.js.map +1 -1
- package/dist/manifest/ManifestDiagnostics.d.ts +50 -47
- package/dist/manifest/ManifestDiagnostics.d.ts.map +1 -1
- package/dist/manifest/ManifestDiagnostics.js +99 -80
- package/dist/manifest/ManifestDiagnostics.js.map +1 -1
- package/dist/pack/PackDiagnostics.d.ts +31 -28
- package/dist/pack/PackDiagnostics.d.ts.map +1 -1
- package/dist/pack/PackDiagnostics.js +70 -64
- package/dist/pack/PackDiagnostics.js.map +1 -1
- package/dist/postinstall/PostinstallDiagnostics.d.ts +35 -32
- package/dist/postinstall/PostinstallDiagnostics.d.ts.map +1 -1
- package/dist/postinstall/PostinstallDiagnostics.js +75 -52
- package/dist/postinstall/PostinstallDiagnostics.js.map +1 -1
- package/dist/publishing/PublishingDiagnostics.d.ts +78 -0
- package/dist/publishing/PublishingDiagnostics.d.ts.map +1 -0
- package/dist/publishing/PublishingDiagnostics.js +14 -0
- package/dist/publishing/PublishingDiagnostics.js.map +1 -0
- package/dist/registry/RegistryDiagnostics.d.ts +51 -48
- package/dist/registry/RegistryDiagnostics.d.ts.map +1 -1
- package/dist/registry/RegistryDiagnostics.js +106 -82
- package/dist/registry/RegistryDiagnostics.js.map +1 -1
- package/dist/registryTools/RegistryToolsDiagnostics.d.ts +97 -94
- package/dist/registryTools/RegistryToolsDiagnostics.d.ts.map +1 -1
- package/dist/registryTools/RegistryToolsDiagnostics.js +91 -40
- package/dist/registryTools/RegistryToolsDiagnostics.js.map +1 -1
- package/dist/resolver/ResolverDiagnostics.d.ts +27 -24
- package/dist/resolver/ResolverDiagnostics.d.ts.map +1 -1
- package/dist/resolver/ResolverDiagnostics.js +59 -43
- package/dist/resolver/ResolverDiagnostics.js.map +1 -1
- package/dist/safety/SafetyDiagnostics.d.ts +19 -16
- package/dist/safety/SafetyDiagnostics.d.ts.map +1 -1
- package/dist/safety/SafetyDiagnostics.js +38 -26
- package/dist/safety/SafetyDiagnostics.js.map +1 -1
- package/dist/spec/SpecDiagnostics.d.ts +17 -14
- package/dist/spec/SpecDiagnostics.d.ts.map +1 -1
- package/dist/spec/SpecDiagnostics.js +37 -27
- package/dist/spec/SpecDiagnostics.js.map +1 -1
- package/dist/types.d.ts +20 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/package.json +14 -16
- package/dist/base/DiagnosticLevel.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,59 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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","
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type NetworkErrorDiagnostic = DiagnosticBase<'NETWORK_ERROR', {
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly reason: string;
|
|
6
7
|
}>;
|
|
7
8
|
/** A git operation failed. */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
20
|
-
|
|
20
|
+
type RegistryNotFoundDiagnostic = DiagnosticBase<'REGISTRY_NOT_FOUND', {
|
|
21
|
+
readonly registryName: string;
|
|
21
22
|
}>;
|
|
22
23
|
/** Failed to acquire the registry update lock. */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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","
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
44
|
-
|
|
51
|
+
data: { registryName }
|
|
52
|
+
};
|
|
45
53
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|