@uapkg/cli 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (625) hide show
  1. package/README.md +3 -0
  2. package/dist/build/BuildMetadata.js +2 -2
  3. package/dist/cli-bootstrap.js +19846 -13
  4. package/dist/cli.js +1 -1
  5. package/dist/index.js +19980 -60
  6. package/dist/licenses/semver-LICENSE +15 -0
  7. package/dist/profile.js +25 -0
  8. package/dist/runtime-lock.json +2142 -0
  9. package/dist/{app → types/uapkg/app}/CompositionRoot.d.ts +4 -5
  10. package/dist/{app → types/uapkg/app}/UAPKGApplication.d.ts +0 -1
  11. package/dist/{build → types/uapkg/build}/BuildMetadata.d.ts +1 -2
  12. package/dist/types/uapkg/cli/DebugEnvironment.d.ts +15 -0
  13. package/dist/types/uapkg/cli/DebugInfo.d.ts +15 -0
  14. package/dist/{cli → types/uapkg/cli}/UAPKGCommandLine.d.ts +0 -1
  15. package/dist/{cli → types/uapkg/cli}/parseCommandLine.d.ts +0 -1
  16. package/dist/{cli → types/uapkg/cli}/parsing/UAPKGCommandLineParser.d.ts +0 -1
  17. package/dist/{cli → types/uapkg/cli}/parsing/UAPKGParserRegistry.d.ts +0 -1
  18. package/dist/{cli → types/uapkg/cli}/parsing/contracts/UAPKGCommandModule.d.ts +0 -1
  19. package/dist/{cli → types/uapkg/cli}/parsing/modules/AddCommandModule.d.ts +0 -1
  20. package/dist/{cli → types/uapkg/cli}/parsing/modules/ConfigCommandModule.d.ts +0 -1
  21. package/dist/{cli → types/uapkg/cli}/parsing/modules/InitCommandModule.d.ts +0 -1
  22. package/dist/{cli → types/uapkg/cli}/parsing/modules/InstallCommandModule.d.ts +0 -1
  23. package/dist/{cli → types/uapkg/cli}/parsing/modules/LifecycleCommandModule.d.ts +0 -1
  24. package/dist/{cli → types/uapkg/cli}/parsing/modules/ListCommandModule.d.ts +0 -1
  25. package/dist/{cli → types/uapkg/cli}/parsing/modules/LoginCommandModule.d.ts +0 -1
  26. package/dist/{cli → types/uapkg/cli}/parsing/modules/LogoutCommandModule.d.ts +0 -1
  27. package/dist/{cli → types/uapkg/cli}/parsing/modules/OutdatedCommandModule.d.ts +0 -1
  28. package/dist/{cli → types/uapkg/cli}/parsing/modules/PackCommandModule.d.ts +0 -1
  29. package/dist/{cli → types/uapkg/cli}/parsing/modules/ProjectGetNameCommandModule.d.ts +0 -1
  30. package/dist/{cli → types/uapkg/cli}/parsing/modules/PublishCommandModule.d.ts +0 -1
  31. package/dist/{cli → types/uapkg/cli}/parsing/modules/RegistryCommandModule.d.ts +0 -1
  32. package/dist/{cli → types/uapkg/cli}/parsing/modules/RemoveCommandModule.d.ts +0 -1
  33. package/dist/{cli → types/uapkg/cli}/parsing/modules/RequestsCommandModule.d.ts +0 -1
  34. package/dist/{cli → types/uapkg/cli}/parsing/modules/UpdateCommandModule.d.ts +0 -1
  35. package/dist/{cli → types/uapkg/cli}/parsing/modules/WhoamiCommandModule.d.ts +0 -1
  36. package/dist/{cli → types/uapkg/cli}/parsing/modules/WhyCommandModule.d.ts +0 -1
  37. package/dist/{cli → types/uapkg/cli}/parsing/modules/sharedOptions.d.ts +0 -1
  38. package/dist/{cli → types/uapkg/cli}/runUAPKGCLI.d.ts +0 -1
  39. package/dist/{commands → types/uapkg/commands}/AddCommand.d.ts +0 -1
  40. package/dist/{commands → types/uapkg/commands}/Command.d.ts +0 -1
  41. package/dist/{commands → types/uapkg/commands}/ConfigCommand.d.ts +0 -1
  42. package/dist/{commands → types/uapkg/commands}/InitCommand.d.ts +1 -2
  43. package/dist/{commands → types/uapkg/commands}/InstallCommand.d.ts +0 -1
  44. package/dist/{commands → types/uapkg/commands}/ListCommand.d.ts +0 -1
  45. package/dist/{commands → types/uapkg/commands}/LoginCommand.d.ts +0 -1
  46. package/dist/{commands → types/uapkg/commands}/LogoutCommand.d.ts +0 -1
  47. package/dist/{commands → types/uapkg/commands}/OutdatedCommand.d.ts +0 -1
  48. package/dist/{commands → types/uapkg/commands}/PackCommand.d.ts +0 -1
  49. package/dist/{commands → types/uapkg/commands}/PackageLifecycleCommand.d.ts +0 -1
  50. package/dist/{commands → types/uapkg/commands}/PostinstallCandidateBuilder.d.ts +2 -3
  51. package/dist/{commands → types/uapkg/commands}/ProjectGetNameCommand.d.ts +0 -1
  52. package/dist/{commands → types/uapkg/commands}/PublishCommand.d.ts +1 -2
  53. package/dist/{commands → types/uapkg/commands}/RegistryCommand.d.ts +0 -1
  54. package/dist/{commands → types/uapkg/commands}/RemoveCommand.d.ts +0 -1
  55. package/dist/{commands → types/uapkg/commands}/RequestsCommand.d.ts +0 -1
  56. package/dist/{commands → types/uapkg/commands}/UpdateCommand.d.ts +0 -1
  57. package/dist/{commands → types/uapkg/commands}/WhoamiCommand.d.ts +0 -1
  58. package/dist/{commands → types/uapkg/commands}/WhyCommand.d.ts +0 -1
  59. package/dist/{commands → types/uapkg/commands}/add/DependencyAddResolver.d.ts +3 -4
  60. package/dist/{control-plane → types/uapkg/control-plane}/AccountManager.d.ts +1 -2
  61. package/dist/{control-plane → types/uapkg/control-plane}/ArtifactObserver.d.ts +0 -1
  62. package/dist/{control-plane → types/uapkg/control-plane}/AuthMetadataStore.d.ts +0 -1
  63. package/dist/{control-plane → types/uapkg/control-plane}/AuthStoragePaths.d.ts +0 -1
  64. package/dist/{control-plane → types/uapkg/control-plane}/AuthenticationSelector.d.ts +0 -1
  65. package/dist/{control-plane → types/uapkg/control-plane}/ControlPlaneClient.d.ts +1 -2
  66. package/dist/{control-plane → types/uapkg/control-plane}/ControlPlaneEndpoints.d.ts +1 -2
  67. package/dist/{control-plane → types/uapkg/control-plane}/ControlPlaneTypes.d.ts +4 -2
  68. package/dist/{control-plane → types/uapkg/control-plane}/CredentialStore.d.ts +0 -1
  69. package/dist/{control-plane → types/uapkg/control-plane}/DPoPKeyStore.d.ts +0 -1
  70. package/dist/{control-plane → types/uapkg/control-plane}/GitHubActionsOidcCredentialProvider.d.ts +4 -3
  71. package/dist/{control-plane → types/uapkg/control-plane}/PublishIdempotencyStore.d.ts +0 -1
  72. package/dist/{control-plane → types/uapkg/control-plane}/PublishRequestErrorMapper.d.ts +1 -2
  73. package/dist/{control-plane → types/uapkg/control-plane}/RegistryGrantLock.d.ts +0 -1
  74. package/dist/{control-plane → types/uapkg/control-plane}/RegistryTrustResolver.d.ts +0 -1
  75. package/dist/types/uapkg/control-plane/RequestWatch.d.ts +15 -0
  76. package/dist/types/uapkg/control-plane/RetryAfter.d.ts +6 -0
  77. package/dist/{postinstall → types/uapkg/postinstall}/api/PostinstallDsl.d.ts +0 -1
  78. package/dist/{postinstall → types/uapkg/postinstall}/api/definePostinstall.d.ts +0 -1
  79. package/dist/{postinstall → types/uapkg/postinstall}/loader/EntryResolver.d.ts +1 -2
  80. package/dist/{postinstall → types/uapkg/postinstall}/loader/EsbuildTranspiler.d.ts +1 -2
  81. package/dist/{postinstall → types/uapkg/postinstall}/loader/ExportValidator.d.ts +1 -2
  82. package/dist/{postinstall → types/uapkg/postinstall}/loader/ModuleImporter.d.ts +1 -2
  83. package/dist/{postinstall → types/uapkg/postinstall}/loader/PostinstallLoader.d.ts +1 -2
  84. package/dist/{postinstall → types/uapkg/postinstall}/markers/MarkerBlockEditor.d.ts +1 -2
  85. package/dist/{postinstall → types/uapkg/postinstall}/markers/MarkerBlockService.d.ts +0 -1
  86. package/dist/{postinstall → types/uapkg/postinstall}/markers/MarkerIntegrityValidator.d.ts +0 -1
  87. package/dist/{postinstall → types/uapkg/postinstall}/policy/PostinstallPolicyGate.d.ts +2 -3
  88. package/dist/{postinstall → types/uapkg/postinstall}/runner/PostinstallOrchestrator.d.ts +1 -2
  89. package/dist/{postinstall → types/uapkg/postinstall}/unreal/BuildCsInjector.d.ts +1 -2
  90. package/dist/{postinstall → types/uapkg/postinstall}/unreal/CSharpInjectionEngine.d.ts +0 -1
  91. package/dist/{postinstall → types/uapkg/postinstall}/unreal/CSharpStructureAnalyzer.d.ts +0 -1
  92. package/dist/{postinstall → types/uapkg/postinstall}/unreal/CSharpStructures.d.ts +0 -1
  93. package/dist/{postinstall → types/uapkg/postinstall}/unreal/CSharpWrapperFactory.d.ts +0 -1
  94. package/dist/{postinstall → types/uapkg/postinstall}/unreal/PluginHash.d.ts +0 -1
  95. package/dist/{postinstall → types/uapkg/postinstall}/unreal/PrettyParseError.d.ts +0 -1
  96. package/dist/{postinstall → types/uapkg/postinstall}/unreal/ProjectFileLocator.d.ts +0 -1
  97. package/dist/{postinstall → types/uapkg/postinstall}/unreal/TargetCsInjector.d.ts +1 -2
  98. package/dist/{postinstall → types/uapkg/postinstall}/unreal/UProjectInjector.d.ts +1 -2
  99. package/dist/{postinstall → types/uapkg/postinstall}/unreal/UProjectMetadataReader.d.ts +0 -1
  100. package/dist/{postinstall → types/uapkg/postinstall}/unreal/UnrealSourceCatalog.d.ts +0 -1
  101. package/dist/{prompts → types/uapkg/prompts}/InkPromptService.d.ts +0 -1
  102. package/dist/{prompts → types/uapkg/prompts}/ProjectContextDetector.d.ts +1 -2
  103. package/dist/{prompts → types/uapkg/prompts}/PromptService.d.ts +0 -1
  104. package/dist/{reporting → types/uapkg/reporting}/DiagnosticDeduplicator.d.ts +1 -2
  105. package/dist/{reporting → types/uapkg/reporting}/DiagnosticRenderer.d.ts +1 -2
  106. package/dist/{reporting → types/uapkg/reporting}/DiagnosticReporter.d.ts +1 -2
  107. package/dist/{reporting → types/uapkg/reporting}/InkDiagnosticRenderer.d.ts +2 -3
  108. package/dist/{reporting → types/uapkg/reporting}/InstallProgressReporter.d.ts +1 -2
  109. package/dist/{reporting → types/uapkg/reporting}/JsonReporter.d.ts +1 -2
  110. package/dist/{reporting → types/uapkg/reporting}/RegistryRequestTerminalFormatter.d.ts +0 -1
  111. package/dist/{reporting → types/uapkg/reporting}/TextDiagnosticRenderer.d.ts +1 -2
  112. package/dist/{reporting → types/uapkg/reporting}/TextSink.d.ts +1 -2
  113. package/dist/types/uapkg-common/format/prettyBytes.d.ts +19 -0
  114. package/dist/types/uapkg-common/hash/registryIdentifier.d.ts +28 -0
  115. package/dist/types/uapkg-common/hash/sha256.d.ts +12 -0
  116. package/dist/types/uapkg-common/index.d.ts +10 -0
  117. package/dist/types/uapkg-common/json/safeJsonParse.d.ts +9 -0
  118. package/dist/types/uapkg-common/json/stableStringify.d.ts +9 -0
  119. package/dist/types/uapkg-common/normalize/normalizeUrl.d.ts +11 -0
  120. package/dist/types/uapkg-common/paths/forwardSlash.d.ts +12 -0
  121. package/dist/types/uapkg-common/runtime/UapkgRuntimeProfile.d.ts +19 -0
  122. package/dist/types/uapkg-common/spec/parsePackageSpec.d.ts +21 -0
  123. package/dist/types/uapkg-common-schema/brand/Brand.d.ts +15 -0
  124. package/dist/types/uapkg-common-schema/index.d.ts +17 -0
  125. package/dist/types/uapkg-common-schema/primitives/AssetHash.d.ts +11 -0
  126. package/dist/types/uapkg-common-schema/primitives/ConcurrencyCount.d.ts +11 -0
  127. package/dist/types/uapkg-common-schema/primitives/DurationSeconds.d.ts +11 -0
  128. package/dist/types/uapkg-common-schema/primitives/GitTree.d.ts +10 -0
  129. package/dist/types/uapkg-common-schema/primitives/InstallPath.d.ts +18 -0
  130. package/dist/types/uapkg-common-schema/primitives/OrgName.d.ts +12 -0
  131. package/dist/types/uapkg-common-schema/primitives/PackageName.d.ts +14 -0
  132. package/dist/types/uapkg-common-schema/primitives/PackageSpec.d.ts +21 -0
  133. package/dist/types/uapkg-common-schema/primitives/PackageVersion.d.ts +10 -0
  134. package/dist/types/uapkg-common-schema/primitives/PostInstallPolicy.d.ts +21 -0
  135. package/dist/types/uapkg-common-schema/primitives/RegistryIdentifier.d.ts +15 -0
  136. package/dist/types/uapkg-common-schema/primitives/RegistryName.d.ts +18 -0
  137. package/dist/types/uapkg-common-schema/primitives/RegistryURL.d.ts +10 -0
  138. package/dist/types/uapkg-common-schema/primitives/UnixTimestamp.d.ts +10 -0
  139. package/dist/types/uapkg-common-schema/primitives/VersionRange.d.ts +10 -0
  140. package/dist/types/uapkg-config/contracts/ConfigTypes.d.ts +58 -0
  141. package/dist/types/uapkg-config/core/ConfigInstance.d.ts +43 -0
  142. package/dist/types/uapkg-config/core/ConfigLayerBuilder.d.ts +13 -0
  143. package/dist/types/uapkg-config/core/ConfigResolver.d.ts +19 -0
  144. package/dist/types/uapkg-config/core/ConfigSemanticValidator.d.ts +13 -0
  145. package/dist/types/uapkg-config/core/ConfigWriter.d.ts +25 -0
  146. package/dist/types/uapkg-config/core/PostInstallPolicyResolver.d.ts +22 -0
  147. package/dist/types/uapkg-config/factory/createConfig.d.ts +6 -0
  148. package/dist/types/uapkg-config/files/ConfigFileRepository.d.ts +11 -0
  149. package/dist/types/uapkg-config/files/ConfigPathResolver.d.ts +14 -0
  150. package/dist/types/uapkg-config/index.d.ts +127 -0
  151. package/dist/types/uapkg-config/merge/ConfigMerger.d.ts +10 -0
  152. package/dist/types/uapkg-config/merge/ConfigSchemaMergeEngine.d.ts +26 -0
  153. package/dist/types/uapkg-config/schema/configSchema.d.ts +114 -0
  154. package/dist/types/uapkg-config/schema/pathSchema.d.ts +12 -0
  155. package/dist/types/uapkg-config/schema/runtime/ConfigCliValueParser.d.ts +18 -0
  156. package/dist/types/uapkg-config/schema/runtime/ConfigSchemaIntrospection.d.ts +13 -0
  157. package/dist/types/uapkg-config/schema/runtime/ConfigSchemaRuntime.d.ts +26 -0
  158. package/dist/types/uapkg-config/schema/runtime/ConfigSchemaRuntimeProvider.d.ts +7 -0
  159. package/dist/types/uapkg-diagnostics/base/Diagnostic.d.ts +32 -0
  160. package/dist/types/uapkg-diagnostics/base/DiagnosticBag.d.ts +44 -0
  161. package/dist/types/uapkg-diagnostics/base/DiagnosticFingerprint.d.ts +12 -0
  162. package/dist/types/uapkg-diagnostics/base/DiagnosticLevel.d.ts +11 -0
  163. package/dist/types/uapkg-diagnostics/base/Result.d.ts +26 -0
  164. package/dist/types/uapkg-diagnostics/config/ConfigDiagnostics.d.ts +49 -0
  165. package/dist/types/uapkg-diagnostics/controlPlane/ControlPlaneDiagnostics.d.ts +25 -0
  166. package/dist/types/uapkg-diagnostics/general/GeneralDiagnostics.d.ts +23 -0
  167. package/dist/types/uapkg-diagnostics/index.d.ts +20 -0
  168. package/dist/types/uapkg-diagnostics/installer/InstallerDiagnostics.d.ts +55 -0
  169. package/dist/types/uapkg-diagnostics/manifest/ManifestDiagnostics.d.ts +70 -0
  170. package/dist/types/uapkg-diagnostics/pack/PackDiagnostics.d.ts +49 -0
  171. package/dist/types/uapkg-diagnostics/postinstall/PostinstallDiagnostics.d.ts +47 -0
  172. package/dist/types/uapkg-diagnostics/publishing/PublishingDiagnostics.d.ts +77 -0
  173. package/dist/types/uapkg-diagnostics/registry/RegistryDiagnostics.d.ts +71 -0
  174. package/dist/types/uapkg-diagnostics/registryTools/RegistryToolsDiagnostics.d.ts +130 -0
  175. package/dist/types/uapkg-diagnostics/resolver/ResolverDiagnostics.d.ts +38 -0
  176. package/dist/types/uapkg-diagnostics/safety/SafetyDiagnostics.d.ts +33 -0
  177. package/dist/types/uapkg-diagnostics/spec/SpecDiagnostics.d.ts +23 -0
  178. package/dist/types/uapkg-diagnostics/types.d.ts +37 -0
  179. package/dist/types/uapkg-diagnostics-format/contracts/FormatterTypes.d.ts +23 -0
  180. package/dist/types/uapkg-diagnostics-format/defaults/defaultFormatters.d.ts +8 -0
  181. package/dist/types/uapkg-diagnostics-format/formatters/PlainTextFormatter.d.ts +11 -0
  182. package/dist/types/uapkg-diagnostics-format/formatters/config/configFormatters.d.ts +5 -0
  183. package/dist/types/uapkg-diagnostics-format/formatters/installer/installerFormatters.d.ts +5 -0
  184. package/dist/types/uapkg-diagnostics-format/formatters/manifest/manifestFormatters.d.ts +5 -0
  185. package/dist/types/uapkg-diagnostics-format/formatters/pack/packFormatters.d.ts +5 -0
  186. package/dist/types/uapkg-diagnostics-format/formatters/postinstall/postinstallFormatters.d.ts +5 -0
  187. package/dist/types/uapkg-diagnostics-format/formatters/publishing/publishingFormatters.d.ts +13 -0
  188. package/dist/types/uapkg-diagnostics-format/formatters/registry/registryFormatters.d.ts +5 -0
  189. package/dist/types/uapkg-diagnostics-format/formatters/registryTools/registryToolsFormatters.d.ts +5 -0
  190. package/dist/types/uapkg-diagnostics-format/formatters/resolver/resolverFormatters.d.ts +5 -0
  191. package/dist/types/uapkg-diagnostics-format/formatters/safety/safetyFormatters.d.ts +5 -0
  192. package/dist/types/uapkg-diagnostics-format/formatters/spec/specFormatters.d.ts +5 -0
  193. package/dist/types/uapkg-diagnostics-format/index.d.ts +15 -0
  194. package/dist/types/uapkg-diagnostics-format/ink/components/configInkComponents.d.ts +5 -0
  195. package/dist/types/uapkg-diagnostics-format/ink/components/installerInkComponents.d.ts +5 -0
  196. package/dist/types/uapkg-diagnostics-format/ink/components/manifestInkComponents.d.ts +5 -0
  197. package/dist/types/uapkg-diagnostics-format/ink/components/packInkComponents.d.ts +5 -0
  198. package/dist/types/uapkg-diagnostics-format/ink/components/postinstallInkComponents.d.ts +5 -0
  199. package/dist/types/uapkg-diagnostics-format/ink/components/publishingInkComponents.d.ts +5 -0
  200. package/dist/types/uapkg-diagnostics-format/ink/components/registryInkComponents.d.ts +5 -0
  201. package/dist/types/uapkg-diagnostics-format/ink/components/resolverInkComponents.d.ts +5 -0
  202. package/dist/types/uapkg-diagnostics-format/ink/components/safetyInkComponents.d.ts +5 -0
  203. package/dist/types/uapkg-diagnostics-format/ink/components/specInkComponents.d.ts +5 -0
  204. package/dist/types/uapkg-diagnostics-format/ink/contracts/InkTypes.d.ts +35 -0
  205. package/dist/types/uapkg-diagnostics-format/ink/defaults/defaultInkComponents.d.ts +15 -0
  206. package/dist/types/uapkg-diagnostics-format/ink/index.d.ts +17 -0
  207. package/dist/types/uapkg-diagnostics-format/ink/primitives/HintLine.d.ts +12 -0
  208. package/dist/types/uapkg-diagnostics-format/ink/primitives/PlainTextBody.d.ts +11 -0
  209. package/dist/types/uapkg-diagnostics-format/ink/primitives/SeverityBadge.d.ts +13 -0
  210. package/dist/types/uapkg-diagnostics-format/ink/registry/DiagnosticInkRegistry.d.ts +24 -0
  211. package/dist/types/uapkg-diagnostics-format/ink/views/DiagnosticView.d.ts +21 -0
  212. package/dist/types/uapkg-diagnostics-format/ink/views/DiagnosticsListView.d.ts +16 -0
  213. package/dist/types/uapkg-diagnostics-format/registry/FormatterRegistry.d.ts +26 -0
  214. package/dist/types/uapkg-diagnostics-format/utils/indent.d.ts +7 -0
  215. package/dist/types/uapkg-installer/contracts/InstallerTypes.d.ts +91 -0
  216. package/dist/types/uapkg-installer/contracts/SafetyPolicyTypes.d.ts +43 -0
  217. package/dist/types/uapkg-installer/contracts/StatusStreamTypes.d.ts +42 -0
  218. package/dist/types/uapkg-installer/core/ClaimsVerifier.d.ts +22 -0
  219. package/dist/types/uapkg-installer/core/DiskStateInspector.d.ts +29 -0
  220. package/dist/types/uapkg-installer/core/InstallPlanner.d.ts +35 -0
  221. package/dist/types/uapkg-installer/core/Installer.d.ts +61 -0
  222. package/dist/types/uapkg-installer/core/IntegrityVerifier.d.ts +16 -0
  223. package/dist/types/uapkg-installer/core/PackageDownloader.d.ts +40 -0
  224. package/dist/types/uapkg-installer/core/PackageExtractor.d.ts +20 -0
  225. package/dist/types/uapkg-installer/core/PackageRemover.d.ts +14 -0
  226. package/dist/types/uapkg-installer/index.d.ts +16 -0
  227. package/dist/types/uapkg-installer/safety/NoMarkerPolicy.d.ts +17 -0
  228. package/dist/types/uapkg-installer/safety/SafetyPolicyRegistry.d.ts +32 -0
  229. package/dist/types/uapkg-installer/status/SlotTable.d.ts +36 -0
  230. package/dist/types/uapkg-installer/status/StatusStream.d.ts +25 -0
  231. package/dist/types/uapkg-log/contracts/LoggerTypes.d.ts +22 -0
  232. package/dist/types/uapkg-log/core/LogLevelPolicy.d.ts +15 -0
  233. package/dist/types/uapkg-log/core/LoggerFactory.d.ts +11 -0
  234. package/dist/types/uapkg-log/core/LoggerInstance.d.ts +17 -0
  235. package/dist/types/uapkg-log/core/WinstonLoggerAdapter.d.ts +8 -0
  236. package/dist/types/uapkg-log/index.d.ts +8 -0
  237. package/dist/types/uapkg-pack/contracts/PackTypes.d.ts +29 -0
  238. package/dist/types/uapkg-pack/core/FileCrawler.d.ts +12 -0
  239. package/dist/types/uapkg-pack/core/IgnoreEvaluator.d.ts +7 -0
  240. package/dist/types/uapkg-pack/core/IgnoreRuleLoader.d.ts +14 -0
  241. package/dist/types/uapkg-pack/core/IntegrityWriter.d.ts +6 -0
  242. package/dist/types/uapkg-pack/core/LFSPointerDetector.d.ts +6 -0
  243. package/dist/types/uapkg-pack/core/PackArtifactExcluder.d.ts +11 -0
  244. package/dist/types/uapkg-pack/core/PackManifestReader.d.ts +8 -0
  245. package/dist/types/uapkg-pack/core/PackService.d.ts +32 -0
  246. package/dist/types/uapkg-pack/core/PluginDescriptorGuard.d.ts +11 -0
  247. package/dist/types/uapkg-pack/core/PluginRootResolver.d.ts +14 -0
  248. package/dist/types/uapkg-pack/core/TarArchiveWriter.d.ts +11 -0
  249. package/dist/types/uapkg-pack/index.d.ts +7 -0
  250. package/dist/types/uapkg-package-claims/archive/PackagedManifestReader.d.ts +28 -0
  251. package/dist/types/uapkg-package-claims/claims/ClaimsComparison.d.ts +44 -0
  252. package/dist/types/uapkg-package-claims/claims/PackageClaims.d.ts +9 -0
  253. package/dist/types/uapkg-package-claims/index.d.ts +7 -0
  254. package/dist/types/uapkg-package-claims/json/CanonicalJson.d.ts +17 -0
  255. package/dist/types/uapkg-package-claims/schema/PackageClaimsSchema.d.ts +27 -0
  256. package/dist/types/uapkg-package-claims/schema/index.d.ts +2 -0
  257. package/dist/types/uapkg-package-manifest/contracts/ManifestTypes.d.ts +37 -0
  258. package/dist/types/uapkg-package-manifest/core/DependencyMutator.d.ts +48 -0
  259. package/dist/types/uapkg-package-manifest/core/DevDependencyPolicy.d.ts +30 -0
  260. package/dist/types/uapkg-package-manifest/core/InstallPathResolver.d.ts +35 -0
  261. package/dist/types/uapkg-package-manifest/core/LockfileDiffer.d.ts +40 -0
  262. package/dist/types/uapkg-package-manifest/core/LockfileSyncIssue.d.ts +11 -0
  263. package/dist/types/uapkg-package-manifest/core/LockfileSyncValidator.d.ts +26 -0
  264. package/dist/types/uapkg-package-manifest/core/OutdatedChecker.d.ts +36 -0
  265. package/dist/types/uapkg-package-manifest/core/PackageManifest.d.ts +63 -0
  266. package/dist/types/uapkg-package-manifest/core/WhyGraph.d.ts +31 -0
  267. package/dist/types/uapkg-package-manifest/index.d.ts +18 -0
  268. package/dist/types/uapkg-package-manifest/io/LockfileReader.d.ts +12 -0
  269. package/dist/types/uapkg-package-manifest/io/LockfileSyncIssueWriter.d.ts +12 -0
  270. package/dist/types/uapkg-package-manifest/io/LockfileWriter.d.ts +11 -0
  271. package/dist/types/uapkg-package-manifest/io/ManifestReader.d.ts +12 -0
  272. package/dist/types/uapkg-package-manifest/io/ManifestWriter.d.ts +13 -0
  273. package/dist/types/uapkg-package-manifest/resolver/LockfileSync.d.ts +13 -0
  274. package/dist/types/uapkg-package-manifest/resolver/Resolver.d.ts +16 -0
  275. package/dist/types/uapkg-package-manifest-schema/index.d.ts +10 -0
  276. package/dist/types/uapkg-package-manifest-schema/lockfile/LockDependencySchema.d.ts +15 -0
  277. package/dist/types/uapkg-package-manifest-schema/lockfile/LockfileSchema.d.ts +22 -0
  278. package/dist/types/uapkg-package-manifest-schema/manifest/BaseManifestSchema.d.ts +56 -0
  279. package/dist/types/uapkg-package-manifest-schema/manifest/DependencySchema.d.ts +57 -0
  280. package/dist/types/uapkg-package-manifest-schema/manifest/ManifestKind.d.ts +17 -0
  281. package/dist/types/uapkg-package-manifest-schema/manifest/ManifestSchema.d.ts +106 -0
  282. package/dist/types/uapkg-package-manifest-schema/manifest/PluginManifestSchema.d.ts +52 -0
  283. package/dist/types/uapkg-package-manifest-schema/manifest/ProjectManifestSchema.d.ts +80 -0
  284. package/dist/types/uapkg-package-manifest-schema/manifest/PublishSchema.d.ts +15 -0
  285. package/dist/types/uapkg-registry-core/contracts/RegistryCoreTypes.d.ts +54 -0
  286. package/dist/types/uapkg-registry-core/core/RegistryCore.d.ts +26 -0
  287. package/dist/types/uapkg-registry-core/index.d.ts +14 -0
  288. package/dist/types/uapkg-registry-core/paths/RegistryPaths.d.ts +15 -0
  289. package/dist/types/uapkg-registry-core/registry/GitRunner.d.ts +31 -0
  290. package/dist/types/uapkg-registry-core/registry/Registry.d.ts +46 -0
  291. package/dist/types/uapkg-registry-core/registry/RegistryCacheValidator.d.ts +21 -0
  292. package/dist/types/uapkg-registry-core/registry/RegistryLock.d.ts +27 -0
  293. package/dist/types/uapkg-registry-core/registry/RegistryMetadataReader.d.ts +18 -0
  294. package/dist/types/uapkg-registry-core/registry/RegistryPackageReader.d.ts +24 -0
  295. package/dist/types/uapkg-registry-core/registry/RegistrySyncPolicy.d.ts +14 -0
  296. package/dist/types/uapkg-registry-core/registry/RegistryUpdater.d.ts +23 -0
  297. package/dist/types/uapkg-registry-core/registry/RegistryUrlSanitizer.d.ts +10 -0
  298. package/dist/types/uapkg-registry-core/resolution/PackageResolver.d.ts +21 -0
  299. package/dist/types/uapkg-registry-core/resolution/SemverSelectionPolicy.d.ts +36 -0
  300. package/dist/types/uapkg-registry-schema/index.d.ts +9 -0
  301. package/dist/types/uapkg-registry-schema/paths/RegistryPackagePath.d.ts +15 -0
  302. package/dist/types/uapkg-registry-schema/schemas/IntegritySchema.d.ts +12 -0
  303. package/dist/types/uapkg-registry-schema/schemas/PackageRegistryManifestSchema.d.ts +108 -0
  304. package/dist/types/uapkg-registry-schema/schemas/PackageSourceSchema.d.ts +12 -0
  305. package/dist/types/uapkg-registry-schema/schemas/RegistryAssetSchema.d.ts +15 -0
  306. package/dist/types/uapkg-registry-schema/schemas/RegistryDependencySchema.d.ts +36 -0
  307. package/dist/types/uapkg-registry-schema/schemas/RegistryMetaSchema.d.ts +29 -0
  308. package/dist/types/uapkg-registry-schema/schemas/RegistryVersionSchema.d.ts +71 -0
  309. package/dist/types/uapkg-registry-tools/aggregator/RegistryToolsAggregator.d.ts +45 -0
  310. package/dist/types/uapkg-registry-tools/contracts/RegistryToolsTypes.d.ts +116 -0
  311. package/dist/types/uapkg-registry-tools/index.d.ts +18 -0
  312. package/dist/types/uapkg-registry-tools/io/IntegrityCalculator.d.ts +20 -0
  313. package/dist/types/uapkg-registry-tools/io/ManifestStore.d.ts +41 -0
  314. package/dist/types/uapkg-registry-tools/listing/PackageLister.d.ts +22 -0
  315. package/dist/types/uapkg-registry-tools/mutation/AddPackageVersionPlanner.d.ts +25 -0
  316. package/dist/types/uapkg-registry-tools/mutation/RemovePackagePlanner.d.ts +22 -0
  317. package/dist/types/uapkg-registry-tools/mutation/RemovePackageVersionPlanner.d.ts +21 -0
  318. package/dist/types/uapkg-registry-tools/mutation/VersionSorter.d.ts +10 -0
  319. package/dist/types/uapkg-registry-tools/paths/RegistryRepoPaths.d.ts +23 -0
  320. package/dist/types/uapkg-registry-tools/tools/RegistryTools.d.ts +64 -0
  321. package/dist/types/uapkg-registry-tools/validation/DependencyReachabilityValidator.d.ts +24 -0
  322. package/dist/types/uapkg-registry-tools/validation/ExternalRegistryPolicyValidator.d.ts +22 -0
  323. package/dist/types/uapkg-registry-tools/validation/ManifestValidator.d.ts +16 -0
  324. package/dist/types/uapkg-registry-tools/validation/OfficialRegistryPolicyValidator.d.ts +34 -0
  325. package/dist/types/uapkg-registry-tools/validation/RegistryValidator.d.ts +31 -0
  326. package/dist/types/uapkg-registry-tools/validation/ReleaseFileNameValidator.d.ts +21 -0
  327. package/package.json +21 -48
  328. package/dist/app/CompositionRoot.d.ts.map +0 -1
  329. package/dist/app/CompositionRoot.js +0 -93
  330. package/dist/app/CompositionRoot.js.map +0 -1
  331. package/dist/app/UAPKGApplication.d.ts.map +0 -1
  332. package/dist/app/UAPKGApplication.js +0 -157
  333. package/dist/app/UAPKGApplication.js.map +0 -1
  334. package/dist/build/BuildMetadata.d.ts.map +0 -1
  335. package/dist/cli/UAPKGCommandLine.d.ts.map +0 -1
  336. package/dist/cli/UAPKGCommandLine.js +0 -250
  337. package/dist/cli/UAPKGCommandLine.js.map +0 -1
  338. package/dist/cli/parseCommandLine.d.ts.map +0 -1
  339. package/dist/cli/parseCommandLine.js +0 -11
  340. package/dist/cli/parseCommandLine.js.map +0 -1
  341. package/dist/cli/parsing/UAPKGCommandLineParser.d.ts.map +0 -1
  342. package/dist/cli/parsing/UAPKGCommandLineParser.js +0 -24
  343. package/dist/cli/parsing/UAPKGCommandLineParser.js.map +0 -1
  344. package/dist/cli/parsing/UAPKGParserRegistry.d.ts.map +0 -1
  345. package/dist/cli/parsing/UAPKGParserRegistry.js +0 -54
  346. package/dist/cli/parsing/UAPKGParserRegistry.js.map +0 -1
  347. package/dist/cli/parsing/contracts/UAPKGCommandModule.d.ts.map +0 -1
  348. package/dist/cli/parsing/contracts/UAPKGCommandModule.js +0 -1
  349. package/dist/cli/parsing/modules/AddCommandModule.d.ts.map +0 -1
  350. package/dist/cli/parsing/modules/AddCommandModule.js +0 -50
  351. package/dist/cli/parsing/modules/AddCommandModule.js.map +0 -1
  352. package/dist/cli/parsing/modules/ConfigCommandModule.d.ts.map +0 -1
  353. package/dist/cli/parsing/modules/ConfigCommandModule.js +0 -88
  354. package/dist/cli/parsing/modules/ConfigCommandModule.js.map +0 -1
  355. package/dist/cli/parsing/modules/InitCommandModule.d.ts.map +0 -1
  356. package/dist/cli/parsing/modules/InitCommandModule.js +0 -26
  357. package/dist/cli/parsing/modules/InitCommandModule.js.map +0 -1
  358. package/dist/cli/parsing/modules/InstallCommandModule.d.ts.map +0 -1
  359. package/dist/cli/parsing/modules/InstallCommandModule.js +0 -37
  360. package/dist/cli/parsing/modules/InstallCommandModule.js.map +0 -1
  361. package/dist/cli/parsing/modules/LifecycleCommandModule.d.ts.map +0 -1
  362. package/dist/cli/parsing/modules/LifecycleCommandModule.js +0 -84
  363. package/dist/cli/parsing/modules/LifecycleCommandModule.js.map +0 -1
  364. package/dist/cli/parsing/modules/ListCommandModule.d.ts.map +0 -1
  365. package/dist/cli/parsing/modules/ListCommandModule.js +0 -27
  366. package/dist/cli/parsing/modules/ListCommandModule.js.map +0 -1
  367. package/dist/cli/parsing/modules/LoginCommandModule.d.ts.map +0 -1
  368. package/dist/cli/parsing/modules/LoginCommandModule.js +0 -35
  369. package/dist/cli/parsing/modules/LoginCommandModule.js.map +0 -1
  370. package/dist/cli/parsing/modules/LogoutCommandModule.d.ts.map +0 -1
  371. package/dist/cli/parsing/modules/LogoutCommandModule.js +0 -31
  372. package/dist/cli/parsing/modules/LogoutCommandModule.js.map +0 -1
  373. package/dist/cli/parsing/modules/OutdatedCommandModule.d.ts.map +0 -1
  374. package/dist/cli/parsing/modules/OutdatedCommandModule.js +0 -22
  375. package/dist/cli/parsing/modules/OutdatedCommandModule.js.map +0 -1
  376. package/dist/cli/parsing/modules/PackCommandModule.d.ts.map +0 -1
  377. package/dist/cli/parsing/modules/PackCommandModule.js +0 -31
  378. package/dist/cli/parsing/modules/PackCommandModule.js.map +0 -1
  379. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.d.ts.map +0 -1
  380. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js +0 -15
  381. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js.map +0 -1
  382. package/dist/cli/parsing/modules/PublishCommandModule.d.ts.map +0 -1
  383. package/dist/cli/parsing/modules/PublishCommandModule.js +0 -66
  384. package/dist/cli/parsing/modules/PublishCommandModule.js.map +0 -1
  385. package/dist/cli/parsing/modules/RegistryCommandModule.d.ts.map +0 -1
  386. package/dist/cli/parsing/modules/RegistryCommandModule.js +0 -118
  387. package/dist/cli/parsing/modules/RegistryCommandModule.js.map +0 -1
  388. package/dist/cli/parsing/modules/RemoveCommandModule.d.ts.map +0 -1
  389. package/dist/cli/parsing/modules/RemoveCommandModule.js +0 -26
  390. package/dist/cli/parsing/modules/RemoveCommandModule.js.map +0 -1
  391. package/dist/cli/parsing/modules/RequestsCommandModule.d.ts.map +0 -1
  392. package/dist/cli/parsing/modules/RequestsCommandModule.js +0 -59
  393. package/dist/cli/parsing/modules/RequestsCommandModule.js.map +0 -1
  394. package/dist/cli/parsing/modules/UpdateCommandModule.d.ts.map +0 -1
  395. package/dist/cli/parsing/modules/UpdateCommandModule.js +0 -39
  396. package/dist/cli/parsing/modules/UpdateCommandModule.js.map +0 -1
  397. package/dist/cli/parsing/modules/WhoamiCommandModule.d.ts.map +0 -1
  398. package/dist/cli/parsing/modules/WhoamiCommandModule.js +0 -31
  399. package/dist/cli/parsing/modules/WhoamiCommandModule.js.map +0 -1
  400. package/dist/cli/parsing/modules/WhyCommandModule.d.ts.map +0 -1
  401. package/dist/cli/parsing/modules/WhyCommandModule.js +0 -26
  402. package/dist/cli/parsing/modules/WhyCommandModule.js.map +0 -1
  403. package/dist/cli/parsing/modules/sharedOptions.d.ts.map +0 -1
  404. package/dist/cli/parsing/modules/sharedOptions.js +0 -21
  405. package/dist/cli/parsing/modules/sharedOptions.js.map +0 -1
  406. package/dist/cli/runUAPKGCLI.d.ts.map +0 -1
  407. package/dist/cli/runUAPKGCLI.js +0 -12
  408. package/dist/cli/runUAPKGCLI.js.map +0 -1
  409. package/dist/cli-bootstrap.js.map +0 -1
  410. package/dist/commands/AddCommand.d.ts.map +0 -1
  411. package/dist/commands/AddCommand.js +0 -51
  412. package/dist/commands/AddCommand.js.map +0 -1
  413. package/dist/commands/Command.d.ts.map +0 -1
  414. package/dist/commands/Command.js +0 -1
  415. package/dist/commands/ConfigCommand.d.ts.map +0 -1
  416. package/dist/commands/ConfigCommand.js +0 -166
  417. package/dist/commands/ConfigCommand.js.map +0 -1
  418. package/dist/commands/InitCommand.d.ts.map +0 -1
  419. package/dist/commands/InitCommand.js +0 -66
  420. package/dist/commands/InitCommand.js.map +0 -1
  421. package/dist/commands/InstallCommand.d.ts.map +0 -1
  422. package/dist/commands/InstallCommand.js +0 -120
  423. package/dist/commands/InstallCommand.js.map +0 -1
  424. package/dist/commands/ListCommand.d.ts.map +0 -1
  425. package/dist/commands/ListCommand.js +0 -78
  426. package/dist/commands/ListCommand.js.map +0 -1
  427. package/dist/commands/LoginCommand.d.ts.map +0 -1
  428. package/dist/commands/LoginCommand.js +0 -67
  429. package/dist/commands/LoginCommand.js.map +0 -1
  430. package/dist/commands/LogoutCommand.d.ts.map +0 -1
  431. package/dist/commands/LogoutCommand.js +0 -37
  432. package/dist/commands/LogoutCommand.js.map +0 -1
  433. package/dist/commands/OutdatedCommand.d.ts.map +0 -1
  434. package/dist/commands/OutdatedCommand.js +0 -43
  435. package/dist/commands/OutdatedCommand.js.map +0 -1
  436. package/dist/commands/PackCommand.d.ts.map +0 -1
  437. package/dist/commands/PackCommand.js +0 -27
  438. package/dist/commands/PackCommand.js.map +0 -1
  439. package/dist/commands/PackageLifecycleCommand.d.ts.map +0 -1
  440. package/dist/commands/PackageLifecycleCommand.js +0 -149
  441. package/dist/commands/PackageLifecycleCommand.js.map +0 -1
  442. package/dist/commands/PostinstallCandidateBuilder.d.ts.map +0 -1
  443. package/dist/commands/PostinstallCandidateBuilder.js +0 -44
  444. package/dist/commands/PostinstallCandidateBuilder.js.map +0 -1
  445. package/dist/commands/ProjectGetNameCommand.d.ts.map +0 -1
  446. package/dist/commands/ProjectGetNameCommand.js +0 -26
  447. package/dist/commands/ProjectGetNameCommand.js.map +0 -1
  448. package/dist/commands/PublishCommand.d.ts.map +0 -1
  449. package/dist/commands/PublishCommand.js +0 -259
  450. package/dist/commands/PublishCommand.js.map +0 -1
  451. package/dist/commands/RegistryCommand.d.ts.map +0 -1
  452. package/dist/commands/RegistryCommand.js +0 -197
  453. package/dist/commands/RegistryCommand.js.map +0 -1
  454. package/dist/commands/RemoveCommand.d.ts.map +0 -1
  455. package/dist/commands/RemoveCommand.js +0 -48
  456. package/dist/commands/RemoveCommand.js.map +0 -1
  457. package/dist/commands/RequestsCommand.d.ts.map +0 -1
  458. package/dist/commands/RequestsCommand.js +0 -85
  459. package/dist/commands/RequestsCommand.js.map +0 -1
  460. package/dist/commands/UpdateCommand.d.ts.map +0 -1
  461. package/dist/commands/UpdateCommand.js +0 -113
  462. package/dist/commands/UpdateCommand.js.map +0 -1
  463. package/dist/commands/WhoamiCommand.d.ts.map +0 -1
  464. package/dist/commands/WhoamiCommand.js +0 -66
  465. package/dist/commands/WhoamiCommand.js.map +0 -1
  466. package/dist/commands/WhyCommand.d.ts.map +0 -1
  467. package/dist/commands/WhyCommand.js +0 -47
  468. package/dist/commands/WhyCommand.js.map +0 -1
  469. package/dist/commands/add/DependencyAddResolver.d.ts.map +0 -1
  470. package/dist/commands/add/DependencyAddResolver.js +0 -38
  471. package/dist/commands/add/DependencyAddResolver.js.map +0 -1
  472. package/dist/control-plane/AccountManager.d.ts.map +0 -1
  473. package/dist/control-plane/AccountManager.js +0 -822
  474. package/dist/control-plane/AccountManager.js.map +0 -1
  475. package/dist/control-plane/ArtifactObserver.d.ts.map +0 -1
  476. package/dist/control-plane/ArtifactObserver.js +0 -77
  477. package/dist/control-plane/ArtifactObserver.js.map +0 -1
  478. package/dist/control-plane/AuthMetadataStore.d.ts.map +0 -1
  479. package/dist/control-plane/AuthMetadataStore.js +0 -114
  480. package/dist/control-plane/AuthMetadataStore.js.map +0 -1
  481. package/dist/control-plane/AuthStoragePaths.d.ts.map +0 -1
  482. package/dist/control-plane/AuthStoragePaths.js +0 -22
  483. package/dist/control-plane/AuthStoragePaths.js.map +0 -1
  484. package/dist/control-plane/AuthenticationSelector.d.ts.map +0 -1
  485. package/dist/control-plane/AuthenticationSelector.js +0 -70
  486. package/dist/control-plane/AuthenticationSelector.js.map +0 -1
  487. package/dist/control-plane/ControlPlaneClient.d.ts.map +0 -1
  488. package/dist/control-plane/ControlPlaneClient.js +0 -291
  489. package/dist/control-plane/ControlPlaneClient.js.map +0 -1
  490. package/dist/control-plane/ControlPlaneEndpoints.d.ts.map +0 -1
  491. package/dist/control-plane/ControlPlaneEndpoints.js +0 -24
  492. package/dist/control-plane/ControlPlaneEndpoints.js.map +0 -1
  493. package/dist/control-plane/ControlPlaneTypes.d.ts.map +0 -1
  494. package/dist/control-plane/ControlPlaneTypes.js +0 -100
  495. package/dist/control-plane/ControlPlaneTypes.js.map +0 -1
  496. package/dist/control-plane/CredentialStore.d.ts.map +0 -1
  497. package/dist/control-plane/CredentialStore.js +0 -70
  498. package/dist/control-plane/CredentialStore.js.map +0 -1
  499. package/dist/control-plane/DPoPKeyStore.d.ts.map +0 -1
  500. package/dist/control-plane/DPoPKeyStore.js +0 -58
  501. package/dist/control-plane/DPoPKeyStore.js.map +0 -1
  502. package/dist/control-plane/GitHubActionsOidcCredentialProvider.d.ts.map +0 -1
  503. package/dist/control-plane/GitHubActionsOidcCredentialProvider.js +0 -201
  504. package/dist/control-plane/GitHubActionsOidcCredentialProvider.js.map +0 -1
  505. package/dist/control-plane/PublishIdempotencyStore.d.ts.map +0 -1
  506. package/dist/control-plane/PublishIdempotencyStore.js +0 -100
  507. package/dist/control-plane/PublishIdempotencyStore.js.map +0 -1
  508. package/dist/control-plane/PublishRequestErrorMapper.d.ts.map +0 -1
  509. package/dist/control-plane/PublishRequestErrorMapper.js +0 -597
  510. package/dist/control-plane/PublishRequestErrorMapper.js.map +0 -1
  511. package/dist/control-plane/RegistryGrantLock.d.ts.map +0 -1
  512. package/dist/control-plane/RegistryGrantLock.js +0 -163
  513. package/dist/control-plane/RegistryGrantLock.js.map +0 -1
  514. package/dist/control-plane/RegistryTrustResolver.d.ts.map +0 -1
  515. package/dist/control-plane/RegistryTrustResolver.js +0 -105
  516. package/dist/control-plane/RegistryTrustResolver.js.map +0 -1
  517. package/dist/postinstall/api/PostinstallDsl.d.ts.map +0 -1
  518. package/dist/postinstall/api/PostinstallDsl.js +0 -36
  519. package/dist/postinstall/api/PostinstallDsl.js.map +0 -1
  520. package/dist/postinstall/api/definePostinstall.d.ts.map +0 -1
  521. package/dist/postinstall/api/definePostinstall.js +0 -23
  522. package/dist/postinstall/api/definePostinstall.js.map +0 -1
  523. package/dist/postinstall/index.js +0 -25
  524. package/dist/postinstall/loader/EntryResolver.d.ts.map +0 -1
  525. package/dist/postinstall/loader/EntryResolver.js +0 -39
  526. package/dist/postinstall/loader/EntryResolver.js.map +0 -1
  527. package/dist/postinstall/loader/EsbuildTranspiler.d.ts.map +0 -1
  528. package/dist/postinstall/loader/EsbuildTranspiler.js +0 -54
  529. package/dist/postinstall/loader/EsbuildTranspiler.js.map +0 -1
  530. package/dist/postinstall/loader/ExportValidator.d.ts.map +0 -1
  531. package/dist/postinstall/loader/ExportValidator.js +0 -38
  532. package/dist/postinstall/loader/ExportValidator.js.map +0 -1
  533. package/dist/postinstall/loader/ModuleImporter.d.ts.map +0 -1
  534. package/dist/postinstall/loader/ModuleImporter.js +0 -52
  535. package/dist/postinstall/loader/ModuleImporter.js.map +0 -1
  536. package/dist/postinstall/loader/PostinstallLoader.d.ts.map +0 -1
  537. package/dist/postinstall/loader/PostinstallLoader.js +0 -64
  538. package/dist/postinstall/loader/PostinstallLoader.js.map +0 -1
  539. package/dist/postinstall/markers/MarkerBlockEditor.d.ts.map +0 -1
  540. package/dist/postinstall/markers/MarkerBlockEditor.js +0 -50
  541. package/dist/postinstall/markers/MarkerBlockEditor.js.map +0 -1
  542. package/dist/postinstall/markers/MarkerBlockService.d.ts.map +0 -1
  543. package/dist/postinstall/markers/MarkerBlockService.js +0 -46
  544. package/dist/postinstall/markers/MarkerBlockService.js.map +0 -1
  545. package/dist/postinstall/markers/MarkerIntegrityValidator.d.ts.map +0 -1
  546. package/dist/postinstall/markers/MarkerIntegrityValidator.js +0 -48
  547. package/dist/postinstall/markers/MarkerIntegrityValidator.js.map +0 -1
  548. package/dist/postinstall/policy/PostinstallPolicyGate.d.ts.map +0 -1
  549. package/dist/postinstall/policy/PostinstallPolicyGate.js +0 -68
  550. package/dist/postinstall/policy/PostinstallPolicyGate.js.map +0 -1
  551. package/dist/postinstall/runner/PostinstallOrchestrator.d.ts.map +0 -1
  552. package/dist/postinstall/runner/PostinstallOrchestrator.js +0 -174
  553. package/dist/postinstall/runner/PostinstallOrchestrator.js.map +0 -1
  554. package/dist/postinstall/unreal/BuildCsInjector.d.ts.map +0 -1
  555. package/dist/postinstall/unreal/BuildCsInjector.js +0 -60
  556. package/dist/postinstall/unreal/BuildCsInjector.js.map +0 -1
  557. package/dist/postinstall/unreal/CSharpInjectionEngine.d.ts.map +0 -1
  558. package/dist/postinstall/unreal/CSharpInjectionEngine.js +0 -58
  559. package/dist/postinstall/unreal/CSharpInjectionEngine.js.map +0 -1
  560. package/dist/postinstall/unreal/CSharpStructureAnalyzer.d.ts.map +0 -1
  561. package/dist/postinstall/unreal/CSharpStructureAnalyzer.js +0 -126
  562. package/dist/postinstall/unreal/CSharpStructureAnalyzer.js.map +0 -1
  563. package/dist/postinstall/unreal/CSharpStructures.d.ts.map +0 -1
  564. package/dist/postinstall/unreal/CSharpStructures.js +0 -1
  565. package/dist/postinstall/unreal/CSharpWrapperFactory.d.ts.map +0 -1
  566. package/dist/postinstall/unreal/CSharpWrapperFactory.js +0 -56
  567. package/dist/postinstall/unreal/CSharpWrapperFactory.js.map +0 -1
  568. package/dist/postinstall/unreal/PluginHash.d.ts.map +0 -1
  569. package/dist/postinstall/unreal/PluginHash.js +0 -18
  570. package/dist/postinstall/unreal/PluginHash.js.map +0 -1
  571. package/dist/postinstall/unreal/PrettyParseError.d.ts.map +0 -1
  572. package/dist/postinstall/unreal/PrettyParseError.js +0 -43
  573. package/dist/postinstall/unreal/PrettyParseError.js.map +0 -1
  574. package/dist/postinstall/unreal/ProjectFileLocator.d.ts.map +0 -1
  575. package/dist/postinstall/unreal/ProjectFileLocator.js +0 -51
  576. package/dist/postinstall/unreal/ProjectFileLocator.js.map +0 -1
  577. package/dist/postinstall/unreal/TargetCsInjector.d.ts.map +0 -1
  578. package/dist/postinstall/unreal/TargetCsInjector.js +0 -60
  579. package/dist/postinstall/unreal/TargetCsInjector.js.map +0 -1
  580. package/dist/postinstall/unreal/UProjectInjector.d.ts.map +0 -1
  581. package/dist/postinstall/unreal/UProjectInjector.js +0 -58
  582. package/dist/postinstall/unreal/UProjectInjector.js.map +0 -1
  583. package/dist/postinstall/unreal/UProjectMetadataReader.d.ts.map +0 -1
  584. package/dist/postinstall/unreal/UProjectMetadataReader.js +0 -24
  585. package/dist/postinstall/unreal/UProjectMetadataReader.js.map +0 -1
  586. package/dist/postinstall/unreal/UnrealSourceCatalog.d.ts.map +0 -1
  587. package/dist/postinstall/unreal/UnrealSourceCatalog.js +0 -52
  588. package/dist/postinstall/unreal/UnrealSourceCatalog.js.map +0 -1
  589. package/dist/prompts/InkPromptService.d.ts.map +0 -1
  590. package/dist/prompts/InkPromptService.js +0 -105
  591. package/dist/prompts/InkPromptService.js.map +0 -1
  592. package/dist/prompts/ProjectContextDetector.d.ts.map +0 -1
  593. package/dist/prompts/ProjectContextDetector.js +0 -33
  594. package/dist/prompts/ProjectContextDetector.js.map +0 -1
  595. package/dist/prompts/PromptService.d.ts.map +0 -1
  596. package/dist/prompts/PromptService.js +0 -1
  597. package/dist/reporting/DiagnosticDeduplicator.d.ts.map +0 -1
  598. package/dist/reporting/DiagnosticDeduplicator.js +0 -38
  599. package/dist/reporting/DiagnosticDeduplicator.js.map +0 -1
  600. package/dist/reporting/DiagnosticRenderer.d.ts.map +0 -1
  601. package/dist/reporting/DiagnosticRenderer.js +0 -1
  602. package/dist/reporting/DiagnosticReporter.d.ts.map +0 -1
  603. package/dist/reporting/DiagnosticReporter.js +0 -42
  604. package/dist/reporting/DiagnosticReporter.js.map +0 -1
  605. package/dist/reporting/InkDiagnosticRenderer.d.ts.map +0 -1
  606. package/dist/reporting/InkDiagnosticRenderer.js +0 -52
  607. package/dist/reporting/InkDiagnosticRenderer.js.map +0 -1
  608. package/dist/reporting/InstallProgressReporter.d.ts.map +0 -1
  609. package/dist/reporting/InstallProgressReporter.js +0 -50
  610. package/dist/reporting/InstallProgressReporter.js.map +0 -1
  611. package/dist/reporting/JsonReporter.d.ts.map +0 -1
  612. package/dist/reporting/JsonReporter.js +0 -36
  613. package/dist/reporting/JsonReporter.js.map +0 -1
  614. package/dist/reporting/RegistryRequestTerminalFormatter.d.ts.map +0 -1
  615. package/dist/reporting/RegistryRequestTerminalFormatter.js +0 -90
  616. package/dist/reporting/RegistryRequestTerminalFormatter.js.map +0 -1
  617. package/dist/reporting/TextDiagnosticRenderer.d.ts.map +0 -1
  618. package/dist/reporting/TextDiagnosticRenderer.js +0 -38
  619. package/dist/reporting/TextDiagnosticRenderer.js.map +0 -1
  620. package/dist/reporting/TextSink.d.ts.map +0 -1
  621. package/dist/reporting/TextSink.js +0 -29
  622. package/dist/reporting/TextSink.js.map +0 -1
  623. /package/dist/{cli-bootstrap.d.ts → types/uapkg/cli-bootstrap.d.ts} +0 -0
  624. /package/dist/{index.d.ts → types/uapkg/index.d.ts} +0 -0
  625. /package/dist/{postinstall → types/uapkg/postinstall}/index.d.ts +0 -0
