@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.
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryDiagnostics.js","
|
|
1
|
+
{"version":3,"file":"RegistryDiagnostics.js","names":[],"sources":["../../src/registry/RegistryDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Registry diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** A network-level error when communicating with a registry. */\nexport type NetworkErrorDiagnostic = DiagnosticBase<\n 'NETWORK_ERROR',\n {\n readonly url: string;\n readonly reason: string;\n }\n>;\n\n/** A git operation failed. */\nexport type GitErrorDiagnostic = DiagnosticBase<\n 'GIT_ERROR',\n {\n readonly command: string;\n readonly stderr: string;\n readonly exitCode: number;\n }\n>;\n\n/** A registry document did not pass schema validation. */\nexport type SchemaInvalidDiagnostic = DiagnosticBase<\n 'SCHEMA_INVALID',\n {\n readonly filePath: string;\n readonly issues: readonly string[];\n }\n>;\n\n/** A referenced registry name is not found in configuration. */\nexport type RegistryNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_NOT_FOUND',\n {\n readonly registryName: string;\n }\n>;\n\n/** Failed to acquire the registry update lock. */\nexport type LockAcquisitionFailedDiagnostic = DiagnosticBase<\n 'LOCK_ACQUISITION_FAILED',\n {\n readonly lockPath: string;\n readonly ownerPid: number;\n }\n>;\n\n/** Registry cache could not be read. */\nexport type CacheReadErrorDiagnostic = DiagnosticBase<\n 'CACHE_READ_ERROR',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** Registry cache state is internally inconsistent or malformed. */\nexport type CacheCorruptDiagnostic = DiagnosticBase<\n 'CACHE_CORRUPT',\n {\n readonly cachePath: string;\n readonly reason: string;\n }\n>;\n\n/** A shortened cache path belongs to a different full registry identifier. */\nexport type CacheIdentifierCollisionDiagnostic = DiagnosticBase<\n 'CACHE_IDENTIFIER_COLLISION',\n {\n readonly cachePath: string;\n readonly expectedIdentifier: string;\n readonly actualIdentifier: string;\n }\n>;\n\n/** Registry could not be reached, optionally with cached state available. */\nexport type RegistryUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_UNREACHABLE',\n {\n readonly registryName: string;\n readonly url: string;\n readonly httpStatus?: number;\n readonly cause: string;\n readonly initialized: boolean;\n }\n>;\n\n/** Union of all registry diagnostics. */\nexport type RegistryDiagnostic =\n | NetworkErrorDiagnostic\n | GitErrorDiagnostic\n | SchemaInvalidDiagnostic\n | RegistryNotFoundDiagnostic\n | LockAcquisitionFailedDiagnostic\n | CacheReadErrorDiagnostic\n | CacheCorruptDiagnostic\n | CacheIdentifierCollisionDiagnostic\n | RegistryUnreachableDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nexport function createNetworkErrorDiagnostic(url: string, reason: string): NetworkErrorDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_ERROR',\n message: `Network error for \"${url}\": ${reason}.`,\n hint: 'Check your network connection and retry.',\n data: { url, reason },\n };\n}\n\nexport function createGitErrorDiagnostic(command: string, stderr: string, exitCode: number): GitErrorDiagnostic {\n return {\n level: 'error',\n code: 'GIT_ERROR',\n message: `Git command failed (exit ${exitCode}): ${command}.`,\n hint: 'Ensure git is installed and the registry URL is reachable.',\n data: { command, stderr, exitCode },\n };\n}\n\nexport function createSchemaInvalidDiagnostic(filePath: string, issues: readonly string[]): SchemaInvalidDiagnostic {\n return {\n level: 'error',\n code: 'SCHEMA_INVALID',\n message: `Schema validation failed for \"${filePath}\".`,\n hint: 'Review the file against the expected schema.',\n data: { filePath, issues },\n };\n}\n\nexport function createRegistryNotFoundDiagnostic(registryName: string): RegistryNotFoundDiagnostic {\n return {\n level: 'error',\n code: 'REGISTRY_NOT_FOUND',\n message: `Registry \"${registryName}\" is not defined in configuration.`,\n hint: `Add the registry. Example:\n uapkg registry add ${registryName} https://registry.example.com\n\nOr configure manually:\n uapkg config set registries.${registryName}.url https://registry.example.com\n uapkg config set registries.${registryName}.ref.type branch\n uapkg config set registries.${registryName}.ref.value main`,\n data: { registryName },\n };\n}\n\nexport function createLockAcquisitionFailedDiagnostic(\n lockPath: string,\n ownerPid: number,\n): LockAcquisitionFailedDiagnostic {\n return {\n level: 'error',\n code: 'LOCK_ACQUISITION_FAILED',\n message: `Could not acquire registry lock at \"${lockPath}\" (held by PID ${ownerPid}).`,\n hint: 'Another uapkg process may be updating this registry. Wait or remove the stale lock.',\n data: { lockPath, ownerPid },\n };\n}\n\nexport function createCacheReadErrorDiagnostic(cachePath: string, reason: string): CacheReadErrorDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_READ_ERROR',\n message: `Failed to read registry cache at \"${cachePath}\": ${reason}.`,\n hint: 'The cache may be corrupted. Try running `uapkg update` to refresh.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheCorruptDiagnostic(cachePath: string, reason: string): CacheCorruptDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_CORRUPT',\n message: `Registry cache at \"${cachePath}\" is corrupt: ${reason}.`,\n hint: 'Remove this registry cache directory and retry. Registry caches contain only disposable local data.',\n data: { cachePath, reason },\n };\n}\n\nexport function createCacheIdentifierCollisionDiagnostic(\n cachePath: string,\n expectedIdentifier: string,\n actualIdentifier: string,\n): CacheIdentifierCollisionDiagnostic {\n return {\n level: 'error',\n code: 'CACHE_IDENTIFIER_COLLISION',\n message: `Registry cache identifier collision at \"${cachePath}\".`,\n hint: 'Remove this registry cache directory and retry. If the collision recurs, report it to the uapkg maintainers.',\n data: { cachePath, expectedIdentifier, actualIdentifier },\n };\n}\n\nexport function createRegistryUnreachableDiagnostic(input: {\n readonly registryName: string;\n readonly url: string;\n readonly cause: string;\n readonly initialized: boolean;\n readonly httpStatus?: number;\n readonly level?: 'error' | 'warning';\n}): RegistryUnreachableDiagnostic {\n return {\n level: input.level ?? (input.initialized ? 'warning' : 'error'),\n code: 'REGISTRY_UNREACHABLE',\n message: `The \"${input.registryName}\" registry could not be reached at ${input.url}.`,\n emitPolicy: 'once',\n hint: `Verify the registry URL with 'uapkg config get registries.${input.registryName}.url --trace'.\nThe registry may also be temporarily unavailable.`,\n data: {\n registryName: input.registryName,\n url: input.url,\n cause: input.cause,\n initialized: input.initialized,\n httpStatus: input.httpStatus,\n },\n };\n}\n"],"mappings":";AA2GA,SAAgB,6BAA6B,KAAa,QAAwC;CAChG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,IAAI,KAAK,OAAO;EAC/C,MAAM;EACN,MAAM;GAAE;GAAK;EAAO;CACtB;AACF;AAEA,SAAgB,yBAAyB,SAAiB,QAAgB,UAAsC;CAC9G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,4BAA4B,SAAS,KAAK,QAAQ;EAC3D,MAAM;EACN,MAAM;GAAE;GAAS;GAAQ;EAAS;CACpC;AACF;AAEA,SAAgB,8BAA8B,UAAkB,QAAoD;CAClH,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iCAAiC,SAAS;EACnD,MAAM;EACN,MAAM;GAAE;GAAU;EAAO;CAC3B;AACF;AAEA,SAAgB,iCAAiC,cAAkD;CACjG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,aAAa,aAAa;EACnC,MAAM;uBACa,aAAa;;;gCAGJ,aAAa;gCACb,aAAa;gCACb,aAAa;EACzC,MAAM,EAAE,aAAa;CACvB;AACF;AAEA,SAAgB,sCACd,UACA,UACiC;CACjC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,uCAAuC,SAAS,iBAAiB,SAAS;EACnF,MAAM;EACN,MAAM;GAAE;GAAU;EAAS;CAC7B;AACF;AAEA,SAAgB,+BAA+B,WAAmB,QAA0C;CAC1G,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qCAAqC,UAAU,KAAK,OAAO;EACpE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,6BAA6B,WAAmB,QAAwC;CACtG,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,sBAAsB,UAAU,gBAAgB,OAAO;EAChE,MAAM;EACN,MAAM;GAAE;GAAW;EAAO;CAC5B;AACF;AAEA,SAAgB,yCACd,WACA,oBACA,kBACoC;CACpC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2CAA2C,UAAU;EAC9D,MAAM;EACN,MAAM;GAAE;GAAW;GAAoB;EAAiB;CAC1D;AACF;AAEA,SAAgB,oCAAoC,OAOlB;CAChC,OAAO;EACL,OAAO,MAAM,UAAU,MAAM,cAAc,YAAY;EACvD,MAAM;EACN,SAAS,QAAQ,MAAM,aAAa,qCAAqC,MAAM,IAAI;EACnF,YAAY;EACZ,MAAM,6DAA6D,MAAM,aAAa;;EAEtF,MAAM;GACJ,cAAc,MAAM;GACpB,KAAK,MAAM;GACX,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,YAAY,MAAM;EACpB;CACF;AACF"}
|
|
@@ -1,128 +1,131 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DiagnosticBase } from "../base/Diagnostic.js";
|
|
2
|
+
//#region src/registryTools/RegistryToolsDiagnostics.d.ts
|
|
2
3
|
/** Package name does not match its on-disk manifest path. */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type RegistryToolsPathMismatchDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_PATH_MISMATCH', {
|
|
5
|
+
readonly packageName: string;
|
|
6
|
+
readonly expectedPath: string;
|
|
7
|
+
readonly actualPath: string;
|
|
7
8
|
}>;
|
|
8
9
|
/** Existing package manifest declares a different `packageSource` than the request. */
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
type RegistryToolsPackageSourceMismatchDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH', {
|
|
11
|
+
readonly packageName: string;
|
|
12
|
+
readonly existing: {
|
|
13
|
+
readonly type: string;
|
|
14
|
+
readonly url: string;
|
|
15
|
+
};
|
|
16
|
+
readonly requested: {
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly url: string;
|
|
19
|
+
};
|
|
19
20
|
}>;
|
|
20
21
|
/** A version already exists and `overwriteExistingVersion` was not set. */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
type RegistryToolsVersionExistsDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_VERSION_EXISTS', {
|
|
23
|
+
readonly packageName: string;
|
|
24
|
+
readonly version: string;
|
|
24
25
|
}>;
|
|
25
26
|
/** Requested version was not found on the package. */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
type RegistryToolsVersionNotFoundDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_VERSION_NOT_FOUND', {
|
|
28
|
+
readonly packageName: string;
|
|
29
|
+
readonly version: string;
|
|
29
30
|
}>;
|
|
30
31
|
/** Package manifest is missing and was not allowed to be created. */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
type RegistryToolsPackageMissingDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_PACKAGE_MISSING', {
|
|
33
|
+
readonly packageName: string;
|
|
34
|
+
readonly manifestPath: string;
|
|
34
35
|
}>;
|
|
35
36
|
/** Versions in a manifest are not sorted newest-first by SemVer. */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
type RegistryToolsVersionsUnsortedDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_VERSIONS_UNSORTED', {
|
|
38
|
+
readonly packageName: string;
|
|
39
|
+
readonly actual: readonly string[];
|
|
40
|
+
readonly expected: readonly string[];
|
|
40
41
|
}>;
|
|
41
42
|
/** External-registry dependency is forbidden by policy. */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
type RegistryToolsExternalRegistryDeniedDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED', {
|
|
44
|
+
readonly packageName: string;
|
|
45
|
+
readonly version: string;
|
|
46
|
+
readonly dependency: string;
|
|
47
|
+
readonly registryName: string;
|
|
48
|
+
readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';
|
|
48
49
|
}>;
|
|
49
50
|
/** External-registry dependency uses a registry name not in the allow-list. */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
type RegistryToolsExternalRegistryNotAllowedDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED', {
|
|
52
|
+
readonly packageName: string;
|
|
53
|
+
readonly version: string;
|
|
54
|
+
readonly dependency: string;
|
|
55
|
+
readonly registryName: string;
|
|
56
|
+
readonly allowList: readonly string[];
|
|
57
|
+
readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';
|
|
57
58
|
}>;
|
|
58
59
|
/** A required (non-external) dependency is not present in this registry. */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
type RegistryToolsDependencyNotInRegistryDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY', {
|
|
61
|
+
readonly packageName: string;
|
|
62
|
+
readonly version: string;
|
|
63
|
+
readonly dependency: string;
|
|
63
64
|
}>;
|
|
64
65
|
/** A dependency version range cannot be satisfied by any version in the registry. */
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
type RegistryToolsDependencyRangeUnreachableDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE', {
|
|
67
|
+
readonly packageName: string;
|
|
68
|
+
readonly version: string;
|
|
69
|
+
readonly dependency: string;
|
|
70
|
+
readonly range: string;
|
|
71
|
+
readonly availableVersions: readonly string[];
|
|
71
72
|
}>;
|
|
72
73
|
/** A removal was attempted but disallowed by policy. */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
type RegistryToolsRemovalDeniedDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_REMOVAL_DENIED', {
|
|
75
|
+
readonly kind: 'version' | 'package';
|
|
76
|
+
readonly packageName: string;
|
|
77
|
+
readonly version?: string;
|
|
78
|
+
readonly policy: string;
|
|
78
79
|
}>;
|
|
79
80
|
/** A computed integrity does not match an expected integrity. */
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
type RegistryToolsIntegrityMismatchDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_INTEGRITY_MISMATCH', {
|
|
82
|
+
readonly filePath: string;
|
|
83
|
+
readonly expectedHash: string;
|
|
84
|
+
readonly actualHash: string;
|
|
85
|
+
readonly expectedSize: number;
|
|
86
|
+
readonly actualSize: number;
|
|
86
87
|
}>;
|
|
87
88
|
/** A release file name does not match an accepted pattern. */
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
type RegistryToolsReleaseFileNameInvalidDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID', {
|
|
90
|
+
readonly packageName: string;
|
|
91
|
+
readonly version: string;
|
|
92
|
+
readonly fileName: string;
|
|
93
|
+
readonly accepted: readonly string[];
|
|
93
94
|
}>;
|
|
94
95
|
/** Generic violation surfaced by the official-registry policy validator. */
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
type RegistryToolsOfficialPolicyViolationDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION', {
|
|
97
|
+
readonly rule: string;
|
|
98
|
+
readonly detail: string;
|
|
99
|
+
readonly path?: string;
|
|
99
100
|
}>;
|
|
100
101
|
/** An unrecognized top-level or nested key was found in a registry manifest. */
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
type RegistryToolsUnknownKeyDiagnostic = DiagnosticBase<'REGISTRY_TOOLS_UNKNOWN_KEY', {
|
|
103
|
+
readonly path: string;
|
|
104
|
+
readonly key: string;
|
|
104
105
|
}>;
|
|
105
106
|
/** Union of all registry-tools diagnostics. */
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
type RegistryToolsDiagnostic = RegistryToolsPathMismatchDiagnostic | RegistryToolsPackageSourceMismatchDiagnostic | RegistryToolsVersionExistsDiagnostic | RegistryToolsVersionNotFoundDiagnostic | RegistryToolsPackageMissingDiagnostic | RegistryToolsVersionsUnsortedDiagnostic | RegistryToolsExternalRegistryDeniedDiagnostic | RegistryToolsExternalRegistryNotAllowedDiagnostic | RegistryToolsDependencyNotInRegistryDiagnostic | RegistryToolsDependencyRangeUnreachableDiagnostic | RegistryToolsRemovalDeniedDiagnostic | RegistryToolsIntegrityMismatchDiagnostic | RegistryToolsReleaseFileNameInvalidDiagnostic | RegistryToolsOfficialPolicyViolationDiagnostic | RegistryToolsUnknownKeyDiagnostic;
|
|
108
|
+
declare function createRegistryToolsPathMismatchDiagnostic(packageName: string, expectedPath: string, actualPath: string): RegistryToolsPathMismatchDiagnostic;
|
|
109
|
+
declare function createRegistryToolsPackageSourceMismatchDiagnostic(packageName: string, existing: {
|
|
110
|
+
readonly type: string;
|
|
111
|
+
readonly url: string;
|
|
111
112
|
}, requested: {
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
readonly type: string;
|
|
114
|
+
readonly url: string;
|
|
114
115
|
}): RegistryToolsPackageSourceMismatchDiagnostic;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
declare function createRegistryToolsVersionExistsDiagnostic(packageName: string, version: string): RegistryToolsVersionExistsDiagnostic;
|
|
117
|
+
declare function createRegistryToolsVersionNotFoundDiagnostic(packageName: string, version: string): RegistryToolsVersionNotFoundDiagnostic;
|
|
118
|
+
declare function createRegistryToolsPackageMissingDiagnostic(packageName: string, manifestPath: string): RegistryToolsPackageMissingDiagnostic;
|
|
119
|
+
declare function createRegistryToolsVersionsUnsortedDiagnostic(packageName: string, actual: readonly string[], expected: readonly string[]): RegistryToolsVersionsUnsortedDiagnostic;
|
|
120
|
+
declare function createRegistryToolsExternalRegistryDeniedDiagnostic(args: Omit<RegistryToolsExternalRegistryDeniedDiagnostic['data'], never>): RegistryToolsExternalRegistryDeniedDiagnostic;
|
|
121
|
+
declare function createRegistryToolsExternalRegistryNotAllowedDiagnostic(args: Omit<RegistryToolsExternalRegistryNotAllowedDiagnostic['data'], never>): RegistryToolsExternalRegistryNotAllowedDiagnostic;
|
|
122
|
+
declare function createRegistryToolsDependencyNotInRegistryDiagnostic(packageName: string, version: string, dependency: string): RegistryToolsDependencyNotInRegistryDiagnostic;
|
|
123
|
+
declare function createRegistryToolsDependencyRangeUnreachableDiagnostic(packageName: string, version: string, dependency: string, range: string, availableVersions: readonly string[]): RegistryToolsDependencyRangeUnreachableDiagnostic;
|
|
124
|
+
declare function createRegistryToolsRemovalDeniedDiagnostic(kind: 'version' | 'package', packageName: string, policy: string, version?: string): RegistryToolsRemovalDeniedDiagnostic;
|
|
125
|
+
declare function createRegistryToolsIntegrityMismatchDiagnostic(filePath: string, expectedHash: string, actualHash: string, expectedSize: number, actualSize: number): RegistryToolsIntegrityMismatchDiagnostic;
|
|
126
|
+
declare function createRegistryToolsReleaseFileNameInvalidDiagnostic(packageName: string, version: string, fileName: string, accepted: readonly string[]): RegistryToolsReleaseFileNameInvalidDiagnostic;
|
|
127
|
+
declare function createRegistryToolsOfficialPolicyViolationDiagnostic(rule: string, detail: string, path?: string): RegistryToolsOfficialPolicyViolationDiagnostic;
|
|
128
|
+
declare function createRegistryToolsUnknownKeyDiagnostic(path: string, key: string, level?: 'warning' | 'error'): RegistryToolsUnknownKeyDiagnostic;
|
|
129
|
+
//#endregion
|
|
130
|
+
export { RegistryToolsDependencyNotInRegistryDiagnostic, RegistryToolsDependencyRangeUnreachableDiagnostic, RegistryToolsDiagnostic, RegistryToolsExternalRegistryDeniedDiagnostic, RegistryToolsExternalRegistryNotAllowedDiagnostic, RegistryToolsIntegrityMismatchDiagnostic, RegistryToolsOfficialPolicyViolationDiagnostic, RegistryToolsPackageMissingDiagnostic, RegistryToolsPackageSourceMismatchDiagnostic, RegistryToolsPathMismatchDiagnostic, RegistryToolsReleaseFileNameInvalidDiagnostic, RegistryToolsRemovalDeniedDiagnostic, RegistryToolsUnknownKeyDiagnostic, RegistryToolsVersionExistsDiagnostic, RegistryToolsVersionNotFoundDiagnostic, RegistryToolsVersionsUnsortedDiagnostic, createRegistryToolsDependencyNotInRegistryDiagnostic, createRegistryToolsDependencyRangeUnreachableDiagnostic, createRegistryToolsExternalRegistryDeniedDiagnostic, createRegistryToolsExternalRegistryNotAllowedDiagnostic, createRegistryToolsIntegrityMismatchDiagnostic, createRegistryToolsOfficialPolicyViolationDiagnostic, createRegistryToolsPackageMissingDiagnostic, createRegistryToolsPackageSourceMismatchDiagnostic, createRegistryToolsPathMismatchDiagnostic, createRegistryToolsReleaseFileNameInvalidDiagnostic, createRegistryToolsRemovalDeniedDiagnostic, createRegistryToolsUnknownKeyDiagnostic, createRegistryToolsVersionExistsDiagnostic, createRegistryToolsVersionNotFoundDiagnostic, createRegistryToolsVersionsUnsortedDiagnostic };
|
|
128
131
|
//# sourceMappingURL=RegistryToolsDiagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryToolsDiagnostics.d.ts","
|
|
1
|
+
{"version":3,"file":"RegistryToolsDiagnostics.d.ts","names":[],"sources":["../../src/registryTools/RegistryToolsDiagnostics.ts"],"mappings":";;;KAWY,sCAAsC;WAGrC;WACA;WACA;;;KAKD,+CAA+C;WAG9C;WACA;aAAqB;aAAuB;;WAC5C;aAAsB;aAAuB;;;;KAK9C,uCAAuC;WAGtC;WACA;;;KAKD,yCAAyC;WAGxC;WACA;;;KAKD,wCAAwC;WAGvC;WACA;;;KAKD,0CAA0C;WAGzC;WACA;WACA;;;KAKD,gDAAgD;WAG/C;WACA;WACA;WACA;WACA;;;KAKD,oDAAoD;WAGnD;WACA;WACA;WACA;WACA;WACA;;;KAKD,iDAAiD;WAGhD;WACA;WACA;;;KAKD,oDAAoD;WAGnD;WACA;WACA;WACA;WACA;;;KAKD,uCAAuC;WAGtC;WACA;WACA;WACA;;;KAKD,2CAA2C;WAG1C;WACA;WACA;WACA;WACA;;;KAKD,gDAAgD;WAG/C;WACA;WACA;WACA;;;KAKD,iDAAiD;WAGhD;WACA;WACA;;;KAKD,oCAAoC;WAGnC;WACA;;;KAKD,0BACR,sCACA,+CACA,uCACA,yCACA,wCACA,0CACA,gDACA,oDACA,iDACA,oDACA,uCACA,2CACA,gDACA,iDACA;iBAUY,0CACd,qBACA,sBACA,qBACC;iBAWa,mDACd,qBACA;WAAqB;WAAuB;GAC5C;WAAsB;WAAuB;IAC5C;iBAYa,2CACd,qBACA,kBACC;iBAWa,6CACd,qBACA,kBACC;iBAWa,4CACd,qBACA,uBACC;iBAWa,8CACd,qBACA,2BACA,8BACC;iBAWa,oDACd,MAAM,KAAK,gEACV;iBAYa,wDACd,MAAM,KAAK,oEACV;iBAYa,qDACd,qBACA,iBACA,qBACC;iBAWa,wDACd,qBACA,iBACA,oBACA,eACA,uCACC;iBAWa,2CACd,6BACA,qBACA,gBACA,mBACC;iBAaa,+CACd,kBACA,sBACA,oBACA,sBACA,qBACC;iBAWa,oDACd,qBACA,iBACA,kBACA,8BACC;iBAWa,qDACd,cACA,gBACA,gBACC;iBAWa,wCACd,cACA,aACA,8BACC"}
|
|
@@ -1,56 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createDiagnostic } from "../base/Diagnostic.js";
|
|
2
|
+
|
|
3
|
+
//#region src/registryTools/RegistryToolsDiagnostics.ts
|
|
4
|
+
const ONCE = { emitPolicy: "once" };
|
|
5
|
+
function createRegistryToolsPathMismatchDiagnostic(packageName, expectedPath, actualPath) {
|
|
6
|
+
return createDiagnostic("REGISTRY_TOOLS_PATH_MISMATCH", "error", `Package "${packageName}" was found at "${actualPath}" but should live at "${expectedPath}".`, {
|
|
7
|
+
packageName,
|
|
8
|
+
expectedPath,
|
|
9
|
+
actualPath
|
|
10
|
+
}, "Move the manifest to packages/{first-letter}/{name}.json or correct the package name.", ONCE);
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
function createRegistryToolsPackageSourceMismatchDiagnostic(packageName, existing, requested) {
|
|
13
|
+
return createDiagnostic("REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH", "error", `Package "${packageName}" already declares a different packageSource (${existing.type}:${existing.url}); the request used (${requested.type}:${requested.url}).`, {
|
|
14
|
+
packageName,
|
|
15
|
+
existing,
|
|
16
|
+
requested
|
|
17
|
+
}, "Either update the request to match the existing source, or remove and re-create the package intentionally.", ONCE);
|
|
12
18
|
}
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
function createRegistryToolsVersionExistsDiagnostic(packageName, version) {
|
|
20
|
+
return createDiagnostic("REGISTRY_TOOLS_VERSION_EXISTS", "error", `Version "${version}" already exists for package "${packageName}".`, {
|
|
21
|
+
packageName,
|
|
22
|
+
version
|
|
23
|
+
}, "Pass `overwriteExistingVersion: true` to replace it, or publish a new version.", ONCE);
|
|
15
24
|
}
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
function createRegistryToolsVersionNotFoundDiagnostic(packageName, version) {
|
|
26
|
+
return createDiagnostic("REGISTRY_TOOLS_VERSION_NOT_FOUND", "error", `Version "${version}" was not found for package "${packageName}".`, {
|
|
27
|
+
packageName,
|
|
28
|
+
version
|
|
29
|
+
}, "Use `listVersions` to see the available versions.", ONCE);
|
|
18
30
|
}
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
function createRegistryToolsPackageMissingDiagnostic(packageName, manifestPath) {
|
|
32
|
+
return createDiagnostic("REGISTRY_TOOLS_PACKAGE_MISSING", "error", `Package manifest for "${packageName}" was not found at "${manifestPath}".`, {
|
|
33
|
+
packageName,
|
|
34
|
+
manifestPath
|
|
35
|
+
}, "Pass `createPackageManifestIfMissing: true` on the add request to create it.", ONCE);
|
|
21
36
|
}
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
function createRegistryToolsVersionsUnsortedDiagnostic(packageName, actual, expected) {
|
|
38
|
+
return createDiagnostic("REGISTRY_TOOLS_VERSIONS_UNSORTED", "warning", `Versions on package "${packageName}" are not sorted newest-first.`, {
|
|
39
|
+
packageName,
|
|
40
|
+
actual,
|
|
41
|
+
expected
|
|
42
|
+
}, "Re-write the manifest. Registry tools sorts versions newest-first by SemVer.", ONCE);
|
|
24
43
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
`"${args.registryName}", but external registries are denied by policy.`, args, 'Set `policy.externalRegistries` to `allow-listed` or `allow-any` if cross-registry dependencies are intended.', ONCE);
|
|
44
|
+
function createRegistryToolsExternalRegistryDeniedDiagnostic(args) {
|
|
45
|
+
return createDiagnostic("REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED", "error", `Dependency "${args.dependency}" of "${args.packageName}@${args.version}" targets external registry "${args.registryName}", but external registries are denied by policy.`, args, "Set `policy.externalRegistries` to `allow-listed` or `allow-any` if cross-registry dependencies are intended.", ONCE);
|
|
28
46
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`"${args.registryName}", which is not in the allow-list [${args.allowList.join(', ')}].`, args, 'Add the registry name to `policy.allowedExternalRegistryNames` or remove the dependency.', ONCE);
|
|
47
|
+
function createRegistryToolsExternalRegistryNotAllowedDiagnostic(args) {
|
|
48
|
+
return createDiagnostic("REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED", "error", `Dependency "${args.dependency}" of "${args.packageName}@${args.version}" targets external registry "${args.registryName}", which is not in the allow-list [${args.allowList.join(", ")}].`, args, "Add the registry name to `policy.allowedExternalRegistryNames` or remove the dependency.", ONCE);
|
|
32
49
|
}
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
function createRegistryToolsDependencyNotInRegistryDiagnostic(packageName, version, dependency) {
|
|
51
|
+
return createDiagnostic("REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY", "error", `Dependency "${dependency}" of "${packageName}@${version}" is not present in this registry.`, {
|
|
52
|
+
packageName,
|
|
53
|
+
version,
|
|
54
|
+
dependency
|
|
55
|
+
}, "Publish the dependency first, or mark it as an external-registry dependency.", ONCE);
|
|
35
56
|
}
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
function createRegistryToolsDependencyRangeUnreachableDiagnostic(packageName, version, dependency, range, availableVersions) {
|
|
58
|
+
return createDiagnostic("REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE", "error", `Dependency "${dependency}@${range}" of "${packageName}@${version}" cannot be satisfied by any published version.`, {
|
|
59
|
+
packageName,
|
|
60
|
+
version,
|
|
61
|
+
dependency,
|
|
62
|
+
range,
|
|
63
|
+
availableVersions
|
|
64
|
+
}, `Available versions: ${availableVersions.length > 0 ? availableVersions.join(", ") : "(none)"}.`, ONCE);
|
|
38
65
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
66
|
+
function createRegistryToolsRemovalDeniedDiagnostic(kind, packageName, policy, version) {
|
|
67
|
+
return createDiagnostic("REGISTRY_TOOLS_REMOVAL_DENIED", "error", kind === "version" ? `Removing version "${version ?? "?"}" of "${packageName}" is not allowed (policy: ${policy}).` : `Removing package "${packageName}" is not allowed (policy: ${policy}).`, {
|
|
68
|
+
kind,
|
|
69
|
+
packageName,
|
|
70
|
+
version,
|
|
71
|
+
policy
|
|
72
|
+
}, "Update `policy.removals` if removals are intentional.", ONCE);
|
|
43
73
|
}
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
function createRegistryToolsIntegrityMismatchDiagnostic(filePath, expectedHash, actualHash, expectedSize, actualSize) {
|
|
75
|
+
return createDiagnostic("REGISTRY_TOOLS_INTEGRITY_MISMATCH", "error", `Integrity mismatch for "${filePath}".`, {
|
|
76
|
+
filePath,
|
|
77
|
+
expectedHash,
|
|
78
|
+
actualHash,
|
|
79
|
+
expectedSize,
|
|
80
|
+
actualSize
|
|
81
|
+
}, `Expected ${expectedHash} (${expectedSize} bytes); got ${actualHash} (${actualSize} bytes).`, ONCE);
|
|
46
82
|
}
|
|
47
|
-
|
|
48
|
-
|
|
83
|
+
function createRegistryToolsReleaseFileNameInvalidDiagnostic(packageName, version, fileName, accepted) {
|
|
84
|
+
return createDiagnostic("REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID", "error", `Release file "${fileName}" for "${packageName}@${version}" is not an accepted name.`, {
|
|
85
|
+
packageName,
|
|
86
|
+
version,
|
|
87
|
+
fileName,
|
|
88
|
+
accepted
|
|
89
|
+
}, `Use one of: ${accepted.join(", ")}.`, ONCE);
|
|
49
90
|
}
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
function createRegistryToolsOfficialPolicyViolationDiagnostic(rule, detail, path) {
|
|
92
|
+
return createDiagnostic("REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION", "error", `Official-registry policy violation (${rule}): ${detail}.`, {
|
|
93
|
+
rule,
|
|
94
|
+
detail,
|
|
95
|
+
path
|
|
96
|
+
}, "Adjust the package contents to satisfy the official-registry policy and try again.", ONCE);
|
|
52
97
|
}
|
|
53
|
-
|
|
54
|
-
|
|
98
|
+
function createRegistryToolsUnknownKeyDiagnostic(path, key, level = "warning") {
|
|
99
|
+
return createDiagnostic("REGISTRY_TOOLS_UNKNOWN_KEY", level, `Unknown key "${key}" at "${path}".`, {
|
|
100
|
+
path,
|
|
101
|
+
key
|
|
102
|
+
}, "Remove the key, or update `@uapkg/registry-schema` if it is a new field.", ONCE);
|
|
55
103
|
}
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { createRegistryToolsDependencyNotInRegistryDiagnostic, createRegistryToolsDependencyRangeUnreachableDiagnostic, createRegistryToolsExternalRegistryDeniedDiagnostic, createRegistryToolsExternalRegistryNotAllowedDiagnostic, createRegistryToolsIntegrityMismatchDiagnostic, createRegistryToolsOfficialPolicyViolationDiagnostic, createRegistryToolsPackageMissingDiagnostic, createRegistryToolsPackageSourceMismatchDiagnostic, createRegistryToolsPathMismatchDiagnostic, createRegistryToolsReleaseFileNameInvalidDiagnostic, createRegistryToolsRemovalDeniedDiagnostic, createRegistryToolsUnknownKeyDiagnostic, createRegistryToolsVersionExistsDiagnostic, createRegistryToolsVersionNotFoundDiagnostic, createRegistryToolsVersionsUnsortedDiagnostic };
|
|
56
107
|
//# sourceMappingURL=RegistryToolsDiagnostics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegistryToolsDiagnostics.js","sourceRoot":"","sources":["../../src/registryTools/RegistryToolsDiagnostics.ts"],"names":[],"mappings":"AAyLA,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CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mDAAmD,CACjE,WAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,QAA2B;IAE3B,OAAO,gBAAgB,CACrB,0CAA0C,EAC1C,OAAO,EACP,iBAAiB,QAAQ,UAAU,WAAW,IAAI,OAAO,4BAA4B,EACrF,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAC5C,eAAe,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EACrC,IAAI,CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oDAAoD,CAClE,IAAY,EACZ,MAAc,EACd,IAAa;IAEb,OAAO,gBAAgB,CACrB,0CAA0C,EAC1C,OAAO,EACP,uCAAuC,IAAI,MAAM,MAAM,GAAG,EAC1D,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EACtB,oFAAoF,EACpF,IAAI,CACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uCAAuC,CACrD,IAAY,EACZ,GAAW,EACX,QAA6B,SAAS;IAEtC,OAAO,gBAAgB,CACrB,4BAA4B,EAC5B,KAAK,EACL,gBAAgB,GAAG,SAAS,IAAI,IAAI,EACpC,EAAE,IAAI,EAAE,GAAG,EAAE,EACb,0EAA0E,EAC1E,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"RegistryToolsDiagnostics.js","names":[],"sources":["../../src/registryTools/RegistryToolsDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Registry-tools diagnostic codes\n//\n// Emitted by `@uapkg/registry-tools` when authoring, validating, or linting a\n// registry repo. All diagnostics in this family default to `emitPolicy: 'once'`\n// so plan-then-apply flows do not double-report the same issue.\n// ---------------------------------------------------------------------------\n\n/** Package name does not match its on-disk manifest path. */\nexport type RegistryToolsPathMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n {\n readonly packageName: string;\n readonly expectedPath: string;\n readonly actualPath: string;\n }\n>;\n\n/** Existing package manifest declares a different `packageSource` than the request. */\nexport type RegistryToolsPackageSourceMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n {\n readonly packageName: string;\n readonly existing: { readonly type: string; readonly url: string };\n readonly requested: { readonly type: string; readonly url: string };\n }\n>;\n\n/** A version already exists and `overwriteExistingVersion` was not set. */\nexport type RegistryToolsVersionExistsDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Requested version was not found on the package. */\nexport type RegistryToolsVersionNotFoundDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n {\n readonly packageName: string;\n readonly version: string;\n }\n>;\n\n/** Package manifest is missing and was not allowed to be created. */\nexport type RegistryToolsPackageMissingDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n {\n readonly packageName: string;\n readonly manifestPath: string;\n }\n>;\n\n/** Versions in a manifest are not sorted newest-first by SemVer. */\nexport type RegistryToolsVersionsUnsortedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n {\n readonly packageName: string;\n readonly actual: readonly string[];\n readonly expected: readonly string[];\n }\n>;\n\n/** External-registry dependency is forbidden by policy. */\nexport type RegistryToolsExternalRegistryDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** External-registry dependency uses a registry name not in the allow-list. */\nexport type RegistryToolsExternalRegistryNotAllowedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly registryName: string;\n readonly allowList: readonly string[];\n readonly bucket: 'dependencies' | 'devDependencies' | 'peerDependencies';\n }\n>;\n\n/** A required (non-external) dependency is not present in this registry. */\nexport type RegistryToolsDependencyNotInRegistryDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n }\n>;\n\n/** A dependency version range cannot be satisfied by any version in the registry. */\nexport type RegistryToolsDependencyRangeUnreachableDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n {\n readonly packageName: string;\n readonly version: string;\n readonly dependency: string;\n readonly range: string;\n readonly availableVersions: readonly string[];\n }\n>;\n\n/** A removal was attempted but disallowed by policy. */\nexport type RegistryToolsRemovalDeniedDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n {\n readonly kind: 'version' | 'package';\n readonly packageName: string;\n readonly version?: string;\n readonly policy: string;\n }\n>;\n\n/** A computed integrity does not match an expected integrity. */\nexport type RegistryToolsIntegrityMismatchDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n {\n readonly filePath: string;\n readonly expectedHash: string;\n readonly actualHash: string;\n readonly expectedSize: number;\n readonly actualSize: number;\n }\n>;\n\n/** A release file name does not match an accepted pattern. */\nexport type RegistryToolsReleaseFileNameInvalidDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n {\n readonly packageName: string;\n readonly version: string;\n readonly fileName: string;\n readonly accepted: readonly string[];\n }\n>;\n\n/** Generic violation surfaced by the official-registry policy validator. */\nexport type RegistryToolsOfficialPolicyViolationDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n {\n readonly rule: string;\n readonly detail: string;\n readonly path?: string;\n }\n>;\n\n/** An unrecognized top-level or nested key was found in a registry manifest. */\nexport type RegistryToolsUnknownKeyDiagnostic = DiagnosticBase<\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n {\n readonly path: string;\n readonly key: string;\n }\n>;\n\n/** Union of all registry-tools diagnostics. */\nexport type RegistryToolsDiagnostic =\n | RegistryToolsPathMismatchDiagnostic\n | RegistryToolsPackageSourceMismatchDiagnostic\n | RegistryToolsVersionExistsDiagnostic\n | RegistryToolsVersionNotFoundDiagnostic\n | RegistryToolsPackageMissingDiagnostic\n | RegistryToolsVersionsUnsortedDiagnostic\n | RegistryToolsExternalRegistryDeniedDiagnostic\n | RegistryToolsExternalRegistryNotAllowedDiagnostic\n | RegistryToolsDependencyNotInRegistryDiagnostic\n | RegistryToolsDependencyRangeUnreachableDiagnostic\n | RegistryToolsRemovalDeniedDiagnostic\n | RegistryToolsIntegrityMismatchDiagnostic\n | RegistryToolsReleaseFileNameInvalidDiagnostic\n | RegistryToolsOfficialPolicyViolationDiagnostic\n | RegistryToolsUnknownKeyDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\nimport { createDiagnostic } from '../base/Diagnostic.js';\n\nconst ONCE = { emitPolicy: 'once' as const };\n\nexport function createRegistryToolsPathMismatchDiagnostic(\n packageName: string,\n expectedPath: string,\n actualPath: string,\n): RegistryToolsPathMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PATH_MISMATCH',\n 'error',\n `Package \"${packageName}\" was found at \"${actualPath}\" but should live at \"${expectedPath}\".`,\n { packageName, expectedPath, actualPath },\n 'Move the manifest to packages/{first-letter}/{name}.json or correct the package name.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageSourceMismatchDiagnostic(\n packageName: string,\n existing: { readonly type: string; readonly url: string },\n requested: { readonly type: string; readonly url: string },\n): RegistryToolsPackageSourceMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_SOURCE_MISMATCH',\n 'error',\n `Package \"${packageName}\" already declares a different packageSource (${existing.type}:${existing.url}); ` +\n `the request used (${requested.type}:${requested.url}).`,\n { packageName, existing, requested },\n 'Either update the request to match the existing source, or remove and re-create the package intentionally.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionExistsDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionExistsDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_EXISTS',\n 'error',\n `Version \"${version}\" already exists for package \"${packageName}\".`,\n { packageName, version },\n 'Pass `overwriteExistingVersion: true` to replace it, or publish a new version.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionNotFoundDiagnostic(\n packageName: string,\n version: string,\n): RegistryToolsVersionNotFoundDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSION_NOT_FOUND',\n 'error',\n `Version \"${version}\" was not found for package \"${packageName}\".`,\n { packageName, version },\n 'Use `listVersions` to see the available versions.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsPackageMissingDiagnostic(\n packageName: string,\n manifestPath: string,\n): RegistryToolsPackageMissingDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_PACKAGE_MISSING',\n 'error',\n `Package manifest for \"${packageName}\" was not found at \"${manifestPath}\".`,\n { packageName, manifestPath },\n 'Pass `createPackageManifestIfMissing: true` on the add request to create it.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsVersionsUnsortedDiagnostic(\n packageName: string,\n actual: readonly string[],\n expected: readonly string[],\n): RegistryToolsVersionsUnsortedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_VERSIONS_UNSORTED',\n 'warning',\n `Versions on package \"${packageName}\" are not sorted newest-first.`,\n { packageName, actual, expected },\n 'Re-write the manifest. Registry tools sorts versions newest-first by SemVer.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryDeniedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryDeniedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_DENIED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", but external registries are denied by policy.`,\n args,\n 'Set `policy.externalRegistries` to `allow-listed` or `allow-any` if cross-registry dependencies are intended.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsExternalRegistryNotAllowedDiagnostic(\n args: Omit<RegistryToolsExternalRegistryNotAllowedDiagnostic['data'], never>,\n): RegistryToolsExternalRegistryNotAllowedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_EXTERNAL_REGISTRY_NOT_ALLOWED',\n 'error',\n `Dependency \"${args.dependency}\" of \"${args.packageName}@${args.version}\" targets external registry ` +\n `\"${args.registryName}\", which is not in the allow-list [${args.allowList.join(', ')}].`,\n args,\n 'Add the registry name to `policy.allowedExternalRegistryNames` or remove the dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyNotInRegistryDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n): RegistryToolsDependencyNotInRegistryDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_NOT_IN_REGISTRY',\n 'error',\n `Dependency \"${dependency}\" of \"${packageName}@${version}\" is not present in this registry.`,\n { packageName, version, dependency },\n 'Publish the dependency first, or mark it as an external-registry dependency.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsDependencyRangeUnreachableDiagnostic(\n packageName: string,\n version: string,\n dependency: string,\n range: string,\n availableVersions: readonly string[],\n): RegistryToolsDependencyRangeUnreachableDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_DEPENDENCY_RANGE_UNREACHABLE',\n 'error',\n `Dependency \"${dependency}@${range}\" of \"${packageName}@${version}\" cannot be satisfied by any published version.`,\n { packageName, version, dependency, range, availableVersions },\n `Available versions: ${availableVersions.length > 0 ? availableVersions.join(', ') : '(none)'}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsRemovalDeniedDiagnostic(\n kind: 'version' | 'package',\n packageName: string,\n policy: string,\n version?: string,\n): RegistryToolsRemovalDeniedDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_REMOVAL_DENIED',\n 'error',\n kind === 'version'\n ? `Removing version \"${version ?? '?'}\" of \"${packageName}\" is not allowed (policy: ${policy}).`\n : `Removing package \"${packageName}\" is not allowed (policy: ${policy}).`,\n { kind, packageName, version, policy },\n 'Update `policy.removals` if removals are intentional.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsIntegrityMismatchDiagnostic(\n filePath: string,\n expectedHash: string,\n actualHash: string,\n expectedSize: number,\n actualSize: number,\n): RegistryToolsIntegrityMismatchDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_INTEGRITY_MISMATCH',\n 'error',\n `Integrity mismatch for \"${filePath}\".`,\n { filePath, expectedHash, actualHash, expectedSize, actualSize },\n `Expected ${expectedHash} (${expectedSize} bytes); got ${actualHash} (${actualSize} bytes).`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsReleaseFileNameInvalidDiagnostic(\n packageName: string,\n version: string,\n fileName: string,\n accepted: readonly string[],\n): RegistryToolsReleaseFileNameInvalidDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_RELEASE_FILE_NAME_INVALID',\n 'error',\n `Release file \"${fileName}\" for \"${packageName}@${version}\" is not an accepted name.`,\n { packageName, version, fileName, accepted },\n `Use one of: ${accepted.join(', ')}.`,\n ONCE,\n );\n}\n\nexport function createRegistryToolsOfficialPolicyViolationDiagnostic(\n rule: string,\n detail: string,\n path?: string,\n): RegistryToolsOfficialPolicyViolationDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_OFFICIAL_POLICY_VIOLATION',\n 'error',\n `Official-registry policy violation (${rule}): ${detail}.`,\n { rule, detail, path },\n 'Adjust the package contents to satisfy the official-registry policy and try again.',\n ONCE,\n );\n}\n\nexport function createRegistryToolsUnknownKeyDiagnostic(\n path: string,\n key: string,\n level: 'warning' | 'error' = 'warning',\n): RegistryToolsUnknownKeyDiagnostic {\n return createDiagnostic(\n 'REGISTRY_TOOLS_UNKNOWN_KEY',\n level,\n `Unknown key \"${key}\" at \"${path}\".`,\n { path, key },\n 'Remove the key, or update `@uapkg/registry-schema` if it is a new field.',\n ONCE,\n );\n}\n"],"mappings":";;;AA+LA,MAAM,OAAO,EAAE,YAAY,OAAgB;AAE3C,SAAgB,0CACd,aACA,cACA,YACqC;CACrC,OAAO,iBACL,gCACA,SACA,YAAY,YAAY,kBAAkB,WAAW,wBAAwB,aAAa,KAC1F;EAAE;EAAa;EAAc;CAAW,GACxC,yFACA,IACF;AACF;AAEA,SAAgB,mDACd,aACA,UACA,WAC8C;CAC9C,OAAO,iBACL,0CACA,SACA,YAAY,YAAY,gDAAgD,SAAS,KAAK,GAAG,SAAS,IAAI,uBAC/E,UAAU,KAAK,GAAG,UAAU,IAAI,KACvD;EAAE;EAAa;EAAU;CAAU,GACnC,8GACA,IACF;AACF;AAEA,SAAgB,2CACd,aACA,SACsC;CACtC,OAAO,iBACL,iCACA,SACA,YAAY,QAAQ,gCAAgC,YAAY,KAChE;EAAE;EAAa;CAAQ,GACvB,kFACA,IACF;AACF;AAEA,SAAgB,6CACd,aACA,SACwC;CACxC,OAAO,iBACL,oCACA,SACA,YAAY,QAAQ,+BAA+B,YAAY,KAC/D;EAAE;EAAa;CAAQ,GACvB,qDACA,IACF;AACF;AAEA,SAAgB,4CACd,aACA,cACuC;CACvC,OAAO,iBACL,kCACA,SACA,yBAAyB,YAAY,sBAAsB,aAAa,KACxE;EAAE;EAAa;CAAa,GAC5B,gFACA,IACF;AACF;AAEA,SAAgB,8CACd,aACA,QACA,UACyC;CACzC,OAAO,iBACL,oCACA,WACA,wBAAwB,YAAY,iCACpC;EAAE;EAAa;EAAQ;CAAS,GAChC,gFACA,IACF;AACF;AAEA,SAAgB,oDACd,MAC+C;CA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iBAAiB,SAAS,SAAS,YAAY,GAAG,QAAQ,6BAC1D;EAAE;EAAa;EAAS;EAAU;CAAS,GAC3C,eAAe,SAAS,KAAK,IAAI,EAAE,IACnC,IACF;AACF;AAEA,SAAgB,qDACd,MACA,QACA,MACgD;CAChD,OAAO,iBACL,4CACA,SACA,uCAAuC,KAAK,KAAK,OAAO,IACxD;EAAE;EAAM;EAAQ;CAAK,GACrB,sFACA,IACF;AACF;AAEA,SAAgB,wCACd,MACA,KACA,QAA6B,WACM;CACnC,OAAO,iBACL,8BACA,OACA,gBAAgB,IAAI,QAAQ,KAAK,KACjC;EAAE;EAAM;CAAI,GACZ,4EACA,IACF;AACF"}
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DiagnosticBase } from "../base/Diagnostic.js";
|
|
2
|
+
//#region src/resolver/ResolverDiagnostics.d.ts
|
|
2
3
|
/** Two or more registries resolve the same package name to different versions (single-version kind). */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type VersionConflictDiagnostic = DiagnosticBase<'VERSION_CONFLICT', {
|
|
5
|
+
readonly packageName: string;
|
|
6
|
+
readonly versions: readonly string[];
|
|
7
|
+
readonly registry: string;
|
|
7
8
|
}>;
|
|
8
9
|
/** A dependency cycle was detected. */
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
type CircularDepDiagnostic = DiagnosticBase<'CIRCULAR_DEP', {
|
|
11
|
+
readonly path: readonly string[];
|
|
11
12
|
}>;
|
|
12
13
|
/** Requested package could not be found in any configured registry. */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type PackageNotFoundDiagnostic = DiagnosticBase<'PACKAGE_NOT_FOUND', {
|
|
15
|
+
readonly packageName: string;
|
|
16
|
+
readonly registry: string;
|
|
16
17
|
}>;
|
|
17
18
|
/** No published version satisfies the requested range. */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
type VersionNotFoundDiagnostic = DiagnosticBase<'VERSION_NOT_FOUND', {
|
|
20
|
+
readonly packageName: string;
|
|
21
|
+
readonly versionRange: string;
|
|
22
|
+
readonly registry: string;
|
|
23
|
+
readonly availableVersions: readonly string[];
|
|
23
24
|
}>;
|
|
24
25
|
/** Same package name required from two different registries. */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type RegistryNameCollisionDiagnostic = DiagnosticBase<'REGISTRY_NAME_COLLISION', {
|
|
27
|
+
readonly packageName: string;
|
|
28
|
+
readonly registries: readonly string[];
|
|
28
29
|
}>;
|
|
29
30
|
/** Union of all resolver diagnostics. */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
type ResolverDiagnostic = VersionConflictDiagnostic | CircularDepDiagnostic | PackageNotFoundDiagnostic | VersionNotFoundDiagnostic | RegistryNameCollisionDiagnostic;
|
|
32
|
+
declare function createVersionConflictDiagnostic(packageName: string, versions: readonly string[], registry: string): VersionConflictDiagnostic;
|
|
33
|
+
declare function createCircularDepDiagnostic(path: readonly string[]): CircularDepDiagnostic;
|
|
34
|
+
declare function createPackageNotFoundDiagnostic(packageName: string, registry: string): PackageNotFoundDiagnostic;
|
|
35
|
+
declare function createVersionNotFoundDiagnostic(packageName: string, versionRange: string, registry: string, availableVersions: readonly string[]): VersionNotFoundDiagnostic;
|
|
36
|
+
declare function createRegistryNameCollisionDiagnostic(packageName: string, registries: readonly string[]): RegistryNameCollisionDiagnostic;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { CircularDepDiagnostic, PackageNotFoundDiagnostic, RegistryNameCollisionDiagnostic, ResolverDiagnostic, VersionConflictDiagnostic, VersionNotFoundDiagnostic, createCircularDepDiagnostic, createPackageNotFoundDiagnostic, createRegistryNameCollisionDiagnostic, createVersionConflictDiagnostic, createVersionNotFoundDiagnostic };
|
|
36
39
|
//# sourceMappingURL=ResolverDiagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResolverDiagnostics.d.ts","
|
|
1
|
+
{"version":3,"file":"ResolverDiagnostics.d.ts","names":[],"sources":["../../src/resolver/ResolverDiagnostics.ts"],"mappings":";;;KAOY,4BAA4B;WAG3B;WACA;WACA;;;KAKD,wBAAwB;WAGvB;;;KAKD,4BAA4B;WAG3B;WACA;;;KAKD,4BAA4B;WAG3B;WACA;WACA;WACA;;;KAKD,kCAAkC;WAGjC;WACA;;;KAKD,qBACR,4BACA,wBACA,4BACA,4BACA;iBAMY,gCACd,qBACA,6BACA,mBACC;iBAUa,4BAA4B,0BAA0B;iBAUtD,gCAAgC,qBAAqB,mBAAmB;iBAUxE,gCACd,qBACA,sBACA,kBACA,uCACC;iBAUa,sCACd,qBACA,gCACC"}
|