@uapkg/cli 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/dist/app/CompositionRoot.d.ts +36 -33
  2. package/dist/app/CompositionRoot.d.ts.map +1 -1
  3. package/dist/app/CompositionRoot.js +91 -109
  4. package/dist/app/CompositionRoot.js.map +1 -1
  5. package/dist/app/UAPKGApplication.d.ts +6 -3
  6. package/dist/app/UAPKGApplication.d.ts.map +1 -1
  7. package/dist/app/UAPKGApplication.js +155 -169
  8. package/dist/app/UAPKGApplication.js.map +1 -1
  9. package/dist/build/BuildMetadata.d.ts +9 -6
  10. package/dist/build/BuildMetadata.d.ts.map +1 -1
  11. package/dist/build/BuildMetadata.js +2 -2
  12. package/dist/cli/UAPKGCommandLine.d.ts +259 -257
  13. package/dist/cli/UAPKGCommandLine.d.ts.map +1 -1
  14. package/dist/cli/UAPKGCommandLine.js +248 -239
  15. package/dist/cli/UAPKGCommandLine.js.map +1 -1
  16. package/dist/cli/parseCommandLine.d.ts +5 -1
  17. package/dist/cli/parseCommandLine.d.ts.map +1 -1
  18. package/dist/cli/parseCommandLine.js +8 -3
  19. package/dist/cli/parseCommandLine.js.map +1 -1
  20. package/dist/cli/parsing/UAPKGCommandLineParser.d.ts +9 -6
  21. package/dist/cli/parsing/UAPKGCommandLineParser.d.ts.map +1 -1
  22. package/dist/cli/parsing/UAPKGCommandLineParser.js +23 -31
  23. package/dist/cli/parsing/UAPKGCommandLineParser.js.map +1 -1
  24. package/dist/cli/parsing/UAPKGParserRegistry.d.ts +12 -9
  25. package/dist/cli/parsing/UAPKGParserRegistry.d.ts.map +1 -1
  26. package/dist/cli/parsing/UAPKGParserRegistry.js +53 -50
  27. package/dist/cli/parsing/UAPKGParserRegistry.js.map +1 -1
  28. package/dist/cli/parsing/contracts/UAPKGCommandModule.d.ts +9 -6
  29. package/dist/cli/parsing/contracts/UAPKGCommandModule.d.ts.map +1 -1
  30. package/dist/cli/parsing/contracts/UAPKGCommandModule.js +1 -2
  31. package/dist/cli/parsing/modules/AddCommandModule.d.ts +8 -5
  32. package/dist/cli/parsing/modules/AddCommandModule.d.ts.map +1 -1
  33. package/dist/cli/parsing/modules/AddCommandModule.js +49 -36
  34. package/dist/cli/parsing/modules/AddCommandModule.js.map +1 -1
  35. package/dist/cli/parsing/modules/ConfigCommandModule.d.ts +8 -5
  36. package/dist/cli/parsing/modules/ConfigCommandModule.d.ts.map +1 -1
  37. package/dist/cli/parsing/modules/ConfigCommandModule.js +87 -83
  38. package/dist/cli/parsing/modules/ConfigCommandModule.js.map +1 -1
  39. package/dist/cli/parsing/modules/InitCommandModule.d.ts +8 -5
  40. package/dist/cli/parsing/modules/InitCommandModule.d.ts.map +1 -1
  41. package/dist/cli/parsing/modules/InitCommandModule.js +25 -22
  42. package/dist/cli/parsing/modules/InitCommandModule.js.map +1 -1
  43. package/dist/cli/parsing/modules/InstallCommandModule.d.ts +8 -5
  44. package/dist/cli/parsing/modules/InstallCommandModule.d.ts.map +1 -1
  45. package/dist/cli/parsing/modules/InstallCommandModule.js +36 -28
  46. package/dist/cli/parsing/modules/InstallCommandModule.js.map +1 -1
  47. package/dist/cli/parsing/modules/LifecycleCommandModule.d.ts +8 -5
  48. package/dist/cli/parsing/modules/LifecycleCommandModule.d.ts.map +1 -1
  49. package/dist/cli/parsing/modules/LifecycleCommandModule.js +78 -50
  50. package/dist/cli/parsing/modules/LifecycleCommandModule.js.map +1 -1
  51. package/dist/cli/parsing/modules/ListCommandModule.d.ts +8 -5
  52. package/dist/cli/parsing/modules/ListCommandModule.d.ts.map +1 -1
  53. package/dist/cli/parsing/modules/ListCommandModule.js +26 -15
  54. package/dist/cli/parsing/modules/ListCommandModule.js.map +1 -1
  55. package/dist/cli/parsing/modules/LoginCommandModule.d.ts +8 -5
  56. package/dist/cli/parsing/modules/LoginCommandModule.d.ts.map +1 -1
  57. package/dist/cli/parsing/modules/LoginCommandModule.js +34 -33
  58. package/dist/cli/parsing/modules/LoginCommandModule.js.map +1 -1
  59. package/dist/cli/parsing/modules/LogoutCommandModule.d.ts +8 -5
  60. package/dist/cli/parsing/modules/LogoutCommandModule.d.ts.map +1 -1
  61. package/dist/cli/parsing/modules/LogoutCommandModule.js +30 -28
  62. package/dist/cli/parsing/modules/LogoutCommandModule.js.map +1 -1
  63. package/dist/cli/parsing/modules/OutdatedCommandModule.d.ts +8 -5
  64. package/dist/cli/parsing/modules/OutdatedCommandModule.d.ts.map +1 -1
  65. package/dist/cli/parsing/modules/OutdatedCommandModule.js +21 -16
  66. package/dist/cli/parsing/modules/OutdatedCommandModule.js.map +1 -1
  67. package/dist/cli/parsing/modules/PackCommandModule.d.ts +8 -5
  68. package/dist/cli/parsing/modules/PackCommandModule.d.ts.map +1 -1
  69. package/dist/cli/parsing/modules/PackCommandModule.js +30 -28
  70. package/dist/cli/parsing/modules/PackCommandModule.js.map +1 -1
  71. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.d.ts +8 -5
  72. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.d.ts.map +1 -1
  73. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js +14 -11
  74. package/dist/cli/parsing/modules/ProjectGetNameCommandModule.js.map +1 -1
  75. package/dist/cli/parsing/modules/PublishCommandModule.d.ts +8 -5
  76. package/dist/cli/parsing/modules/PublishCommandModule.d.ts.map +1 -1
  77. package/dist/cli/parsing/modules/PublishCommandModule.js +63 -47
  78. package/dist/cli/parsing/modules/PublishCommandModule.js.map +1 -1
  79. package/dist/cli/parsing/modules/RegistryCommandModule.d.ts +8 -5
  80. package/dist/cli/parsing/modules/RegistryCommandModule.d.ts.map +1 -1
  81. package/dist/cli/parsing/modules/RegistryCommandModule.js +117 -120
  82. package/dist/cli/parsing/modules/RegistryCommandModule.js.map +1 -1
  83. package/dist/cli/parsing/modules/RemoveCommandModule.d.ts +8 -5
  84. package/dist/cli/parsing/modules/RemoveCommandModule.d.ts.map +1 -1
  85. package/dist/cli/parsing/modules/RemoveCommandModule.js +25 -14
  86. package/dist/cli/parsing/modules/RemoveCommandModule.js.map +1 -1
  87. package/dist/cli/parsing/modules/RequestsCommandModule.d.ts +8 -5
  88. package/dist/cli/parsing/modules/RequestsCommandModule.d.ts.map +1 -1
  89. package/dist/cli/parsing/modules/RequestsCommandModule.js +56 -60
  90. package/dist/cli/parsing/modules/RequestsCommandModule.js.map +1 -1
  91. package/dist/cli/parsing/modules/UpdateCommandModule.d.ts +8 -5
  92. package/dist/cli/parsing/modules/UpdateCommandModule.d.ts.map +1 -1
  93. package/dist/cli/parsing/modules/UpdateCommandModule.js +38 -25
  94. package/dist/cli/parsing/modules/UpdateCommandModule.js.map +1 -1
  95. package/dist/cli/parsing/modules/WhoamiCommandModule.d.ts +8 -5
  96. package/dist/cli/parsing/modules/WhoamiCommandModule.d.ts.map +1 -1
  97. package/dist/cli/parsing/modules/WhoamiCommandModule.js +30 -28
  98. package/dist/cli/parsing/modules/WhoamiCommandModule.js.map +1 -1
  99. package/dist/cli/parsing/modules/WhyCommandModule.d.ts +8 -5
  100. package/dist/cli/parsing/modules/WhyCommandModule.d.ts.map +1 -1
  101. package/dist/cli/parsing/modules/WhyCommandModule.js +25 -14
  102. package/dist/cli/parsing/modules/WhyCommandModule.js.map +1 -1
  103. package/dist/cli/parsing/modules/sharedOptions.d.ts +8 -5
  104. package/dist/cli/parsing/modules/sharedOptions.d.ts.map +1 -1
  105. package/dist/cli/parsing/modules/sharedOptions.js +18 -23
  106. package/dist/cli/parsing/modules/sharedOptions.js.map +1 -1
  107. package/dist/cli/runUAPKGCLI.d.ts +4 -1
  108. package/dist/cli/runUAPKGCLI.d.ts.map +1 -1
  109. package/dist/cli/runUAPKGCLI.js +10 -5
  110. package/dist/cli/runUAPKGCLI.js.map +1 -1
  111. package/dist/cli-bootstrap.d.ts +1 -2
  112. package/dist/cli-bootstrap.js +15 -12
  113. package/dist/cli-bootstrap.js.map +1 -1
  114. package/dist/commands/AddCommand.d.ts +19 -16
  115. package/dist/commands/AddCommand.d.ts.map +1 -1
  116. package/dist/commands/AddCommand.js +49 -53
  117. package/dist/commands/AddCommand.js.map +1 -1
  118. package/dist/commands/Command.d.ts +5 -2
  119. package/dist/commands/Command.d.ts.map +1 -1
  120. package/dist/commands/Command.js +1 -2
  121. package/dist/commands/ConfigCommand.d.ts +28 -25
  122. package/dist/commands/ConfigCommand.d.ts.map +1 -1
  123. package/dist/commands/ConfigCommand.js +165 -186
  124. package/dist/commands/ConfigCommand.js.map +1 -1
  125. package/dist/commands/InitCommand.d.ts +19 -16
  126. package/dist/commands/InitCommand.d.ts.map +1 -1
  127. package/dist/commands/InitCommand.js +65 -60
  128. package/dist/commands/InitCommand.js.map +1 -1
  129. package/dist/commands/InstallCommand.d.ts +16 -13
  130. package/dist/commands/InstallCommand.d.ts.map +1 -1
  131. package/dist/commands/InstallCommand.js +118 -110
  132. package/dist/commands/InstallCommand.js.map +1 -1
  133. package/dist/commands/ListCommand.d.ts +13 -10
  134. package/dist/commands/ListCommand.d.ts.map +1 -1
  135. package/dist/commands/ListCommand.js +76 -81
  136. package/dist/commands/ListCommand.js.map +1 -1
  137. package/dist/commands/LoginCommand.d.ts +17 -14
  138. package/dist/commands/LoginCommand.d.ts.map +1 -1
  139. package/dist/commands/LoginCommand.js +66 -72
  140. package/dist/commands/LoginCommand.js.map +1 -1
  141. package/dist/commands/LogoutCommand.d.ts +15 -12
  142. package/dist/commands/LogoutCommand.d.ts.map +1 -1
  143. package/dist/commands/LogoutCommand.js +36 -37
  144. package/dist/commands/LogoutCommand.js.map +1 -1
  145. package/dist/commands/OutdatedCommand.d.ts +12 -9
  146. package/dist/commands/OutdatedCommand.d.ts.map +1 -1
  147. package/dist/commands/OutdatedCommand.js +41 -40
  148. package/dist/commands/OutdatedCommand.js.map +1 -1
  149. package/dist/commands/PackCommand.d.ts +13 -10
  150. package/dist/commands/PackCommand.d.ts.map +1 -1
  151. package/dist/commands/PackCommand.js +26 -21
  152. package/dist/commands/PackCommand.js.map +1 -1
  153. package/dist/commands/PackageLifecycleCommand.d.ts +23 -19
  154. package/dist/commands/PackageLifecycleCommand.d.ts.map +1 -1
  155. package/dist/commands/PackageLifecycleCommand.js +144 -129
  156. package/dist/commands/PackageLifecycleCommand.js.map +1 -1
  157. package/dist/commands/PostinstallCandidateBuilder.d.ts +11 -8
  158. package/dist/commands/PostinstallCandidateBuilder.d.ts.map +1 -1
  159. package/dist/commands/PostinstallCandidateBuilder.js +42 -42
  160. package/dist/commands/PostinstallCandidateBuilder.js.map +1 -1
  161. package/dist/commands/ProjectGetNameCommand.d.ts +10 -7
  162. package/dist/commands/ProjectGetNameCommand.d.ts.map +1 -1
  163. package/dist/commands/ProjectGetNameCommand.js +25 -25
  164. package/dist/commands/ProjectGetNameCommand.js.map +1 -1
  165. package/dist/commands/PublishCommand.d.ts +29 -23
  166. package/dist/commands/PublishCommand.d.ts.map +1 -1
  167. package/dist/commands/PublishCommand.js +243 -244
  168. package/dist/commands/PublishCommand.js.map +1 -1
  169. package/dist/commands/RegistryCommand.d.ts +38 -35
  170. package/dist/commands/RegistryCommand.d.ts.map +1 -1
  171. package/dist/commands/RegistryCommand.js +195 -223
  172. package/dist/commands/RegistryCommand.js.map +1 -1
  173. package/dist/commands/RemoveCommand.d.ts +14 -11
  174. package/dist/commands/RemoveCommand.d.ts.map +1 -1
  175. package/dist/commands/RemoveCommand.js +47 -54
  176. package/dist/commands/RemoveCommand.js.map +1 -1
  177. package/dist/commands/RequestsCommand.d.ts +21 -18
  178. package/dist/commands/RequestsCommand.d.ts.map +1 -1
  179. package/dist/commands/RequestsCommand.js +82 -95
  180. package/dist/commands/RequestsCommand.js.map +1 -1
  181. package/dist/commands/UpdateCommand.d.ts +29 -26
  182. package/dist/commands/UpdateCommand.d.ts.map +1 -1
  183. package/dist/commands/UpdateCommand.js +111 -111
  184. package/dist/commands/UpdateCommand.js.map +1 -1
  185. package/dist/commands/WhoamiCommand.d.ts +30 -27
  186. package/dist/commands/WhoamiCommand.d.ts.map +1 -1
  187. package/dist/commands/WhoamiCommand.js +63 -72
  188. package/dist/commands/WhoamiCommand.js.map +1 -1
  189. package/dist/commands/WhyCommand.d.ts +13 -10
  190. package/dist/commands/WhyCommand.d.ts.map +1 -1
  191. package/dist/commands/WhyCommand.js +45 -44
  192. package/dist/commands/WhyCommand.js.map +1 -1
  193. package/dist/commands/add/DependencyAddResolver.d.ts +14 -11
  194. package/dist/commands/add/DependencyAddResolver.d.ts.map +1 -1
  195. package/dist/commands/add/DependencyAddResolver.js +36 -36
  196. package/dist/commands/add/DependencyAddResolver.js.map +1 -1
  197. package/dist/control-plane/AccountManager.d.ts +96 -94
  198. package/dist/control-plane/AccountManager.d.ts.map +1 -1
  199. package/dist/control-plane/AccountManager.js +775 -967
  200. package/dist/control-plane/AccountManager.js.map +1 -1
  201. package/dist/control-plane/ArtifactObserver.d.ts +19 -16
  202. package/dist/control-plane/ArtifactObserver.d.ts.map +1 -1
  203. package/dist/control-plane/ArtifactObserver.js +73 -59
  204. package/dist/control-plane/ArtifactObserver.js.map +1 -1
  205. package/dist/control-plane/AuthMetadataStore.d.ts +16 -13
  206. package/dist/control-plane/AuthMetadataStore.d.ts.map +1 -1
  207. package/dist/control-plane/AuthMetadataStore.js +111 -113
  208. package/dist/control-plane/AuthMetadataStore.js.map +1 -1
  209. package/dist/control-plane/AuthStoragePaths.d.ts +7 -4
  210. package/dist/control-plane/AuthStoragePaths.d.ts.map +1 -1
  211. package/dist/control-plane/AuthStoragePaths.js +19 -14
  212. package/dist/control-plane/AuthStoragePaths.js.map +1 -1
  213. package/dist/control-plane/AuthenticationSelector.d.ts +21 -18
  214. package/dist/control-plane/AuthenticationSelector.d.ts.map +1 -1
  215. package/dist/control-plane/AuthenticationSelector.js +69 -63
  216. package/dist/control-plane/AuthenticationSelector.js.map +1 -1
  217. package/dist/control-plane/ControlPlaneClient.d.ts +37 -28
  218. package/dist/control-plane/ControlPlaneClient.d.ts.map +1 -1
  219. package/dist/control-plane/ControlPlaneClient.js +265 -254
  220. package/dist/control-plane/ControlPlaneClient.js.map +1 -1
  221. package/dist/control-plane/ControlPlaneEndpoints.d.ts +9 -6
  222. package/dist/control-plane/ControlPlaneEndpoints.d.ts.map +1 -1
  223. package/dist/control-plane/ControlPlaneEndpoints.js +17 -12
  224. package/dist/control-plane/ControlPlaneEndpoints.js.map +1 -1
  225. package/dist/control-plane/ControlPlaneTypes.d.ts +176 -152
  226. package/dist/control-plane/ControlPlaneTypes.d.ts.map +1 -1
  227. package/dist/control-plane/ControlPlaneTypes.js +88 -81
  228. package/dist/control-plane/ControlPlaneTypes.js.map +1 -1
  229. package/dist/control-plane/CredentialStore.d.ts +20 -18
  230. package/dist/control-plane/CredentialStore.d.ts.map +1 -1
  231. package/dist/control-plane/CredentialStore.js +66 -83
  232. package/dist/control-plane/CredentialStore.js.map +1 -1
  233. package/dist/control-plane/DPoPKeyStore.d.ts +12 -9
  234. package/dist/control-plane/DPoPKeyStore.d.ts.map +1 -1
  235. package/dist/control-plane/DPoPKeyStore.js +57 -53
  236. package/dist/control-plane/DPoPKeyStore.js.map +1 -1
  237. package/dist/control-plane/GitHubActionsOidcCredentialProvider.d.ts +37 -4
  238. package/dist/control-plane/GitHubActionsOidcCredentialProvider.d.ts.map +1 -1
  239. package/dist/control-plane/GitHubActionsOidcCredentialProvider.js +197 -63
  240. package/dist/control-plane/GitHubActionsOidcCredentialProvider.js.map +1 -1
  241. package/dist/control-plane/PublishIdempotencyStore.d.ts +25 -9
  242. package/dist/control-plane/PublishIdempotencyStore.d.ts.map +1 -1
  243. package/dist/control-plane/PublishIdempotencyStore.js +97 -68
  244. package/dist/control-plane/PublishIdempotencyStore.js.map +1 -1
  245. package/dist/control-plane/PublishRequestErrorMapper.d.ts +155 -0
  246. package/dist/control-plane/PublishRequestErrorMapper.d.ts.map +1 -0
  247. package/dist/control-plane/PublishRequestErrorMapper.js +597 -0
  248. package/dist/control-plane/PublishRequestErrorMapper.js.map +1 -0
  249. package/dist/control-plane/RegistryGrantLock.d.ts +29 -26
  250. package/dist/control-plane/RegistryGrantLock.d.ts.map +1 -1
  251. package/dist/control-plane/RegistryGrantLock.js +149 -185
  252. package/dist/control-plane/RegistryGrantLock.js.map +1 -1
  253. package/dist/control-plane/RegistryTrustResolver.d.ts +13 -10
  254. package/dist/control-plane/RegistryTrustResolver.d.ts.map +1 -1
  255. package/dist/control-plane/RegistryTrustResolver.js +97 -132
  256. package/dist/control-plane/RegistryTrustResolver.js.map +1 -1
  257. package/dist/index.d.ts +62 -39
  258. package/dist/index.js +60 -53
  259. package/dist/postinstall/api/PostinstallDsl.d.ts +24 -21
  260. package/dist/postinstall/api/PostinstallDsl.d.ts.map +1 -1
  261. package/dist/postinstall/api/PostinstallDsl.js +32 -35
  262. package/dist/postinstall/api/PostinstallDsl.js.map +1 -1
  263. package/dist/postinstall/api/definePostinstall.d.ts +5 -2
  264. package/dist/postinstall/api/definePostinstall.d.ts.map +1 -1
  265. package/dist/postinstall/api/definePostinstall.js +20 -16
  266. package/dist/postinstall/api/definePostinstall.js.map +1 -1
  267. package/dist/postinstall/index.d.ts +25 -26
  268. package/dist/postinstall/index.js +25 -37
  269. package/dist/postinstall/loader/EntryResolver.d.ts +11 -9
  270. package/dist/postinstall/loader/EntryResolver.d.ts.map +1 -1
  271. package/dist/postinstall/loader/EntryResolver.js +36 -32
  272. package/dist/postinstall/loader/EntryResolver.js.map +1 -1
  273. package/dist/postinstall/loader/EsbuildTranspiler.d.ts +6 -3
  274. package/dist/postinstall/loader/EsbuildTranspiler.d.ts.map +1 -1
  275. package/dist/postinstall/loader/EsbuildTranspiler.js +52 -56
  276. package/dist/postinstall/loader/EsbuildTranspiler.js.map +1 -1
  277. package/dist/postinstall/loader/ExportValidator.d.ts +8 -5
  278. package/dist/postinstall/loader/ExportValidator.d.ts.map +1 -1
  279. package/dist/postinstall/loader/ExportValidator.js +36 -32
  280. package/dist/postinstall/loader/ExportValidator.js.map +1 -1
  281. package/dist/postinstall/loader/ModuleImporter.d.ts +17 -14
  282. package/dist/postinstall/loader/ModuleImporter.d.ts.map +1 -1
  283. package/dist/postinstall/loader/ModuleImporter.js +50 -58
  284. package/dist/postinstall/loader/ModuleImporter.js.map +1 -1
  285. package/dist/postinstall/loader/PostinstallLoader.d.ts +22 -19
  286. package/dist/postinstall/loader/PostinstallLoader.d.ts.map +1 -1
  287. package/dist/postinstall/loader/PostinstallLoader.js +62 -58
  288. package/dist/postinstall/loader/PostinstallLoader.js.map +1 -1
  289. package/dist/postinstall/markers/MarkerBlockEditor.d.ts +19 -16
  290. package/dist/postinstall/markers/MarkerBlockEditor.d.ts.map +1 -1
  291. package/dist/postinstall/markers/MarkerBlockEditor.js +48 -44
  292. package/dist/postinstall/markers/MarkerBlockEditor.js.map +1 -1
  293. package/dist/postinstall/markers/MarkerBlockService.d.ts +10 -7
  294. package/dist/postinstall/markers/MarkerBlockService.d.ts.map +1 -1
  295. package/dist/postinstall/markers/MarkerBlockService.js +44 -44
  296. package/dist/postinstall/markers/MarkerBlockService.js.map +1 -1
  297. package/dist/postinstall/markers/MarkerIntegrityValidator.d.ts +12 -9
  298. package/dist/postinstall/markers/MarkerIntegrityValidator.d.ts.map +1 -1
  299. package/dist/postinstall/markers/MarkerIntegrityValidator.js +47 -52
  300. package/dist/postinstall/markers/MarkerIntegrityValidator.js.map +1 -1
  301. package/dist/postinstall/policy/PostinstallPolicyGate.d.ts +25 -23
  302. package/dist/postinstall/policy/PostinstallPolicyGate.d.ts.map +1 -1
  303. package/dist/postinstall/policy/PostinstallPolicyGate.js +63 -52
  304. package/dist/postinstall/policy/PostinstallPolicyGate.js.map +1 -1
  305. package/dist/postinstall/runner/PostinstallOrchestrator.d.ts +48 -45
  306. package/dist/postinstall/runner/PostinstallOrchestrator.d.ts.map +1 -1
  307. package/dist/postinstall/runner/PostinstallOrchestrator.js +172 -170
  308. package/dist/postinstall/runner/PostinstallOrchestrator.js.map +1 -1
  309. package/dist/postinstall/unreal/BuildCsInjector.d.ts +16 -13
  310. package/dist/postinstall/unreal/BuildCsInjector.d.ts.map +1 -1
  311. package/dist/postinstall/unreal/BuildCsInjector.js +58 -53
  312. package/dist/postinstall/unreal/BuildCsInjector.js.map +1 -1
  313. package/dist/postinstall/unreal/CSharpInjectionEngine.d.ts +13 -10
  314. package/dist/postinstall/unreal/CSharpInjectionEngine.d.ts.map +1 -1
  315. package/dist/postinstall/unreal/CSharpInjectionEngine.js +56 -59
  316. package/dist/postinstall/unreal/CSharpInjectionEngine.js.map +1 -1
  317. package/dist/postinstall/unreal/CSharpStructureAnalyzer.d.ts +11 -8
  318. package/dist/postinstall/unreal/CSharpStructureAnalyzer.d.ts.map +1 -1
  319. package/dist/postinstall/unreal/CSharpStructureAnalyzer.js +123 -127
  320. package/dist/postinstall/unreal/CSharpStructureAnalyzer.js.map +1 -1
  321. package/dist/postinstall/unreal/CSharpStructures.d.ts +18 -15
  322. package/dist/postinstall/unreal/CSharpStructures.d.ts.map +1 -1
  323. package/dist/postinstall/unreal/CSharpStructures.js +1 -2
  324. package/dist/postinstall/unreal/CSharpWrapperFactory.d.ts +7 -4
  325. package/dist/postinstall/unreal/CSharpWrapperFactory.d.ts.map +1 -1
  326. package/dist/postinstall/unreal/CSharpWrapperFactory.js +54 -58
  327. package/dist/postinstall/unreal/CSharpWrapperFactory.js.map +1 -1
  328. package/dist/postinstall/unreal/PluginHash.d.ts +5 -2
  329. package/dist/postinstall/unreal/PluginHash.d.ts.map +1 -1
  330. package/dist/postinstall/unreal/PluginHash.js +13 -8
  331. package/dist/postinstall/unreal/PluginHash.js.map +1 -1
  332. package/dist/postinstall/unreal/PrettyParseError.d.ts +8 -5
  333. package/dist/postinstall/unreal/PrettyParseError.d.ts.map +1 -1
  334. package/dist/postinstall/unreal/PrettyParseError.js +37 -37
  335. package/dist/postinstall/unreal/PrettyParseError.js.map +1 -1
  336. package/dist/postinstall/unreal/ProjectFileLocator.d.ts +12 -9
  337. package/dist/postinstall/unreal/ProjectFileLocator.d.ts.map +1 -1
  338. package/dist/postinstall/unreal/ProjectFileLocator.js +49 -51
  339. package/dist/postinstall/unreal/ProjectFileLocator.js.map +1 -1
  340. package/dist/postinstall/unreal/TargetCsInjector.d.ts +16 -13
  341. package/dist/postinstall/unreal/TargetCsInjector.d.ts.map +1 -1
  342. package/dist/postinstall/unreal/TargetCsInjector.js +58 -53
  343. package/dist/postinstall/unreal/TargetCsInjector.js.map +1 -1
  344. package/dist/postinstall/unreal/UProjectInjector.d.ts +6 -3
  345. package/dist/postinstall/unreal/UProjectInjector.d.ts.map +1 -1
  346. package/dist/postinstall/unreal/UProjectInjector.js +56 -52
  347. package/dist/postinstall/unreal/UProjectInjector.js.map +1 -1
  348. package/dist/postinstall/unreal/UProjectMetadataReader.d.ts +5 -2
  349. package/dist/postinstall/unreal/UProjectMetadataReader.d.ts.map +1 -1
  350. package/dist/postinstall/unreal/UProjectMetadataReader.js +22 -18
  351. package/dist/postinstall/unreal/UProjectMetadataReader.js.map +1 -1
  352. package/dist/postinstall/unreal/UnrealSourceCatalog.d.ts +17 -14
  353. package/dist/postinstall/unreal/UnrealSourceCatalog.d.ts.map +1 -1
  354. package/dist/postinstall/unreal/UnrealSourceCatalog.js +50 -50
  355. package/dist/postinstall/unreal/UnrealSourceCatalog.js.map +1 -1
  356. package/dist/prompts/InkPromptService.d.ts +10 -7
  357. package/dist/prompts/InkPromptService.d.ts.map +1 -1
  358. package/dist/prompts/InkPromptService.js +100 -71
  359. package/dist/prompts/InkPromptService.js.map +1 -1
  360. package/dist/prompts/ProjectContextDetector.d.ts +10 -7
  361. package/dist/prompts/ProjectContextDetector.d.ts.map +1 -1
  362. package/dist/prompts/ProjectContextDetector.js +32 -26
  363. package/dist/prompts/ProjectContextDetector.js.map +1 -1
  364. package/dist/prompts/PromptService.d.ts +11 -8
  365. package/dist/prompts/PromptService.d.ts.map +1 -1
  366. package/dist/prompts/PromptService.js +1 -8
  367. package/dist/reporting/DiagnosticDeduplicator.d.ts +8 -5
  368. package/dist/reporting/DiagnosticDeduplicator.d.ts.map +1 -1
  369. package/dist/reporting/DiagnosticDeduplicator.js +36 -35
  370. package/dist/reporting/DiagnosticDeduplicator.js.map +1 -1
  371. package/dist/reporting/DiagnosticRenderer.d.ts +11 -8
  372. package/dist/reporting/DiagnosticRenderer.d.ts.map +1 -1
  373. package/dist/reporting/DiagnosticRenderer.js +1 -2
  374. package/dist/reporting/DiagnosticReporter.d.ts +12 -9
  375. package/dist/reporting/DiagnosticReporter.d.ts.map +1 -1
  376. package/dist/reporting/DiagnosticReporter.js +40 -39
  377. package/dist/reporting/DiagnosticReporter.js.map +1 -1
  378. package/dist/reporting/InkDiagnosticRenderer.d.ts +12 -9
  379. package/dist/reporting/InkDiagnosticRenderer.d.ts.map +1 -1
  380. package/dist/reporting/InkDiagnosticRenderer.js +50 -42
  381. package/dist/reporting/InkDiagnosticRenderer.js.map +1 -1
  382. package/dist/reporting/InstallProgressReporter.d.ts +23 -20
  383. package/dist/reporting/InstallProgressReporter.d.ts.map +1 -1
  384. package/dist/reporting/InstallProgressReporter.js +48 -47
  385. package/dist/reporting/InstallProgressReporter.js.map +1 -1
  386. package/dist/reporting/JsonReporter.d.ts +16 -13
  387. package/dist/reporting/JsonReporter.d.ts.map +1 -1
  388. package/dist/reporting/JsonReporter.js +34 -20
  389. package/dist/reporting/JsonReporter.js.map +1 -1
  390. package/dist/reporting/RegistryRequestTerminalFormatter.d.ts +36 -0
  391. package/dist/reporting/RegistryRequestTerminalFormatter.d.ts.map +1 -0
  392. package/dist/reporting/RegistryRequestTerminalFormatter.js +90 -0
  393. package/dist/reporting/RegistryRequestTerminalFormatter.js.map +1 -0
  394. package/dist/reporting/TextDiagnosticRenderer.d.ts +11 -8
  395. package/dist/reporting/TextDiagnosticRenderer.d.ts.map +1 -1
  396. package/dist/reporting/TextDiagnosticRenderer.js +36 -28
  397. package/dist/reporting/TextDiagnosticRenderer.js.map +1 -1
  398. package/dist/reporting/TextSink.d.ts +14 -11
  399. package/dist/reporting/TextSink.d.ts.map +1 -1
  400. package/dist/reporting/TextSink.js +24 -20
  401. package/dist/reporting/TextSink.js.map +1 -1
  402. package/package.json +31 -32
  403. package/dist/cli/parsing/contracts/UAPKGCommandModule.js.map +0 -1
  404. package/dist/cli-bootstrap.d.ts.map +0 -1
  405. package/dist/commands/Command.js.map +0 -1
  406. package/dist/index.d.ts.map +0 -1
  407. package/dist/index.js.map +0 -1
  408. package/dist/postinstall/index.d.ts.map +0 -1
  409. package/dist/postinstall/index.js.map +0 -1
  410. package/dist/postinstall/unreal/CSharpStructures.js.map +0 -1
  411. package/dist/prompts/PromptService.js.map +0 -1
  412. package/dist/reporting/DiagnosticRenderer.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PublishRequestErrorMapper.js","names":[],"sources":["../../src/control-plane/PublishRequestErrorMapper.ts"],"sourcesContent":["import {\n createPublishRequestFailedDiagnostic,\n type PublishDiagnosticFact,\n type PublishDiagnosticResource,\n type PublishRequestFailedDiagnostic,\n} from '@uapkg/diagnostics';\nimport { z } from 'zod';\nimport { ControlPlaneError } from './ControlPlaneTypes.js';\n\nconst SERVER_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,127}$/u;\n\nconst boundedText = (maximumLength: number) =>\n z\n .string()\n .trim()\n .min(1)\n .max(maximumLength)\n .refine((value) => !hasUnsafeDisplayCharacter(value));\nconst packageNameSchema = boundedText(214);\nconst packageVersionSchema = boundedText(256);\nconst ownerNameSchema = boundedText(100).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u);\nconst repositorySchema = boundedText(255).regex(/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/u);\nconst requestIdSchema = boundedText(128).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u);\nconst accessModeSchema = z.enum(['none', 'selected', 'all']);\nconst missingCapabilitiesSchema = z\n .array(z.enum(['package.publish', 'publishing.request.create']))\n .max(10)\n .transform((values) => [...new Set(values)]);\nconst missingOAuthScopesSchema = z\n .array(z.enum(['publishing.request.create', 'publishing.request.read.self']))\n .max(2)\n .transform((values) => [...new Set(values)]);\nconst ownerNamesSchema = z\n .array(ownerNameSchema)\n .max(20)\n .transform((values) => [...new Set(values)].sort());\n\nconst emptyDetailsSchema = z.object({});\nconst packageDetailsSchema = z.object({ packageName: packageNameSchema.optional() });\nconst ownerRequiredDetailsSchema = packageDetailsSchema;\nconst requestedOwnerDetailsSchema = packageDetailsSchema.extend({\n requestedOwnerOrganizationName: ownerNameSchema.optional(),\n ownerOrganizationName: ownerNameSchema.optional(),\n allowedOwnerOrganizationNames: ownerNamesSchema.optional(),\n});\nconst gatOwnerMismatchDetailsSchema = packageDetailsSchema.extend({\n requestedOwnerOrganizationName: ownerNameSchema.optional(),\n tokenOwnerOrganizationNames: ownerNamesSchema.optional(),\n});\nconst scopeMismatchDetailsSchema = packageDetailsSchema.extend({\n requestedScopeOwner: ownerNameSchema.optional(),\n scopeOwner: ownerNameSchema.optional(),\n allowedScopeOwners: ownerNamesSchema.optional(),\n tokenOwnerOrganizationNames: ownerNamesSchema.optional(),\n});\nconst tokenAccessDetailsSchema = packageDetailsSchema.extend({\n actualPackageAccessMode: accessModeSchema.optional(),\n requiredPackageAccessMode: z.literal('all').optional(),\n missingCapabilities: missingCapabilitiesSchema.optional(),\n packageAccess: z.object({ mode: accessModeSchema }).optional(),\n actualRegistryAccessMode: accessModeSchema.optional(),\n requiredRegistryAccessModes: z\n .array(z.enum(['selected', 'all']))\n .max(2)\n .optional(),\n requiredPackageAccessModes: z\n .array(z.enum(['selected', 'all']))\n .max(2)\n .optional(),\n registryAccess: z.object({ mode: accessModeSchema }).optional(),\n});\nconst tokenPermissionDetailsSchema = z.object({\n missingCapabilities: missingCapabilitiesSchema.optional(),\n});\nconst oauthScopeDetailsSchema = z.object({\n missingScopes: missingOAuthScopesSchema.optional(),\n});\nconst oidcRepositoryDetailsSchema = packageDetailsSchema.extend({\n submittedRepository: repositorySchema.optional(),\n trustedRepository: repositorySchema.optional(),\n});\nconst versionDetailsSchema = z.object({\n packageName: packageNameSchema.optional(),\n packageVersion: packageVersionSchema.optional(),\n});\nconst activeRequestDetailsSchema = versionDetailsSchema.extend({\n activeRequestId: requestIdSchema.optional(),\n});\nconst haltedPackageDetailsSchema = packageDetailsSchema.extend({\n blockingRequestId: requestIdSchema.optional(),\n});\nconst retryDetailsSchema = z.object({\n retryAfterSeconds: z.number().int().min(1).max(86_400).optional(),\n});\n\nexport interface PublishRequestErrorContext {\n readonly packageName: string;\n readonly packageVersion: string;\n readonly registryAlias: string;\n readonly registryName?: string;\n readonly registryIssuer: string;\n readonly credentialKind: 'login' | 'gat' | 'oidc';\n readonly requestedOwner?: string;\n readonly repository: string;\n}\n\ntype ResourceKind =\n | 'access-tokens'\n | 'help'\n | 'login'\n | 'owner-command'\n | 'requests'\n | 'security'\n | 'registries'\n | 'trusted-publishers';\n\ninterface PublishGuidance {\n readonly message: string;\n readonly hint: string;\n readonly facts?: readonly PublishDiagnosticFact[];\n readonly resources?: readonly ResourceKind[];\n readonly requestId?: string;\n}\n\ninterface PublishErrorSpec {\n build(details: unknown, context: PublishRequestErrorContext): PublishGuidance;\n}\n\nfunction defineSpec<Schema extends z.ZodObject>(\n schema: Schema,\n build: (details: z.output<Schema>, context: PublishRequestErrorContext) => PublishGuidance,\n): PublishErrorSpec {\n const empty = schema.parse({});\n return {\n build(details, context) {\n const parsed = schema.safeParse(details ?? {});\n return build(parsed.success ? parsed.data : empty, context);\n },\n };\n}\n\nfunction fixedSpec(message: string, hint: string, resources: readonly ResourceKind[] = []): PublishErrorSpec {\n return defineSpec(emptyDetailsSchema, () => ({ message, hint, resources }));\n}\n\nconst UPDATE_CLIENT_AND_RETRY =\n 'Update UAPKG CLI and try again. If the problem remains, report the server code to the registry operator.';\nconst RETRY_AND_REPORT =\n 'Try publishing again. If the failure continues, report the server code to the registry operator.';\nconst LOGIN_AGAIN = 'Sign in again for this registry, then retry the publication.';\nconst CHECK_TOKEN =\n 'Create or use an active granular access token with the correct owner, permissions, and package access, then try again.';\n\nconst clientRequestSpec = (message: string) => fixedSpec(message, UPDATE_CLIENT_AND_RETRY);\nconst internalServiceSpec = (message: string) => fixedSpec(message, RETRY_AND_REPORT);\nconst loginSpec = (message: string) => fixedSpec(message, LOGIN_AGAIN, ['login']);\nconst tokenSpec = (message: string) => fixedSpec(message, CHECK_TOKEN, ['access-tokens']);\n\nconst unscopedOwnerSpec = defineSpec(ownerRequiredDetailsSchema, (_details, context) => {\n const packageName = safeDisplayValue(context.packageName, 214);\n return {\n message: packageName\n ? `\"${packageName}\" needs an owner organization before it can be published for the first time.`\n : 'This unscoped package needs an owner organization before it can be published for the first time.',\n hint: 'Pass `--owner <organization>`, set `publish.owner` in uapkg.json, or publish the package under an `@organization/name` scope.',\n resources: ['owner-command'],\n };\n});\n\nconst gatOwnerMismatchSpec = defineSpec(gatOwnerMismatchDetailsSchema, (details, context) => {\n const requestedOwner = details.requestedOwnerOrganizationName ?? safeOwner(context.requestedOwner);\n const tokenOwners = details.tokenOwnerOrganizationNames ?? [];\n const ownerDescription = tokenOwners.length > 0 ? quotedList(tokenOwners) : 'a different organization';\n const requestedDescription = requestedOwner ? `\"${requestedOwner}\"` : 'the requested organization';\n const scoped = scopedOwner(context.packageName);\n return {\n message: `The selected token was created for ${ownerDescription}, but this publication asks to use ${requestedDescription}.`,\n hint: scoped\n ? `Use a token created for \"${scoped}\", or rebuild the package under the organization scope this token acts for.`\n : 'Correct or remove the explicit owner, or use a token created for the organization that should own this package.',\n facts: compactFacts([\n fact('requested-owner', requestedOwner),\n ...tokenOwners.map((owner) => fact('token-owner', owner)),\n ]),\n resources: ['access-tokens'],\n };\n});\n\nconst scopeMismatchSpec = defineSpec(scopeMismatchDetailsSchema, (details, context) => {\n const requestedOwner = details.requestedScopeOwner ?? details.scopeOwner ?? scopedOwner(context.packageName);\n const allowedOwners = details.allowedScopeOwners ?? details.tokenOwnerOrganizationNames ?? [];\n const requestedDescription = requestedOwner ? `\"@${requestedOwner}\"` : 'The package scope';\n const allowedDescription =\n allowedOwners.length > 0\n ? quotedList(allowedOwners.map((owner) => `@${owner}`))\n : 'the organization this token acts for';\n return {\n message: `${requestedDescription} does not match ${allowedDescription}.`,\n hint: 'Use a token created for the package scope, or rebuild the package under the organization scope this token acts for.',\n facts: compactFacts([\n fact('requested-owner', requestedOwner),\n ...allowedOwners.map((owner) => fact('allowed-owner', owner)),\n ]),\n resources: ['access-tokens'],\n };\n});\n\nconst initialTokenAccessSpec = defineSpec(tokenAccessDetailsSchema, (details) => {\n const actualMode = details.actualPackageAccessMode ?? details.packageAccess?.mode;\n const requiredMode = details.requiredPackageAccessMode ?? 'all';\n const missing = details.missingCapabilities ?? (actualMode === undefined ? ['package.publish'] : []);\n return {\n message: 'This token cannot create a package during its first publication.',\n hint: 'Create or use a token with Package Access set to All and permission to publish packages.',\n facts: compactFacts([\n fact('actual-access-mode', accessModeLabel(actualMode, 'package')),\n fact('required-access-mode', accessModeLabel(requiredMode, 'package')),\n ...missing.map((capability) => fact('missing-capability', capabilityLabel(capability))),\n ]),\n resources: ['access-tokens'],\n };\n});\n\nconst tokenPermissionSpec = defineSpec(tokenPermissionDetailsSchema, (details) => ({\n message: 'This token does not allow package publication.',\n hint: 'Create or use a token with permission to publish packages, then try again.',\n facts: (details.missingCapabilities ?? ['package.publish']).map((capability) => ({\n kind: 'missing-capability' as const,\n value: capabilityLabel(capability),\n })),\n resources: ['access-tokens'],\n}));\n\nconst oauthScopeSpec = defineSpec(oauthScopeDetailsSchema, (details) => ({\n message: 'This CLI login does not include permission to submit publishing requests.',\n hint: 'Reauthorize the login for this registry, then try publishing again.',\n facts: (details.missingScopes ?? ['publishing.request.create']).map((scope) => ({\n kind: 'missing-capability' as const,\n value: oauthScopeLabel(scope),\n })),\n resources: ['login'],\n}));\n\nconst packageOwnerNotAuthorizedSpec = defineSpec(requestedOwnerDetailsSchema, (details, context) => {\n const owner =\n details.requestedOwnerOrganizationName ?? details.ownerOrganizationName ?? safeOwner(context.requestedOwner);\n const allowedOwners = details.allowedOwnerOrganizationNames ?? [];\n const scoped = scopedOwner(context.packageName);\n const retryOwner = allowedOwners.length === 1 && !scoped ? allowedOwners[0] : undefined;\n return {\n message: owner\n ? `Your account is not allowed to create this package for UAPKG organization \"${owner}\".`\n : 'Your account is not allowed to create this package for the requested UAPKG organization.',\n hint: scoped\n ? allowedOwners.length > 0\n ? 'This package’s `@owner` scope determines ownership. Rebuild it under one of the allowed UAPKG organization scopes shown above.'\n : 'This package’s `@owner` scope determines ownership. Rebuild it under a UAPKG organization scope where you can publish, or ask an organization administrator to grant access.'\n : retryOwner\n ? `Retry with \\`--owner ${retryOwner}\\` to use the allowed UAPKG organization namespace.`\n : allowedOwners.length > 0\n ? 'Choose one of the allowed UAPKG organization namespaces with `--owner`, or ask a UAPKG organization administrator to grant access.'\n : 'Choose a UAPKG organization namespace where you can publish, or ask a UAPKG organization administrator to grant access.',\n facts: compactFacts([\n fact('requested-owner', owner),\n ...allowedOwners.map((allowedOwner) => fact('allowed-owner', allowedOwner)),\n ]),\n };\n});\n\nconst publishingAuthorityDeniedSpec = defineSpec(emptyDetailsSchema, (_details, context) => {\n switch (context.credentialKind) {\n case 'oidc':\n return {\n message: 'This GitHub Actions workflow does not currently have publishing authority for the package.',\n hint: 'Check the package’s trusted-publisher repository, workflow, and optional GitHub Environment setting, then run the workflow again.',\n resources: ['trusted-publishers'],\n };\n case 'gat':\n return {\n message: 'This granular access token does not currently have publishing authority for the package.',\n hint: 'Create or use a token for the package owner with the required package access and publishing permission.',\n resources: ['access-tokens'],\n };\n case 'login':\n return {\n message: 'Your account does not currently have publishing authority for the package.',\n hint: 'Choose an owner organization where you can publish, or ask an organization administrator to grant access.',\n };\n }\n});\n\nconst tokenResourceAccessSpec = defineSpec(tokenAccessDetailsSchema, (details) => {\n const actualPackageMode = details.actualPackageAccessMode ?? details.packageAccess?.mode;\n const actualRegistryMode = details.actualRegistryAccessMode ?? details.registryAccess?.mode;\n const requiredPackageModes = details.requiredPackageAccessModes;\n const requiredRegistryModes = details.requiredRegistryAccessModes;\n return {\n message: 'This token does not cover the package or registry selected for publication.',\n hint: 'Create or use a token whose package and registry access cover this publication.',\n facts: compactFacts([\n fact('actual-access-mode', accessModeLabel(actualPackageMode, 'package')),\n fact('actual-access-mode', accessModeLabel(actualRegistryMode, 'registry')),\n fact('required-access-mode', accessModesLabel(requiredPackageModes, 'package')),\n fact('required-access-mode', accessModesLabel(requiredRegistryModes, 'registry')),\n ]),\n resources: ['access-tokens'],\n };\n});\n\nconst oidcRepositorySpec = defineSpec(oidcRepositoryDetailsSchema, (details, context) => {\n const submitted = details.submittedRepository ?? safeRepository(context.repository);\n const trusted = details.trustedRepository;\n if (!trusted) {\n return {\n message: 'The registry could not determine the trusted repository for this workflow session.',\n hint: 'Start a new trusted-publishing workflow and try again. If the failure continues, review the trusted-publisher rule and report the server code.',\n facts: compactFacts([fact('requested-repository', submitted)]),\n resources: ['trusted-publishers'],\n };\n }\n return {\n message: submitted\n ? `This workflow submitted \"${submitted}\", but its trusted-publisher rule is bound to \"${trusted}\".`\n : 'The registry could not compare the package source with this workflow’s trusted-publisher rule.',\n hint: submitted\n ? 'Publish from the repository named by the trusted-publisher rule, or update the rule for the intended package source.'\n : 'Start a new trusted-publishing workflow and try again. If the failure continues, report the server code.',\n facts: compactFacts([fact('requested-repository', submitted), fact('trusted-repository', trusted)]),\n resources: ['trusted-publishers'],\n };\n});\n\nconst versionConflictSpec = (kind: 'exists' | 'tombstoned') =>\n defineSpec(versionDetailsSchema, (_details, context) => {\n const coordinate = packageCoordinate(context);\n return kind === 'exists'\n ? {\n message: `${coordinate} is already published in this registry.`,\n hint: 'Choose a new version in uapkg.json, rebuild the archive, and publish that version instead.',\n resources: ['requests'],\n }\n : {\n message: `${coordinate} was previously unpublished and cannot be reused.`,\n hint: 'Choose a new version in uapkg.json, rebuild the archive, and publish that version instead.',\n resources: ['requests'],\n };\n });\n\nconst activeRequestSpec = (ownershipConflict: boolean) =>\n defineSpec(activeRequestDetailsSchema, (details, context) => {\n const coordinate = packageCoordinate(context);\n const readableRequestId = ownershipConflict ? undefined : details.activeRequestId;\n return {\n message: ownershipConflict\n ? `Another organization already has an active first-publication request for ${safePackageLabel(context.packageName)}.`\n : `An active publishing request already covers ${coordinate}.`,\n hint: ownershipConflict\n ? 'Wait for that request to finish before trying to claim this package name, or review your own request when a request ID is shown.'\n : 'Wait for the active request to finish instead of submitting the same publication again.',\n facts: compactFacts([fact('request-id', readableRequestId)]),\n resources: ['requests'],\n requestId: readableRequestId,\n };\n });\n\nconst haltedPackageSpec = defineSpec(haltedPackageDetailsSchema, (details, context) => ({\n message: `Publishing for ${safePackageLabel(context.packageName)} is paused because an earlier request could not be completed.`,\n hint: 'Review the earlier request and ask the registry operator to resolve its failure before publishing again.',\n facts: compactFacts([fact('request-id', details.blockingRequestId)]),\n resources: ['requests'],\n requestId: details.blockingRequestId,\n}));\n\nconst rateLimitSpec = defineSpec(retryDetailsSchema, (details) => ({\n message: 'Too many publishing requests were submitted in a short time.',\n hint: details.retryAfterSeconds\n ? `Wait ${formatDuration(details.retryAfterSeconds)}, then try publishing again.`\n : 'Wait a moment, then try publishing again.',\n facts: compactFacts([\n fact('retry-after', details.retryAfterSeconds ? formatDuration(details.retryAfterSeconds) : undefined),\n ]),\n}));\n\n/**\n * Explicit inventory of errors that can be returned synchronously while the\n * CLI submits POST /v1/registry-requests/publish. Unknown future codes use the\n * non-leaking fallback in {@link publishRequestDiagnosticForError}.\n */\nexport const PUBLISH_SUBMISSION_ERROR_CATALOG = {\n // Authentication and request-bound authorization.\n AUTH_REQUIRED: loginSpec('Authentication is required to publish this package.'),\n CONTROL_PLANE_AUTHENTICATION_REQUIRED: loginSpec('The saved registry login was rejected.'),\n DPOP_AUTH_UNAVAILABLE: internalServiceSpec('The registry cannot validate CLI logins right now.'),\n DPOP_AUTH_REQUIRED: loginSpec('The publishing request did not include a valid CLI login.'),\n DPOP_PROOF_INVALID: loginSpec('The saved CLI login proof was rejected.'),\n DPOP_PROOF_REPLAYED: fixedSpec(\n 'The security proof for this CLI login was already used.',\n 'Run the publish command again. If the failure continues, sign in to the selected registry again.',\n ['login'],\n ),\n DPOP_ACCESS_TOKEN_INVALID: loginSpec('The saved CLI login is invalid or no longer usable.'),\n DPOP_PROOF_STALE: fixedSpec(\n 'The security proof for this CLI login expired before the request arrived.',\n 'Run the publish command again. If the failure continues, sign in to the selected registry again.',\n ['login'],\n ),\n DPOP_NONCE_REQUIRED: fixedSpec(\n 'The registry could not complete the security challenge for this CLI login.',\n 'Run the publish command again. If the failure continues, sign in to the selected registry again.',\n ['login'],\n ),\n REGISTRY_GRANT_INVALID: loginSpec('The registry login was revoked, expired, or belongs to another registry.'),\n CLI_LOGIN_ACTIVATION_EXPIRED: loginSpec('This CLI login expired before the device finished confirming it.'),\n ACCOUNT_NOT_ACTIVE: loginSpec('The account for this registry login is not active.'),\n CLI_ACCESS_TOKEN_INVALID: loginSpec('The saved CLI login is invalid.'),\n CLI_ACCESS_TOKEN_EXPIRED: loginSpec('The saved CLI login has expired.'),\n OAUTH_SCOPE_INSUFFICIENT: oauthScopeSpec,\n OAUTH_SCOPE_UNSUPPORTED: fixedSpec(\n 'This CLI version does not understand a capability required by the registry.',\n 'Update UAPKG CLI, sign in again, and retry the publication.',\n ['login'],\n ),\n TOKEN_INVALID: tokenSpec('The selected granular access token is invalid.'),\n TOKEN_REVOKED: tokenSpec('The selected granular access token has been revoked.'),\n TOKEN_EXPIRED: tokenSpec('The selected granular access token has expired.'),\n UAPKG_TOKEN_APPROVAL_PENDING: fixedSpec(\n 'The selected token is still waiting for organization approval.',\n 'Ask an organization administrator to approve the token, or select a different active token.',\n ['access-tokens'],\n ),\n UAPKG_TOKEN_APPROVAL_DENIED: fixedSpec(\n 'The organization denied the selected token request.',\n 'Use an approved token, or request a new token from the organization.',\n ['access-tokens'],\n ),\n UAPKG_TOKEN_ORGANIZATION_POLICY_DENIED: fixedSpec(\n 'The organization’s token policy blocks this publication.',\n 'Ask an organization administrator to review the token policy, or publish with an allowed credential.',\n ['access-tokens'],\n ),\n UAPKG_TOKEN_TEMPORARILY_BLOCKED_OWNER_MFA_REQUIRED: fixedSpec(\n 'This token is temporarily blocked because its owner must enable two-factor authentication.',\n 'Enable two-factor authentication for the token owner, then try again.',\n ['access-tokens', 'security'],\n ),\n UAPKG_TOKEN_LIFECYCLE_DISABLED: tokenSpec('The selected token is not currently usable.'),\n UAPKG_TOKEN_PERMISSION_DENIED: tokenPermissionSpec,\n UAPKG_TOKEN_RESOURCE_ACCESS_DENIED: tokenResourceAccessSpec,\n SECOND_FACTOR_REQUIRED: fixedSpec(\n 'A current two-factor authentication code is required for this publication.',\n 'Run the publish command again and enter the current code when prompted.',\n ['security'],\n ),\n OTP_INVALID: fixedSpec(\n 'The two-factor authentication code was incorrect or expired.',\n 'Run the publish command again and enter a new code when prompted.',\n ['security'],\n ),\n OTP_NOT_ENROLLED: fixedSpec(\n 'This account must enroll in two-factor authentication before publishing.',\n 'Enable two-factor authentication in account settings, then try publishing again.',\n ['security'],\n ),\n OTP_RATE_LIMITED: rateLimitSpec,\n OTP_ERROR: internalServiceSpec('The registry could not verify the two-factor authentication code.'),\n OTP_UNSUPPORTED_PRINCIPAL: fixedSpec(\n 'This credential cannot use an interactive two-factor authentication code.',\n 'Select a CLI login or granular access token that supports attended publication.',\n ),\n SECURED_ACCOUNT_REQUIRED: fixedSpec(\n 'Publishing requires an active account with two-factor authentication enabled.',\n 'Activate the account and enable two-factor authentication, then try again.',\n ['security'],\n ),\n ACTOR_WRITE_FORBIDDEN: fixedSpec(\n 'This account is not allowed to submit registry changes.',\n 'Use an account with publishing access, or ask an organization administrator for access.',\n ),\n UAPKG_PRINCIPAL_NOT_ALLOWED: fixedSpec(\n 'This kind of credential cannot submit a publishing request.',\n 'Use a CLI login, granular access token, or configured GitHub Actions trusted publisher.',\n ),\n\n // Ownership, package naming, and token access.\n UNSCOPED_PACKAGE_OWNER_REQUIRED: unscopedOwnerSpec,\n GAT_OWNER_ORGANIZATION_MISMATCH: gatOwnerMismatchSpec,\n UAPKG_PACKAGE_SCOPE_OWNER_MISMATCH: scopeMismatchSpec,\n UAPKG_REGISTRY_REQUIRES_SCOPED_PACKAGE: defineSpec(packageDetailsSchema, (_details, context) => ({\n message: `This registry requires a scoped name for the first publication of ${safePackageLabel(context.packageName)}.`,\n hint: 'Rename the package to `@organization/name`, rebuild the archive, and publish it again.',\n })),\n INITIAL_PUBLICATION_PACKAGE_ACCESS_ALL_REQUIRED: initialTokenAccessSpec,\n PACKAGE_OWNER_NOT_AUTHORIZED: packageOwnerNotAuthorizedSpec,\n INITIAL_PUBLICATION_CREDENTIAL_UNSUPPORTED: fixedSpec(\n 'This credential cannot create a package during its first publication.',\n 'Publish the package once with an interactive CLI login or an attended granular access token.',\n ['login', 'access-tokens'],\n ),\n CLI_REGISTRY_GRANT_NOT_AUTHORIZED: fixedSpec(\n 'The saved CLI login cannot publish to this registry.',\n 'Reauthorize the login for the selected registry, then try again.',\n ['login'],\n ),\n REGISTRY_WRITE_DENIED_REBAC: publishingAuthorityDeniedSpec,\n GAT_CREDENTIAL_CONTEXT_REQUIRED: internalServiceSpec('The registry could not validate the selected token.'),\n PACKAGE_OWNER_NOT_RESOLVED: internalServiceSpec('The registry could not determine this package’s owner.'),\n\n // GitHub Actions trusted publishing.\n OIDC_SESSION_INVALID: fixedSpec(\n 'The GitHub Actions publishing session expired or is no longer trusted.',\n 'Run the workflow again. If it still fails, verify that the package still has an active trusted-publisher rule for this repository and workflow.',\n ['trusted-publishers'],\n ),\n OIDC_PROVIDER_UNAVAILABLE: fixedSpec(\n 'The registry cannot validate GitHub trusted publishing right now.',\n 'Run the workflow again later. If the failure continues, report the server code to the registry operator.',\n ['trusted-publishers'],\n ),\n OIDC_INITIAL_PUBLICATION_NOT_SUPPORTED: fixedSpec(\n 'GitHub Actions cannot create this package during its first publication.',\n 'Publish the package once with an interactive CLI login, then configure its trusted-publisher rule and rerun the workflow.',\n ['login', 'trusted-publishers'],\n ),\n OIDC_SOURCE_REPOSITORY_MISMATCH: oidcRepositorySpec,\n TRUSTED_PUBLISHER_NOT_AUTHORIZED: fixedSpec(\n 'This GitHub Actions workflow is not authorized to publish the package.',\n 'Check the package’s trusted-publisher repository, workflow, and optional GitHub Environment setting, then rerun the workflow.',\n ['trusted-publishers'],\n ),\n\n // Archive, source, claims, and request-contract validation.\n INVALID_PACKAGE_NAME: fixedSpec(\n 'The packaged manifest contains an invalid package name.',\n 'Set `name` in uapkg.json to a name such as `my-package` or `@organization/my-package`, rebuild the archive, and publish it again.',\n ),\n SCOPED_PACKAGES_DISABLED: fixedSpec(\n 'The selected registry does not accept organization-scoped package names.',\n 'Select a registry that supports scoped packages, or intentionally rename and rebuild the package as an unscoped package with an explicit owner.',\n ['registries', 'owner-command'],\n ),\n INVALID_VERSION: fixedSpec(\n 'The packaged manifest contains an invalid semantic version.',\n 'Set `version` in uapkg.json to a semantic version such as `1.2.3`, rebuild the archive, and publish it again.',\n ),\n INVALID_OWNER_ORGANIZATION_NAME: fixedSpec(\n 'The selected owner is not a valid organization name.',\n 'Correct `--owner <organization>` or `publish.owner` in uapkg.json, then try publishing again.',\n ['owner-command'],\n ),\n SOURCE_REQUIRED: fixedSpec(\n 'The publishing request did not identify its GitHub Release source.',\n 'Set `publish.repository` or pass `--repository owner/repository`, and make sure the release tag and asset exist before retrying.',\n ),\n GITHUB_RELEASE_SOURCE_REQUIRED: fixedSpec(\n 'The publishing request did not identify its GitHub Release source.',\n 'Set `publish.repository` or pass `--repository owner/repository`, and make sure the release tag and asset exist before retrying.',\n ),\n SOURCE_TYPE_UNSUPPORTED: fixedSpec(\n 'The registry does not support this kind of package source.',\n 'Publish from an uploaded GitHub Release asset. If this CLI produced another source type, update it and try again.',\n ),\n GITHUB_REPOSITORY_INVALID: fixedSpec(\n 'The publishing request contains an invalid GitHub repository coordinate.',\n 'Pass `--repository owner/repository` or correct `publish.repository` in uapkg.json, then try again.',\n ),\n RELEASE_TAG_INVALID: fixedSpec(\n 'The publishing request contains an invalid GitHub Release tag.',\n 'Pass a non-empty GitHub Release tag with `--tag <tag>`, or correct the package version used by the default tag.',\n ),\n RELEASE_ASSET_NAME_INVALID: fixedSpec(\n 'The publishing request contains an invalid GitHub Release asset name.',\n 'Pass the uploaded file name—not a path—with `--asset <file-name>`, then try again.',\n ),\n OBSERVED_INTEGRITY_REQUIRED: fixedSpec(\n 'The publishing request is missing the archive’s integrity information.',\n 'Re-read or rebuild the archive and try again. If the problem remains, update UAPKG CLI and report the server code.',\n ),\n OBSERVED_DIGEST_INVALID: fixedSpec(\n 'The publishing request contains an invalid archive digest.',\n 'Re-read or rebuild the archive and try again. If the problem remains, update UAPKG CLI and report the server code.',\n ),\n OBSERVED_SIZE_INVALID: fixedSpec(\n 'The publishing request contains an invalid archive size.',\n 'Re-read or rebuild the archive and try again. If the problem remains, update UAPKG CLI and report the server code.',\n ),\n CLAIMS_REQUIRED: fixedSpec(\n 'The publishing request is missing package information from the packaged manifest.',\n 'Rebuild the archive so it contains a valid uapkg.json, then publish the rebuilt file.',\n ),\n CLAIMS_IDENTITY_MISMATCH: fixedSpec(\n 'The package name or version inside the archive does not match the publication being submitted.',\n 'Rebuild the archive from the intended uapkg.json and publish the rebuilt file.',\n ),\n CLAIMS_PRIVATE_INVALID: fixedSpec(\n 'The packaged manifest has an invalid private-package setting.',\n 'Set `private` in uapkg.json to `true` or `false`, rebuild the archive, and publish it again.',\n ),\n CLAIMS_BUCKET_INVALID: fixedSpec(\n 'The packaged manifest has an invalid dependency section.',\n 'Make each dependency section in uapkg.json an object, rebuild the archive, and publish it again.',\n ),\n CLAIMS_DEPENDENCIES_TOO_MANY: fixedSpec(\n 'A dependency section in the packaged manifest is too large.',\n 'Reduce the dependency entries in uapkg.json, rebuild the archive, and publish it again.',\n ),\n CLAIMS_DEPENDENCY_NAME_INVALID: fixedSpec(\n 'The packaged manifest contains an invalid dependency name.',\n 'Correct the dependency name in uapkg.json, rebuild the archive, and publish it again.',\n ),\n CLAIMS_DEPENDENCY_RANGE_INVALID: fixedSpec(\n 'The packaged manifest contains an invalid dependency version range.',\n 'Set a non-empty bounded version range for the dependency, rebuild the archive, and publish it again.',\n ),\n CLAIMS_DEPENDENCY_REGISTRY_INVALID: fixedSpec(\n 'The packaged manifest contains an invalid dependency registry.',\n 'Correct the dependency registry alias in uapkg.json, rebuild the archive, and publish it again.',\n ),\n CLAIMS_DEPENDENCY_FIELDS_INVALID: fixedSpec(\n 'A packaged dependency contains unsupported fields.',\n 'Remove unsupported dependency fields from uapkg.json, rebuild the archive, and publish it again.',\n ),\n OFFICIAL_REGISTRY_PRIVATE_PACKAGE_FORBIDDEN: fixedSpec(\n 'This package is marked private, but the selected registry accepts only public packages.',\n 'Publish to a private registry, or intentionally remove the private setting, rebuild the archive, and try again.',\n ['registries'],\n ),\n SERVER_RESOLVED_METADATA_NOT_ALLOWED: clientRequestSpec('The publishing request contains server-owned metadata.'),\n UNRECOGNIZED_REQUEST_FIELDS: clientRequestSpec(\n 'The publishing request contains fields this registry does not recognize.',\n ),\n INVALID_REGISTRY_ID: clientRequestSpec('The CLI resolved an invalid registry identity.'),\n PAYLOAD_TOO_LARGE: fixedSpec(\n 'The packaged publication information is too large for this registry.',\n 'Reduce oversized manifest metadata or dependency entries, rebuild the archive, and try again.',\n ),\n REQUEST_BODY_TOO_LARGE: fixedSpec(\n 'The publishing request is too large for this registry.',\n 'Reduce oversized manifest metadata or dependency entries, rebuild the archive, and try again.',\n ),\n UAPKG_OPERATION_INPUT_TOO_LARGE: fixedSpec(\n 'The publishing request is too large for this registry.',\n 'Reduce oversized manifest metadata or dependency entries, rebuild the archive, and try again.',\n ),\n INVALID_CONTENT_LENGTH: clientRequestSpec('The registry received an incomplete publishing request.'),\n INVALID_JSON: clientRequestSpec('The registry could not read the publishing request.'),\n INVALID_REQUEST_BODY: clientRequestSpec('The registry could not understand the publishing request.'),\n UAPKG_OPERATION_INPUT_INVALID: clientRequestSpec('The registry could not understand the publishing request.'),\n IDEMPOTENCY_KEY_REQUIRED: clientRequestSpec('The publishing request was missing its retry-safety key.'),\n REQUEST_KIND_NOT_PUBLIC: internalServiceSpec('The CLI reached the wrong registry operation.'),\n SOURCE_NOT_ALLOWED: internalServiceSpec('The CLI reached the wrong registry operation for an artifact publication.'),\n REASON_REQUIRED: internalServiceSpec('The CLI reached an operation that requires a reason.'),\n DEPRECATION_MESSAGE_REQUIRED: internalServiceSpec(\n 'The CLI reached an operation that requires a deprecation message.',\n ),\n\n // Registry readiness, versions, and concurrent requests.\n REGISTRY_NOT_FOUND: fixedSpec(\n 'The selected registry is no longer available to the publishing service.',\n 'Refresh or reconfigure the registry, then try publishing again.',\n ['registries'],\n ),\n REGISTRY_LINK_MISSING: fixedSpec(\n 'The selected registry is not connected to an initialized repository.',\n 'Finish the registry repository connection in account settings, then try publishing again.',\n ['registries'],\n ),\n REGISTRY_LINK_NOT_READY: fixedSpec(\n 'The selected registry repository connection is incomplete.',\n 'Finish reconnecting the registry repository in account settings, then try publishing again.',\n ['registries'],\n ),\n PACKAGE_POLICY_NOT_CONFIGURED: internalServiceSpec(\n 'The registry is not ready to assign ownership for a new package.',\n ),\n PACKAGE_NOT_FOUND: fixedSpec(\n 'The package does not exist in the selected registry.',\n 'Check the package and registry, then try again.',\n ['registries'],\n ),\n PACKAGE_HALTED: haltedPackageSpec,\n VERSION_ALREADY_EXISTS: versionConflictSpec('exists'),\n VERSION_TOMBSTONED: versionConflictSpec('tombstoned'),\n DUPLICATE_ACTIVE_REQUEST: activeRequestSpec(false),\n PACKAGE_OWNERSHIP_PENDING_CONFLICT: activeRequestSpec(true),\n IDEMPOTENCY_KEY_CONFLICT: fixedSpec(\n 'The retry-safety key for this publication is already attached to a different request.',\n 'Run the publication again. If the conflict continues, report the server code to the registry operator.',\n ['requests'],\n ),\n RATE_LIMIT_EXCEEDED: rateLimitSpec,\n\n // Defensive catalog entries for invalid route state and server failures.\n REQUEST_ATTRIBUTION_INVALID: internalServiceSpec('The registry could not safely attribute this publishing request.'),\n AUTHORIZATION_RECEIPT_REQUIRED: internalServiceSpec(\n 'The registry could not preserve authorization for this request.',\n ),\n REQUEST_CREATE_FAILED: internalServiceSpec('The registry could not save the publishing request.'),\n OPERATION_AUTHORIZATION_ACTION_MISMATCH: internalServiceSpec('The publishing endpoint is misconfigured.'),\n OPERATION_BODY_LIMIT_UNREGISTERED: internalServiceSpec('The publishing endpoint is missing its request-size policy.'),\n UAPKG_OPERATION_BINDING_MISMATCH: internalServiceSpec('The publishing endpoint is bound incorrectly.'),\n UAPKG_OPERATION_BINDER_MISMATCH: internalServiceSpec(\n 'The publishing endpoint uses the wrong authentication boundary.',\n ),\n UAPKG_OPERATION_BODY_LIMIT_UNREGISTERED: internalServiceSpec(\n 'The publishing endpoint is missing its request-size policy.',\n ),\n UAPKG_SERVICE_AUTHENTICATION_REQUIRED: internalServiceSpec(\n 'The publishing endpoint rejected an unsupported credential.',\n ),\n REGISTRY_REQUEST_RESPONSE_INVALID: internalServiceSpec('The registry returned an invalid publishing response.'),\n CONTROL_PLANE_RESPONSE_NOT_JSON: internalServiceSpec('The registry returned an unreadable publishing response.'),\n\n // These normally belong to lifecycle routes, but cataloging them keeps a\n // misrouted publish response helpful and non-leaking.\n DESTRUCTIVE_POLICY_NOT_CONFIGURED: internalServiceSpec('The registry’s version policy is not configured.'),\n PACKAGE_VERSION_TARGET_NOT_FOUND: fixedSpec(\n 'The selected package version does not exist in the registry.',\n 'Check the package version and selected registry.',\n ['requests'],\n ),\n VERSION_ALREADY_UNPUBLISHED: fixedSpec(\n 'This package version is already unpublished.',\n 'No further action is needed.',\n ),\n VERSION_ALREADY_YANKED: fixedSpec('This package version is already yanked.', 'No further action is needed.'),\n VERSION_NOT_YANKED: fixedSpec(\n 'This package version is not yanked.',\n 'Check the current request state before trying again.',\n ),\n VERSION_ALREADY_DEPRECATED: fixedSpec('This package version is already deprecated.', 'No further action is needed.'),\n VERSION_NOT_DEPRECATED: fixedSpec(\n 'This package version is not deprecated.',\n 'Check the current request state before trying again.',\n ),\n UNPUBLISH_WINDOW_EXPIRED: fixedSpec(\n 'The allowed time window for unpublishing this version has closed.',\n 'Contact the registry operator if the version presents a security or legal issue.',\n ),\n} as const satisfies Record<string, PublishErrorSpec>;\n\nexport type PublishSubmissionErrorCode = keyof typeof PUBLISH_SUBMISSION_ERROR_CATALOG;\n\nexport function publishRequestDiagnosticForError(\n error: unknown,\n context: PublishRequestErrorContext,\n): PublishRequestFailedDiagnostic {\n const serverCode = validatedServerCode(error);\n const status = validatedStatus(error);\n const spec = serverCode\n ? (PUBLISH_SUBMISSION_ERROR_CATALOG as Record<string, PublishErrorSpec>)[serverCode]\n : undefined;\n const guidance = spec\n ? spec.build(error instanceof ControlPlaneError ? error.details : undefined, context)\n : fallback(error, status);\n const facts = dedupeFacts([...baseFacts(context), ...(guidance.facts ?? [])]);\n const resources = resourcesFor(guidance.resources ?? [], context, guidance.requestId);\n\n return createPublishRequestFailedDiagnostic(\n guidance.message,\n {\n ...(serverCode ? { serverCode } : {}),\n ...(status !== undefined ? { status } : {}),\n facts,\n resources,\n },\n guidance.hint,\n );\n}\n\nfunction fallback(error: unknown, status: number | undefined): PublishGuidance {\n if (isNetworkFailure(error)) {\n return {\n message: 'UAPKG could not reach the publishing service.',\n hint: 'Check the network connection and registry availability, then try publishing again.',\n };\n }\n if (status !== undefined && status >= 500) {\n return {\n message: 'The publishing service could not complete the request.',\n hint: RETRY_AND_REPORT,\n };\n }\n return {\n message: 'The registry did not accept the publishing request.',\n hint: 'Review the publication details and try again. If the failure continues, report this diagnostic to the registry operator.',\n };\n}\n\nfunction baseFacts(context: PublishRequestErrorContext): PublishDiagnosticFact[] {\n const registryName = safeDisplayValue(context.registryName ?? '', 100);\n const registryAlias = safeDisplayValue(context.registryAlias, 100);\n const registry =\n registryName && registryAlias && registryName !== registryAlias\n ? `${registryName} (${registryAlias})`\n : (registryName ?? registryAlias);\n return compactFacts([\n fact('package', safeDisplayValue(context.packageName, 214)),\n fact('version', safeDisplayValue(context.packageVersion, 256)),\n fact('registry', registry),\n fact('credential-kind', credentialKindLabel(context.credentialKind)),\n fact('requested-owner', safeOwner(context.requestedOwner)),\n fact('repository', safeRepository(context.repository)),\n ]);\n}\n\nfunction resourcesFor(\n requested: readonly ResourceKind[],\n context: PublishRequestErrorContext,\n requestId?: string,\n): PublishDiagnosticResource[] {\n const kinds = [...new Set([...requested, 'help' as const])];\n const accountOrigin = accountOriginForIssuer(context.registryIssuer);\n const resources: PublishDiagnosticResource[] = [];\n for (const kind of kinds) {\n switch (kind) {\n case 'help':\n resources.push({ kind: 'command', command: 'uapkg publish --help', label: 'Publish command help' });\n break;\n case 'login':\n resources.push({\n kind: 'command',\n command: `uapkg login --registry ${shellDisplayArgument(context.registryAlias)} --reauthorize`,\n label: 'Reauthorize this registry login',\n });\n break;\n case 'owner-command':\n resources.push({\n kind: 'command',\n command: 'uapkg publish --owner <organization>',\n label: 'Publish with an explicit owner',\n });\n break;\n case 'requests':\n if (requestId) {\n resources.push({\n kind: 'command',\n command: `uapkg requests status ${requestId}`,\n label: 'Inspect the related request',\n });\n }\n addAccountUrl(resources, accountOrigin, '/requests', 'Publishing requests');\n break;\n case 'access-tokens':\n addAccountUrl(resources, accountOrigin, '/settings/access-tokens', 'Access token settings');\n break;\n case 'trusted-publishers':\n addAccountUrl(resources, accountOrigin, '/trusted-publishers', 'Trusted publishers');\n break;\n case 'registries':\n addAccountUrl(resources, accountOrigin, '/settings/registries', 'Registry settings');\n break;\n case 'security':\n addAccountUrl(\n resources,\n accountOrigin,\n '/settings/two-factor-authentication',\n 'Two-factor authentication settings',\n );\n break;\n }\n }\n return dedupeResources(resources);\n}\n\nfunction addAccountUrl(\n resources: PublishDiagnosticResource[],\n origin: string | undefined,\n path: string,\n label: string,\n): void {\n if (!origin) return;\n resources.push({ kind: 'url', url: new URL(path, origin).href, label });\n}\n\nfunction accountOriginForIssuer(issuer: string): string | undefined {\n try {\n const url = new URL(issuer);\n return url.protocol === 'https:' || url.protocol === 'http:' ? url.origin : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction validatedServerCode(error: unknown): string | undefined {\n return error instanceof ControlPlaneError && SERVER_CODE_PATTERN.test(error.code) ? error.code : undefined;\n}\n\nfunction validatedStatus(error: unknown): number | undefined {\n if (!(error instanceof ControlPlaneError) || error.status === undefined) return undefined;\n return Number.isInteger(error.status) && error.status >= 100 && error.status <= 599 ? error.status : undefined;\n}\n\nfunction isNetworkFailure(error: unknown): boolean {\n return (\n error instanceof TypeError ||\n (error instanceof Error && (error.name === 'AbortError' || error.name === 'TimeoutError'))\n );\n}\n\nfunction safeDisplayValue(value: unknown, maximumLength: number): string | undefined {\n if (typeof value !== 'string') return undefined;\n const normalized = value.trim();\n return normalized.length > 0 && normalized.length <= maximumLength && !hasUnsafeDisplayCharacter(normalized)\n ? normalized\n : undefined;\n}\n\nfunction hasUnsafeDisplayCharacter(value: string): boolean {\n for (const character of value) {\n const codePoint = character.codePointAt(0);\n if (\n codePoint !== undefined &&\n (codePoint <= 0x1f ||\n (codePoint >= 0x7f && codePoint <= 0x9f) ||\n codePoint === 0x061c ||\n codePoint === 0x200e ||\n codePoint === 0x200f ||\n (codePoint >= 0x2028 && codePoint <= 0x202e) ||\n (codePoint >= 0x2066 && codePoint <= 0x2069))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction safeOwner(value: unknown): string | undefined {\n const parsed = ownerNameSchema.safeParse(value);\n return parsed.success ? parsed.data : undefined;\n}\n\nfunction safeRepository(value: unknown): string | undefined {\n const parsed = repositorySchema.safeParse(value);\n return parsed.success ? parsed.data : undefined;\n}\n\nfunction safePackageLabel(packageName: string): string {\n const safe = safeDisplayValue(packageName, 214);\n return safe ? `\"${safe}\"` : 'this package';\n}\n\nfunction packageCoordinate(context: PublishRequestErrorContext): string {\n const packageName = safeDisplayValue(context.packageName, 214);\n const version = safeDisplayValue(context.packageVersion, 256);\n return packageName && version ? `\"${packageName}@${version}\"` : 'This package version';\n}\n\nfunction scopedOwner(packageName: string): string | undefined {\n const match = safeDisplayValue(packageName, 214)?.match(/^@([^/]+)\\//u);\n return safeOwner(match?.[1]);\n}\n\nfunction credentialKindLabel(kind: PublishRequestErrorContext['credentialKind']): string {\n switch (kind) {\n case 'login':\n return 'CLI login';\n case 'gat':\n return 'Granular access token';\n case 'oidc':\n return 'GitHub Actions trusted publishing';\n }\n}\n\nfunction capabilityLabel(capability: z.output<typeof missingCapabilitiesSchema>[number]): string {\n return capability === 'package.publish' ? 'Publish packages' : 'Submit publishing requests';\n}\n\nfunction oauthScopeLabel(scope: z.output<typeof missingOAuthScopesSchema>[number]): string {\n return scope === 'publishing.request.create' ? 'Submit publishing requests' : 'Read your publishing requests';\n}\n\nfunction accessModeLabel(\n mode: z.output<typeof accessModeSchema> | undefined,\n category: 'package' | 'registry',\n): string | undefined {\n if (!mode) return undefined;\n const noun = category === 'package' ? 'packages' : 'registries';\n switch (mode) {\n case 'none':\n return `No ${noun}`;\n case 'selected':\n return `Selected ${noun}`;\n case 'all':\n return `All ${noun}`;\n }\n}\n\nfunction accessModesLabel(\n modes: readonly ('selected' | 'all')[] | undefined,\n category: 'package' | 'registry',\n): string | undefined {\n if (!modes || modes.length === 0) return undefined;\n const labels = [...new Set(modes)].map((mode) => accessModeLabel(mode, category)).filter(Boolean);\n return labels.join(' or ');\n}\n\nfunction formatDuration(seconds: number): string {\n if (seconds === 1) return '1 second';\n if (seconds < 60) return `${seconds} seconds`;\n if (seconds % 60 === 0) {\n const minutes = seconds / 60;\n return `${minutes} ${minutes === 1 ? 'minute' : 'minutes'}`;\n }\n return `${seconds} seconds`;\n}\n\nfunction quotedList(values: readonly string[]): string {\n const quoted = values.map((value) => `\"${value}\"`);\n if (quoted.length === 1) return quoted[0] as string;\n if (quoted.length === 2) return `${quoted[0]} or ${quoted[1]}`;\n return `${quoted.slice(0, -1).join(', ')}, or ${quoted.at(-1)}`;\n}\n\nfunction fact(kind: PublishDiagnosticFact['kind'], value: string | undefined): PublishDiagnosticFact | undefined {\n return value ? { kind, value } : undefined;\n}\n\nfunction compactFacts(facts: readonly (PublishDiagnosticFact | undefined)[]): PublishDiagnosticFact[] {\n return facts.filter((value): value is PublishDiagnosticFact => value !== undefined);\n}\n\nfunction dedupeFacts(facts: readonly PublishDiagnosticFact[]): PublishDiagnosticFact[] {\n const seen = new Set<string>();\n return facts.filter((factValue) => {\n const key = `${factValue.kind}\\0${factValue.value}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\nfunction dedupeResources(resources: readonly PublishDiagnosticResource[]): PublishDiagnosticResource[] {\n const seen = new Set<string>();\n return resources.filter((resource) => {\n const key = resource.kind === 'command' ? `command\\0${resource.command}` : `url\\0${resource.url}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n}\n\nfunction shellDisplayArgument(value: string): string {\n const safe = safeDisplayValue(value, 100);\n return safe && /^[A-Za-z0-9._-]+$/u.test(safe) ? safe : '<registry>';\n}\n"],"mappings":";;;;;AASA,MAAM,sBAAsB;AAE5B,MAAM,eAAe,kBACnB,EACG,OAAO,CAAC,CACR,KAAK,CAAC,CACN,IAAI,CAAC,CAAC,CACN,IAAI,aAAa,CAAC,CAClB,QAAQ,UAAU,CAAC,0BAA0B,KAAK,CAAC;AACxD,MAAM,oBAAoB,YAAY,GAAG;AACzC,MAAM,uBAAuB,YAAY,GAAG;AAC5C,MAAM,kBAAkB,YAAY,GAAG,CAAC,CAAC,MAAM,8BAA8B;AAC7E,MAAM,mBAAmB,YAAY,GAAG,CAAC,CAAC,MAAM,qCAAqC;AACrF,MAAM,kBAAkB,YAAY,GAAG,CAAC,CAAC,MAAM,gCAAgC;AAC/E,MAAM,mBAAmB,EAAE,KAAK;CAAC;CAAQ;CAAY;AAAK,CAAC;AAC3D,MAAM,4BAA4B,EAC/B,MAAM,EAAE,KAAK,CAAC,mBAAmB,2BAA2B,CAAC,CAAC,CAAC,CAC/D,IAAI,EAAE,CAAC,CACP,WA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,YAAY,OAAkE;CACrF,MAAM,uBAAO,IAAI,IAAY;CAC7B,OAAO,MAAM,QAAQ,cAAc;EACjC,MAAM,MAAM,GAAG,UAAU,KAAK,IAAI,UAAU;EAC5C,IAAI,KAAK,IAAI,GAAG,GAAG,OAAO;EAC1B,KAAK,IAAI,GAAG;EACZ,OAAO;CACT,CAAC;AACH;AAEA,SAAS,gBAAgB,WAA8E;CACrG,MAAM,uBAAO,IAAI,IAAY;CAC7B,OAAO,UAAU,QAAQ,aAAa;EACpC,MAAM,MAAM,SAAS,SAAS,YAAY,YAAY,SAAS,YAAY,QAAQ,SAAS;EAC5F,IAAI,KAAK,IAAI,GAAG,GAAG,OAAO;EAC1B,KAAK,IAAI,GAAG;EACZ,OAAO;CACT,CAAC;AACH;AAEA,SAAS,qBAAqB,OAAuB;CACnD,MAAM,OAAO,iBAAiB,OAAO,GAAG;CACxC,OAAO,QAAQ,qBAAqB,KAAK,IAAI,IAAI,OAAO;AAC1D"}
@@ -1,35 +1,38 @@
1
- export interface RegistryGrantLock {
2
- withLock<T>(issuer: string, registryId: string, operation: () => Promise<T>): Promise<T>;
1
+ //#region src/control-plane/RegistryGrantLock.d.ts
2
+ interface RegistryGrantLock {
3
+ withLock<T>(issuer: string, registryId: string, operation: () => Promise<T>): Promise<T>;
3
4
  }
4
- export interface FileRegistryGrantLockOptions {
5
- readonly waitTimeoutMs?: number;
6
- readonly staleAfterMs?: number;
7
- readonly pollIntervalMs?: number;
8
- readonly heartbeatIntervalMs?: number;
9
- readonly now?: () => number;
10
- readonly sleep?: (milliseconds: number) => Promise<void>;
11
- readonly isProcessAlive?: (pid: number) => boolean;
5
+ interface FileRegistryGrantLockOptions {
6
+ readonly waitTimeoutMs?: number;
7
+ readonly staleAfterMs?: number;
8
+ readonly pollIntervalMs?: number;
9
+ readonly heartbeatIntervalMs?: number;
10
+ readonly now?: () => number;
11
+ readonly sleep?: (milliseconds: number) => Promise<void>;
12
+ readonly isProcessAlive?: (pid: number) => boolean;
12
13
  }
13
14
  /**
14
15
  * Cross-process serialization for a registry grant's rotating refresh-token
15
16
  * family. Lock file names contain only a SHA-256 digest of the issuer and
16
17
  * registry ID; lock contents contain only an opaque owner ID, PID, and time.
17
18
  */
18
- export declare class FileRegistryGrantLock implements RegistryGrantLock {
19
- private readonly directory;
20
- private readonly waitTimeoutMs;
21
- private readonly staleAfterMs;
22
- private readonly pollIntervalMs;
23
- private readonly heartbeatIntervalMs;
24
- private readonly now;
25
- private readonly sleep;
26
- private readonly isProcessAlive;
27
- constructor(directory: string, options?: FileRegistryGrantLockOptions);
28
- pathFor(issuer: string, registryId: string): string;
29
- withLock<T>(issuer: string, registryId: string, operation: () => Promise<T>): Promise<T>;
30
- private tryAcquire;
31
- private reclaimIfStale;
32
- private touchIfOwned;
33
- private releaseIfOwned;
19
+ declare class FileRegistryGrantLock implements RegistryGrantLock {
20
+ private readonly directory;
21
+ private readonly waitTimeoutMs;
22
+ private readonly staleAfterMs;
23
+ private readonly pollIntervalMs;
24
+ private readonly heartbeatIntervalMs;
25
+ private readonly now;
26
+ private readonly sleep;
27
+ private readonly isProcessAlive;
28
+ constructor(directory: string, options?: FileRegistryGrantLockOptions);
29
+ pathFor(issuer: string, registryId: string): string;
30
+ withLock<T>(issuer: string, registryId: string, operation: () => Promise<T>): Promise<T>;
31
+ private tryAcquire;
32
+ private reclaimIfStale;
33
+ private touchIfOwned;
34
+ private releaseIfOwned;
34
35
  }
36
+ //#endregion
37
+ export { FileRegistryGrantLock, FileRegistryGrantLockOptions, RegistryGrantLock };
35
38
  //# sourceMappingURL=RegistryGrantLock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryGrantLock.d.ts","sourceRoot":"","sources":["../../src/control-plane/RegistryGrantLock.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CA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A2Cd,YAAY;YAOZ,cAAc;CAa7B"}
1
+ {"version":3,"file":"RegistryGrantLock.d.ts","names":[],"sources":["../../src/control-plane/RegistryGrantLock.ts"],"mappings":";UAiBiB;EACf,SAAS,GAAG,gBAAgB,oBAAoB,iBAAiB,QAAQ,KAAK,QAAQ;;UAGvE;WACN;WACA;WACA;WACA;WACA;WACA,SAAS,yBAAyB;WAClC,kBAAkB;;;;;;;cAQhB,iCAAiC;mBAUzB;mBATF;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;EAEjB,YACmB,mBACjB,UAAS;EAcJ,QAAQ,gBAAgB;EAOlB,SAAS,GAAG,gBAAgB,oBAAoB,iBAAiB,QAAQ,KAAK,QAAQ;UAmCrF;UAoBA;UA2CA;UAOA"}
@@ -1,199 +1,163 @@
1
- import { createHash, randomUUID } from 'node:crypto';
2
- import { mkdir, open, readFile, rename, stat, unlink, utimes } from 'node:fs/promises';
3
- import { join } from 'node:path';
1
+ import { join } from "node:path";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { mkdir, open, readFile, rename, stat, unlink, utimes } from "node:fs/promises";
4
+
5
+ //#region src/control-plane/RegistryGrantLock.ts
4
6
  const LOCK_FILE_VERSION = 1;
5
- const DEFAULT_WAIT_TIMEOUT_MS = 30_000;
6
- const DEFAULT_STALE_AFTER_MS = 120_000;
7
+ const DEFAULT_WAIT_TIMEOUT_MS = 3e4;
8
+ const DEFAULT_STALE_AFTER_MS = 12e4;
7
9
  const DEFAULT_POLL_INTERVAL_MS = 50;
8
- const DEFAULT_HEARTBEAT_INTERVAL_MS = 5_000;
10
+ const DEFAULT_HEARTBEAT_INTERVAL_MS = 5e3;
9
11
  /**
10
- * Cross-process serialization for a registry grant's rotating refresh-token
11
- * family. Lock file names contain only a SHA-256 digest of the issuer and
12
- * registry ID; lock contents contain only an opaque owner ID, PID, and time.
13
- */
14
- export class FileRegistryGrantLock {
15
- directory;
16
- waitTimeoutMs;
17
- staleAfterMs;
18
- pollIntervalMs;
19
- heartbeatIntervalMs;
20
- now;
21
- sleep;
22
- isProcessAlive;
23
- constructor(directory, options = {}) {
24
- this.directory = directory;
25
- this.waitTimeoutMs = positiveMilliseconds(options.waitTimeoutMs, DEFAULT_WAIT_TIMEOUT_MS);
26
- this.staleAfterMs = positiveMilliseconds(options.staleAfterMs, DEFAULT_STALE_AFTER_MS);
27
- this.pollIntervalMs = positiveMilliseconds(options.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
28
- this.heartbeatIntervalMs = positiveMilliseconds(options.heartbeatIntervalMs, Math.min(DEFAULT_HEARTBEAT_INTERVAL_MS, Math.max(1, Math.floor(this.staleAfterMs / 3))));
29
- this.now = options.now ?? Date.now;
30
- this.sleep = options.sleep ?? delay;
31
- this.isProcessAlive = options.isProcessAlive ?? processIsAlive;
32
- }
33
- pathFor(issuer, registryId) {
34
- const digest = createHash('sha256')
35
- .update(`${issuer.replace(/\/+$/, '')}\0${registryId.toLowerCase()}`)
36
- .digest('hex');
37
- return join(this.directory, `${digest}.lock`);
38
- }
39
- async withLock(issuer, registryId, operation) {
40
- await mkdir(this.directory, { recursive: true, mode: 0o700 });
41
- const lockPath = this.pathFor(issuer, registryId);
42
- const owner = {
43
- version: LOCK_FILE_VERSION,
44
- ownerId: randomUUID(),
45
- pid: process.pid,
46
- acquiredAt: this.now(),
47
- };
48
- const deadline = this.now() + this.waitTimeoutMs;
49
- while (!(await this.tryAcquire(lockPath, owner))) {
50
- if (await this.reclaimIfStale(lockPath))
51
- continue;
52
- const remaining = deadline - this.now();
53
- if (remaining <= 0) {
54
- throw new Error('Timed out waiting for another UAPKG process to finish using the saved login for this registry.');
55
- }
56
- await this.sleep(Math.min(this.pollIntervalMs, remaining));
57
- }
58
- const heartbeat = setInterval(() => {
59
- void this.touchIfOwned(lockPath, owner.ownerId);
60
- }, this.heartbeatIntervalMs);
61
- heartbeat.unref?.();
62
- try {
63
- return await operation();
64
- }
65
- finally {
66
- clearInterval(heartbeat);
67
- await this.releaseIfOwned(lockPath, owner.ownerId);
68
- }
69
- }
70
- async tryAcquire(lockPath, owner) {
71
- let handle;
72
- try {
73
- handle = await open(lockPath, 'wx', 0o600);
74
- }
75
- catch (error) {
76
- if (errorCode(error) === 'EEXIST')
77
- return false;
78
- throw new Error('Unable to create the UAPKG registry-grant lock.', { cause: error });
79
- }
80
- try {
81
- await handle.writeFile(JSON.stringify(owner), { encoding: 'utf8' });
82
- return true;
83
- }
84
- catch (error) {
85
- await unlink(lockPath).catch(() => undefined);
86
- throw new Error('Unable to initialize the UAPKG registry-grant lock.', { cause: error });
87
- }
88
- finally {
89
- await handle.close();
90
- }
91
- }
92
- async reclaimIfStale(lockPath) {
93
- let lockStat;
94
- try {
95
- lockStat = await stat(lockPath);
96
- }
97
- catch (error) {
98
- if (errorCode(error) === 'ENOENT')
99
- return true;
100
- throw new Error('Unable to inspect the UAPKG registry-grant lock.', { cause: error });
101
- }
102
- const observedOwner = await readOwner(lockPath);
103
- if (observedOwner) {
104
- // A valid owner record with a definitely dead PID is safe to reclaim
105
- // immediately. Waiting for the general stale threshold would make a
106
- // refresh retry miss the authorization server's bounded predecessor
107
- // grace after a process dies between rotation and local persistence.
108
- if (this.isProcessAlive(observedOwner.pid))
109
- return false;
110
- }
111
- else if (this.now() - lockStat.mtimeMs <= this.staleAfterMs) {
112
- // A just-created lock can briefly be empty while its owner record is
113
- // written. Malformed or unreadable ownership therefore remains subject
114
- // to the conservative stale threshold.
115
- return false;
116
- }
117
- const quarantinePath = `${lockPath}.stale-${randomUUID()}`;
118
- try {
119
- await rename(lockPath, quarantinePath);
120
- }
121
- catch (error) {
122
- if (errorCode(error) === 'ENOENT')
123
- return true;
124
- throw new Error('Unable to quarantine a stale UAPKG registry-grant lock.', { cause: error });
125
- }
126
- const movedOwner = await readOwner(quarantinePath);
127
- if (observedOwner && movedOwner?.ownerId !== observedOwner.ownerId) {
128
- await rename(quarantinePath, lockPath).catch(() => undefined);
129
- return false;
130
- }
131
- await unlink(quarantinePath).catch((error) => {
132
- throw new Error('Unable to remove a stale UAPKG registry-grant lock.', { cause: error });
133
- });
134
- return true;
135
- }
136
- async touchIfOwned(lockPath, ownerId) {
137
- const owner = await readOwner(lockPath);
138
- if (owner?.ownerId !== ownerId)
139
- return;
140
- const now = new Date(this.now());
141
- await utimes(lockPath, now, now).catch(() => undefined);
142
- }
143
- async releaseIfOwned(lockPath, ownerId) {
144
- const owner = await readOwner(lockPath);
145
- if (!owner)
146
- return;
147
- if (owner.ownerId !== ownerId) {
148
- throw new Error('The UAPKG registry-grant lock changed ownership before it could be released.');
149
- }
150
- try {
151
- await unlink(lockPath);
152
- }
153
- catch (error) {
154
- if (errorCode(error) === 'ENOENT')
155
- return;
156
- throw new Error('Unable to release the UAPKG registry-grant lock.', { cause: error });
157
- }
158
- }
159
- }
12
+ * Cross-process serialization for a registry grant's rotating refresh-token
13
+ * family. Lock file names contain only a SHA-256 digest of the issuer and
14
+ * registry ID; lock contents contain only an opaque owner ID, PID, and time.
15
+ */
16
+ var FileRegistryGrantLock = class {
17
+ directory;
18
+ waitTimeoutMs;
19
+ staleAfterMs;
20
+ pollIntervalMs;
21
+ heartbeatIntervalMs;
22
+ now;
23
+ sleep;
24
+ isProcessAlive;
25
+ constructor(directory, options = {}) {
26
+ this.directory = directory;
27
+ this.waitTimeoutMs = positiveMilliseconds(options.waitTimeoutMs, DEFAULT_WAIT_TIMEOUT_MS);
28
+ this.staleAfterMs = positiveMilliseconds(options.staleAfterMs, DEFAULT_STALE_AFTER_MS);
29
+ this.pollIntervalMs = positiveMilliseconds(options.pollIntervalMs, DEFAULT_POLL_INTERVAL_MS);
30
+ this.heartbeatIntervalMs = positiveMilliseconds(options.heartbeatIntervalMs, Math.min(DEFAULT_HEARTBEAT_INTERVAL_MS, Math.max(1, Math.floor(this.staleAfterMs / 3))));
31
+ this.now = options.now ?? Date.now;
32
+ this.sleep = options.sleep ?? delay;
33
+ this.isProcessAlive = options.isProcessAlive ?? processIsAlive;
34
+ }
35
+ pathFor(issuer, registryId) {
36
+ const digest = createHash("sha256").update(`${issuer.replace(/\/+$/, "")}\0${registryId.toLowerCase()}`).digest("hex");
37
+ return join(this.directory, `${digest}.lock`);
38
+ }
39
+ async withLock(issuer, registryId, operation) {
40
+ await mkdir(this.directory, {
41
+ recursive: true,
42
+ mode: 448
43
+ });
44
+ const lockPath = this.pathFor(issuer, registryId);
45
+ const owner = {
46
+ version: LOCK_FILE_VERSION,
47
+ ownerId: randomUUID(),
48
+ pid: process.pid,
49
+ acquiredAt: this.now()
50
+ };
51
+ const deadline = this.now() + this.waitTimeoutMs;
52
+ while (!await this.tryAcquire(lockPath, owner)) {
53
+ if (await this.reclaimIfStale(lockPath)) continue;
54
+ const remaining = deadline - this.now();
55
+ if (remaining <= 0) throw new Error("Timed out waiting for another UAPKG process to finish using the saved login for this registry.");
56
+ await this.sleep(Math.min(this.pollIntervalMs, remaining));
57
+ }
58
+ const heartbeat = setInterval(() => {
59
+ this.touchIfOwned(lockPath, owner.ownerId);
60
+ }, this.heartbeatIntervalMs);
61
+ heartbeat.unref?.();
62
+ try {
63
+ return await operation();
64
+ } finally {
65
+ clearInterval(heartbeat);
66
+ await this.releaseIfOwned(lockPath, owner.ownerId);
67
+ }
68
+ }
69
+ async tryAcquire(lockPath, owner) {
70
+ let handle;
71
+ try {
72
+ handle = await open(lockPath, "wx", 384);
73
+ } catch (error) {
74
+ if (errorCode(error) === "EEXIST") return false;
75
+ throw new Error("Unable to create the UAPKG registry-grant lock.", { cause: error });
76
+ }
77
+ try {
78
+ await handle.writeFile(JSON.stringify(owner), { encoding: "utf8" });
79
+ return true;
80
+ } catch (error) {
81
+ await unlink(lockPath).catch(() => void 0);
82
+ throw new Error("Unable to initialize the UAPKG registry-grant lock.", { cause: error });
83
+ } finally {
84
+ await handle.close();
85
+ }
86
+ }
87
+ async reclaimIfStale(lockPath) {
88
+ let lockStat;
89
+ try {
90
+ lockStat = await stat(lockPath);
91
+ } catch (error) {
92
+ if (errorCode(error) === "ENOENT") return true;
93
+ throw new Error("Unable to inspect the UAPKG registry-grant lock.", { cause: error });
94
+ }
95
+ const observedOwner = await readOwner(lockPath);
96
+ if (observedOwner) {
97
+ if (this.isProcessAlive(observedOwner.pid)) return false;
98
+ } else if (this.now() - lockStat.mtimeMs <= this.staleAfterMs) return false;
99
+ const quarantinePath = `${lockPath}.stale-${randomUUID()}`;
100
+ try {
101
+ await rename(lockPath, quarantinePath);
102
+ } catch (error) {
103
+ if (errorCode(error) === "ENOENT") return true;
104
+ throw new Error("Unable to quarantine a stale UAPKG registry-grant lock.", { cause: error });
105
+ }
106
+ const movedOwner = await readOwner(quarantinePath);
107
+ if (observedOwner && movedOwner?.ownerId !== observedOwner.ownerId) {
108
+ await rename(quarantinePath, lockPath).catch(() => void 0);
109
+ return false;
110
+ }
111
+ await unlink(quarantinePath).catch((error) => {
112
+ throw new Error("Unable to remove a stale UAPKG registry-grant lock.", { cause: error });
113
+ });
114
+ return true;
115
+ }
116
+ async touchIfOwned(lockPath, ownerId) {
117
+ if ((await readOwner(lockPath))?.ownerId !== ownerId) return;
118
+ const now = new Date(this.now());
119
+ await utimes(lockPath, now, now).catch(() => void 0);
120
+ }
121
+ async releaseIfOwned(lockPath, ownerId) {
122
+ const owner = await readOwner(lockPath);
123
+ if (!owner) return;
124
+ if (owner.ownerId !== ownerId) throw new Error("The UAPKG registry-grant lock changed ownership before it could be released.");
125
+ try {
126
+ await unlink(lockPath);
127
+ } catch (error) {
128
+ if (errorCode(error) === "ENOENT") return;
129
+ throw new Error("Unable to release the UAPKG registry-grant lock.", { cause: error });
130
+ }
131
+ }
132
+ };
160
133
  async function readOwner(lockPath) {
161
- try {
162
- const value = JSON.parse(await readFile(lockPath, 'utf8'));
163
- if (typeof value !== 'object' ||
164
- value === null ||
165
- value.version !== LOCK_FILE_VERSION ||
166
- typeof value.ownerId !== 'string' ||
167
- !Number.isInteger(value.pid) ||
168
- typeof value.acquiredAt !== 'number') {
169
- return undefined;
170
- }
171
- return value;
172
- }
173
- catch {
174
- return undefined;
175
- }
134
+ try {
135
+ const value = JSON.parse(await readFile(lockPath, "utf8"));
136
+ if (typeof value !== "object" || value === null || value.version !== LOCK_FILE_VERSION || typeof value.ownerId !== "string" || !Number.isInteger(value.pid) || typeof value.acquiredAt !== "number") return;
137
+ return value;
138
+ } catch {
139
+ return;
140
+ }
176
141
  }
177
142
  function processIsAlive(pid) {
178
- if (pid === process.pid)
179
- return true;
180
- try {
181
- process.kill(pid, 0);
182
- return true;
183
- }
184
- catch (error) {
185
- return errorCode(error) !== 'ESRCH';
186
- }
143
+ if (pid === process.pid) return true;
144
+ try {
145
+ process.kill(pid, 0);
146
+ return true;
147
+ } catch (error) {
148
+ return errorCode(error) !== "ESRCH";
149
+ }
187
150
  }
188
151
  function positiveMilliseconds(value, fallback) {
189
- return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : fallback;
152
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
190
153
  }
191
154
  function errorCode(error) {
192
- return typeof error === 'object' && error !== null && 'code' in error
193
- ? String(error.code)
194
- : undefined;
155
+ return typeof error === "object" && error !== null && "code" in error ? String(error.code) : void 0;
195
156
  }
196
157
  function delay(milliseconds) {
197
- return new Promise((resolve) => setTimeout(resolve, milliseconds));
158
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
198
159
  }
160
+
161
+ //#endregion
162
+ export { FileRegistryGrantLock };
199
163
  //# sourceMappingURL=RegistryGrantLock.js.map