trm-core 9.10.6 → 10.0.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 (384) hide show
  1. package/README.md +20 -0
  2. package/changelog.txt +11 -0
  3. package/dist/actions/cg3y/download.js +34 -4
  4. package/dist/actions/cg3y/index.d.ts +23 -0
  5. package/dist/actions/cg3y/index.js +13 -10
  6. package/dist/actions/cg3z/index.d.ts +67 -3
  7. package/dist/actions/cg3z/index.js +25 -14
  8. package/dist/actions/cg3z/upload.d.ts +20 -0
  9. package/dist/actions/cg3z/upload.js +165 -36
  10. package/dist/actions/checkEngines/analyze.d.ts +11 -0
  11. package/dist/actions/checkEngines/analyze.js +294 -0
  12. package/dist/actions/checkEngines/index.d.ts +87 -0
  13. package/dist/actions/checkEngines/index.js +38 -0
  14. package/dist/actions/checkEngines/init.d.ts +11 -0
  15. package/dist/actions/checkEngines/init.js +45 -0
  16. package/dist/actions/checkPackageDependencies/analyze.d.ts +10 -0
  17. package/dist/actions/checkPackageDependencies/analyze.js +37 -39
  18. package/dist/actions/checkPackageDependencies/index.d.ts +56 -0
  19. package/dist/actions/checkPackageDependencies/index.js +13 -10
  20. package/dist/actions/checkPackageDependencies/init.d.ts +8 -0
  21. package/dist/actions/checkPackageDependencies/init.js +24 -2
  22. package/dist/actions/checkSapEntries/analyze.d.ts +12 -0
  23. package/dist/actions/checkSapEntries/analyze.js +63 -47
  24. package/dist/actions/checkSapEntries/index.d.ts +35 -0
  25. package/dist/actions/checkSapEntries/index.js +12 -10
  26. package/dist/actions/checkSapEntries/init.d.ts +8 -0
  27. package/dist/actions/checkSapEntries/init.js +10 -2
  28. package/dist/actions/commons/IActionContext.d.ts +10 -0
  29. package/dist/actions/commons/checkServerAuth.d.ts +7 -0
  30. package/dist/actions/commons/checkServerAuth.js +10 -5
  31. package/dist/actions/commons/index.d.ts +1 -1
  32. package/dist/actions/commons/index.js +1 -1
  33. package/dist/actions/commons/prompts/index.d.ts +1 -0
  34. package/dist/actions/commons/prompts/index.js +1 -0
  35. package/dist/actions/commons/prompts/setLandscapeTarget.d.ts +14 -0
  36. package/dist/actions/commons/prompts/setLandscapeTarget.js +40 -0
  37. package/dist/actions/commons/prompts/setTransportTarget.d.ts +15 -0
  38. package/dist/actions/commons/prompts/setTransportTarget.js +20 -2
  39. package/dist/actions/commons/setSystemPackages.d.ts +7 -0
  40. package/dist/actions/commons/setSystemPackages.js +12 -2
  41. package/dist/actions/commons/utils/actionLocks.d.ts +32 -0
  42. package/dist/actions/commons/utils/actionLocks.js +135 -0
  43. package/dist/actions/commons/utils/dirtyEntries.d.ts +12 -0
  44. package/dist/actions/commons/utils/dirtyEntries.js +54 -0
  45. package/dist/actions/commons/utils/index.d.ts +10 -0
  46. package/dist/actions/commons/utils/index.js +26 -0
  47. package/dist/actions/commons/utils/installRegistry.d.ts +18 -0
  48. package/dist/actions/commons/utils/installRegistry.js +46 -0
  49. package/dist/actions/commons/utils/installedDependency.d.ts +15 -0
  50. package/dist/actions/commons/utils/installedDependency.js +30 -0
  51. package/dist/actions/commons/utils/owningInstallation.d.ts +6 -0
  52. package/dist/actions/commons/utils/owningInstallation.js +47 -0
  53. package/dist/actions/commons/utils/packageCleanup.d.ts +168 -0
  54. package/dist/actions/commons/utils/packageCleanup.js +1017 -0
  55. package/dist/actions/commons/utils/releaseDeletionTransport.d.ts +5 -0
  56. package/dist/actions/commons/utils/releaseDeletionTransport.js +67 -0
  57. package/dist/actions/commons/utils/restoreTransport.d.ts +6 -0
  58. package/dist/actions/commons/utils/restoreTransport.js +50 -0
  59. package/dist/actions/commons/utils/retainedWorkflow.d.ts +6 -0
  60. package/dist/actions/commons/utils/retainedWorkflow.js +49 -0
  61. package/dist/actions/commons/utils/withScopedPrefix.d.ts +5 -0
  62. package/dist/actions/commons/utils/withScopedPrefix.js +32 -0
  63. package/dist/actions/commons/workflowCallbacks.d.ts +21 -0
  64. package/dist/actions/commons/workflowCallbacks.js +157 -0
  65. package/dist/actions/index.d.ts +3 -0
  66. package/dist/actions/index.js +5 -0
  67. package/dist/actions/install/addNamespace.d.ts +18 -0
  68. package/dist/actions/install/addNamespace.js +121 -51
  69. package/dist/actions/install/checkDependants.d.ts +15 -0
  70. package/dist/actions/install/checkDependants.js +74 -0
  71. package/dist/actions/install/checkDependencies.d.ts +11 -0
  72. package/dist/actions/install/checkDependencies.js +32 -13
  73. package/dist/actions/install/checkDependencyCycles.d.ts +17 -0
  74. package/dist/actions/install/checkDependencyCycles.js +105 -0
  75. package/dist/actions/install/checkEngines.d.ts +11 -0
  76. package/dist/actions/install/checkEngines.js +100 -0
  77. package/dist/actions/install/checkInstallDevclass.d.ts +24 -0
  78. package/dist/actions/install/checkInstallDevclass.js +110 -0
  79. package/dist/actions/install/checkSapEntries.d.ts +9 -0
  80. package/dist/actions/install/checkSapEntries.js +20 -12
  81. package/dist/actions/install/checkTransports.d.ts +34 -0
  82. package/dist/actions/install/checkTransports.js +329 -170
  83. package/dist/actions/install/cleanupCheckpoint.d.ts +11 -0
  84. package/dist/actions/install/cleanupCheckpoint.js +62 -0
  85. package/dist/actions/install/defaultTransportLayer.d.ts +5 -0
  86. package/dist/actions/install/defaultTransportLayer.js +36 -0
  87. package/dist/actions/install/executePostActivities.d.ts +6 -0
  88. package/dist/actions/install/executePostActivities.js +28 -38
  89. package/dist/actions/install/generateDevclass.d.ts +10 -0
  90. package/dist/actions/install/generateDevclass.js +66 -20
  91. package/dist/actions/install/generateLandscapeTransport.d.ts +23 -0
  92. package/dist/actions/install/generateLandscapeTransport.js +136 -0
  93. package/dist/actions/install/generateUpdateTransport.d.ts +20 -0
  94. package/dist/actions/install/generateUpdateTransport.js +122 -0
  95. package/dist/actions/install/importBatch.d.ts +22 -0
  96. package/dist/actions/install/importBatch.js +0 -0
  97. package/dist/actions/install/index.d.ts +273 -44
  98. package/dist/actions/install/index.js +139 -59
  99. package/dist/actions/install/init.d.ts +14 -0
  100. package/dist/actions/install/init.js +215 -108
  101. package/dist/actions/install/installDependencies.d.ts +14 -0
  102. package/dist/actions/install/installDependencies.js +122 -45
  103. package/dist/actions/install/lockResources.d.ts +8 -0
  104. package/dist/actions/install/lockResources.js +100 -0
  105. package/dist/actions/install/prepareCust.d.ts +13 -0
  106. package/dist/actions/install/prepareCust.js +138 -0
  107. package/dist/actions/install/prepareDevc.d.ts +15 -0
  108. package/dist/actions/install/prepareDevc.js +113 -0
  109. package/dist/actions/install/prepareLang.d.ts +13 -0
  110. package/dist/actions/install/prepareLang.js +110 -0
  111. package/dist/actions/install/prepareTadir.d.ts +13 -0
  112. package/dist/actions/install/prepareTadir.js +95 -0
  113. package/dist/actions/install/releaseLandscapeTransport.d.ts +11 -0
  114. package/dist/actions/install/releaseLandscapeTransport.js +79 -0
  115. package/dist/actions/install/setInstallDevclass.d.ts +10 -0
  116. package/dist/actions/install/setInstallDevclass.js +140 -54
  117. package/dist/actions/install/updatePackageData.d.ts +9 -0
  118. package/dist/actions/install/updatePackageData.js +117 -13
  119. package/dist/actions/installDependency/checkInstalledRelease.d.ts +13 -0
  120. package/dist/actions/installDependency/checkInstalledRelease.js +50 -0
  121. package/dist/actions/installDependency/confirmDowngrade.d.ts +11 -0
  122. package/dist/actions/installDependency/confirmDowngrade.js +53 -0
  123. package/dist/actions/installDependency/findInstallRelease.d.ts +24 -0
  124. package/dist/actions/installDependency/findInstallRelease.js +42 -19
  125. package/dist/actions/installDependency/index.d.ts +64 -3
  126. package/dist/actions/installDependency/index.js +30 -13
  127. package/dist/actions/installDependency/init.d.ts +14 -0
  128. package/dist/actions/installDependency/init.js +24 -3
  129. package/dist/actions/installDependency/installRelease.d.ts +6 -0
  130. package/dist/actions/installDependency/installRelease.js +22 -12
  131. package/dist/actions/publish/enginesUi.d.ts +53 -0
  132. package/dist/actions/publish/enginesUi.js +289 -0
  133. package/dist/actions/publish/findDependencies.d.ts +19 -0
  134. package/dist/actions/publish/findDependencies.js +72 -37
  135. package/dist/actions/publish/generateCustTransport.d.ts +6 -0
  136. package/dist/actions/publish/generateCustTransport.js +42 -19
  137. package/dist/actions/publish/generateDevcTransport.d.ts +6 -0
  138. package/dist/actions/publish/generateDevcTransport.js +16 -18
  139. package/dist/actions/publish/generateLangTransport.d.ts +6 -0
  140. package/dist/actions/publish/generateLangTransport.js +20 -23
  141. package/dist/actions/publish/generateTadirTransport.d.ts +6 -0
  142. package/dist/actions/publish/generateTadirTransport.js +18 -17
  143. package/dist/actions/publish/getSystemEngines.d.ts +27 -0
  144. package/dist/actions/publish/getSystemEngines.js +112 -0
  145. package/dist/actions/publish/index.d.ts +162 -37
  146. package/dist/actions/publish/index.js +51 -34
  147. package/dist/actions/publish/init.d.ts +28 -0
  148. package/dist/actions/publish/init.js +304 -120
  149. package/dist/actions/publish/lockResources.d.ts +4 -0
  150. package/dist/actions/{install/refreshTmsTxt.js → publish/lockResources.js} +14 -17
  151. package/dist/actions/publish/publishToRegistry.d.ts +8 -0
  152. package/dist/actions/publish/publishToRegistry.js +18 -8
  153. package/dist/actions/publish/releaseTransports.d.ts +6 -0
  154. package/dist/actions/publish/releaseTransports.js +48 -20
  155. package/dist/actions/publish/setCustomizingTransports.d.ts +6 -0
  156. package/dist/actions/publish/setCustomizingTransports.js +227 -101
  157. package/dist/actions/publish/setManifestValues.d.ts +22 -0
  158. package/dist/actions/publish/setManifestValues.js +455 -119
  159. package/dist/actions/publish/setOptionalPublishData.d.ts +11 -0
  160. package/dist/actions/publish/setOptionalPublishData.js +133 -0
  161. package/dist/actions/publish/updatePackageData.d.ts +8 -0
  162. package/dist/actions/publish/updatePackageData.js +20 -7
  163. package/dist/actions/stopWarning.d.ts +5 -0
  164. package/dist/actions/stopWarning.js +5 -0
  165. package/dist/actions/uninstall/checkDependants.d.ts +7 -0
  166. package/dist/actions/uninstall/checkDependants.js +55 -0
  167. package/dist/actions/uninstall/forwardDeletionTransport.d.ts +10 -0
  168. package/dist/actions/uninstall/forwardDeletionTransport.js +51 -0
  169. package/dist/actions/uninstall/generateDeletionTransport.d.ts +10 -0
  170. package/dist/actions/uninstall/generateDeletionTransport.js +45 -0
  171. package/dist/actions/uninstall/index.d.ts +153 -0
  172. package/dist/actions/uninstall/index.js +141 -0
  173. package/dist/actions/uninstall/init.d.ts +17 -0
  174. package/dist/actions/uninstall/init.js +146 -0
  175. package/dist/actions/uninstall/lockResources.d.ts +4 -0
  176. package/dist/actions/{publish/setTransportTarget.js → uninstall/lockResources.js} +16 -7
  177. package/dist/actions/uninstall/removePackageData.d.ts +9 -0
  178. package/dist/actions/uninstall/removePackageData.js +64 -0
  179. package/dist/actions/uninstall/uninstallNestedPackages.d.ts +26 -0
  180. package/dist/actions/uninstall/uninstallNestedPackages.js +174 -0
  181. package/dist/client/ClientError.d.ts +3 -1
  182. package/dist/client/ClientError.js +2 -1
  183. package/dist/client/RESTClient.d.ts +18 -5
  184. package/dist/client/RESTClient.js +194 -52
  185. package/dist/client/RESTClientError.d.ts +1 -2
  186. package/dist/client/RESTClientError.js +3 -2
  187. package/dist/client/RFCClient.d.ts +28 -7
  188. package/dist/client/RFCClient.js +325 -77
  189. package/dist/client/RFCClientError.d.ts +1 -1
  190. package/dist/client/RFCClientError.js +2 -2
  191. package/dist/client/TransportEntries.d.ts +8 -0
  192. package/dist/client/TransportEntries.js +2 -0
  193. package/dist/client/components/BORM_ID.d.ts +1 -0
  194. package/dist/client/components/BORM_ID.js +2 -0
  195. package/dist/client/components/BORM_NAME.d.ts +1 -0
  196. package/dist/client/components/BORM_NAME.js +2 -0
  197. package/dist/client/components/BORM_NAMEL.d.ts +1 -0
  198. package/dist/client/components/BORM_NAMEL.js +2 -0
  199. package/dist/client/components/BORM_VEND.d.ts +1 -0
  200. package/dist/client/components/BORM_VEND.js +2 -0
  201. package/dist/client/components/BORM_VERS.d.ts +1 -0
  202. package/dist/client/components/BORM_VERS.js +2 -0
  203. package/dist/client/components/CWBNTNUMM.d.ts +1 -0
  204. package/dist/client/components/CWBNTNUMM.js +2 -0
  205. package/dist/client/components/CWBNTSTAT.d.ts +1 -0
  206. package/dist/client/components/CWBNTSTAT.js +2 -0
  207. package/dist/client/components/CWBNTVERS.d.ts +1 -0
  208. package/dist/client/components/CWBNTVERS.js +2 -0
  209. package/dist/client/components/CWBPRSTAT.d.ts +1 -0
  210. package/dist/client/components/CWBPRSTAT.js +2 -0
  211. package/dist/client/components/INSTSTATE.d.ts +1 -0
  212. package/dist/client/components/INSTSTATE.js +2 -0
  213. package/dist/client/components/RELC_TYPE.d.ts +1 -0
  214. package/dist/client/components/RELC_TYPE.js +2 -0
  215. package/dist/client/components/SAPPATCHLV.d.ts +1 -0
  216. package/dist/client/components/SAPPATCHLV.js +2 -0
  217. package/dist/client/components/SAPRELEASE.d.ts +1 -0
  218. package/dist/client/components/SAPRELEASE.js +2 -0
  219. package/dist/client/components/SYSYSID.d.ts +1 -0
  220. package/dist/client/components/SYSYSID.js +2 -0
  221. package/dist/client/components/ZTRM_INSTALLTR_TYPE.d.ts +1 -0
  222. package/dist/client/components/ZTRM_INSTALLTR_TYPE.js +2 -0
  223. package/dist/client/components/index.d.ts +15 -0
  224. package/dist/client/components/index.js +15 -0
  225. package/dist/client/index.d.ts +1 -0
  226. package/dist/client/index.js +1 -0
  227. package/dist/client/messageLog.d.ts +7 -0
  228. package/dist/client/messageLog.js +21 -0
  229. package/dist/client/struct/ActionLockKey.d.ts +6 -0
  230. package/dist/client/struct/ActionLockKey.js +2 -0
  231. package/dist/client/struct/CVERS.d.ts +7 -0
  232. package/dist/client/struct/CVERS.js +2 -0
  233. package/dist/client/struct/CWBNTCUST.d.ts +6 -0
  234. package/dist/client/struct/CWBNTCUST.js +2 -0
  235. package/dist/client/struct/CWBNTHEAD.d.ts +5 -0
  236. package/dist/client/struct/CWBNTHEAD.js +2 -0
  237. package/dist/client/struct/E070.d.ts +2 -1
  238. package/dist/client/struct/E071K.d.ts +9 -0
  239. package/dist/client/struct/E071K.js +2 -0
  240. package/dist/client/struct/PRDVERS.d.ts +9 -0
  241. package/dist/client/struct/PRDVERS.js +2 -0
  242. package/dist/client/struct/SCOMPKDTLN.d.ts +21 -0
  243. package/dist/client/struct/STMSCALERT.d.ts +21 -0
  244. package/dist/client/struct/STMSCALERT.js +2 -0
  245. package/dist/client/struct/STMS_TP_IMPORT.d.ts +14 -0
  246. package/dist/client/struct/STMS_TP_IMPORT.js +2 -0
  247. package/dist/client/struct/STMS_TR_REQUEST.d.ts +8 -0
  248. package/dist/client/struct/STMS_TR_REQUEST.js +2 -0
  249. package/dist/client/struct/TDEVC.d.ts +38 -0
  250. package/dist/client/struct/TPLOGPTR.d.ts +13 -0
  251. package/dist/client/struct/TPLOGPTR.js +2 -0
  252. package/dist/client/struct/TPSTDOUT.d.ts +3 -0
  253. package/dist/client/struct/TPSTDOUT.js +2 -0
  254. package/dist/client/struct/ZTRM_INSTALLTR.d.ts +8 -0
  255. package/dist/client/struct/ZTRM_INSTALLTR.js +2 -0
  256. package/dist/client/struct/index.d.ts +12 -0
  257. package/dist/client/struct/index.js +12 -0
  258. package/dist/commons/checkCoreTrmDependencies.js +1 -1
  259. package/dist/commons/getAxiosInstance.js +8 -17
  260. package/dist/commons/getNodePackage.js +7 -0
  261. package/dist/commons/getPackageHierarchy.js +2 -0
  262. package/dist/commons/getPackagesNamespace.d.ts +9 -0
  263. package/dist/commons/getPackagesNamespace.js +19 -0
  264. package/dist/commons/index.d.ts +4 -0
  265. package/dist/commons/index.js +4 -0
  266. package/dist/commons/packageDataFromTdevc.d.ts +12 -0
  267. package/dist/commons/packageDataFromTdevc.js +25 -0
  268. package/dist/commons/resolveCoreVersion.d.ts +10 -0
  269. package/dist/commons/resolveCoreVersion.js +24 -0
  270. package/dist/commons/summarizeForLog.d.ts +22 -0
  271. package/dist/commons/summarizeForLog.js +120 -0
  272. package/dist/connection/OpenRFCConnect.d.ts +13 -0
  273. package/dist/connection/OpenRFCConnect.js +23 -0
  274. package/dist/connection/index.d.ts +1 -0
  275. package/dist/connection/index.js +17 -0
  276. package/dist/dependencies/PackageDependencies.d.ts +2 -0
  277. package/dist/dependencies/PackageDependencies.js +24 -0
  278. package/dist/index.d.ts +1 -0
  279. package/dist/index.js +1 -0
  280. package/dist/lockfile/Lockfile.d.ts +23 -1
  281. package/dist/lockfile/Lockfile.js +45 -9
  282. package/dist/manifest/Manifest.d.ts +9 -5
  283. package/dist/manifest/Manifest.js +82 -29
  284. package/dist/manifest/PostActivity.js +3 -3
  285. package/dist/manifest/TrmManifest.d.ts +0 -2
  286. package/dist/manifest/TrmManifestBase.d.ts +2 -0
  287. package/dist/manifest/TrmManifestEngines.d.ts +64 -0
  288. package/dist/manifest/TrmManifestEngines.js +2 -0
  289. package/dist/manifest/engines/index.d.ts +2 -0
  290. package/dist/manifest/engines/index.js +18 -0
  291. package/dist/manifest/engines/sapRange.d.ts +38 -0
  292. package/dist/manifest/engines/sapRange.js +135 -0
  293. package/dist/manifest/engines/validateEngines.d.ts +44 -0
  294. package/dist/manifest/engines/validateEngines.js +282 -0
  295. package/dist/manifest/index.d.ts +3 -0
  296. package/dist/manifest/index.js +3 -0
  297. package/dist/manifest/sapEntries.d.ts +14 -0
  298. package/dist/manifest/sapEntries.js +63 -0
  299. package/dist/protocol/Protocol.js +7 -0
  300. package/dist/registry/AbstractRegistry.d.ts +18 -3
  301. package/dist/registry/FileSystem.d.ts +22 -13
  302. package/dist/registry/FileSystem.js +69 -18
  303. package/dist/registry/RegistryDeletionTransportUnauthorizedError.d.ts +4 -0
  304. package/dist/registry/RegistryDeletionTransportUnauthorizedError.js +12 -0
  305. package/dist/registry/RegistryDeletionTransportUnavailableError.d.ts +9 -0
  306. package/dist/registry/RegistryDeletionTransportUnavailableError.js +17 -0
  307. package/dist/registry/RegistryPackageNotFoundError.d.ts +7 -0
  308. package/dist/registry/RegistryPackageNotFoundError.js +14 -0
  309. package/dist/registry/RegistryV2.d.ts +15 -5
  310. package/dist/registry/RegistryV2.js +308 -48
  311. package/dist/registry/index.d.ts +4 -0
  312. package/dist/registry/index.js +4 -0
  313. package/dist/registry/registryKey.d.ts +7 -0
  314. package/dist/registry/registryKey.js +21 -0
  315. package/dist/systemConnector/ActionLock.d.ts +1 -0
  316. package/dist/systemConnector/ActionLock.js +2 -0
  317. package/dist/systemConnector/ISystemConnector.d.ts +21 -4
  318. package/dist/systemConnector/ISystemConnectorBase.d.ts +16 -0
  319. package/dist/systemConnector/InstallTransport.d.ts +6 -0
  320. package/dist/systemConnector/InstallTransport.js +2 -0
  321. package/dist/systemConnector/OpenRFCSystemConnector.d.ts +12 -0
  322. package/dist/systemConnector/OpenRFCSystemConnector.js +51 -0
  323. package/dist/systemConnector/RESTSystemConnector.d.ts +22 -7
  324. package/dist/systemConnector/RESTSystemConnector.js +95 -23
  325. package/dist/systemConnector/RFCConnection.d.ts +0 -1
  326. package/dist/systemConnector/RFCSystemConnector.d.ts +25 -7
  327. package/dist/systemConnector/RFCSystemConnector.js +75 -16
  328. package/dist/systemConnector/SystemConnector.d.ts +38 -6
  329. package/dist/systemConnector/SystemConnector.js +138 -12
  330. package/dist/systemConnector/SystemConnectorBase.d.ts +24 -1
  331. package/dist/systemConnector/SystemConnectorBase.js +174 -22
  332. package/dist/systemConnector/index.d.ts +3 -0
  333. package/dist/systemConnector/index.js +3 -0
  334. package/dist/transport/E071KOwner.d.ts +10 -0
  335. package/dist/transport/E071KOwner.js +15 -0
  336. package/dist/transport/R3transLogParser.d.ts +19 -0
  337. package/dist/transport/R3transLogParser.js +148 -0
  338. package/dist/transport/Transport.d.ts +36 -3
  339. package/dist/transport/Transport.js +304 -138
  340. package/dist/transport/index.d.ts +2 -0
  341. package/dist/transport/index.js +2 -0
  342. package/dist/trmPackage/TransportBinary.d.ts +4 -1
  343. package/dist/trmPackage/TrmArtifact.d.ts +12 -8
  344. package/dist/trmPackage/TrmArtifact.js +93 -74
  345. package/dist/trmPackage/TrmPackage.d.ts +20 -6
  346. package/dist/trmPackage/TrmPackage.js +27 -1
  347. package/dist/validators/validateDevclass.js +4 -0
  348. package/package.json +15 -7
  349. package/dist/actions/commons/trmServerPa.d.ts +0 -3
  350. package/dist/actions/commons/trmServerPa.js +0 -40
  351. package/dist/actions/install/checkAlreadyInstalled.d.ts +0 -3
  352. package/dist/actions/install/checkAlreadyInstalled.js +0 -71
  353. package/dist/actions/install/checkObjectTypes.d.ts +0 -3
  354. package/dist/actions/install/checkObjectTypes.js +0 -50
  355. package/dist/actions/install/checkObjectsLock.d.ts +0 -3
  356. package/dist/actions/install/checkObjectsLock.js +0 -52
  357. package/dist/actions/install/generateInstallTransports.d.ts +0 -3
  358. package/dist/actions/install/generateInstallTransports.js +0 -128
  359. package/dist/actions/install/importCustTransport.d.ts +0 -3
  360. package/dist/actions/install/importCustTransport.js +0 -73
  361. package/dist/actions/install/importDevcTransport.d.ts +0 -3
  362. package/dist/actions/install/importDevcTransport.js +0 -93
  363. package/dist/actions/install/importLangTransport.d.ts +0 -3
  364. package/dist/actions/install/importLangTransport.js +0 -72
  365. package/dist/actions/install/importTadirTransport.d.ts +0 -3
  366. package/dist/actions/install/importTadirTransport.js +0 -83
  367. package/dist/actions/install/readDevc.d.ts +0 -3
  368. package/dist/actions/install/readDevc.js +0 -33
  369. package/dist/actions/install/readTadir.d.ts +0 -3
  370. package/dist/actions/install/readTadir.js +0 -101
  371. package/dist/actions/install/refreshTmsTxt.d.ts +0 -3
  372. package/dist/actions/install/releaseInstallTransport.d.ts +0 -3
  373. package/dist/actions/install/releaseInstallTransport.js +0 -80
  374. package/dist/actions/publish/checkAllObjectsReleased.d.ts +0 -3
  375. package/dist/actions/publish/checkAllObjectsReleased.js +0 -46
  376. package/dist/actions/publish/getSourceCode.d.ts +0 -3
  377. package/dist/actions/publish/getSourceCode.js +0 -49
  378. package/dist/actions/publish/setChangelog.d.ts +0 -3
  379. package/dist/actions/publish/setChangelog.js +0 -69
  380. package/dist/actions/publish/setDevclass.d.ts +0 -3
  381. package/dist/actions/publish/setDevclass.js +0 -74
  382. package/dist/actions/publish/setReadme.d.ts +0 -3
  383. package/dist/actions/publish/setReadme.js +0 -52
  384. package/dist/actions/publish/setTransportTarget.d.ts +0 -3
