@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
package/dist/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export { createInvalidOrgNameDiagnostic, createInvalidPackageSpecDiagnostic, createInvalidVersionRangeDiagnostic,
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { createDiagnosticFingerprint } from "./base/DiagnosticFingerprint.js";
|
|
2
|
+
import { createDiagnostic } from "./base/Diagnostic.js";
|
|
3
|
+
import { fail, fromDiagnostics, ok } from "./base/Result.js";
|
|
4
|
+
import { DiagnosticBag } from "./base/DiagnosticBag.js";
|
|
5
|
+
import { createConfigInvalidJsonDiagnostic, createConfigInvalidValueDiagnostic, createConfigTypeMismatchDiagnostic, createConfigUnknownKeyDiagnostic, createConfigUnresolvedDefaultRegistryDiagnostic } from "./config/ConfigDiagnostics.js";
|
|
6
|
+
import { createControlPlaneCommandFailedDiagnostic } from "./controlPlane/ControlPlaneDiagnostics.js";
|
|
7
|
+
import { createIoErrorDiagnostic, createParseErrorDiagnostic, createUnknownErrorDiagnostic } from "./general/GeneralDiagnostics.js";
|
|
8
|
+
import { createDiskRemoveFailedDiagnostic, createDownloadFailedDiagnostic, createDownloadHttpStatusDiagnostic, createExtractionFailedDiagnostic, createIntegrityMismatchDiagnostic, createNetworkRetriesExhaustedDiagnostic, createNetworkTimeoutDiagnostic } from "./installer/InstallerDiagnostics.js";
|
|
9
|
+
import { createDependencyNotFoundDiagnostic, createForbiddenOverridesDiagnostic, createLockfileInvalidDiagnostic, createLockfileMissingDiagnostic, createLockfileOutOfSyncDiagnostic, createManifestInvalidDiagnostic, createManifestReadErrorDiagnostic, createManifestWriteErrorDiagnostic, createUnresolvedRegistryDiagnostic } from "./manifest/ManifestDiagnostics.js";
|
|
10
|
+
import { createCyclicSymlinkDiagnostic, createInvalidPathDiagnostic, createLfsSkippedDiagnostic, createNoFilesSelectedDiagnostic, createOutFileIsDirectoryDiagnostic, createPluginRootNotFoundDiagnostic, createSymlinkOutsideRootDiagnostic, createUnresolvedLfsDiagnostic, createUpluginMissingDiagnostic } from "./pack/PackDiagnostics.js";
|
|
11
|
+
import { createPostinstallDuplicateEntryDiagnostic, createPostinstallEsbuildErrorDiagnostic, createPostinstallInvalidExportDiagnostic, createPostinstallLoadFailedDiagnostic, createPostinstallMarkerCorruptDiagnostic, createPostinstallPolicyDeniedDiagnostic } from "./postinstall/PostinstallDiagnostics.js";
|
|
12
|
+
import { createPublishRequestFailedDiagnostic } from "./publishing/PublishingDiagnostics.js";
|
|
13
|
+
import { createCacheCorruptDiagnostic, createCacheIdentifierCollisionDiagnostic, createCacheReadErrorDiagnostic, createGitErrorDiagnostic, createLockAcquisitionFailedDiagnostic, createNetworkErrorDiagnostic, createRegistryNotFoundDiagnostic, createRegistryUnreachableDiagnostic, createSchemaInvalidDiagnostic } from "./registry/RegistryDiagnostics.js";
|
|
14
|
+
import { createRegistryToolsDependencyNotInRegistryDiagnostic, createRegistryToolsDependencyRangeUnreachableDiagnostic, createRegistryToolsExternalRegistryDeniedDiagnostic, createRegistryToolsExternalRegistryNotAllowedDiagnostic, createRegistryToolsIntegrityMismatchDiagnostic, createRegistryToolsOfficialPolicyViolationDiagnostic, createRegistryToolsPackageMissingDiagnostic, createRegistryToolsPackageSourceMismatchDiagnostic, createRegistryToolsPathMismatchDiagnostic, createRegistryToolsReleaseFileNameInvalidDiagnostic, createRegistryToolsRemovalDeniedDiagnostic, createRegistryToolsUnknownKeyDiagnostic, createRegistryToolsVersionExistsDiagnostic, createRegistryToolsVersionNotFoundDiagnostic, createRegistryToolsVersionsUnsortedDiagnostic } from "./registryTools/RegistryToolsDiagnostics.js";
|
|
15
|
+
import { createCircularDepDiagnostic, createPackageNotFoundDiagnostic, createRegistryNameCollisionDiagnostic, createVersionConflictDiagnostic, createVersionNotFoundDiagnostic } from "./resolver/ResolverDiagnostics.js";
|
|
16
|
+
import { createSafetyOverriddenByForceDiagnostic, createSafetyPathNotProjectManifestDiagnostic, createSafetyTargetExistsNoManifestDiagnostic } from "./safety/SafetyDiagnostics.js";
|
|
17
|
+
import { createInvalidOrgNameDiagnostic, createInvalidPackageSpecDiagnostic, createInvalidVersionRangeDiagnostic } from "./spec/SpecDiagnostics.js";
|
|
18
|
+
|
|
19
|
+
export { DiagnosticBag, createCacheCorruptDiagnostic, createCacheIdentifierCollisionDiagnostic, createCacheReadErrorDiagnostic, createCircularDepDiagnostic, createConfigInvalidJsonDiagnostic, createConfigInvalidValueDiagnostic, createConfigTypeMismatchDiagnostic, createConfigUnknownKeyDiagnostic, createConfigUnresolvedDefaultRegistryDiagnostic, createControlPlaneCommandFailedDiagnostic, createCyclicSymlinkDiagnostic, createDependencyNotFoundDiagnostic, createDiagnostic, createDiagnosticFingerprint, createDiskRemoveFailedDiagnostic, createDownloadFailedDiagnostic, createDownloadHttpStatusDiagnostic, createExtractionFailedDiagnostic, createForbiddenOverridesDiagnostic, createGitErrorDiagnostic, createIntegrityMismatchDiagnostic, createInvalidOrgNameDiagnostic, createInvalidPackageSpecDiagnostic, createInvalidPathDiagnostic, createInvalidVersionRangeDiagnostic, createIoErrorDiagnostic, createLfsSkippedDiagnostic, createLockAcquisitionFailedDiagnostic, createLockfileInvalidDiagnostic, createLockfileMissingDiagnostic, createLockfileOutOfSyncDiagnostic, createManifestInvalidDiagnostic, createManifestReadErrorDiagnostic, createManifestWriteErrorDiagnostic, createNetworkErrorDiagnostic, createNetworkRetriesExhaustedDiagnostic, createNetworkTimeoutDiagnostic, createNoFilesSelectedDiagnostic, createOutFileIsDirectoryDiagnostic, createPackageNotFoundDiagnostic, createParseErrorDiagnostic, createPluginRootNotFoundDiagnostic, createPostinstallDuplicateEntryDiagnostic, createPostinstallEsbuildErrorDiagnostic, createPostinstallInvalidExportDiagnostic, createPostinstallLoadFailedDiagnostic, createPostinstallMarkerCorruptDiagnostic, createPostinstallPolicyDeniedDiagnostic, createPublishRequestFailedDiagnostic, createRegistryNameCollisionDiagnostic, createRegistryNotFoundDiagnostic, createRegistryToolsDependencyNotInRegistryDiagnostic, createRegistryToolsDependencyRangeUnreachableDiagnostic, createRegistryToolsExternalRegistryDeniedDiagnostic, createRegistryToolsExternalRegistryNotAllowedDiagnostic, createRegistryToolsIntegrityMismatchDiagnostic, createRegistryToolsOfficialPolicyViolationDiagnostic, createRegistryToolsPackageMissingDiagnostic, createRegistryToolsPackageSourceMismatchDiagnostic, createRegistryToolsPathMismatchDiagnostic, createRegistryToolsReleaseFileNameInvalidDiagnostic, createRegistryToolsRemovalDeniedDiagnostic, createRegistryToolsUnknownKeyDiagnostic, createRegistryToolsVersionExistsDiagnostic, createRegistryToolsVersionNotFoundDiagnostic, createRegistryToolsVersionsUnsortedDiagnostic, createRegistryUnreachableDiagnostic, createSafetyOverriddenByForceDiagnostic, createSafetyPathNotProjectManifestDiagnostic, createSafetyTargetExistsNoManifestDiagnostic, createSchemaInvalidDiagnostic, createSymlinkOutsideRootDiagnostic, createUnknownErrorDiagnostic, createUnresolvedLfsDiagnostic, createUnresolvedRegistryDiagnostic, createUpluginMissingDiagnostic, createVersionConflictDiagnostic, createVersionNotFoundDiagnostic, fail, fromDiagnostics, ok };
|
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DiagnosticBase } from "../base/Diagnostic.js";
|
|
2
|
+
//#region src/installer/InstallerDiagnostics.d.ts
|
|
2
3
|
/** HTTP download of a package .tgz asset failed. */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
type DownloadFailedDiagnostic = DiagnosticBase<'DOWNLOAD_FAILED', {
|
|
5
|
+
readonly packageName: string;
|
|
6
|
+
readonly url: string;
|
|
7
|
+
readonly reason: string;
|
|
8
|
+
readonly attempt: number;
|
|
8
9
|
}>;
|
|
9
10
|
/** Remote responded with a non-2xx HTTP status. */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type DownloadHttpStatusDiagnostic = DiagnosticBase<'DOWNLOAD_HTTP_STATUS', {
|
|
12
|
+
readonly packageName: string;
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly status: number;
|
|
14
15
|
}>;
|
|
15
16
|
/** Download timed out per `network.timeout`. */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
type NetworkTimeoutDiagnostic = DiagnosticBase<'NETWORK_TIMEOUT', {
|
|
18
|
+
readonly packageName: string;
|
|
19
|
+
readonly url: string;
|
|
20
|
+
readonly timeoutSeconds: number;
|
|
20
21
|
}>;
|
|
21
22
|
/** Retries exhausted per `network.retries`. */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
type NetworkRetriesExhaustedDiagnostic = DiagnosticBase<'NETWORK_RETRIES_EXHAUSTED', {
|
|
24
|
+
readonly packageName: string;
|
|
25
|
+
readonly url: string;
|
|
26
|
+
readonly attempts: number;
|
|
26
27
|
}>;
|
|
27
28
|
/** Downloaded file hash did not match the expected integrity from the registry. */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
type IntegrityMismatchDiagnostic = DiagnosticBase<'INTEGRITY_MISMATCH', {
|
|
30
|
+
readonly packageName: string;
|
|
31
|
+
readonly expected: string;
|
|
32
|
+
readonly actual: string;
|
|
32
33
|
}>;
|
|
33
34
|
/** Failed to extract a .tgz archive into the install path. */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
type ExtractionFailedDiagnostic = DiagnosticBase<'EXTRACTION_FAILED', {
|
|
36
|
+
readonly packageName: string;
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly reason: string;
|
|
38
39
|
}>;
|
|
39
40
|
/** Failed to remove a package directory. */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
type DiskRemoveFailedDiagnostic = DiagnosticBase<'DISK_REMOVE_FAILED', {
|
|
42
|
+
readonly packageName: string;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly reason: string;
|
|
44
45
|
}>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
type InstallerDiagnostic = DownloadFailedDiagnostic | DownloadHttpStatusDiagnostic | NetworkTimeoutDiagnostic | NetworkRetriesExhaustedDiagnostic | IntegrityMismatchDiagnostic | ExtractionFailedDiagnostic | DiskRemoveFailedDiagnostic;
|
|
47
|
+
declare function createDownloadFailedDiagnostic(packageName: string, url: string, reason: string, attempt: number): DownloadFailedDiagnostic;
|
|
48
|
+
declare function createDownloadHttpStatusDiagnostic(packageName: string, url: string, status: number): DownloadHttpStatusDiagnostic;
|
|
49
|
+
declare function createNetworkTimeoutDiagnostic(packageName: string, url: string, timeoutSeconds: number): NetworkTimeoutDiagnostic;
|
|
50
|
+
declare function createNetworkRetriesExhaustedDiagnostic(packageName: string, url: string, attempts: number): NetworkRetriesExhaustedDiagnostic;
|
|
51
|
+
declare function createIntegrityMismatchDiagnostic(packageName: string, expected: string, actual: string): IntegrityMismatchDiagnostic;
|
|
52
|
+
declare function createExtractionFailedDiagnostic(packageName: string, path: string, reason: string): ExtractionFailedDiagnostic;
|
|
53
|
+
declare function createDiskRemoveFailedDiagnostic(packageName: string, path: string, reason: string): DiskRemoveFailedDiagnostic;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { DiskRemoveFailedDiagnostic, DownloadFailedDiagnostic, DownloadHttpStatusDiagnostic, ExtractionFailedDiagnostic, InstallerDiagnostic, IntegrityMismatchDiagnostic, NetworkRetriesExhaustedDiagnostic, NetworkTimeoutDiagnostic, createDiskRemoveFailedDiagnostic, createDownloadFailedDiagnostic, createDownloadHttpStatusDiagnostic, createExtractionFailedDiagnostic, createIntegrityMismatchDiagnostic, createNetworkRetriesExhaustedDiagnostic, createNetworkTimeoutDiagnostic };
|
|
53
56
|
//# sourceMappingURL=InstallerDiagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstallerDiagnostics.d.ts","
|
|
1
|
+
{"version":3,"file":"InstallerDiagnostics.d.ts","names":[],"sources":["../../src/installer/InstallerDiagnostics.ts"],"mappings":";;;KAOY,2BAA2B;WAG1B;WACA;WACA;WACA;;;KAKD,+BAA+B;WAG9B;WACA;WACA;;;KAKD,2BAA2B;WAG1B;WACA;WACA;;;KAKD,oCAAoC;WAGnC;WACA;WACA;;;KAKD,8BAA8B;WAG7B;WACA;WACA;;;KAKD,6BAA6B;WAG5B;WACA;WACA;;;KAKD,6BAA6B;WAG5B;WACA;WACA;;KAID,sBACR,2BACA,+BACA,2BACA,oCACA,8BACA,6BACA;iBAMY,+BACd,qBACA,aACA,gBACA,kBACC;iBAUa,mCACd,qBACA,aACA,iBACC;iBASa,+BACd,qBACA,aACA,yBACC;iBAUa,wCACd,qBACA,aACA,mBACC;iBAUa,kCACd,qBACA,kBACA,iBACC;iBAUa,iCACd,qBACA,cACA,iBACC;iBASa,iCACd,qBACA,cACA,iBACC"}
|
|
@@ -1,64 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
//#region src/installer/InstallerDiagnostics.ts
|
|
2
|
+
function createDownloadFailedDiagnostic(packageName, url, reason, attempt) {
|
|
3
|
+
return {
|
|
4
|
+
level: "error",
|
|
5
|
+
code: "DOWNLOAD_FAILED",
|
|
6
|
+
message: `Download of "${packageName}" failed (attempt ${attempt}): ${reason}.`,
|
|
7
|
+
hint: "Check your network connection and registry URL.",
|
|
8
|
+
data: {
|
|
9
|
+
packageName,
|
|
10
|
+
url,
|
|
11
|
+
reason,
|
|
12
|
+
attempt
|
|
13
|
+
}
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
function createDownloadHttpStatusDiagnostic(packageName, url, status) {
|
|
17
|
+
return {
|
|
18
|
+
level: "error",
|
|
19
|
+
code: "DOWNLOAD_HTTP_STATUS",
|
|
20
|
+
message: `Download of "${packageName}" returned HTTP ${status}.`,
|
|
21
|
+
data: {
|
|
22
|
+
packageName,
|
|
23
|
+
url,
|
|
24
|
+
status
|
|
25
|
+
}
|
|
26
|
+
};
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
function createNetworkTimeoutDiagnostic(packageName, url, timeoutSeconds) {
|
|
29
|
+
return {
|
|
30
|
+
level: "error",
|
|
31
|
+
code: "NETWORK_TIMEOUT",
|
|
32
|
+
message: `Download of "${packageName}" timed out after ${timeoutSeconds}s.`,
|
|
33
|
+
hint: "Increase `network.timeout` in your uapkg config.",
|
|
34
|
+
data: {
|
|
35
|
+
packageName,
|
|
36
|
+
url,
|
|
37
|
+
timeoutSeconds
|
|
38
|
+
}
|
|
39
|
+
};
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
function createNetworkRetriesExhaustedDiagnostic(packageName, url, attempts) {
|
|
42
|
+
return {
|
|
43
|
+
level: "error",
|
|
44
|
+
code: "NETWORK_RETRIES_EXHAUSTED",
|
|
45
|
+
message: `Giving up on "${packageName}" after ${attempts} attempts.`,
|
|
46
|
+
hint: "Increase `network.retries` or check network stability.",
|
|
47
|
+
data: {
|
|
48
|
+
packageName,
|
|
49
|
+
url,
|
|
50
|
+
attempts
|
|
51
|
+
}
|
|
52
|
+
};
|
|
38
53
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
function createIntegrityMismatchDiagnostic(packageName, expected, actual) {
|
|
55
|
+
return {
|
|
56
|
+
level: "error",
|
|
57
|
+
code: "INTEGRITY_MISMATCH",
|
|
58
|
+
message: `Integrity mismatch for "${packageName}".`,
|
|
59
|
+
hint: "The download may be corrupt or the registry entry has changed; re-run or report to the registry.",
|
|
60
|
+
data: {
|
|
61
|
+
packageName,
|
|
62
|
+
expected,
|
|
63
|
+
actual
|
|
64
|
+
}
|
|
65
|
+
};
|
|
47
66
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
function createExtractionFailedDiagnostic(packageName, path, reason) {
|
|
68
|
+
return {
|
|
69
|
+
level: "error",
|
|
70
|
+
code: "EXTRACTION_FAILED",
|
|
71
|
+
message: `Extraction of "${packageName}" to "${path}" failed: ${reason}.`,
|
|
72
|
+
data: {
|
|
73
|
+
packageName,
|
|
74
|
+
path,
|
|
75
|
+
reason
|
|
76
|
+
}
|
|
77
|
+
};
|
|
55
78
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
function createDiskRemoveFailedDiagnostic(packageName, path, reason) {
|
|
80
|
+
return {
|
|
81
|
+
level: "error",
|
|
82
|
+
code: "DISK_REMOVE_FAILED",
|
|
83
|
+
message: `Failed to remove "${packageName}" at "${path}": ${reason}.`,
|
|
84
|
+
data: {
|
|
85
|
+
packageName,
|
|
86
|
+
path,
|
|
87
|
+
reason
|
|
88
|
+
}
|
|
89
|
+
};
|
|
63
90
|
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { createDiskRemoveFailedDiagnostic, createDownloadFailedDiagnostic, createDownloadHttpStatusDiagnostic, createExtractionFailedDiagnostic, createIntegrityMismatchDiagnostic, createNetworkRetriesExhaustedDiagnostic, createNetworkTimeoutDiagnostic };
|
|
64
94
|
//# sourceMappingURL=InstallerDiagnostics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstallerDiagnostics.js","
|
|
1
|
+
{"version":3,"file":"InstallerDiagnostics.js","names":[],"sources":["../../src/installer/InstallerDiagnostics.ts"],"sourcesContent":["import type { DiagnosticBase } from '../base/Diagnostic.js';\n\n// ---------------------------------------------------------------------------\n// Installer diagnostic codes\n// ---------------------------------------------------------------------------\n\n/** HTTP download of a package .tgz asset failed. */\nexport type DownloadFailedDiagnostic = DiagnosticBase<\n 'DOWNLOAD_FAILED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly reason: string;\n readonly attempt: number;\n }\n>;\n\n/** Remote responded with a non-2xx HTTP status. */\nexport type DownloadHttpStatusDiagnostic = DiagnosticBase<\n 'DOWNLOAD_HTTP_STATUS',\n {\n readonly packageName: string;\n readonly url: string;\n readonly status: number;\n }\n>;\n\n/** Download timed out per `network.timeout`. */\nexport type NetworkTimeoutDiagnostic = DiagnosticBase<\n 'NETWORK_TIMEOUT',\n {\n readonly packageName: string;\n readonly url: string;\n readonly timeoutSeconds: number;\n }\n>;\n\n/** Retries exhausted per `network.retries`. */\nexport type NetworkRetriesExhaustedDiagnostic = DiagnosticBase<\n 'NETWORK_RETRIES_EXHAUSTED',\n {\n readonly packageName: string;\n readonly url: string;\n readonly attempts: number;\n }\n>;\n\n/** Downloaded file hash did not match the expected integrity from the registry. */\nexport type IntegrityMismatchDiagnostic = DiagnosticBase<\n 'INTEGRITY_MISMATCH',\n {\n readonly packageName: string;\n readonly expected: string;\n readonly actual: string;\n }\n>;\n\n/** Failed to extract a .tgz archive into the install path. */\nexport type ExtractionFailedDiagnostic = DiagnosticBase<\n 'EXTRACTION_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\n/** Failed to remove a package directory. */\nexport type DiskRemoveFailedDiagnostic = DiagnosticBase<\n 'DISK_REMOVE_FAILED',\n {\n readonly packageName: string;\n readonly path: string;\n readonly reason: string;\n }\n>;\n\nexport type InstallerDiagnostic =\n | DownloadFailedDiagnostic\n | DownloadHttpStatusDiagnostic\n | NetworkTimeoutDiagnostic\n | NetworkRetriesExhaustedDiagnostic\n | IntegrityMismatchDiagnostic\n | ExtractionFailedDiagnostic\n | DiskRemoveFailedDiagnostic;\n\n// ---------------------------------------------------------------------------\n// Factories\n// ---------------------------------------------------------------------------\n\nexport function createDownloadFailedDiagnostic(\n packageName: string,\n url: string,\n reason: string,\n attempt: number,\n): DownloadFailedDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_FAILED',\n message: `Download of \"${packageName}\" failed (attempt ${attempt}): ${reason}.`,\n hint: 'Check your network connection and registry URL.',\n data: { packageName, url, reason, attempt },\n };\n}\n\nexport function createDownloadHttpStatusDiagnostic(\n packageName: string,\n url: string,\n status: number,\n): DownloadHttpStatusDiagnostic {\n return {\n level: 'error',\n code: 'DOWNLOAD_HTTP_STATUS',\n message: `Download of \"${packageName}\" returned HTTP ${status}.`,\n data: { packageName, url, status },\n };\n}\n\nexport function createNetworkTimeoutDiagnostic(\n packageName: string,\n url: string,\n timeoutSeconds: number,\n): NetworkTimeoutDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_TIMEOUT',\n message: `Download of \"${packageName}\" timed out after ${timeoutSeconds}s.`,\n hint: 'Increase `network.timeout` in your uapkg config.',\n data: { packageName, url, timeoutSeconds },\n };\n}\n\nexport function createNetworkRetriesExhaustedDiagnostic(\n packageName: string,\n url: string,\n attempts: number,\n): NetworkRetriesExhaustedDiagnostic {\n return {\n level: 'error',\n code: 'NETWORK_RETRIES_EXHAUSTED',\n message: `Giving up on \"${packageName}\" after ${attempts} attempts.`,\n hint: 'Increase `network.retries` or check network stability.',\n data: { packageName, url, attempts },\n };\n}\n\nexport function createIntegrityMismatchDiagnostic(\n packageName: string,\n expected: string,\n actual: string,\n): IntegrityMismatchDiagnostic {\n return {\n level: 'error',\n code: 'INTEGRITY_MISMATCH',\n message: `Integrity mismatch for \"${packageName}\".`,\n hint: 'The download may be corrupt or the registry entry has changed; re-run or report to the registry.',\n data: { packageName, expected, actual },\n };\n}\n\nexport function createExtractionFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): ExtractionFailedDiagnostic {\n return {\n level: 'error',\n code: 'EXTRACTION_FAILED',\n message: `Extraction of \"${packageName}\" to \"${path}\" failed: ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n\nexport function createDiskRemoveFailedDiagnostic(\n packageName: string,\n path: string,\n reason: string,\n): DiskRemoveFailedDiagnostic {\n return {\n level: 'error',\n code: 'DISK_REMOVE_FAILED',\n message: `Failed to remove \"${packageName}\" at \"${path}\": ${reason}.`,\n data: { packageName, path, reason },\n };\n}\n"],"mappings":";AA0FA,SAAgB,+BACd,aACA,KACA,QACA,SAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,QAAQ,KAAK,OAAO;EAC7E,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;GAAQ;EAAQ;CAC5C;AACF;AAEA,SAAgB,mCACd,aACA,KACA,QAC8B;CAC9B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,kBAAkB,OAAO;EAC9D,MAAM;GAAE;GAAa;GAAK;EAAO;CACnC;AACF;AAEA,SAAgB,+BACd,aACA,KACA,gBAC0B;CAC1B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,gBAAgB,YAAY,oBAAoB,eAAe;EACxE,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAe;CAC3C;AACF;AAEA,SAAgB,wCACd,aACA,KACA,UACmC;CACnC,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,iBAAiB,YAAY,UAAU,SAAS;EACzD,MAAM;EACN,MAAM;GAAE;GAAa;GAAK;EAAS;CACrC;AACF;AAEA,SAAgB,kCACd,aACA,UACA,QAC6B;CAC7B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,2BAA2B,YAAY;EAChD,MAAM;EACN,MAAM;GAAE;GAAa;GAAU;EAAO;CACxC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,kBAAkB,YAAY,QAAQ,KAAK,YAAY,OAAO;EACvE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF;AAEA,SAAgB,iCACd,aACA,MACA,QAC4B;CAC5B,OAAO;EACL,OAAO;EACP,MAAM;EACN,SAAS,qBAAqB,YAAY,QAAQ,KAAK,KAAK,OAAO;EACnE,MAAM;GAAE;GAAa;GAAM;EAAO;CACpC;AACF"}
|
|
@@ -1,68 +1,71 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DiagnosticBase } from "../base/Diagnostic.js";
|
|
2
|
+
//#region src/manifest/ManifestDiagnostics.d.ts
|
|
2
3
|
/** Manifest content failed schema validation. */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type ManifestInvalidDiagnostic = DiagnosticBase<'MANIFEST_INVALID', {
|
|
5
|
+
readonly filePath: string;
|
|
6
|
+
readonly issues: readonly string[];
|
|
6
7
|
}>;
|
|
7
8
|
/** Lockfile content failed schema validation. */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type LockfileInvalidDiagnostic = DiagnosticBase<'LOCKFILE_INVALID', {
|
|
10
|
+
readonly filePath: string;
|
|
11
|
+
readonly issues: readonly string[];
|
|
11
12
|
}>;
|
|
12
13
|
/** Lockfile is missing from disk. */
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
type LockfileMissingDiagnostic = DiagnosticBase<'LOCKFILE_MISSING', {
|
|
15
|
+
readonly filePath: string;
|
|
15
16
|
}>;
|
|
16
17
|
/** Lockfile is present but does not match manifest/config expectations. */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
type LockfileOutOfSyncDiagnostic = DiagnosticBase<'LOCKFILE_OUT_OF_SYNC', {
|
|
19
|
+
readonly issues: readonly {
|
|
20
|
+
readonly severity: 'error' | 'warning' | 'info';
|
|
21
|
+
readonly code: string;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly packageName?: string;
|
|
24
|
+
}[];
|
|
25
|
+
readonly totalIssues: number;
|
|
26
|
+
readonly additionalIssues: number;
|
|
27
|
+
readonly logFilePath: string;
|
|
27
28
|
}>;
|
|
28
29
|
/** Overrides are only allowed in root project manifests. */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
type ForbiddenOverridesDiagnostic = DiagnosticBase<'FORBIDDEN_OVERRIDES', {
|
|
31
|
+
readonly manifestKind: string;
|
|
32
|
+
readonly filePath: string;
|
|
32
33
|
}>;
|
|
33
34
|
/** A registry name referenced in a dependency is not in configuration. */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
type UnresolvedRegistryDiagnostic = DiagnosticBase<'UNRESOLVED_REGISTRY', {
|
|
36
|
+
readonly registryName: string;
|
|
37
|
+
readonly dependencyName: string;
|
|
37
38
|
}>;
|
|
38
39
|
/** Failed to read a manifest or lockfile from disk. */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
type ManifestReadErrorDiagnostic = DiagnosticBase<'MANIFEST_READ_ERROR', {
|
|
41
|
+
readonly filePath: string;
|
|
42
|
+
readonly reason: string;
|
|
42
43
|
}>;
|
|
43
44
|
/** Failed to write a manifest or lockfile to disk. */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
type ManifestWriteErrorDiagnostic = DiagnosticBase<'MANIFEST_WRITE_ERROR', {
|
|
46
|
+
readonly filePath: string;
|
|
47
|
+
readonly reason: string;
|
|
47
48
|
}>;
|
|
48
49
|
/** Remove was requested for a package that does not exist in manifest buckets. */
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
type DependencyNotFoundDiagnostic = DiagnosticBase<'DEPENDENCY_NOT_FOUND', {
|
|
51
|
+
readonly packageName: string;
|
|
51
52
|
}>;
|
|
52
53
|
/** Union of all manifest diagnostics. */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
type ManifestDiagnostic = ManifestInvalidDiagnostic | LockfileInvalidDiagnostic | LockfileMissingDiagnostic | LockfileOutOfSyncDiagnostic | ForbiddenOverridesDiagnostic | UnresolvedRegistryDiagnostic | ManifestReadErrorDiagnostic | ManifestWriteErrorDiagnostic | DependencyNotFoundDiagnostic;
|
|
55
|
+
declare function createManifestInvalidDiagnostic(filePath: string, issues: readonly string[]): ManifestInvalidDiagnostic;
|
|
56
|
+
declare function createLockfileInvalidDiagnostic(filePath: string, issues: readonly string[]): LockfileInvalidDiagnostic;
|
|
57
|
+
declare function createLockfileMissingDiagnostic(filePath: string, level?: 'warning' | 'error'): LockfileMissingDiagnostic;
|
|
58
|
+
declare function createLockfileOutOfSyncDiagnostic(issues: readonly {
|
|
59
|
+
readonly severity: 'error' | 'warning' | 'info';
|
|
60
|
+
readonly code: string;
|
|
61
|
+
readonly message: string;
|
|
62
|
+
readonly packageName?: string;
|
|
62
63
|
}[], totalIssues: number, logFilePath: string): LockfileOutOfSyncDiagnostic;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
declare function createForbiddenOverridesDiagnostic(manifestKind: string, filePath: string): ForbiddenOverridesDiagnostic;
|
|
65
|
+
declare function createUnresolvedRegistryDiagnostic(registryName: string, dependencyName: string): UnresolvedRegistryDiagnostic;
|
|
66
|
+
declare function createManifestReadErrorDiagnostic(filePath: string, reason: string): ManifestReadErrorDiagnostic;
|
|
67
|
+
declare function createManifestWriteErrorDiagnostic(filePath: string, reason: string): ManifestWriteErrorDiagnostic;
|
|
68
|
+
declare function createDependencyNotFoundDiagnostic(packageName: string): DependencyNotFoundDiagnostic;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { DependencyNotFoundDiagnostic, ForbiddenOverridesDiagnostic, LockfileInvalidDiagnostic, LockfileMissingDiagnostic, LockfileOutOfSyncDiagnostic, ManifestDiagnostic, ManifestInvalidDiagnostic, ManifestReadErrorDiagnostic, ManifestWriteErrorDiagnostic, UnresolvedRegistryDiagnostic, createDependencyNotFoundDiagnostic, createForbiddenOverridesDiagnostic, createLockfileInvalidDiagnostic, createLockfileMissingDiagnostic, createLockfileOutOfSyncDiagnostic, createManifestInvalidDiagnostic, createManifestReadErrorDiagnostic, createManifestWriteErrorDiagnostic, createUnresolvedRegistryDiagnostic };
|
|
68
71
|
//# sourceMappingURL=ManifestDiagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestDiagnostics.d.ts","
|
|
1
|
+
{"version":3,"file":"ManifestDiagnostics.d.ts","names":[],"sources":["../../src/manifest/ManifestDiagnostics.ts"],"mappings":";;;KAOY,4BAA4B;WAG3B;WACA;;;KAKD,4BAA4B;WAG3B;WACA;;;KAKD,4BAA4B;WAG3B;;;KAKD,8BAA8B;WAG7B;aACE;aACA;aACA;aACA;;WAEF;WACA;WACA;;;KAKD,+BAA+B;WAG9B;WACA;;;KAKD,+BAA+B;WAG9B;WACA;;;KAKD,8BAA8B;WAG7B;WACA;;;KAKD,+BAA+B;WAG9B;WACA;;;KAKD,+BAA+B;WAG9B;;;KAKD,qBACR,4BACA,4BACA,4BACA,8BACA,+BACA,+BACA,8BACA,+BACA;iBAMY,gCACd,kBACA,4BACC;iBAUa,gCACd,kBACA,4BACC;iBAUa,gCACd,kBACA,8BACC;iBAUa,kCACd;WACW;WACA;WACA;WACA;KAEX,qBACA,sBACC;iBAea,mCACd,sBACA,mBACC;iBAUa,mCACd,sBACA,yBACC;iBAUa,kCAAkC,kBAAkB,iBAAiB;iBAUrE,mCAAmC,kBAAkB,iBAAiB;iBAUtE,mCAAmC,sBAAsB"}
|