@@ -1,822 +0,0 @@
1
- import { resolveAuthStoragePaths } from "./AuthStoragePaths.js";
2
- import { FileRegistryGrantLock } from "./RegistryGrantLock.js";
3
- import { AuthMetadataStore } from "./AuthMetadataStore.js";
4
- import { ControlPlaneError, OAuthScopeInsufficientError, OAuthScopeUnsupportedError, UAPKG_AUTHORIZATION_ISSUER, UAPKG_CLI_CLIENT_ID, UAPKG_CLI_SCOPES, UAPKG_CONTROL_PLANE_API, isUAPKGCliScope, parseUAPKGCliScopeString, registryAudience } from "./ControlPlaneTypes.js";
5
- import { ControlPlaneClient } from "./ControlPlaneClient.js";
6
- import { CredentialStore } from "./CredentialStore.js";
7
- import { DPoPKeyStore } from "./DPoPKeyStore.js";
8
- import { createControlPlaneCommandFailedDiagnostic } from "@uapkg/diagnostics";
9
- import { createServer } from "node:http";
10
- import { hostname } from "node:os";
11
- import isCI from "is-ci";
12
- import * as oauth from "oauth4webapi";
13
-
14
- //#region src/control-plane/AccountManager.ts
15
- const INTERACTIVE_LOGIN_TIMEOUT_MS = 18e4;
16
- const INTERACTIVE_LOGIN_FINALIZATION_TIMEOUT_MS = 6e4;
17
- const CLI_LOGIN_RECONCILIATION_TIMEOUT_MS = 5e3;
18
- const OAUTH_BACKCHANNEL_TIMEOUT_MS = 3e4;
19
- const LOOPBACK_CALLBACK_PATH = "/callback";
20
- const ACCOUNT_COMPLETION_PATH = "/cli-login/complete";
21
- const CONTROL_PLANE_SERVER_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/;
22
- var LoginError = class extends Error {
23
- code;
24
- oauthError;
25
- constructor(code, message, oauthError) {
26
- super(message);
27
- this.code = code;
28
- this.oauthError = oauthError;
29
- this.name = "LoginError";
30
- }
31
- };
32
- var AccountManager = class {
33
- metadata;
34
- credentials;
35
- openBrowser;
36
- isInteractiveLogin;
37
- interactiveLoginTimeoutMs;
38
- interactiveLoginFinalizationTimeoutMs;
39
- keyStore;
40
- accessTokenCache = /* @__PURE__ */ new Map();
41
- grantOperationTails = /* @__PURE__ */ new Map();
42
- grantLock;
43
- constructor(metadata = new AuthMetadataStore(), credentials = new CredentialStore(), openBrowser = async (url) => {
44
- const { default: open } = await import("open");
45
- await open(url, { wait: false });
46
- }, isInteractiveLogin = () => Boolean(process.stdin.isTTY && process.stdout.isTTY && !isCI), grantLock, interactiveLoginTimeoutMs = INTERACTIVE_LOGIN_TIMEOUT_MS, interactiveLoginFinalizationTimeoutMs = INTERACTIVE_LOGIN_FINALIZATION_TIMEOUT_MS) {
47
- this.metadata = metadata;
48
- this.credentials = credentials;
49
- this.openBrowser = openBrowser;
50
- this.isInteractiveLogin = isInteractiveLogin;
51
- this.interactiveLoginTimeoutMs = interactiveLoginTimeoutMs;
52
- this.interactiveLoginFinalizationTimeoutMs = interactiveLoginFinalizationTimeoutMs;
53
- this.keyStore = new DPoPKeyStore(credentials);
54
- const metadataPath = typeof metadata.path === "string" ? metadata.path : void 0;
55
- this.grantLock = grantLock ?? new FileRegistryGrantLock(resolveAuthStoragePaths(metadataPath).locksDirectory);
56
- }
57
- async hasGrant(trust) {
58
- return Boolean(await this.metadata.find(trust.issuer, trust.registryId));
59
- }
60
- invalidateAccessCredentials(trust) {
61
- for (const key of this.accessTokenCache.keys()) if (key.startsWith(`${trust.issuer}|${trust.registryId}|`)) this.accessTokenCache.delete(key);
62
- }
63
- async login(trust, options = {}) {
64
- this.assertPinnedTrust(trust);
65
- this.assertInteractiveLogin();
66
- await this.credentials.assertAvailable();
67
- const previous = await this.metadata.find(trust.issuer, trust.registryId);
68
- if (previous && !options.reauthorize) throw new Error(`This device already has a saved login for "${trust.alias}". Use \`uapkg login --registry ${trust.alias} --reauthorize\` to replace it.`);
69
- emitLoginProgress(options.onProgress, {
70
- type: "preparing",
71
- registryAlias: trust.alias
72
- });
73
- const issuer = new URL(trust.issuer);
74
- const as = await this.discover(issuer);
75
- this.validateAuthorizationServer(as);
76
- this.assertIssuerSupportsScopes(as, trust, UAPKG_CLI_SCOPES);
77
- const client = this.client();
78
- const keyPair = await this.keyStore.generate();
79
- const dpop = oauth.DPoP(client, keyPair);
80
- const publicKeyThumbprint = await dpop.calculateThumbprint();
81
- const receiver = await LoopbackAuthorizationReceiver.listen(issuer);
82
- let issuedRefreshToken;
83
- let retainedIssuedGrant = false;
84
- let preserveIssuedGrant = false;
85
- let callbackReceipt;
86
- let finalizationController;
87
- let finalizationTimeout;
88
- try {
89
- const codeVerifier = oauth.generateRandomCodeVerifier();
90
- const codeChallenge = await oauth.calculatePKCECodeChallenge(codeVerifier);
91
- const state = oauth.generateRandomState();
92
- const nonce = oauth.generateRandomNonce();
93
- const requestedScopes = [
94
- "openid",
95
- "offline_access",
96
- ...UAPKG_CLI_SCOPES
97
- ];
98
- const scope = requestedScopes.join(" ");
99
- const deviceName = normalizeDeviceName(options.deviceName);
100
- const parameters = new URLSearchParams({
101
- client_id: client.client_id,
102
- redirect_uri: receiver.redirectUri,
103
- response_type: "code",
104
- code_challenge: codeChallenge,
105
- code_challenge_method: "S256",
106
- state,
107
- nonce,
108
- scope,
109
- resource: trust.resource,
110
- dpop_jkt: publicKeyThumbprint,
111
- registry_id: trust.registryId,
112
- registry_source_fingerprint: trust.repositoryFingerprint,
113
- device_name: deviceName,
114
- max_age: "300"
115
- });
116
- if (requestedScopes.includes("offline_access")) parameters.set("prompt", "consent");
117
- const expectedPredecessorGrantId = options.reauthorize && previous ? previous.grantId : null;
118
- if (expectedPredecessorGrantId) parameters.set("replace_grant_id", expectedPredecessorGrantId);
119
- const pushed = await this.withDPoPNonceRetry(() => oauth.pushedAuthorizationRequest(as, client, oauth.None(), parameters, {
120
- DPoP: dpop,
121
- signal: () => AbortSignal.timeout(OAUTH_BACKCHANNEL_TIMEOUT_MS)
122
- }), (response) => oauth.processPushedAuthorizationResponse(as, client, response));
123
- if (!as.authorization_endpoint) throw new Error("The authorization server did not advertise an authorization endpoint.");
124
- const authorizationUrl = new URL(as.authorization_endpoint);
125
- authorizationUrl.searchParams.set("client_id", client.client_id);
126
- authorizationUrl.searchParams.set("request_uri", pushed.request_uri);
127
- emitLoginProgress(options.onProgress, { type: "opening-browser" });
128
- try {
129
- await this.openBrowser(authorizationUrl.href);
130
- } catch {
131
- emitLoginProgress(options.onProgress, {
132
- type: "browser-open-failed",
133
- authorizationUrl: authorizationUrl.href
134
- });
135
- }
136
- emitLoginProgress(options.onProgress, { type: "waiting-for-decision" });
137
- callbackReceipt = await receiver.waitForCallback(this.interactiveLoginTimeoutMs, trust.alias);
138
- finalizationController = new AbortController();
139
- finalizationTimeout = setTimeout(() => {
140
- finalizationController?.abort(loginFinalizationTimeoutError(trust.alias));
141
- }, this.interactiveLoginFinalizationTimeoutMs);
142
- const finalizationSignal = finalizationController.signal;
143
- const callbackUrl = callbackReceipt.url;
144
- if (callbackUrl.searchParams.get("iss") !== trust.issuer) throw new LoginError("LOGIN_AUTHORIZATION_RESPONSE_INVALID", "The browser authorization response came from an unexpected issuer. Run `uapkg login` again.");
145
- let callbackParameters;
146
- try {
147
- callbackParameters = oauth.validateAuthResponse(as, client, callbackUrl, state);
148
- } catch (error) {
149
- throw authorizationResponseLoginError(error);
150
- }
151
- emitLoginProgress(options.onProgress, { type: "approval-received" });
152
- const tokens = await this.withDPoPNonceRetry(() => oauth.authorizationCodeGrantRequest(as, client, oauth.None(), callbackParameters, receiver.redirectUri, codeVerifier, {
153
- DPoP: dpop,
154
- signal: finalizationSignal
155
- }), (response) => oauth.processAuthorizationCodeResponse(as, client, response, {
156
- expectedNonce: nonce,
157
- maxAge: 300,
158
- requireIdToken: true
159
- }));
160
- finalizationSignal.throwIfAborted();
161
- if (tokens.token_type !== "dpop") throw new Error("The authorization server did not issue a DPoP-bound access token.");
162
- if (!tokens.refresh_token) throw new Error("The authorization server did not issue a persistent registry grant.");
163
- const refreshToken = tokens.refresh_token;
164
- issuedRefreshToken = refreshToken;
165
- const controlPlane = new ControlPlaneClient(trust.apiBaseUrl);
166
- const issuedCredential = {
167
- kind: "dpop",
168
- accessToken: tokens.access_token,
169
- dpop,
170
- registryAlias: trust.alias,
171
- requestedScopes: UAPKG_CLI_SCOPES
172
- };
173
- const self = await controlPlane.getCliLoginConfirmation(issuedCredential, finalizationSignal);
174
- finalizationSignal.throwIfAborted();
175
- if (self.grant.replacesGrantId !== expectedPredecessorGrantId) throw loginReplacementBindingError(trust.alias);
176
- if (self.registry.id !== trust.registryId) throw new Error("The authorization server returned a registry grant for an unexpected registry.");
177
- const missingScopes = UAPKG_CLI_SCOPES.filter((scope) => !self.grant.scopes.includes(scope));
178
- if (missingScopes.length > 0) throw new Error(`The authorization server omitted required CLI capabilities: ${missingScopes.join(", ")}.`);
179
- if (self.grant.status === "pending" && timestampFromIso(self.grant.activationExpiresAt) <= Math.floor(Date.now() / 1e3)) throw new LoginError("LOGIN_AUTHORIZATION_TIMEOUT", `Login approval expired before this device could confirm it. Run \`uapkg login --registry ${trust.alias}\` to try again.`);
180
- const grantId = self.grant.id;
181
- const keyReference = this.credentials.createReference("dpop-key", trust.issuer, trust.registryId, grantId);
182
- const refreshTokenReference = this.credentials.createReference("grant", trust.issuer, trust.registryId, grantId);
183
- const metadata = {
184
- issuer: trust.issuer,
185
- registryId: trust.registryId,
186
- registryName: trust.registryName,
187
- grantId,
188
- clientId: client.client_id,
189
- keyReference,
190
- refreshTokenReference,
191
- publicKeyThumbprint,
192
- deviceName: self.grant.deviceName,
193
- repositoryFingerprint: trust.repositoryFingerprint,
194
- account: self.account,
195
- createdAt: Math.floor(Date.now() / 1e3),
196
- idleExpiresAt: timestampFromIso(self.grant.idleExpiresAt),
197
- expiresAt: timestampFromIso(self.grant.absoluteExpiresAt)
198
- };
199
- let previousForCleanup;
200
- await this.serializeGrantOperation(trust, async () => {
201
- const currentPrevious = await this.metadata.find(trust.issuer, trust.registryId);
202
- if (!isSameRegistryGrant(previous, currentPrevious)) {
203
- if (options.reauthorize) throw loginReauthorizationConflictError(trust.alias);
204
- throw new Error(`This device already has a saved login for "${trust.alias}". Use \`uapkg login --registry ${trust.alias} --reauthorize\` to replace it.`);
205
- }
206
- if (currentPrevious && !options.reauthorize) throw new Error(`This device already has a saved login for "${trust.alias}". Use \`uapkg login --registry ${trust.alias} --reauthorize\` to replace it.`);
207
- emitLoginProgress(options.onProgress, { type: "saving-local-credentials" });
208
- await this.persistPreparedGrant(metadata, keyPair, refreshToken, currentPrevious, finalizationSignal);
209
- if (self.grant.status === "pending") {
210
- emitLoginProgress(options.onProgress, { type: "confirming-with-service" });
211
- const activation = await this.activatePreparedGrant(controlPlane, issuedCredential, metadata.grantId, expectedPredecessorGrantId, finalizationSignal, trust.alias);
212
- if (activation.kind === "rejected") {
213
- await this.rollbackPreparedGrant(metadata, currentPrevious);
214
- throw activation.error;
215
- }
216
- if (activation.kind === "ambiguous") {
217
- preserveIssuedGrant = true;
218
- throw activation.error;
219
- }
220
- }
221
- retainedIssuedGrant = true;
222
- this.invalidateAccessCredentials(trust);
223
- if (finalizationTimeout) {
224
- clearTimeout(finalizationTimeout);
225
- finalizationTimeout = void 0;
226
- }
227
- previousForCleanup = currentPrevious;
228
- });
229
- await callbackReceipt.complete("success");
230
- let warnings = [];
231
- if (previousForCleanup) try {
232
- warnings = await this.serializeGrantOperation(trust, () => this.cleanupPreviousLocalCredentials(metadata, previousForCleanup));
233
- } catch {
234
- warnings = ["The new login is active, but UAPKG could not remove one or more old protected credential entries. Remove the stale UAPKG entries from the operating-system credential store."];
235
- }
236
- return {
237
- grant: metadata,
238
- warnings
239
- };
240
- } catch (error) {
241
- if (finalizationTimeout) {
242
- clearTimeout(finalizationTimeout);
243
- finalizationTimeout = void 0;
244
- }
245
- const failure = error instanceof LoginError ? error : finalizationController?.signal.aborted && finalizationController.signal.reason instanceof LoginError ? finalizationController.signal.reason : error;
246
- if (issuedRefreshToken && !retainedIssuedGrant && !preserveIssuedGrant) await this.revokeToken(as, client, issuedRefreshToken, dpop).catch(() => void 0);
247
- const loginError = normalizeLoginError(failure);
248
- if (callbackReceipt) {
249
- const outcome = loginError.code === "LOGIN_ACCESS_DENIED" ? "denied" : "failed";
250
- await callbackReceipt.complete(outcome).catch(() => void 0);
251
- }
252
- throw loginError;
253
- } finally {
254
- if (finalizationTimeout) clearTimeout(finalizationTimeout);
255
- receiver.close();
256
- }
257
- }
258
- async getAccessCredential(trust, scopes) {
259
- this.assertPinnedTrust(trust);
260
- const requestedScopes = [...new Set(scopes)].sort();
261
- if (requestedScopes.length === 0 || requestedScopes.some((scope) => !isUAPKGCliScope(scope))) throw new Error("A control-plane operation requested an unsupported OAuth capability scope.");
262
- const grant = await this.requireUsableGrant(trust);
263
- const as = await this.discover(new URL(trust.issuer));
264
- this.assertIssuerSupportsScopes(as, trust, requestedScopes);
265
- const cacheKey = this.accessTokenCacheKey(grant, requestedScopes);
266
- const cached = this.accessTokenCache.get(cacheKey);
267
- if (cached && cached.expiresAt > Date.now() + 15e3) return {
268
- grant,
269
- credential: {
270
- kind: "dpop",
271
- accessToken: cached.token,
272
- dpop: cached.dpop,
273
- registryAlias: trust.alias,
274
- requestedScopes
275
- }
276
- };
277
- return this.serializeGrantOperation(trust, async () => {
278
- const currentGrant = await this.requireUsableGrant(trust);
279
- const currentCacheKey = this.accessTokenCacheKey(currentGrant, requestedScopes);
280
- const refreshedCached = this.accessTokenCache.get(currentCacheKey);
281
- if (refreshedCached && refreshedCached.expiresAt > Date.now() + 15e3) return {
282
- grant: currentGrant,
283
- credential: {
284
- kind: "dpop",
285
- accessToken: refreshedCached.token,
286
- dpop: refreshedCached.dpop,
287
- registryAlias: trust.alias,
288
- requestedScopes
289
- }
290
- };
291
- const pair = await this.keyStore.load(currentGrant.keyReference);
292
- if (!pair) throw missingKeyError(trust);
293
- const client = this.client();
294
- const dpop = oauth.DPoP(client, pair);
295
- if (await dpop.calculateThumbprint() !== currentGrant.publicKeyThumbprint) throw missingKeyError(trust);
296
- const refreshToken = await this.credentials.get(currentGrant.refreshTokenReference);
297
- if (!refreshToken) throw new Error(`The saved login for "${trust.alias}" is missing its protected registry grant. Run \`uapkg login --registry ${trust.alias}\` again.`);
298
- let tokenResponse;
299
- try {
300
- tokenResponse = await this.withDPoPNonceRetry(() => oauth.refreshTokenGrantRequest(as, client, oauth.None(), refreshToken, {
301
- DPoP: dpop,
302
- additionalParameters: {
303
- resource: trust.resource,
304
- scope: requestedScopes.join(" ")
305
- }
306
- }), (response) => oauth.processRefreshTokenResponse(as, client, response));
307
- } catch (error) {
308
- if (error instanceof oauth.ResponseBodyError && error.error === "invalid_scope") {
309
- const hintedScopes = parseUAPKGCliScopeString(error.cause.scope).filter((scope) => requestedScopes.includes(scope));
310
- const missingScopes = hintedScopes.length > 0 ? hintedScopes : requestedScopes;
311
- throw new OAuthScopeInsufficientError("The saved registry grant does not include every OAuth scope required by this operation.", trust.alias, requestedScopes, requestedScopes, missingScopes, 403, { cause: error });
312
- }
313
- if (error instanceof oauth.ResponseBodyError && (error.error === "invalid_grant" || error.error === "invalid_token")) throw new Error(`Your saved login for "${trust.alias}" is no longer valid. Run \`uapkg login --registry ${trust.alias} --reauthorize\` to authenticate again.`, { cause: error });
314
- throw error;
315
- }
316
- if (tokenResponse.token_type !== "dpop") throw new Error("The authorization server returned an access token that is not DPoP-bound.");
317
- if (tokenResponse.refresh_token && tokenResponse.refresh_token !== refreshToken) await this.credentials.set(currentGrant.refreshTokenReference, tokenResponse.refresh_token);
318
- const expiresAt = Date.now() + Math.max(1, tokenResponse.expires_in ?? 300) * 1e3;
319
- this.accessTokenCache.set(currentCacheKey, {
320
- token: tokenResponse.access_token,
321
- expiresAt,
322
- dpop
323
- });
324
- return {
325
- grant: currentGrant,
326
- credential: {
327
- kind: "dpop",
328
- accessToken: tokenResponse.access_token,
329
- dpop,
330
- registryAlias: trust.alias,
331
- requestedScopes
332
- }
333
- };
334
- });
335
- }
336
- async logout(trust, localOnly = false) {
337
- this.assertPinnedTrust(trust);
338
- return this.serializeGrantOperation(trust, async () => {
339
- const grant = await this.metadata.find(trust.issuer, trust.registryId);
340
- if (!grant) return "not-logged-in";
341
- if (!localOnly) try {
342
- await this.revokeSavedGrant(grant);
343
- } catch (error) {
344
- throw new Error(`Unable to revoke the registry grant for "${trust.alias}". The local login was kept so you can retry. Use --local-only only if you accept that account-site revocation may still be required.`, { cause: error });
345
- }
346
- await Promise.all([this.keyStore.delete(grant.keyReference), this.credentials.delete(grant.refreshTokenReference)]);
347
- await this.metadata.remove(grant.issuer, grant.registryId);
348
- this.invalidateAccessCredentials(trust);
349
- return "removed";
350
- });
351
- }
352
- async requireUsableGrant(trust) {
353
- const grant = await this.metadata.find(trust.issuer, trust.registryId);
354
- if (!grant) throw new Error(`You are not logged in to "${trust.alias}". Run \`uapkg login --registry ${trust.alias}\`.`);
355
- if (grant.repositoryFingerprint !== trust.repositoryFingerprint) throw new Error(`The configured Git source for "${trust.alias}" does not match the source authorized by the saved login. Run \`uapkg login --registry ${trust.alias} --reauthorize\`.`);
356
- const now = Math.floor(Date.now() / 1e3);
357
- if (grant.expiresAt && grant.expiresAt <= now) throw new Error(`Your saved login for "${trust.alias}" has expired. Run \`uapkg login --registry ${trust.alias}\` again.`);
358
- return grant;
359
- }
360
- async revokeSavedGrant(grant) {
361
- const refreshToken = await this.credentials.get(grant.refreshTokenReference);
362
- if (!refreshToken) throw new Error("The registry grant cannot be revoked because its protected credential is missing.");
363
- const pair = await this.keyStore.load(grant.keyReference);
364
- if (!pair) throw new Error("The registry grant cannot be revoked because its DPoP key is missing.");
365
- const dpop = oauth.DPoP(this.client(), pair);
366
- if (await dpop.calculateThumbprint() !== grant.publicKeyThumbprint) throw new Error("The registry grant cannot be revoked because its DPoP key has changed.");
367
- const as = await this.discover(new URL(grant.issuer));
368
- await this.revokeToken(as, this.client(), refreshToken, dpop);
369
- }
370
- async activatePreparedGrant(controlPlane, credential, expectedGrantId, expectedPredecessorGrantId, signal, registryAlias) {
371
- try {
372
- const confirmed = await controlPlane.confirmCliLogin(credential, signal);
373
- if (confirmed.id === expectedGrantId && confirmed.replacesGrantId === expectedPredecessorGrantId) return { kind: "active" };
374
- return this.reconcilePreparedGrant(controlPlane, credential, expectedGrantId, expectedPredecessorGrantId, registryAlias);
375
- } catch (error) {
376
- if (isCliLoginReauthorizationConflict(error)) return {
377
- kind: "rejected",
378
- error: reauthorizationConflictLoginError(error)
379
- };
380
- if (isDefinitiveCliLoginConfirmationRejection(error)) return {
381
- kind: "rejected",
382
- error
383
- };
384
- return this.reconcilePreparedGrant(controlPlane, credential, expectedGrantId, expectedPredecessorGrantId, registryAlias);
385
- }
386
- }
387
- async reconcilePreparedGrant(controlPlane, credential, expectedGrantId, expectedPredecessorGrantId, registryAlias) {
388
- const signal = AbortSignal.timeout(CLI_LOGIN_RECONCILIATION_TIMEOUT_MS);
389
- let retryActivation = true;
390
- try {
391
- const observed = await controlPlane.getCliLoginConfirmation(credential, signal);
392
- if (observed.grant.id !== expectedGrantId || observed.grant.replacesGrantId !== expectedPredecessorGrantId) retryActivation = false;
393
- else if (observed.grant.status === "active") return { kind: "active" };
394
- } catch {}
395
- if (retryActivation) try {
396
- const confirmed = await controlPlane.confirmCliLogin(credential, signal);
397
- if (confirmed.id === expectedGrantId && confirmed.replacesGrantId === expectedPredecessorGrantId) return { kind: "active" };
398
- } catch {}
399
- try {
400
- const observed = await controlPlane.getCliLoginConfirmation(credential, signal);
401
- if (observed.grant.id === expectedGrantId && observed.grant.replacesGrantId === expectedPredecessorGrantId && observed.grant.status === "active") return { kind: "active" };
402
- } catch {}
403
- return {
404
- kind: "ambiguous",
405
- error: loginConfirmationAmbiguousError(registryAlias)
406
- };
407
- }
408
- async persistPreparedGrant(metadata, keyPair, refreshToken, previous, signal) {
409
- let metadataWriteAttempted = false;
410
- try {
411
- signal?.throwIfAborted();
412
- await this.keyStore.save(metadata.keyReference, keyPair);
413
- signal?.throwIfAborted();
414
- await this.credentials.set(metadata.refreshTokenReference, refreshToken);
415
- signal?.throwIfAborted();
416
- metadataWriteAttempted = true;
417
- await this.metadata.upsert(metadata);
418
- signal?.throwIfAborted();
419
- } catch (error) {
420
- const cleanup = [this.keyStore.delete(metadata.keyReference), this.credentials.delete(metadata.refreshTokenReference)];
421
- let metadataRollbackIndex;
422
- if (metadataWriteAttempted) {
423
- metadataRollbackIndex = cleanup.length;
424
- cleanup.push(previous ? this.metadata.upsert(previous) : this.metadata.remove(metadata.issuer, metadata.registryId));
425
- }
426
- const cleanupResults = await Promise.allSettled(cleanup);
427
- if (metadataRollbackIndex !== void 0 && cleanupResults[metadataRollbackIndex]?.status === "rejected") throw new LoginError("LOGIN_FAILED", "Login failed, and UAPKG could not roll back the local login metadata safely. Check `uapkg whoami --json` before retrying.");
428
- throw error;
429
- }
430
- }
431
- async rollbackPreparedGrant(metadata, previous) {
432
- if ((await Promise.allSettled([
433
- this.keyStore.delete(metadata.keyReference),
434
- this.credentials.delete(metadata.refreshTokenReference),
435
- previous ? this.metadata.upsert(previous) : this.metadata.remove(metadata.issuer, metadata.registryId)
436
- ])).some(({ status }) => status === "rejected")) throw new LoginError("LOGIN_FAILED", "Login confirmation failed, and UAPKG could not roll back the local login safely. Check `uapkg whoami --json` before retrying.");
437
- }
438
- async cleanupPreviousLocalCredentials(metadata, previous) {
439
- if (!previous) return [];
440
- if (previous.grantId === metadata.grantId || previous.keyReference === metadata.keyReference && previous.refreshTokenReference === metadata.refreshTokenReference) return [];
441
- const cleanupResults = await Promise.allSettled([this.keyStore.delete(previous.keyReference), this.credentials.delete(previous.refreshTokenReference)]);
442
- const warnings = [];
443
- if (cleanupResults.some(({ status }) => status === "rejected")) warnings.push("The previous registry grant was replaced, but one or more old protected credential entries could not be removed. Remove the stale UAPKG entries from the operating-system credential store.");
444
- return warnings;
445
- }
446
- async revokeToken(as, client, refreshToken, dpop) {
447
- const signer = signingDPoPHandle(dpop);
448
- await this.withDPoPNonceRetry(() => oauth.revocationRequest(as, client, oauth.None(), refreshToken, {
449
- additionalParameters: { token_type_hint: "refresh_token" },
450
- signal: AbortSignal.timeout(OAUTH_BACKCHANNEL_TIMEOUT_MS),
451
- [oauth.customFetch]: async (url, options) => {
452
- const endpoint = new URL(url);
453
- const headers = new Headers(options.headers);
454
- await signer.addProof(endpoint, headers, "POST");
455
- const response = await fetch(url, {
456
- ...options,
457
- headers
458
- });
459
- signer.cacheNonce(response, endpoint);
460
- return response;
461
- }
462
- }), (response) => oauth.processRevocationResponse(response));
463
- }
464
- async discover(issuer) {
465
- const discoveryUrl = oidcDiscoveryUrl(issuer);
466
- let response;
467
- try {
468
- response = await oauth.discoveryRequest(issuer, {
469
- algorithm: "oidc",
470
- signal: AbortSignal.timeout(OAUTH_BACKCHANNEL_TIMEOUT_MS)
471
- });
472
- } catch {
473
- throw new Error(`Unable to retrieve OAuth metadata for build-pinned issuer "${issuer.href}" from discovery URL "${discoveryUrl.href}".`);
474
- }
475
- try {
476
- return await oauth.processDiscoveryResponse(issuer, response);
477
- } catch {
478
- throw new Error(`Invalid OAuth metadata for build-pinned issuer "${issuer.href}" from discovery URL "${discoveryUrl.href}" (HTTP ${response.status}).`);
479
- }
480
- }
481
- validateAuthorizationServer(as) {
482
- if (!as.authorization_endpoint || !as.token_endpoint || !as.pushed_authorization_request_endpoint) throw new Error("The UAPKG authorization server is missing required authorization, token, or PAR endpoints.");
483
- if (!as.revocation_endpoint) throw new Error("The UAPKG authorization server is missing its grant revocation endpoint.");
484
- if (as.code_challenge_methods_supported && !as.code_challenge_methods_supported.includes("S256")) throw new Error("The UAPKG authorization server does not support PKCE S256.");
485
- if (as.dpop_signing_alg_values_supported && !as.dpop_signing_alg_values_supported.includes("ES256")) throw new Error("The UAPKG authorization server does not support ES256 DPoP proofs.");
486
- }
487
- assertIssuerSupportsScopes(as, trust, requestedScopes) {
488
- const advertisedScopes = new Set(Array.isArray(as.scopes_supported) ? as.scopes_supported : []);
489
- const unsupportedScopes = requestedScopes.filter((scope) => !advertisedScopes.has(scope));
490
- if (unsupportedScopes.length > 0) throw new OAuthScopeUnsupportedError(trust.alias, requestedScopes, unsupportedScopes);
491
- }
492
- client() {
493
- return {
494
- client_id: UAPKG_CLI_CLIENT_ID,
495
- token_endpoint_auth_method: "none"
496
- };
497
- }
498
- assertPinnedTrust(trust) {
499
- if (trust.issuer !== UAPKG_AUTHORIZATION_ISSUER || trust.apiBaseUrl !== UAPKG_CONTROL_PLANE_API || trust.resource !== registryAudience(trust.registryId)) throw new Error("UAPKG v1 does not accept project-configured authorization issuers or API URLs.");
500
- }
501
- assertInteractiveLogin() {
502
- if (this.isInteractiveLogin()) return;
503
- throw new Error([
504
- "Unable to complete interactive login on this machine.",
505
- "",
506
- "Persistent login is not supported in headless environments.",
507
- "",
508
- "For automated publishing, configure a GitHub Actions OIDC trusted publisher.",
509
- "For interactive publishing, run `uapkg login` from a trusted, browser-capable workstation."
510
- ].join("\n"));
511
- }
512
- async withDPoPNonceRetry(request, processResponse) {
513
- try {
514
- return await processResponse(await request());
515
- } catch (error) {
516
- if (!oauth.isDPoPNonceError(error)) throw error;
517
- return processResponse(await request());
518
- }
519
- }
520
- accessTokenCacheKey(grant, scopes) {
521
- return `${grant.issuer}|${grant.registryId}|${grant.grantId}|${scopes.join(" ")}`;
522
- }
523
- async serializeGrantOperation(trust, operation) {
524
- const key = `${trust.issuer}|${trust.registryId}`;
525
- const result = (this.grantOperationTails.get(key) ?? Promise.resolve()).then(() => this.grantLock.withLock(trust.issuer, trust.registryId, operation));
526
- const tail = result.then(() => void 0, () => void 0);
527
- this.grantOperationTails.set(key, tail);
528
- try {
529
- return await result;
530
- } finally {
531
- if (this.grantOperationTails.get(key) === tail) this.grantOperationTails.delete(key);
532
- }
533
- }
534
- };
535
- function signingDPoPHandle(handle) {
536
- const signer = handle;
537
- if (typeof signer.addProof !== "function" || typeof signer.cacheNonce !== "function") throw new Error("The installed OAuth implementation cannot sender-constrain grant revocation.");
538
- return signer;
539
- }
540
- var LoopbackAuthorizationReceiver = class LoopbackAuthorizationReceiver {
541
- server;
542
- callbackPath;
543
- expectedHost;
544
- completionUrl;
545
- redirectUri;
546
- callbackPromise;
547
- callbackResolve;
548
- callbackReject;
549
- receivedReceipt;
550
- timeout;
551
- state = "listening";
552
- terminalError;
553
- pendingResponse;
554
- completion;
555
- constructor(server, callbackPath, expectedHost, completionUrl, redirectUri) {
556
- this.server = server;
557
- this.callbackPath = callbackPath;
558
- this.expectedHost = expectedHost;
559
- this.completionUrl = completionUrl;
560
- this.redirectUri = redirectUri;
561
- }
562
- static async listen(issuer) {
563
- const callbackPath = LOOPBACK_CALLBACK_PATH;
564
- let receiver;
565
- const server = createServer((request, response) => {
566
- if (!receiver) {
567
- response.writeHead(503).end();
568
- return;
569
- }
570
- receiver.receive(request, response);
571
- });
572
- await new Promise((resolve, reject) => {
573
- server.once("error", reject);
574
- server.listen(0, "127.0.0.1", () => resolve());
575
- });
576
- const address = server.address();
577
- if (!address || typeof address === "string") {
578
- server.close();
579
- throw new Error("Unable to determine the interactive login callback address.");
580
- }
581
- const expectedHost = `127.0.0.1:${address.port}`;
582
- receiver = new LoopbackAuthorizationReceiver(server, callbackPath, expectedHost, new URL(ACCOUNT_COMPLETION_PATH, issuer.origin), `http://${expectedHost}${callbackPath}`);
583
- return receiver;
584
- }
585
- async waitForCallback(timeoutMs, registryAlias) {
586
- if (this.receivedReceipt) return this.receivedReceipt;
587
- if (this.state === "closed") throw this.terminalError ?? new LoginError("LOGIN_FAILED", "The browser authorization listener was closed.");
588
- if (this.callbackPromise) return this.callbackPromise;
589
- this.callbackPromise = new Promise((resolve, reject) => {
590
- this.callbackResolve = resolve;
591
- this.callbackReject = reject;
592
- this.timeout = setTimeout(() => {
593
- if (this.state !== "listening") return;
594
- this.terminate(new LoginError("LOGIN_AUTHORIZATION_TIMEOUT", registryAlias ? `Login timed out while waiting for browser authorization. Run \`uapkg login --registry ${registryAlias}\` to try again.` : "Login timed out while waiting for browser authorization. Run `uapkg login` to try again."));
595
- }, timeoutMs);
596
- });
597
- return this.callbackPromise;
598
- }
599
- close() {
600
- this.terminate(new LoginError("LOGIN_FAILED", "The browser authorization listener was closed."));
601
- }
602
- receive(request, response) {
603
- if (this.state !== "listening" || request.method !== "GET" || request.headers.host !== this.expectedHost || request.url !== this.callbackPath && !request.url?.startsWith(`${this.callbackPath}?`)) {
604
- rejectLoopbackRequest(response);
605
- return;
606
- }
607
- let url;
608
- try {
609
- url = new URL(request.url, this.redirectUri);
610
- } catch {
611
- rejectLoopbackRequest(response);
612
- return;
613
- }
614
- if (url.origin !== new URL(this.redirectUri).origin || url.pathname !== this.callbackPath) {
615
- rejectLoopbackRequest(response);
616
- return;
617
- }
618
- this.state = "callback-accepted";
619
- if (this.timeout) clearTimeout(this.timeout);
620
- this.timeout = void 0;
621
- this.pendingResponse = response;
622
- const receipt = {
623
- url,
624
- complete: (outcome) => this.complete(response, outcome)
625
- };
626
- this.receivedReceipt = receipt;
627
- this.callbackResolve?.(receipt);
628
- this.callbackResolve = void 0;
629
- this.callbackReject = void 0;
630
- }
631
- complete(response, outcome) {
632
- if (this.completion) return this.completion;
633
- this.completion = new Promise((resolve) => {
634
- let settled = false;
635
- const finish = () => {
636
- if (settled) return;
637
- settled = true;
638
- this.pendingResponse = void 0;
639
- this.close();
640
- resolve();
641
- };
642
- response.once("finish", finish);
643
- response.once("close", finish);
644
- response.once("error", finish);
645
- if (response.destroyed || response.writableEnded) {
646
- finish();
647
- return;
648
- }
649
- const location = new URL(this.completionUrl);
650
- location.hash = new URLSearchParams({ result: outcome }).toString();
651
- try {
652
- response.writeHead(303, {
653
- location: location.href,
654
- "cache-control": "no-store",
655
- "referrer-policy": "no-referrer",
656
- "content-length": "0",
657
- "x-content-type-options": "nosniff",
658
- connection: "close"
659
- }).end();
660
- } catch {
661
- finish();
662
- }
663
- });
664
- return this.completion;
665
- }
666
- terminate(error) {
667
- if (this.state === "closed") return;
668
- this.state = "closed";
669
- this.terminalError = error;
670
- if (this.timeout) clearTimeout(this.timeout);
671
- this.timeout = void 0;
672
- this.callbackReject?.(error);
673
- this.callbackResolve = void 0;
674
- this.callbackReject = void 0;
675
- if (this.pendingResponse && !this.pendingResponse.writableEnded) this.pendingResponse.destroy();
676
- this.pendingResponse = void 0;
677
- this.server.close();
678
- }
679
- };
680
- function rejectLoopbackRequest(response) {
681
- response.writeHead(404, {
682
- "cache-control": "no-store",
683
- "content-type": "text/plain; charset=utf-8",
684
- "x-content-type-options": "nosniff"
685
- }).end("Not found.");
686
- }
687
- function normalizeDeviceName(value) {
688
- return (value?.trim() || hostname().trim() || "UAPKG CLI").slice(0, 80);
689
- }
690
- function oidcDiscoveryUrl(issuer) {
691
- const discoveryUrl = new URL(issuer);
692
- discoveryUrl.pathname = `${discoveryUrl.pathname.replace(/\/+$/, "")}/.well-known/openid-configuration`;
693
- return discoveryUrl;
694
- }
695
- function timestampFromIso(value) {
696
- const parsed = Date.parse(value);
697
- if (!Number.isFinite(parsed)) throw new Error("The authorization server returned an invalid registry-grant expiration.");
698
- return Math.floor(parsed / 1e3);
699
- }
700
- function missingKeyError(trust) {
701
- return new Error([
702
- `The saved login for "${trust.alias}" cannot be used because its device-bound signing key is missing or has changed.`,
703
- "",
704
- "This can happen after copying configuration to another computer, resetting secure storage,",
705
- "restoring an incomplete backup, or reinstalling the operating system.",
706
- "",
707
- `Run \`uapkg login --registry ${trust.alias} --reauthorize\` to authorize this device again.`
708
- ].join("\n"));
709
- }
710
- function loginFinalizationTimeoutError(registryAlias) {
711
- return new LoginError("LOGIN_AUTHORIZATION_TIMEOUT", `Login timed out while verifying and saving browser authorization. No new login was saved. Run \`uapkg login --registry ${registryAlias}\` to try again.`);
712
- }
713
- function loginConfirmationAmbiguousError(registryAlias) {
714
- return new LoginError("LOGIN_FAILED", [
715
- "UAPKG could not determine whether the service activated this login.",
716
- "Your saved credentials were kept because this login may be active.",
717
- `Run \`uapkg whoami --registry ${registryAlias}\` to check the login before retrying.`
718
- ].join(" "));
719
- }
720
- function loginReauthorizationConflictError(registryAlias) {
721
- return new LoginError("LOGIN_REAUTHORIZATION_CONFLICT", `The saved login for "${registryAlias}" changed while reauthorization was in progress. The newer local login was preserved. Run \`uapkg login --registry ${registryAlias} --reauthorize\` again if you still want to replace it.`);
722
- }
723
- function loginReplacementBindingError(registryAlias) {
724
- return new LoginError("LOGIN_REAUTHORIZATION_CONFLICT", `The authorization service did not bind this login to the expected saved grant for "${registryAlias}". No new local login was saved. Run \`uapkg login --registry ${registryAlias} --reauthorize\` to try again.`);
725
- }
726
- function reauthorizationConflictLoginError(error) {
727
- return new LoginError("LOGIN_REAUTHORIZATION_CONFLICT", error.message);
728
- }
729
- function isCliLoginReauthorizationConflict(error) {
730
- return error instanceof ControlPlaneError && error.code === "CLI_LOGIN_REAUTHORIZATION_CONFLICT";
731
- }
732
- function isSameRegistryGrant(expected, current) {
733
- if (!expected || !current) return expected === current;
734
- return expected.grantId === current.grantId && expected.keyReference === current.keyReference && expected.refreshTokenReference === current.refreshTokenReference;
735
- }
736
- function isDefinitiveCliLoginConfirmationRejection(error) {
737
- if (!(error instanceof ControlPlaneError) || error.status === void 0) return false;
738
- if (error.status < 400 || error.status >= 500) return false;
739
- return ![
740
- 408,
741
- 409,
742
- 425,
743
- 429
744
- ].includes(error.status);
745
- }
746
- function emitLoginProgress(onProgress, event) {
747
- try {
748
- onProgress?.(event);
749
- } catch {}
750
- }
751
- function authorizationResponseLoginError(error) {
752
- if (error instanceof oauth.AuthorizationResponseError) {
753
- const oauthError = sanitizeOAuthErrorIdentifier(error.error);
754
- const description = sanitizeOAuthErrorDescription(error.error_description);
755
- if (oauthError === "access_denied") return new LoginError("LOGIN_ACCESS_DENIED", `Login denied: ${description ?? "The user denied the registry grant."} (access_denied)`, oauthError);
756
- return new LoginError("LOGIN_OAUTH_ERROR", `Login failed: ${description ?? "The authorization server rejected the request."}${oauthError ? ` (${oauthError})` : ""}`, oauthError);
757
- }
758
- return new LoginError("LOGIN_AUTHORIZATION_RESPONSE_INVALID", "The browser authorization response was invalid. Run `uapkg login` again.");
759
- }
760
- function normalizeLoginError(error) {
761
- if (error instanceof LoginError) return error;
762
- if (isCliLoginReauthorizationConflict(error)) return reauthorizationConflictLoginError(error);
763
- if (error instanceof oauth.AuthorizationResponseError) return authorizationResponseLoginError(error);
764
- if (error instanceof oauth.ResponseBodyError) {
765
- const oauthError = sanitizeOAuthErrorIdentifier(error.error);
766
- const description = sanitizeOAuthErrorDescription(error.error_description);
767
- return new LoginError("LOGIN_OAUTH_ERROR", `Login failed: ${description ?? "The authorization server rejected the request."}${oauthError ? ` (${oauthError})` : ""}`, oauthError);
768
- }
769
- return new LoginError("LOGIN_FAILED", describeControlPlaneError(error));
770
- }
771
- function sanitizeOAuthErrorIdentifier(value) {
772
- return value && /^[a-z][a-z0-9._~-]{0,63}$/i.test(value) ? value : void 0;
773
- }
774
- function sanitizeOAuthErrorDescription(value) {
775
- if (!value) return void 0;
776
- const sanitized = Array.from(value, (character) => {
777
- return isUnsafeOAuthDescriptionCodePoint(character.codePointAt(0) ?? 0) ? " " : character;
778
- }).join("").replace(/\s+/g, " ").trim();
779
- return sanitized ? Array.from(sanitized).slice(0, 300).join("") : void 0;
780
- }
781
- function isUnsafeOAuthDescriptionCodePoint(codePoint) {
782
- return codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 1564 || codePoint === 8206 || codePoint === 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint === 8232 || codePoint === 8233 || codePoint >= 8294 && codePoint <= 8297;
783
- }
784
- function loginDiagnosticForError(error) {
785
- const loginError = normalizeLoginError(error);
786
- return {
787
- level: "error",
788
- code: loginError.code,
789
- message: loginError.message,
790
- data: loginError.oauthError ? { oauthError: loginError.oauthError } : {}
791
- };
792
- }
793
- function controlPlaneDiagnosticForError(error, operation) {
794
- const serverCode = error instanceof ControlPlaneError && CONTROL_PLANE_SERVER_CODE_PATTERN.test(error.code) ? error.code : void 0;
795
- const status = error instanceof ControlPlaneError && error.status !== void 0 && Number.isInteger(error.status) && error.status >= 100 && error.status <= 599 ? error.status : void 0;
796
- const data = {
797
- operation,
798
- ...serverCode === void 0 ? {} : { serverCode },
799
- ...status === void 0 ? {} : { status }
800
- };
801
- return createControlPlaneCommandFailedDiagnostic(describeControlPlaneError(error), data);
802
- }
803
- function describeControlPlaneError(error) {
804
- if (error instanceof LoginError) return error.message;
805
- if (error instanceof OAuthScopeInsufficientError && error.missingScopes.length > 0) {
806
- const scopes = error.missingScopes.map((scope) => `\`${scope}\``).join(", ");
807
- return `Missing authorization ${error.missingScopes.length === 1 ? "scope" : "scopes"} ${scopes} for this action.\nRun \`uapkg login --registry ${error.registryAlias} --reauthorize\` to authorize the capabilities required by this CLI version.`;
808
- }
809
- if (error instanceof ControlPlaneError) {
810
- if (error.status === 401 && requiresSavedLoginRenewal(error.code)) return `${error.message}\n\nRun \`uapkg login\` to authenticate again.`;
811
- return `${error.message} (${error.code})`;
812
- }
813
- return error instanceof Error ? error.message : String(error);
814
- }
815
- function requiresSavedLoginRenewal(code) {
816
- const normalized = code.toUpperCase();
817
- return normalized.startsWith("DPOP_") || normalized.startsWith("REGISTRY_GRANT_") || normalized === "CONTROL_PLANE_AUTHENTICATION_REQUIRED" || normalized === "CLI_ACCESS_TOKEN_INVALID" || normalized === "CLI_ACCESS_TOKEN_EXPIRED";
818
- }
819
-
820
- //#endregion
821
- export { AccountManager, LoginError, LoopbackAuthorizationReceiver, controlPlaneDiagnosticForError, describeControlPlaneError, loginDiagnosticForError };
822
- //# sourceMappingURL=AccountManager.js.map