package/README.md CHANGED
@@ -43,7 +43,27 @@ Install the official CLI client via npm:
43
43
  npm install trm-client -g
44
44
  ```
45
45
 
46
+ # Development
47
+
48
+ To contribute to `trm-core`, fork the repository, clone your fork, and install the dependencies:
49
+
50
+ ```bash
51
+ git clone https://github.com/RegestaItalia/trm-core.git
52
+ cd trm-core
53
+ npm ci
54
+ ```
55
+
56
+ The project requires Node.js 22.12.0 or newer. Before submitting a change, run the test suite and compile the TypeScript project:
57
+
58
+ ```bash
59
+ npm test
60
+ npm run build
61
+ ```
62
+
63
+ Development guides for specific areas of the codebase are available in [`docs/development`](docs/development/). Follow the relevant guide when your change affects one of those areas.
64
+
46
65
  # Contributing
66
+
47
67
  Like every other TRM open-source projects, contributions are always welcomed ❤️.
48
68
 
49
69
  Make sure to open an issue first.
package/changelog.txt CHANGED
@@ -8,6 +8,17 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2026-10-11 v10.0.1
12
+ -------------------
13
+ * rest client https agent import
14
+
15
+ 2026-10-11 v10.0.0
16
+ -------------------
17
+ + usage of registry /transport route
18
+ + important log messages
19
+ ! uninstall
20
+ * flows changes
21
+
11
22
  2026-09-23 v9.10.6
12
23
  -------------------
13
24
  ! trm-commons ^5.1.0
@@ -47,22 +47,52 @@ const transport_1 = require("../../transport");
47
47
  const trm_commons_1 = require("trm-commons");
48
48
  const AdmZip = __importStar(require("adm-zip"));
49
49
  const systemConnector_1 = require("../../systemConnector");
50
+ /**
51
+ * Workflow step that verifies and exports a released transport into a ZIP archive.
52
+ *
53
+ * 1- check is released, exportable request
54
+ *
55
+ * 2- download
56
+ *
57
+ * 3- zip
58
+ *
59
+ */
60
+ const TRKORR_PATTERN = /^[A-Z0-9]{3}K\d{6}$/;
61
+ const TASK_TRFUNCTIONS = ['S', 'R', 'Q', 'X'];
62
+ function isEmptyBinary(buffer) {
63
+ return !buffer || buffer.length === 0;
64
+ }
50
65
  exports.download = {
51
66
  name: 'download',
52
67
  run: (context) => __awaiter(void 0, void 0, void 0, function* () {
53
- trm_commons_1.Logger.log('Download step', true);
54
- const transport = new transport_1.Transport(context.rawInput.trkorr);
68
+ const trkorr = (context.rawInput.trkorr || '').trim().toUpperCase();
69
+ if (!TRKORR_PATTERN.test(trkorr)) {
70
+ throw new Error(`Invalid transport number "${context.rawInput.trkorr}".`);
71
+ }
72
+ const transport = new transport_1.Transport(trkorr);
55
73
  trm_commons_1.Logger.loading(`Checking "${transport.trkorr}"...`);
56
- const exists = !!(yield transport.getE070());
57
- if (!exists) {
74
+ const e070 = yield transport.getE070();
75
+ if (!e070) {
58
76
  throw new Error(`Transport "${transport.trkorr}" was not found in ${systemConnector_1.SystemConnector.getDest()}.`);
59
77
  }
78
+ //1- check is released, exportable request
79
+ if (TASK_TRFUNCTIONS.includes(e070.trfunction)) {
80
+ throw new Error(`"${transport.trkorr}" is a task, not a transport request. Download its request instead.`);
81
+ }
60
82
  const isReleased = yield transport.isReleased();
61
83
  if (!isReleased) {
62
84
  throw new Error(`Transport "${transport.trkorr}" is not released. To download, release it first.`);
63
85
  }
86
+ if (!(e070.tarsystem || '').trim()) {
87
+ throw new Error(`Transport "${transport.trkorr}" is a local request (no target system) and has no export files.`);
88
+ }
89
+ //2- download
64
90
  trm_commons_1.Logger.loading(`Downloading transport ${transport_1.Transport.getTransportIcon()} ${transport.trkorr}...`);
65
91
  const data = yield transport.download();
92
+ if (isEmptyBinary(data.binaries.header) || isEmptyBinary(data.binaries.data)) {
93
+ throw new Error(`Transport "${transport.trkorr}" export files are missing or empty.`);
94
+ }
95
+ //3- zip
66
96
  const zip = new AdmZip.default();
67
97
  zip.addFile(data.filenames.header, data.binaries.header);
68
98
  zip.addFile(data.filenames.data, data.binaries.data);
@@ -1,15 +1,38 @@
1
1
  import { TRKORR } from "../../client";
2
+ /** Input required to export a transport from the connected SAP system. */
2
3
  export interface Cg3yActionInput {
4
+ /**
5
+ * Released SAP transport request number to export, for example `DEVK900123`.
6
+ */
3
7
  trkorr: TRKORR;
4
8
  }
5
9
  type WorkflowRuntime = {};
10
+ /** Result of a successful {@link cg3y} export. */
6
11
  export type Cg3yActionOutput = {
12
+ /**
13
+ * ZIP archive containing the transport's `K` header file and `R` data file.
14
+ */
7
15
  binaries: Buffer;
8
16
  };
17
+ /** Internal workflow state used by the CG3Y action steps. */
9
18
  export interface Cg3yWorkflowContext {
19
+ /** Original action input. */
10
20
  rawInput: Cg3yActionInput;
21
+ /** Reserved runtime state for workflow steps. */
11
22
  runtime?: WorkflowRuntime;
23
+ /** Export result, populated by the download step. */
12
24
  output?: Cg3yActionOutput;
13
25
  }
26
+ /**
27
+ * Exports a released SAP transport as an in-memory ZIP archive.
28
+ *
29
+ * The connected user is authorized first, then the action verifies that the transport
30
+ * exists and is released before downloading its header and data files.
31
+ *
32
+ * @param inputData Transport export request.
33
+ * @returns A ZIP archive containing one matching transport header/data pair.
34
+ * @throws When authorization fails, the transport number is invalid, the transport does not exist, is a task,
35
+ * is not released, is a local request without target system, or its export files are missing or empty.
36
+ */
14
37
  export declare function cg3y(inputData: Cg3yActionInput): Promise<Cg3yActionOutput>;
15
38
  export {};
@@ -8,29 +8,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.cg3y = cg3y;
16
- const sammarksworkflow_1 = __importDefault(require("@simonegaffurini/sammarksworkflow"));
17
- const util_1 = require("util");
18
- const trm_commons_1 = require("trm-commons");
19
13
  const __1 = require("..");
20
14
  const download_1 = require("./download");
21
15
  ;
22
16
  const WORKFLOW_NAME = 'cg3y';
17
+ /**
18
+ * Exports a released SAP transport as an in-memory ZIP archive.
19
+ *
20
+ * The connected user is authorized first, then the action verifies that the transport
21
+ * exists and is released before downloading its header and data files.
22
+ *
23
+ * @param inputData Transport export request.
24
+ * @returns A ZIP archive containing one matching transport header/data pair.
25
+ * @throws When authorization fails, the transport number is invalid, the transport does not exist, is a task,
26
+ * is not released, is a local request without target system, or its export files are missing or empty.
27
+ */
23
28
  function cg3y(inputData) {
24
29
  return __awaiter(this, void 0, void 0, function* () {
25
30
  const workflow = [
26
31
  __1.checkServerAuth,
27
32
  download_1.download
28
33
  ];
29
- trm_commons_1.Logger.log(`Ready to execute workflow ${WORKFLOW_NAME}, input data: ${(0, util_1.inspect)(inputData, { breakLength: Infinity, compact: true })}`, true);
30
- const result = yield (0, sammarksworkflow_1.default)(WORKFLOW_NAME, workflow, {
34
+ const result = yield (0, __1.executeWorkflow)(WORKFLOW_NAME, workflow, {
31
35
  rawInput: inputData
32
- });
33
- trm_commons_1.Logger.log(`Workflow ${WORKFLOW_NAME} result: ${(0, util_1.inspect)(result, { breakLength: Infinity, compact: true })}`, true);
36
+ }, __1.workflowCallbacks);
34
37
  return {
35
38
  binaries: result.output.binaries
36
39
  };
@@ -1,17 +1,81 @@
1
- import { R3transOptions } from "node-r3trans";
2
1
  import { TRKORR } from "../../client";
2
+ /** Shared execution settings for the CG3Z action. */
3
+ export type Cg3zActionInputContextData = {
4
+ /**
5
+ * Disable interactive prompts. Any required choice without an explicit value then causes an error.
6
+ */
7
+ noInquirer?: boolean;
8
+ };
9
+ /** Options controlling the transport upload. */
10
+ export type Cg3zActionInputUploadData = {
11
+ /**
12
+ * Whether to overwrite a transport that already exists in the target system (E070 entry,
13
+ * header or data file). `true` overwrites and `false` aborts. When omitted, the user is asked;
14
+ * with `noInquirer` the upload is aborted.
15
+ */
16
+ overwrite?: boolean;
17
+ };
18
+ /** Input required to upload a transport to the connected SAP system. */
3
19
  export interface Cg3zActionInput {
4
- r3transOptions?: R3transOptions;
20
+ /** Optional shared execution settings. */
21
+ contextData?: Cg3zActionInputContextData;
22
+ /** Optional upload settings. */
23
+ uploadData?: Cg3zActionInputUploadData;
24
+ /**
25
+ * ZIP archive containing exactly one matching `K` header file and `R` data file.
26
+ */
5
27
  binaries: Buffer;
6
28
  }
7
- type WorkflowRuntime = {};
29
+ /** SAP changes attempted by the upload step, each set before its call so a failure is rolled back too. */
30
+ export type Cg3zUploadProgress = {
31
+ /** The transport was already in the connected system import queue: rollback must never remove it. */
32
+ queued: boolean;
33
+ /** Header (cofile) write attempted. */
34
+ header?: boolean;
35
+ /** Data file write attempted. */
36
+ data?: boolean;
37
+ /** Forward to the connected system import queue attempted. */
38
+ forwarded?: boolean;
39
+ };
40
+ type WorkflowRuntime = {
41
+ /** Upload progress, set once SAP writes begin. */
42
+ progress?: Cg3zUploadProgress;
43
+ /** State of an existing transport that is being overwritten, restored on rollback. */
44
+ overwritten?: {
45
+ /** The transport already had an E070 entry: rollback must never delete it. */
46
+ e070: boolean;
47
+ /** Previous header (cofile) content. */
48
+ header?: Buffer;
49
+ /** Previous data file content. */
50
+ data?: Buffer;
51
+ };
52
+ };
53
+ /** Result of a successful {@link cg3z} upload. */
8
54
  export type Cg3zActionOutput = {
55
+ /**
56
+ * Transport request number derived from the uploaded file names.
57
+ */
9
58
  trkorr: TRKORR;
10
59
  };
60
+ /** Internal workflow state used by the CG3Z action steps. */
11
61
  export interface Cg3zWorkflowContext {
62
+ /** Original action input. */
12
63
  rawInput: Cg3zActionInput;
64
+ /** Reserved runtime state for workflow steps. */
13
65
  runtime?: WorkflowRuntime;
66
+ /** Upload result, populated after the archive has been validated. */
14
67
  output?: Cg3zActionOutput;
15
68
  }
69
+ /**
70
+ * Uploads and forwards one SAP transport from an in-memory ZIP archive. When an existing transport
71
+ * is overwritten, its TMS text is refreshed too.
72
+ *
73
+ * @param inputData Transport archive and optional upload settings.
74
+ * @returns The uploaded transport request number.
75
+ * @throws When authorization fails, the archive is malformed, the header/data files do
76
+ * not identify the same transport, the transport already exists and overwriting is refused
77
+ * (or cannot be confirmed with `noInquirer`), or the upload/forward operation fails. A transport-text
78
+ * refresh failure (overwrite only) is logged as a warning and does not reject the action.
79
+ */
16
80
  export declare function cg3z(inputData: Cg3zActionInput): Promise<Cg3zActionOutput>;
17
81
  export {};
@@ -8,31 +8,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.cg3z = cg3z;
16
- const sammarksworkflow_1 = __importDefault(require("@simonegaffurini/sammarksworkflow"));
17
- const util_1 = require("util");
18
- const trm_commons_1 = require("trm-commons");
19
13
  const __1 = require("..");
20
14
  const upload_1 = require("./upload");
15
+ const utils_1 = require("../commons/utils");
21
16
  ;
22
17
  const WORKFLOW_NAME = 'cg3z';
18
+ /**
19
+ * Uploads and forwards one SAP transport from an in-memory ZIP archive. When an existing transport
20
+ * is overwritten, its TMS text is refreshed too.
21
+ *
22
+ * @param inputData Transport archive and optional upload settings.
23
+ * @returns The uploaded transport request number.
24
+ * @throws When authorization fails, the archive is malformed, the header/data files do
25
+ * not identify the same transport, the transport already exists and overwriting is refused
26
+ * (or cannot be confirmed with `noInquirer`), or the upload/forward operation fails. A transport-text
27
+ * refresh failure (overwrite only) is logged as a warning and does not reject the action.
28
+ */
23
29
  function cg3z(inputData) {
24
30
  return __awaiter(this, void 0, void 0, function* () {
31
+ var _a, _b;
32
+ const trkorr = (0, upload_1.parseTransportArchive)(inputData.binaries).trkorr;
33
+ const lockScope = new utils_1.ActionLockScope(WORKFLOW_NAME);
34
+ yield lockScope.acquire([{ type: "TRANSPORT", name: trkorr }]);
25
35
  const workflow = [
26
36
  __1.checkServerAuth,
27
37
  upload_1.upload
28
38
  ];
29
- trm_commons_1.Logger.log(`Ready to execute workflow ${WORKFLOW_NAME}, input data: ${(0, util_1.inspect)(inputData, { breakLength: Infinity, compact: true })}`, true);
30
- const result = yield (0, sammarksworkflow_1.default)(WORKFLOW_NAME, workflow, {
31
- rawInput: inputData
32
- });
33
- trm_commons_1.Logger.log(`Workflow ${WORKFLOW_NAME} result: ${(0, util_1.inspect)(result, { breakLength: Infinity, compact: true })}`, true);
34
- return {
35
- trkorr: result.output.trkorr
36
- };
39
+ (_a = inputData.contextData) !== null && _a !== void 0 ? _a : (inputData.contextData = {});
40
+ (_b = inputData.uploadData) !== null && _b !== void 0 ? _b : (inputData.uploadData = {});
41
+ return (0, utils_1.withActionLockScope)(lockScope, () => __awaiter(this, void 0, void 0, function* () {
42
+ const result = yield (0, __1.executeWorkflow)(WORKFLOW_NAME, workflow, {
43
+ rawInput: inputData,
44
+ runtime: {}
45
+ }, __1.workflowCallbacks);
46
+ return { trkorr: result.output.trkorr };
47
+ }));
37
48
  });
38
49
  }
@@ -1,3 +1,23 @@
1
1
  import { Step } from "@simonegaffurini/sammarksworkflow";
2
2
  import { Cg3zWorkflowContext } from ".";
3
+ import * as AdmZip from "adm-zip";
4
+ export declare function parseTransportArchive(binaries: Buffer): {
5
+ header: AdmZip.IZipEntry;
6
+ data: AdmZip.IZipEntry;
7
+ trkorr: string;
8
+ };
9
+ /**
10
+ * Workflow step that validates, uploads, and forwards a transport archive, refreshing the TMS text of an overwritten transport.
11
+ *
12
+ * 1- identifying transport
13
+ *
14
+ * 2- check existing transport (overwrite confirmation)
15
+ *
16
+ * 3- upload
17
+ *
18
+ * 4- forward
19
+ *
20
+ * 5- refresh text, if overwritten
21
+ *
22
+ */
3
23
  export declare const upload: Step<Cg3zWorkflowContext>;
@@ -43,57 +43,186 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.upload = void 0;
46
+ exports.parseTransportArchive = parseTransportArchive;
46
47
  const transport_1 = require("../../transport");
47
48
  const trm_commons_1 = require("trm-commons");
48
49
  const AdmZip = __importStar(require("adm-zip"));
49
50
  const systemConnector_1 = require("../../systemConnector");
51
+ const stopWarning_1 = require("../stopWarning");
52
+ const TRANSPORT_FILE_PATTERN = /^([KR])([A-Z0-9]{6,})\.([A-Z0-9]{3})$/;
53
+ /**
54
+ * Parses a transport file name (`K900001.TST` / `R900001.TST`), ignoring any folder prefix and case.
55
+ *
56
+ * @returns The file kind and transport number, or `undefined` when the name is not a transport file.
57
+ */
58
+ function parseTransportFileName(entryName) {
59
+ const baseName = entryName.split(/[\\/]/).pop().trim().toUpperCase();
60
+ const match = TRANSPORT_FILE_PATTERN.exec(baseName);
61
+ if (!match) {
62
+ return undefined;
63
+ }
64
+ return {
65
+ kind: match[1],
66
+ trkorr: `${match[3]}K${match[2]}`
67
+ };
68
+ }
69
+ function parseTransportArchive(binaries) {
70
+ const zip = new AdmZip.default(binaries);
71
+ const headers = [];
72
+ const data = [];
73
+ zip.forEach(entry => {
74
+ if (entry.isDirectory)
75
+ return;
76
+ const file = parseTransportFileName(entry.entryName);
77
+ if (!file)
78
+ return;
79
+ (file.kind === 'K' ? headers : data).push({ entry, trkorr: file.trkorr });
80
+ });
81
+ if (headers.length !== 1 || data.length !== 1) {
82
+ throw new Error(`Transport archive must contain exactly one header (K<number>.<SID>) and one data (R<number>.<SID>) file, found ${headers.length} header(s) and ${data.length} data file(s).`);
83
+ }
84
+ const trkorr = data[0].trkorr;
85
+ if (headers[0].trkorr !== trkorr) {
86
+ throw new Error(`Transport header (${headers[0].trkorr}) and data (${trkorr}) don't match!`);
87
+ }
88
+ return { header: headers[0].entry, data: data[0].entry, trkorr };
89
+ }
90
+ /**
91
+ * Workflow step that validates, uploads, and forwards a transport archive, refreshing the TMS text of an overwritten transport.
92
+ *
93
+ * 1- identifying transport
94
+ *
95
+ * 2- check existing transport (overwrite confirmation)
96
+ *
97
+ * 3- upload
98
+ *
99
+ * 4- forward
100
+ *
101
+ * 5- refresh text, if overwritten
102
+ *
103
+ */
50
104
  exports.upload = {
51
105
  name: 'upload',
52
106
  run: (context) => __awaiter(void 0, void 0, void 0, function* () {
53
- trm_commons_1.Logger.log('Upload step', true);
107
+ var _a, _b;
108
+ //1- identifying transport
54
109
  trm_commons_1.Logger.loading(`Reading data...`);
55
- const zip = new AdmZip.default(context.rawInput.binaries);
56
- var aHeader = [];
57
- var aData = [];
58
- zip.forEach(e => {
59
- if (e.entryName.startsWith('K')) {
60
- aHeader.push(e);
110
+ const archive = parseTransportArchive(context.rawInput.binaries);
111
+ context.output = {
112
+ trkorr: archive.trkorr
113
+ };
114
+ //2- check existing transport
115
+ const trkorr = context.output.trkorr;
116
+ const dest = systemConnector_1.SystemConnector.getDest();
117
+ const existingE070 = !!(yield new transport_1.Transport(trkorr).getE070());
118
+ const existingFiles = yield transport_1.Transport.readBinaryFiles(trkorr);
119
+ const existing = [
120
+ existingE070 ? 'request (E070)' : undefined,
121
+ existingFiles.header ? 'header file' : undefined,
122
+ existingFiles.data ? 'data file' : undefined
123
+ ].filter(Boolean);
124
+ if (existing.length > 0) {
125
+ const existingText = `Transport ${transport_1.Transport.getTransportIcon()} ${trkorr} already exists in ${dest} (${existing.join(', ')})`;
126
+ let overwrite = (_a = context.rawInput.uploadData) === null || _a === void 0 ? void 0 : _a.overwrite;
127
+ if (typeof overwrite !== 'boolean') {
128
+ if ((_b = context.rawInput.contextData) === null || _b === void 0 ? void 0 : _b.noInquirer) {
129
+ throw new Error(`${existingText}. Set overwrite to replace it.`);
130
+ }
131
+ overwrite = (yield trm_commons_1.Inquirer.prompt({
132
+ type: 'confirm',
133
+ name: 'overwrite',
134
+ default: false,
135
+ message: `${existingText}. Overwrite?`
136
+ })).overwrite;
61
137
  }
62
- if (e.entryName.startsWith('R')) {
63
- aData.push(e);
138
+ if (!overwrite) {
139
+ throw new Error(`${existingText}. Upload aborted.`);
64
140
  }
65
- });
66
- if (aHeader.length === 0) {
67
- throw new Error(`Couldn't find transport header file.`);
141
+ trm_commons_1.Logger.warning(`${existingText}, overwriting.`);
142
+ context.runtime.overwritten = {
143
+ e070: existingE070,
144
+ header: existingFiles.header,
145
+ data: existingFiles.data
146
+ };
68
147
  }
69
- if (aData.length === 0) {
70
- throw new Error(`Couldn't find transport data file.`);
148
+ //an import queue entry that existed before this run is never removed
149
+ const queued = (yield systemConnector_1.SystemConnector.readTmsQueue(dest)).some(o => o.trkorr === trkorr);
150
+ //3- upload
151
+ (0, stopWarning_1.stopWarning)('cg3z');
152
+ trm_commons_1.Logger.loading(`Uploading transport ${transport_1.Transport.getTransportIcon()} ${trkorr}...`);
153
+ //progress is tracked before each call: a failed write or forward may still have changed SAP
154
+ const progress = { queued };
155
+ context.runtime.progress = progress;
156
+ for (const kind of ['header', 'data']) {
157
+ progress[kind] = true;
158
+ yield transport_1.Transport.writeBinaryFile(trkorr, kind, (kind === 'header' ? archive.header : archive.data).getData());
71
159
  }
72
- if (aHeader.length > 1 || aData.length > 1) {
73
- throw new Error(`Found multiple transports in same zip file!`);
160
+ //4- forward
161
+ trm_commons_1.Logger.loading(`Forwarding transport ${transport_1.Transport.getTransportIcon()} ${trkorr}...`);
162
+ progress.forwarded = true;
163
+ yield systemConnector_1.SystemConnector.forwardTransport(trkorr, dest, dest, true);
164
+ //5- refresh text (only an overwritten transport can have a stale TMS text)
165
+ if (context.runtime.overwritten) {
166
+ try {
167
+ trm_commons_1.Logger.loading(`Refreshing transport ${transport_1.Transport.getTransportIcon()} ${trkorr}...`);
168
+ yield systemConnector_1.SystemConnector.refreshTransportTmsTxt(trkorr);
169
+ }
170
+ catch (e) {
171
+ trm_commons_1.Logger.warning(`Couldn't refresh transport ${trkorr} text: ${(e === null || e === void 0 ? void 0 : e.message) || e}`, { important: true });
172
+ }
74
173
  }
75
- context.output = {
76
- trkorr: transport_1.Transport.getTrkorrFromFileName(aData[0].entryName)
77
- };
78
- if (transport_1.Transport.getTrkorrFromFileName(aHeader[0].entryName) !== context.output.trkorr) {
79
- throw new Error(`Transport header and data don't match!`);
174
+ }),
175
+ revert: (context) => __awaiter(void 0, void 0, void 0, function* () {
176
+ var _a, _b;
177
+ const trkorr = (_a = context.output) === null || _a === void 0 ? void 0 : _a.trkorr;
178
+ const progress = (_b = context.runtime) === null || _b === void 0 ? void 0 : _b.progress;
179
+ if (!trkorr || !progress) {
180
+ return;
80
181
  }
81
- trm_commons_1.Logger.loading(`Uploading transport ${transport_1.Transport.getTransportIcon()} ${context.output.trkorr}...`);
82
- yield transport_1.Transport.upload(context.output.trkorr, {
83
- binary: {
84
- header: aHeader[0].getData(),
85
- data: aData[0].getData()
86
- },
87
- trTarget: systemConnector_1.SystemConnector.getDest()
88
- });
89
- trm_commons_1.Logger.loading(`Forwarding transport ${transport_1.Transport.getTransportIcon()} ${context.output.trkorr}...`);
90
- yield systemConnector_1.SystemConnector.forwardTransport(context.output.trkorr, systemConnector_1.SystemConnector.getDest(), systemConnector_1.SystemConnector.getDest(), true);
91
- try {
92
- trm_commons_1.Logger.loading(`Refreshing transport ${transport_1.Transport.getTransportIcon()} ${context.output.trkorr}...`);
93
- yield systemConnector_1.SystemConnector.refreshTransportTmsTxt(context.output.trkorr);
182
+ const overwritten = context.runtime.overwritten;
183
+ let firstError;
184
+ //the request (E070) is never deleted: the upload doesn't create it, and an existing one isn't ours
185
+ //remove the import queue entry added by this run (the forward targets the connected system)
186
+ if (progress.forwarded && !progress.queued) {
187
+ try {
188
+ trm_commons_1.Logger.loading(`Removing ${trkorr} from ${systemConnector_1.SystemConnector.getDest()} import queue...`, true);
189
+ yield systemConnector_1.SystemConnector.deleteTmsTransport(trkorr, systemConnector_1.SystemConnector.getDest());
190
+ }
191
+ catch (e) {
192
+ firstError !== null && firstError !== void 0 ? firstError : (firstError = e);
193
+ }
194
+ }
195
+ //files created by this run: no file deletion API, emptied files are treated as missing
196
+ const created = ['header', 'data'].filter(kind => progress[kind] && !(overwritten === null || overwritten === void 0 ? void 0 : overwritten[kind]));
197
+ for (const kind of created) {
198
+ try {
199
+ trm_commons_1.Logger.loading(`Emptying uploaded ${trkorr} ${kind} file...`, true);
200
+ yield transport_1.Transport.writeBinaryFile(trkorr, kind, Buffer.alloc(0));
201
+ }
202
+ catch (e) {
203
+ firstError !== null && firstError !== void 0 ? firstError : (firstError = e);
204
+ }
205
+ }
206
+ if (created.length > 0) {
207
+ trm_commons_1.Logger.warning(`Uploaded ${trkorr} files (${created.join(', ')}) were emptied in ${systemConnector_1.SystemConnector.getDest()}: delete them from the transport directory if needed.`, { important: true });
208
+ }
209
+ //restore overwritten files only after the destructive cleanup succeeded
210
+ if (!firstError && overwritten) {
211
+ for (const kind of ['header', 'data']) {
212
+ if (!progress[kind] || !overwritten[kind]) {
213
+ continue;
214
+ }
215
+ try {
216
+ trm_commons_1.Logger.loading(`Restoring previous ${trkorr} ${kind} file...`, true);
217
+ yield transport_1.Transport.writeBinaryFile(trkorr, kind, overwritten[kind]);
218
+ }
219
+ catch (e) {
220
+ firstError !== null && firstError !== void 0 ? firstError : (firstError = e);
221
+ }
222
+ }
94
223
  }
95
- catch (_a) {
96
- trm_commons_1.Logger.warning(`Coudln't refresh transport text!`);
224
+ if (firstError) {
225
+ throw firstError;
97
226
  }
98
227
  })
99
228
  };
@@ -0,0 +1,11 @@
1
+ import { Step } from "@simonegaffurini/sammarksworkflow";
2
+ import { CheckEnginesWorkflowContext } from ".";
3
+ /**
4
+ * Workflow step that evaluates the engines declaration against the connected system.
5
+ *
6
+ * 1- evaluate engines
7
+ *
8
+ * 2- print table
9
+ *
10
+ */
11
+ export declare const analyze: Step<CheckEnginesWorkflowContext>;