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.
- package/README.md +20 -0
- package/changelog.txt +11 -0
- package/dist/actions/cg3y/download.js +34 -4
- package/dist/actions/cg3y/index.d.ts +23 -0
- package/dist/actions/cg3y/index.js +13 -10
- package/dist/actions/cg3z/index.d.ts +67 -3
- package/dist/actions/cg3z/index.js +25 -14
- package/dist/actions/cg3z/upload.d.ts +20 -0
- package/dist/actions/cg3z/upload.js +165 -36
- package/dist/actions/checkEngines/analyze.d.ts +11 -0
- package/dist/actions/checkEngines/analyze.js +294 -0
- package/dist/actions/checkEngines/index.d.ts +87 -0
- package/dist/actions/checkEngines/index.js +38 -0
- package/dist/actions/checkEngines/init.d.ts +11 -0
- package/dist/actions/checkEngines/init.js +45 -0
- package/dist/actions/checkPackageDependencies/analyze.d.ts +10 -0
- package/dist/actions/checkPackageDependencies/analyze.js +37 -39
- package/dist/actions/checkPackageDependencies/index.d.ts +56 -0
- package/dist/actions/checkPackageDependencies/index.js +13 -10
- package/dist/actions/checkPackageDependencies/init.d.ts +8 -0
- package/dist/actions/checkPackageDependencies/init.js +24 -2
- package/dist/actions/checkSapEntries/analyze.d.ts +12 -0
- package/dist/actions/checkSapEntries/analyze.js +63 -47
- package/dist/actions/checkSapEntries/index.d.ts +35 -0
- package/dist/actions/checkSapEntries/index.js +12 -10
- package/dist/actions/checkSapEntries/init.d.ts +8 -0
- package/dist/actions/checkSapEntries/init.js +10 -2
- package/dist/actions/commons/IActionContext.d.ts +10 -0
- package/dist/actions/commons/checkServerAuth.d.ts +7 -0
- package/dist/actions/commons/checkServerAuth.js +10 -5
- package/dist/actions/commons/index.d.ts +1 -1
- package/dist/actions/commons/index.js +1 -1
- package/dist/actions/commons/prompts/index.d.ts +1 -0
- package/dist/actions/commons/prompts/index.js +1 -0
- package/dist/actions/commons/prompts/setLandscapeTarget.d.ts +14 -0
- package/dist/actions/commons/prompts/setLandscapeTarget.js +40 -0
- package/dist/actions/commons/prompts/setTransportTarget.d.ts +15 -0
- package/dist/actions/commons/prompts/setTransportTarget.js +20 -2
- package/dist/actions/commons/setSystemPackages.d.ts +7 -0
- package/dist/actions/commons/setSystemPackages.js +12 -2
- package/dist/actions/commons/utils/actionLocks.d.ts +32 -0
- package/dist/actions/commons/utils/actionLocks.js +135 -0
- package/dist/actions/commons/utils/dirtyEntries.d.ts +12 -0
- package/dist/actions/commons/utils/dirtyEntries.js +54 -0
- package/dist/actions/commons/utils/index.d.ts +10 -0
- package/dist/actions/commons/utils/index.js +26 -0
- package/dist/actions/commons/utils/installRegistry.d.ts +18 -0
- package/dist/actions/commons/utils/installRegistry.js +46 -0
- package/dist/actions/commons/utils/installedDependency.d.ts +15 -0
- package/dist/actions/commons/utils/installedDependency.js +30 -0
- package/dist/actions/commons/utils/owningInstallation.d.ts +6 -0
- package/dist/actions/commons/utils/owningInstallation.js +47 -0
- package/dist/actions/commons/utils/packageCleanup.d.ts +168 -0
- package/dist/actions/commons/utils/packageCleanup.js +1017 -0
- package/dist/actions/commons/utils/releaseDeletionTransport.d.ts +5 -0
- package/dist/actions/commons/utils/releaseDeletionTransport.js +67 -0
- package/dist/actions/commons/utils/restoreTransport.d.ts +6 -0
- package/dist/actions/commons/utils/restoreTransport.js +50 -0
- package/dist/actions/commons/utils/retainedWorkflow.d.ts +6 -0
- package/dist/actions/commons/utils/retainedWorkflow.js +49 -0
- package/dist/actions/commons/utils/withScopedPrefix.d.ts +5 -0
- package/dist/actions/commons/utils/withScopedPrefix.js +32 -0
- package/dist/actions/commons/workflowCallbacks.d.ts +21 -0
- package/dist/actions/commons/workflowCallbacks.js +157 -0
- package/dist/actions/index.d.ts +3 -0
- package/dist/actions/index.js +5 -0
- package/dist/actions/install/addNamespace.d.ts +18 -0
- package/dist/actions/install/addNamespace.js +121 -51
- package/dist/actions/install/checkDependants.d.ts +15 -0
- package/dist/actions/install/checkDependants.js +74 -0
- package/dist/actions/install/checkDependencies.d.ts +11 -0
- package/dist/actions/install/checkDependencies.js +32 -13
- package/dist/actions/install/checkDependencyCycles.d.ts +17 -0
- package/dist/actions/install/checkDependencyCycles.js +105 -0
- package/dist/actions/install/checkEngines.d.ts +11 -0
- package/dist/actions/install/checkEngines.js +100 -0
- package/dist/actions/install/checkInstallDevclass.d.ts +24 -0
- package/dist/actions/install/checkInstallDevclass.js +110 -0
- package/dist/actions/install/checkSapEntries.d.ts +9 -0
- package/dist/actions/install/checkSapEntries.js +20 -12
- package/dist/actions/install/checkTransports.d.ts +34 -0
- package/dist/actions/install/checkTransports.js +329 -170
- package/dist/actions/install/cleanupCheckpoint.d.ts +11 -0
- package/dist/actions/install/cleanupCheckpoint.js +62 -0
- package/dist/actions/install/defaultTransportLayer.d.ts +5 -0
- package/dist/actions/install/defaultTransportLayer.js +36 -0
- package/dist/actions/install/executePostActivities.d.ts +6 -0
- package/dist/actions/install/executePostActivities.js +28 -38
- package/dist/actions/install/generateDevclass.d.ts +10 -0
- package/dist/actions/install/generateDevclass.js +66 -20
- package/dist/actions/install/generateLandscapeTransport.d.ts +23 -0
- package/dist/actions/install/generateLandscapeTransport.js +136 -0
- package/dist/actions/install/generateUpdateTransport.d.ts +20 -0
- package/dist/actions/install/generateUpdateTransport.js +122 -0
- package/dist/actions/install/importBatch.d.ts +22 -0
- package/dist/actions/install/importBatch.js +0 -0
- package/dist/actions/install/index.d.ts +273 -44
- package/dist/actions/install/index.js +139 -59
- package/dist/actions/install/init.d.ts +14 -0
- package/dist/actions/install/init.js +215 -108
- package/dist/actions/install/installDependencies.d.ts +14 -0
- package/dist/actions/install/installDependencies.js +122 -45
- package/dist/actions/install/lockResources.d.ts +8 -0
- package/dist/actions/install/lockResources.js +100 -0
- package/dist/actions/install/prepareCust.d.ts +13 -0
- package/dist/actions/install/prepareCust.js +138 -0
- package/dist/actions/install/prepareDevc.d.ts +15 -0
- package/dist/actions/install/prepareDevc.js +113 -0
- package/dist/actions/install/prepareLang.d.ts +13 -0
- package/dist/actions/install/prepareLang.js +110 -0
- package/dist/actions/install/prepareTadir.d.ts +13 -0
- package/dist/actions/install/prepareTadir.js +95 -0
- package/dist/actions/install/releaseLandscapeTransport.d.ts +11 -0
- package/dist/actions/install/releaseLandscapeTransport.js +79 -0
- package/dist/actions/install/setInstallDevclass.d.ts +10 -0
- package/dist/actions/install/setInstallDevclass.js +140 -54
- package/dist/actions/install/updatePackageData.d.ts +9 -0
- package/dist/actions/install/updatePackageData.js +117 -13
- package/dist/actions/installDependency/checkInstalledRelease.d.ts +13 -0
- package/dist/actions/installDependency/checkInstalledRelease.js +50 -0
- package/dist/actions/installDependency/confirmDowngrade.d.ts +11 -0
- package/dist/actions/installDependency/confirmDowngrade.js +53 -0
- package/dist/actions/installDependency/findInstallRelease.d.ts +24 -0
- package/dist/actions/installDependency/findInstallRelease.js +42 -19
- package/dist/actions/installDependency/index.d.ts +64 -3
- package/dist/actions/installDependency/index.js +30 -13
- package/dist/actions/installDependency/init.d.ts +14 -0
- package/dist/actions/installDependency/init.js +24 -3
- package/dist/actions/installDependency/installRelease.d.ts +6 -0
- package/dist/actions/installDependency/installRelease.js +22 -12
- package/dist/actions/publish/enginesUi.d.ts +53 -0
- package/dist/actions/publish/enginesUi.js +289 -0
- package/dist/actions/publish/findDependencies.d.ts +19 -0
- package/dist/actions/publish/findDependencies.js +72 -37
- package/dist/actions/publish/generateCustTransport.d.ts +6 -0
- package/dist/actions/publish/generateCustTransport.js +42 -19
- package/dist/actions/publish/generateDevcTransport.d.ts +6 -0
- package/dist/actions/publish/generateDevcTransport.js +16 -18
- package/dist/actions/publish/generateLangTransport.d.ts +6 -0
- package/dist/actions/publish/generateLangTransport.js +20 -23
- package/dist/actions/publish/generateTadirTransport.d.ts +6 -0
- package/dist/actions/publish/generateTadirTransport.js +18 -17
- package/dist/actions/publish/getSystemEngines.d.ts +27 -0
- package/dist/actions/publish/getSystemEngines.js +112 -0
- package/dist/actions/publish/index.d.ts +162 -37
- package/dist/actions/publish/index.js +51 -34
- package/dist/actions/publish/init.d.ts +28 -0
- package/dist/actions/publish/init.js +304 -120
- package/dist/actions/publish/lockResources.d.ts +4 -0
- package/dist/actions/{install/refreshTmsTxt.js → publish/lockResources.js} +14 -17
- package/dist/actions/publish/publishToRegistry.d.ts +8 -0
- package/dist/actions/publish/publishToRegistry.js +18 -8
- package/dist/actions/publish/releaseTransports.d.ts +6 -0
- package/dist/actions/publish/releaseTransports.js +48 -20
- package/dist/actions/publish/setCustomizingTransports.d.ts +6 -0
- package/dist/actions/publish/setCustomizingTransports.js +227 -101
- package/dist/actions/publish/setManifestValues.d.ts +22 -0
- package/dist/actions/publish/setManifestValues.js +455 -119
- package/dist/actions/publish/setOptionalPublishData.d.ts +11 -0
- package/dist/actions/publish/setOptionalPublishData.js +133 -0
- package/dist/actions/publish/updatePackageData.d.ts +8 -0
- package/dist/actions/publish/updatePackageData.js +20 -7
- package/dist/actions/stopWarning.d.ts +5 -0
- package/dist/actions/stopWarning.js +5 -0
- package/dist/actions/uninstall/checkDependants.d.ts +7 -0
- package/dist/actions/uninstall/checkDependants.js +55 -0
- package/dist/actions/uninstall/forwardDeletionTransport.d.ts +10 -0
- package/dist/actions/uninstall/forwardDeletionTransport.js +51 -0
- package/dist/actions/uninstall/generateDeletionTransport.d.ts +10 -0
- package/dist/actions/uninstall/generateDeletionTransport.js +45 -0
- package/dist/actions/uninstall/index.d.ts +153 -0
- package/dist/actions/uninstall/index.js +141 -0
- package/dist/actions/uninstall/init.d.ts +17 -0
- package/dist/actions/uninstall/init.js +146 -0
- package/dist/actions/uninstall/lockResources.d.ts +4 -0
- package/dist/actions/{publish/setTransportTarget.js → uninstall/lockResources.js} +16 -7
- package/dist/actions/uninstall/removePackageData.d.ts +9 -0
- package/dist/actions/uninstall/removePackageData.js +64 -0
- package/dist/actions/uninstall/uninstallNestedPackages.d.ts +26 -0
- package/dist/actions/uninstall/uninstallNestedPackages.js +174 -0
- package/dist/client/ClientError.d.ts +3 -1
- package/dist/client/ClientError.js +2 -1
- package/dist/client/RESTClient.d.ts +18 -5
- package/dist/client/RESTClient.js +194 -52
- package/dist/client/RESTClientError.d.ts +1 -2
- package/dist/client/RESTClientError.js +3 -2
- package/dist/client/RFCClient.d.ts +28 -7
- package/dist/client/RFCClient.js +325 -77
- package/dist/client/RFCClientError.d.ts +1 -1
- package/dist/client/RFCClientError.js +2 -2
- package/dist/client/TransportEntries.d.ts +8 -0
- package/dist/client/TransportEntries.js +2 -0
- package/dist/client/components/BORM_ID.d.ts +1 -0
- package/dist/client/components/BORM_ID.js +2 -0
- package/dist/client/components/BORM_NAME.d.ts +1 -0
- package/dist/client/components/BORM_NAME.js +2 -0
- package/dist/client/components/BORM_NAMEL.d.ts +1 -0
- package/dist/client/components/BORM_NAMEL.js +2 -0
- package/dist/client/components/BORM_VEND.d.ts +1 -0
- package/dist/client/components/BORM_VEND.js +2 -0
- package/dist/client/components/BORM_VERS.d.ts +1 -0
- package/dist/client/components/BORM_VERS.js +2 -0
- package/dist/client/components/CWBNTNUMM.d.ts +1 -0
- package/dist/client/components/CWBNTNUMM.js +2 -0
- package/dist/client/components/CWBNTSTAT.d.ts +1 -0
- package/dist/client/components/CWBNTSTAT.js +2 -0
- package/dist/client/components/CWBNTVERS.d.ts +1 -0
- package/dist/client/components/CWBNTVERS.js +2 -0
- package/dist/client/components/CWBPRSTAT.d.ts +1 -0
- package/dist/client/components/CWBPRSTAT.js +2 -0
- package/dist/client/components/INSTSTATE.d.ts +1 -0
- package/dist/client/components/INSTSTATE.js +2 -0
- package/dist/client/components/RELC_TYPE.d.ts +1 -0
- package/dist/client/components/RELC_TYPE.js +2 -0
- package/dist/client/components/SAPPATCHLV.d.ts +1 -0
- package/dist/client/components/SAPPATCHLV.js +2 -0
- package/dist/client/components/SAPRELEASE.d.ts +1 -0
- package/dist/client/components/SAPRELEASE.js +2 -0
- package/dist/client/components/SYSYSID.d.ts +1 -0
- package/dist/client/components/SYSYSID.js +2 -0
- package/dist/client/components/ZTRM_INSTALLTR_TYPE.d.ts +1 -0
- package/dist/client/components/ZTRM_INSTALLTR_TYPE.js +2 -0
- package/dist/client/components/index.d.ts +15 -0
- package/dist/client/components/index.js +15 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/messageLog.d.ts +7 -0
- package/dist/client/messageLog.js +21 -0
- package/dist/client/struct/ActionLockKey.d.ts +6 -0
- package/dist/client/struct/ActionLockKey.js +2 -0
- package/dist/client/struct/CVERS.d.ts +7 -0
- package/dist/client/struct/CVERS.js +2 -0
- package/dist/client/struct/CWBNTCUST.d.ts +6 -0
- package/dist/client/struct/CWBNTCUST.js +2 -0
- package/dist/client/struct/CWBNTHEAD.d.ts +5 -0
- package/dist/client/struct/CWBNTHEAD.js +2 -0
- package/dist/client/struct/E070.d.ts +2 -1
- package/dist/client/struct/E071K.d.ts +9 -0
- package/dist/client/struct/E071K.js +2 -0
- package/dist/client/struct/PRDVERS.d.ts +9 -0
- package/dist/client/struct/PRDVERS.js +2 -0
- package/dist/client/struct/SCOMPKDTLN.d.ts +21 -0
- package/dist/client/struct/STMSCALERT.d.ts +21 -0
- package/dist/client/struct/STMSCALERT.js +2 -0
- package/dist/client/struct/STMS_TP_IMPORT.d.ts +14 -0
- package/dist/client/struct/STMS_TP_IMPORT.js +2 -0
- package/dist/client/struct/STMS_TR_REQUEST.d.ts +8 -0
- package/dist/client/struct/STMS_TR_REQUEST.js +2 -0
- package/dist/client/struct/TDEVC.d.ts +38 -0
- package/dist/client/struct/TPLOGPTR.d.ts +13 -0
- package/dist/client/struct/TPLOGPTR.js +2 -0
- package/dist/client/struct/TPSTDOUT.d.ts +3 -0
- package/dist/client/struct/TPSTDOUT.js +2 -0
- package/dist/client/struct/ZTRM_INSTALLTR.d.ts +8 -0
- package/dist/client/struct/ZTRM_INSTALLTR.js +2 -0
- package/dist/client/struct/index.d.ts +12 -0
- package/dist/client/struct/index.js +12 -0
- package/dist/commons/checkCoreTrmDependencies.js +1 -1
- package/dist/commons/getAxiosInstance.js +8 -17
- package/dist/commons/getNodePackage.js +7 -0
- package/dist/commons/getPackageHierarchy.js +2 -0
- package/dist/commons/getPackagesNamespace.d.ts +9 -0
- package/dist/commons/getPackagesNamespace.js +19 -0
- package/dist/commons/index.d.ts +4 -0
- package/dist/commons/index.js +4 -0
- package/dist/commons/packageDataFromTdevc.d.ts +12 -0
- package/dist/commons/packageDataFromTdevc.js +25 -0
- package/dist/commons/resolveCoreVersion.d.ts +10 -0
- package/dist/commons/resolveCoreVersion.js +24 -0
- package/dist/commons/summarizeForLog.d.ts +22 -0
- package/dist/commons/summarizeForLog.js +120 -0
- package/dist/connection/OpenRFCConnect.d.ts +13 -0
- package/dist/connection/OpenRFCConnect.js +23 -0
- package/dist/connection/index.d.ts +1 -0
- package/dist/connection/index.js +17 -0
- package/dist/dependencies/PackageDependencies.d.ts +2 -0
- package/dist/dependencies/PackageDependencies.js +24 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lockfile/Lockfile.d.ts +23 -1
- package/dist/lockfile/Lockfile.js +45 -9
- package/dist/manifest/Manifest.d.ts +9 -5
- package/dist/manifest/Manifest.js +82 -29
- package/dist/manifest/PostActivity.js +3 -3
- package/dist/manifest/TrmManifest.d.ts +0 -2
- package/dist/manifest/TrmManifestBase.d.ts +2 -0
- package/dist/manifest/TrmManifestEngines.d.ts +64 -0
- package/dist/manifest/TrmManifestEngines.js +2 -0
- package/dist/manifest/engines/index.d.ts +2 -0
- package/dist/manifest/engines/index.js +18 -0
- package/dist/manifest/engines/sapRange.d.ts +38 -0
- package/dist/manifest/engines/sapRange.js +135 -0
- package/dist/manifest/engines/validateEngines.d.ts +44 -0
- package/dist/manifest/engines/validateEngines.js +282 -0
- package/dist/manifest/index.d.ts +3 -0
- package/dist/manifest/index.js +3 -0
- package/dist/manifest/sapEntries.d.ts +14 -0
- package/dist/manifest/sapEntries.js +63 -0
- package/dist/protocol/Protocol.js +7 -0
- package/dist/registry/AbstractRegistry.d.ts +18 -3
- package/dist/registry/FileSystem.d.ts +22 -13
- package/dist/registry/FileSystem.js +69 -18
- package/dist/registry/RegistryDeletionTransportUnauthorizedError.d.ts +4 -0
- package/dist/registry/RegistryDeletionTransportUnauthorizedError.js +12 -0
- package/dist/registry/RegistryDeletionTransportUnavailableError.d.ts +9 -0
- package/dist/registry/RegistryDeletionTransportUnavailableError.js +17 -0
- package/dist/registry/RegistryPackageNotFoundError.d.ts +7 -0
- package/dist/registry/RegistryPackageNotFoundError.js +14 -0
- package/dist/registry/RegistryV2.d.ts +15 -5
- package/dist/registry/RegistryV2.js +308 -48
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.js +4 -0
- package/dist/registry/registryKey.d.ts +7 -0
- package/dist/registry/registryKey.js +21 -0
- package/dist/systemConnector/ActionLock.d.ts +1 -0
- package/dist/systemConnector/ActionLock.js +2 -0
- package/dist/systemConnector/ISystemConnector.d.ts +21 -4
- package/dist/systemConnector/ISystemConnectorBase.d.ts +16 -0
- package/dist/systemConnector/InstallTransport.d.ts +6 -0
- package/dist/systemConnector/InstallTransport.js +2 -0
- package/dist/systemConnector/OpenRFCSystemConnector.d.ts +12 -0
- package/dist/systemConnector/OpenRFCSystemConnector.js +51 -0
- package/dist/systemConnector/RESTSystemConnector.d.ts +22 -7
- package/dist/systemConnector/RESTSystemConnector.js +95 -23
- package/dist/systemConnector/RFCConnection.d.ts +0 -1
- package/dist/systemConnector/RFCSystemConnector.d.ts +25 -7
- package/dist/systemConnector/RFCSystemConnector.js +75 -16
- package/dist/systemConnector/SystemConnector.d.ts +38 -6
- package/dist/systemConnector/SystemConnector.js +138 -12
- package/dist/systemConnector/SystemConnectorBase.d.ts +24 -1
- package/dist/systemConnector/SystemConnectorBase.js +174 -22
- package/dist/systemConnector/index.d.ts +3 -0
- package/dist/systemConnector/index.js +3 -0
- package/dist/transport/E071KOwner.d.ts +10 -0
- package/dist/transport/E071KOwner.js +15 -0
- package/dist/transport/R3transLogParser.d.ts +19 -0
- package/dist/transport/R3transLogParser.js +148 -0
- package/dist/transport/Transport.d.ts +36 -3
- package/dist/transport/Transport.js +304 -138
- package/dist/transport/index.d.ts +2 -0
- package/dist/transport/index.js +2 -0
- package/dist/trmPackage/TransportBinary.d.ts +4 -1
- package/dist/trmPackage/TrmArtifact.d.ts +12 -8
- package/dist/trmPackage/TrmArtifact.js +93 -74
- package/dist/trmPackage/TrmPackage.d.ts +20 -6
- package/dist/trmPackage/TrmPackage.js +27 -1
- package/dist/validators/validateDevclass.js +4 -0
- package/package.json +15 -7
- package/dist/actions/commons/trmServerPa.d.ts +0 -3
- package/dist/actions/commons/trmServerPa.js +0 -40
- package/dist/actions/install/checkAlreadyInstalled.d.ts +0 -3
- package/dist/actions/install/checkAlreadyInstalled.js +0 -71
- package/dist/actions/install/checkObjectTypes.d.ts +0 -3
- package/dist/actions/install/checkObjectTypes.js +0 -50
- package/dist/actions/install/checkObjectsLock.d.ts +0 -3
- package/dist/actions/install/checkObjectsLock.js +0 -52
- package/dist/actions/install/generateInstallTransports.d.ts +0 -3
- package/dist/actions/install/generateInstallTransports.js +0 -128
- package/dist/actions/install/importCustTransport.d.ts +0 -3
- package/dist/actions/install/importCustTransport.js +0 -73
- package/dist/actions/install/importDevcTransport.d.ts +0 -3
- package/dist/actions/install/importDevcTransport.js +0 -93
- package/dist/actions/install/importLangTransport.d.ts +0 -3
- package/dist/actions/install/importLangTransport.js +0 -72
- package/dist/actions/install/importTadirTransport.d.ts +0 -3
- package/dist/actions/install/importTadirTransport.js +0 -83
- package/dist/actions/install/readDevc.d.ts +0 -3
- package/dist/actions/install/readDevc.js +0 -33
- package/dist/actions/install/readTadir.d.ts +0 -3
- package/dist/actions/install/readTadir.js +0 -101
- package/dist/actions/install/refreshTmsTxt.d.ts +0 -3
- package/dist/actions/install/releaseInstallTransport.d.ts +0 -3
- package/dist/actions/install/releaseInstallTransport.js +0 -80
- package/dist/actions/publish/checkAllObjectsReleased.d.ts +0 -3
- package/dist/actions/publish/checkAllObjectsReleased.js +0 -46
- package/dist/actions/publish/getSourceCode.d.ts +0 -3
- package/dist/actions/publish/getSourceCode.js +0 -49
- package/dist/actions/publish/setChangelog.d.ts +0 -3
- package/dist/actions/publish/setChangelog.js +0 -69
- package/dist/actions/publish/setDevclass.d.ts +0 -3
- package/dist/actions/publish/setDevclass.js +0 -74
- package/dist/actions/publish/setReadme.d.ts +0 -3
- package/dist/actions/publish/setReadme.js +0 -52
- package/dist/actions/publish/setTransportTarget.d.ts +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The registry can't generate a deletion transport: the user isn't authorized (e.g. registry plan)
|
|
3
|
+
* or the registry doesn't support it (local .trm files). Cleanups that only tidy up continue without it.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RegistryDeletionTransportUnavailableError extends Error {
|
|
6
|
+
readonly registryEndpoint: string;
|
|
7
|
+
readonly originalError: unknown;
|
|
8
|
+
constructor(registryEndpoint: string, message: string, originalError?: unknown);
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistryDeletionTransportUnavailableError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The registry can't generate a deletion transport: the user isn't authorized (e.g. registry plan)
|
|
6
|
+
* or the registry doesn't support it (local .trm files). Cleanups that only tidy up continue without it.
|
|
7
|
+
*/
|
|
8
|
+
class RegistryDeletionTransportUnavailableError extends Error {
|
|
9
|
+
constructor(registryEndpoint, message, originalError) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'RegistryDeletionTransportUnavailableError';
|
|
12
|
+
this.registryEndpoint = registryEndpoint;
|
|
13
|
+
this.originalError = originalError;
|
|
14
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.RegistryDeletionTransportUnavailableError = RegistryDeletionTransportUnavailableError;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class RegistryPackageNotFoundError extends Error {
|
|
2
|
+
readonly packageName: string;
|
|
3
|
+
readonly requestedVersion: string;
|
|
4
|
+
readonly registryEndpoint: string;
|
|
5
|
+
readonly originalError: unknown;
|
|
6
|
+
constructor(packageName: string, requestedVersion: string, registryEndpoint: string, originalError: unknown);
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistryPackageNotFoundError = void 0;
|
|
4
|
+
class RegistryPackageNotFoundError extends Error {
|
|
5
|
+
constructor(packageName, requestedVersion, registryEndpoint, originalError) {
|
|
6
|
+
super(`Package "${packageName}" version "${requestedVersion}" was not found in registry "${registryEndpoint}".`);
|
|
7
|
+
this.name = 'RegistryPackageNotFoundError';
|
|
8
|
+
this.packageName = packageName;
|
|
9
|
+
this.requestedVersion = requestedVersion;
|
|
10
|
+
this.registryEndpoint = registryEndpoint;
|
|
11
|
+
this.originalError = originalError;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.RegistryPackageNotFoundError = RegistryPackageNotFoundError;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { RegistryType } from "./RegistryType";
|
|
2
|
-
import { BatchCompareRequest, BatchCompareResponse, Deprecate, DistTagAdd, DistTagRm, Package,
|
|
2
|
+
import { BatchCompareRequest, BatchCompareResponse, Deprecate, DistTagAdd, DistTagRm, Package, Ping, WhoAmI } from "trm-registry-types";
|
|
3
3
|
import { TrmArtifact } from "../trmPackage/TrmArtifact";
|
|
4
|
-
import { AbstractRegistry } from "./AbstractRegistry";
|
|
4
|
+
import { AbstractRegistry, PublishAdditionalData, PublishResult } from "./AbstractRegistry";
|
|
5
|
+
import { TransportEntries } from "../client";
|
|
6
|
+
import { BinaryTransport } from "../transport";
|
|
5
7
|
export declare const PUBLIC_RESERVED_KEYWORD = "public";
|
|
6
8
|
export declare class RegistryV2 implements AbstractRegistry {
|
|
7
9
|
endpoint: string;
|
|
@@ -11,8 +13,10 @@ export declare class RegistryV2 implements AbstractRegistry {
|
|
|
11
13
|
private _registryType;
|
|
12
14
|
private _axiosInstance;
|
|
13
15
|
private _authData;
|
|
16
|
+
private _externalUserAgent;
|
|
14
17
|
private _userAgent;
|
|
15
18
|
constructor(endpoint: string, name?: string, _coreVersion?: string);
|
|
19
|
+
setExternalUserAgent(userAgent: string): void;
|
|
16
20
|
private getDefaultAxiosHeaders;
|
|
17
21
|
compare(registry: AbstractRegistry): boolean;
|
|
18
22
|
getRegistryType(): RegistryType;
|
|
@@ -21,16 +25,22 @@ export declare class RegistryV2 implements AbstractRegistry {
|
|
|
21
25
|
private _tokenAuth;
|
|
22
26
|
private _oauth2;
|
|
23
27
|
getAuthData(): any;
|
|
28
|
+
private assertStatus;
|
|
29
|
+
private getErrorStatus;
|
|
24
30
|
ping(): Promise<Ping>;
|
|
25
31
|
whoAmI(): Promise<WhoAmI>;
|
|
26
|
-
getPackage(fullName: string, version?: string): Promise<Package>;
|
|
32
|
+
getPackage(fullName: string, version?: string, refresh?: boolean): Promise<Package>;
|
|
33
|
+
private getPackageCacheKey;
|
|
34
|
+
transportEntries(fullName: string, version: string, trkorr: string): Promise<TransportEntries>;
|
|
27
35
|
downloadArtifact(fullName: string, version?: string): Promise<TrmArtifact>;
|
|
28
36
|
validatePublish(fullName: string, version: string, isPrivate: boolean): Promise<void>;
|
|
29
|
-
publish(fullName: string, version: string, artifact: TrmArtifact,
|
|
37
|
+
publish(fullName: string, version: string, artifact: TrmArtifact, additionalData?: PublishAdditionalData): Promise<PublishResult | void>;
|
|
30
38
|
unpublish(fullName: string, version: string): Promise<void>;
|
|
31
39
|
deprecate(fullName: string, version: string, deprecate: Deprecate): Promise<void>;
|
|
32
40
|
addDistTag(fullName: string, distTag: DistTagAdd): Promise<void>;
|
|
33
41
|
rmDistTag(fullName: string, distTag: DistTagRm): Promise<void>;
|
|
34
42
|
batchCompare(packages: BatchCompareRequest): Promise<BatchCompareResponse>;
|
|
35
|
-
|
|
43
|
+
delete(transport: BinaryTransport): Promise<BinaryTransport>;
|
|
44
|
+
transport(trkorr: string, target?: string): Promise<BinaryTransport>;
|
|
45
|
+
private downloadTransport;
|
|
36
46
|
}
|
|
@@ -58,8 +58,15 @@ const protocol_1 = require("../protocol");
|
|
|
58
58
|
const opener_1 = __importDefault(require("opener"));
|
|
59
59
|
const commons_1 = require("../commons");
|
|
60
60
|
const node_cache_1 = __importDefault(require("node-cache"));
|
|
61
|
+
const AdmZip = __importStar(require("adm-zip"));
|
|
62
|
+
const RegistryPackageNotFoundError_1 = require("./RegistryPackageNotFoundError");
|
|
63
|
+
const RegistryDeletionTransportUnauthorizedError_1 = require("./RegistryDeletionTransportUnauthorizedError");
|
|
61
64
|
const AXIOS_CTX = "RegistryV2";
|
|
62
65
|
exports.PUBLIC_RESERVED_KEYWORD = 'public';
|
|
66
|
+
const PUBLISH_POLL_INTERVAL_MS = 5000;
|
|
67
|
+
const PUBLISH_POLL_TIMEOUT_MS = 30 * 60 * 1000;
|
|
68
|
+
const PUBLISH_POLL_MAX_FAILURES = 3;
|
|
69
|
+
const isPublishStatus = (status) => !!status && Number.isInteger(status.steps) && Number.isInteger(status.current_step);
|
|
63
70
|
class RegistryV2 {
|
|
64
71
|
constructor(endpoint, name = 'Unknown', _coreVersion) {
|
|
65
72
|
this.endpoint = endpoint;
|
|
@@ -69,12 +76,15 @@ class RegistryV2 {
|
|
|
69
76
|
var envEndpoint = process.env.TRM_PUBLIC_REGISTRY_ENDPOINT;
|
|
70
77
|
trm_commons_1.Logger.log(`TRM_PUBLIC_REGISTRY_ENDPOINT Environment variable: ${envEndpoint}`, true);
|
|
71
78
|
if (!envEndpoint || envEndpoint.trim().toLowerCase() === exports.PUBLIC_RESERVED_KEYWORD) {
|
|
79
|
+
//no env var value or env var value = public
|
|
72
80
|
envEndpoint = 'https://www.trmregistry.com/registry';
|
|
73
81
|
}
|
|
74
82
|
if (endpoint.trim().toLowerCase() === exports.PUBLIC_RESERVED_KEYWORD) {
|
|
83
|
+
//if input endpoint is public
|
|
75
84
|
this._registryType = RegistryType_1.RegistryType.PUBLIC;
|
|
76
85
|
}
|
|
77
86
|
else {
|
|
87
|
+
//all other cases
|
|
78
88
|
this._registryType = RegistryType_1.RegistryType.PRIVATE;
|
|
79
89
|
}
|
|
80
90
|
if (this._registryType === RegistryType_1.RegistryType.PUBLIC) {
|
|
@@ -99,6 +109,9 @@ class RegistryV2 {
|
|
|
99
109
|
headers: this.getDefaultAxiosHeaders()
|
|
100
110
|
}, AXIOS_CTX);
|
|
101
111
|
}
|
|
112
|
+
setExternalUserAgent(userAgent) {
|
|
113
|
+
this._externalUserAgent = userAgent;
|
|
114
|
+
}
|
|
102
115
|
getDefaultAxiosHeaders() {
|
|
103
116
|
var axiosHeaders = new axios_1.AxiosHeaders();
|
|
104
117
|
if (!this._userAgent) {
|
|
@@ -109,7 +122,7 @@ class RegistryV2 {
|
|
|
109
122
|
this._userAgent = `trm-core with unknown version`;
|
|
110
123
|
}
|
|
111
124
|
}
|
|
112
|
-
axiosHeaders.setUserAgent(this._userAgent);
|
|
125
|
+
axiosHeaders.setUserAgent(this._externalUserAgent ? `${this._externalUserAgent}, ${this._userAgent}` : this._userAgent);
|
|
113
126
|
return axiosHeaders;
|
|
114
127
|
}
|
|
115
128
|
compare(registry) {
|
|
@@ -191,7 +204,7 @@ class RegistryV2 {
|
|
|
191
204
|
var token = defaultData.token;
|
|
192
205
|
if (!token && this._registryType == RegistryType_1.RegistryType.PUBLIC) {
|
|
193
206
|
trm_commons_1.Logger.info(`To authenticate, generate a new token.`);
|
|
194
|
-
trm_commons_1.Logger.info(`Follow the instructions https://docs.trmregistry.com
|
|
207
|
+
trm_commons_1.Logger.info(`Follow the instructions https://docs.trmregistry.com/registry/public/authentication/ .`);
|
|
195
208
|
}
|
|
196
209
|
const inq1 = yield trm_commons_1.Inquirer.prompt([{
|
|
197
210
|
type: "input",
|
|
@@ -232,9 +245,11 @@ class RegistryV2 {
|
|
|
232
245
|
grant_type: "refresh_token",
|
|
233
246
|
refresh_token: refreshToken
|
|
234
247
|
};
|
|
235
|
-
|
|
248
|
+
const tokenResponse = yield ((0, commons_1.getAxiosInstance)({
|
|
236
249
|
baseURL: this.endpoint
|
|
237
|
-
}, AXIOS_CTX)).post('/auth', oAuth2Request)
|
|
250
|
+
}, AXIOS_CTX)).post('/auth', oAuth2Request);
|
|
251
|
+
this.assertStatus(tokenResponse.status, [200], 'OAuth token refresh');
|
|
252
|
+
oAuth2Response = tokenResponse.data;
|
|
238
253
|
runAuthFlow = false;
|
|
239
254
|
authData = {
|
|
240
255
|
access_token: oAuth2Response.access_token,
|
|
@@ -290,9 +305,11 @@ class RegistryV2 {
|
|
|
290
305
|
grant_type: "authorization_code",
|
|
291
306
|
redirect_uri: sRedirectUri
|
|
292
307
|
};
|
|
293
|
-
|
|
308
|
+
const tokenResponse = yield ((0, commons_1.getAxiosInstance)({
|
|
294
309
|
baseURL: this.endpoint
|
|
295
|
-
}, AXIOS_CTX)).post('/auth', oAuth2Request)
|
|
310
|
+
}, AXIOS_CTX)).post('/auth', oAuth2Request);
|
|
311
|
+
this.assertStatus(tokenResponse.status, [200], 'OAuth token exchange');
|
|
312
|
+
oAuth2Response = tokenResponse.data;
|
|
296
313
|
if (oAuth2Response.token_type !== "Bearer") {
|
|
297
314
|
throw new Error('Unknown token type.');
|
|
298
315
|
}
|
|
@@ -320,14 +337,26 @@ class RegistryV2 {
|
|
|
320
337
|
getAuthData() {
|
|
321
338
|
return this._authData;
|
|
322
339
|
}
|
|
340
|
+
assertStatus(status, expected, operation) {
|
|
341
|
+
if (!expected.includes(status)) {
|
|
342
|
+
throw new Error(`${operation} returned unexpected HTTP status ${status}; expected ${expected.join(' or ')}.`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
getErrorStatus(error) {
|
|
346
|
+
var _a, _b, _c, _d, _e;
|
|
347
|
+
const registryError = error;
|
|
348
|
+
return (_c = (_a = registryError.status) !== null && _a !== void 0 ? _a : (_b = registryError.response) === null || _b === void 0 ? void 0 : _b.status) !== null && _c !== void 0 ? _c : (_e = (_d = registryError.axiosError) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.status;
|
|
349
|
+
}
|
|
323
350
|
ping() {
|
|
324
351
|
return __awaiter(this, void 0, void 0, function* () {
|
|
325
352
|
var data = this._cache.get('ping');
|
|
326
353
|
if (!data) {
|
|
327
354
|
try {
|
|
328
|
-
|
|
355
|
+
const response = yield this._axiosInstance.get('/', {
|
|
329
356
|
headers: {}
|
|
330
|
-
})
|
|
357
|
+
});
|
|
358
|
+
this.assertStatus(response.status, [200], 'Registry metadata request');
|
|
359
|
+
data = response.data;
|
|
331
360
|
}
|
|
332
361
|
catch (e) {
|
|
333
362
|
if (e.errors) {
|
|
@@ -350,7 +379,9 @@ class RegistryV2 {
|
|
|
350
379
|
var data = this._cache.get('whoami');
|
|
351
380
|
if (!data) {
|
|
352
381
|
try {
|
|
353
|
-
|
|
382
|
+
const response = yield this._axiosInstance.get('/whoami');
|
|
383
|
+
this.assertStatus(response.status, [200], 'Registry identity request');
|
|
384
|
+
data = response.data;
|
|
354
385
|
}
|
|
355
386
|
catch (e) {
|
|
356
387
|
data = e;
|
|
@@ -366,16 +397,22 @@ class RegistryV2 {
|
|
|
366
397
|
});
|
|
367
398
|
}
|
|
368
399
|
getPackage(fullName_1) {
|
|
369
|
-
return __awaiter(this, arguments, void 0, function* (fullName, version = 'latest') {
|
|
370
|
-
|
|
400
|
+
return __awaiter(this, arguments, void 0, function* (fullName, version = 'latest', refresh = false) {
|
|
401
|
+
const cacheKey = this.getPackageCacheKey(fullName, version);
|
|
402
|
+
if (refresh) {
|
|
403
|
+
this._cache.del(cacheKey);
|
|
404
|
+
}
|
|
405
|
+
var data = this._cache.get(cacheKey);
|
|
371
406
|
if (!data) {
|
|
372
407
|
var ttl;
|
|
373
408
|
try {
|
|
374
|
-
|
|
409
|
+
const response = yield this._axiosInstance.get(`/package/${fullName}`, {
|
|
375
410
|
params: {
|
|
376
|
-
version
|
|
411
|
+
version
|
|
377
412
|
}
|
|
378
|
-
})
|
|
413
|
+
});
|
|
414
|
+
this.assertStatus(response.status, [200], 'Package metadata request');
|
|
415
|
+
data = response.data;
|
|
379
416
|
if (data.download_link_expiry) {
|
|
380
417
|
try {
|
|
381
418
|
ttl = Math.max(0, Math.floor((data.download_link_expiry - Date.now()) / 1000));
|
|
@@ -384,9 +421,17 @@ class RegistryV2 {
|
|
|
384
421
|
}
|
|
385
422
|
}
|
|
386
423
|
catch (e) {
|
|
387
|
-
data = e
|
|
424
|
+
data = this.getErrorStatus(e) === 404
|
|
425
|
+
? new RegistryPackageNotFoundError_1.RegistryPackageNotFoundError(fullName, version, this.endpoint, e)
|
|
426
|
+
: e;
|
|
427
|
+
}
|
|
428
|
+
// A failed refresh must not poison the cache. In particular, a
|
|
429
|
+
// transient ECONNRESET should allow the caller to retry the GET.
|
|
430
|
+
if (!(data instanceof Error)) {
|
|
431
|
+
if (ttl === undefined || ttl > 0) {
|
|
432
|
+
this._cache.set(cacheKey, data, ttl);
|
|
433
|
+
}
|
|
388
434
|
}
|
|
389
|
-
this._cache.set(`package-${fullName}-${version}`, data, ttl);
|
|
390
435
|
}
|
|
391
436
|
if (data instanceof Error) {
|
|
392
437
|
throw data;
|
|
@@ -396,6 +441,48 @@ class RegistryV2 {
|
|
|
396
441
|
}
|
|
397
442
|
});
|
|
398
443
|
}
|
|
444
|
+
getPackageCacheKey(fullName, version) {
|
|
445
|
+
return `package-${fullName}-${version}`;
|
|
446
|
+
}
|
|
447
|
+
transportEntries(fullName, version, trkorr) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
const download = (...args_1) => __awaiter(this, [...args_1], void 0, function* (refreshPackage = false) {
|
|
450
|
+
let packageData;
|
|
451
|
+
try {
|
|
452
|
+
packageData = yield this.getPackage(fullName, version, refreshPackage);
|
|
453
|
+
}
|
|
454
|
+
catch (e) {
|
|
455
|
+
// Signed links are commonly refreshed after the HTTP connection
|
|
456
|
+
// has been idle. Retry this safe metadata GET once if that stale
|
|
457
|
+
// connection was reset; Axios retains the instance auth headers.
|
|
458
|
+
if (refreshPackage && e.code === 'ECONNRESET') {
|
|
459
|
+
packageData = yield this.getPackage(fullName, version, true);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
throw e;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const transport = packageData.transports.find(o => o.trkorr === trkorr);
|
|
466
|
+
if (!transport) {
|
|
467
|
+
throw new Error(`Transport ${trkorr} was not found in package ${fullName} ${version}.`);
|
|
468
|
+
}
|
|
469
|
+
if (!refreshPackage && transport.contents.download_link_expiry && transport.contents.download_link_expiry <= Date.now()) {
|
|
470
|
+
return download(true);
|
|
471
|
+
}
|
|
472
|
+
try {
|
|
473
|
+
return (0, commons_1.normalize)((yield this._axiosInstance.get(transport.contents.download_link)).data || {});
|
|
474
|
+
}
|
|
475
|
+
catch (e) {
|
|
476
|
+
const status = this.getErrorStatus(e);
|
|
477
|
+
if (!refreshPackage && (status === 401 || status === 403)) {
|
|
478
|
+
return download(true);
|
|
479
|
+
}
|
|
480
|
+
throw e;
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
return download();
|
|
484
|
+
});
|
|
485
|
+
}
|
|
399
486
|
downloadArtifact(fullName_1) {
|
|
400
487
|
return __awaiter(this, arguments, void 0, function* (fullName, version = 'latest') {
|
|
401
488
|
var _a;
|
|
@@ -438,9 +525,10 @@ class RegistryV2 {
|
|
|
438
525
|
logProgress.stop();
|
|
439
526
|
}
|
|
440
527
|
catch (_b) {
|
|
528
|
+
// ignore stop errors
|
|
441
529
|
}
|
|
442
530
|
trm_commons_1.Logger.error(e.toString(), true);
|
|
443
|
-
trm_commons_1.Logger.error(`Failed to fetch package
|
|
531
|
+
trm_commons_1.Logger.error(`Failed to fetch package ${fullName} ${version}: ${e.message}`, { important: true });
|
|
444
532
|
throw e;
|
|
445
533
|
}
|
|
446
534
|
return new TrmArtifact_1.TrmArtifact(buffer);
|
|
@@ -450,7 +538,7 @@ class RegistryV2 {
|
|
|
450
538
|
return __awaiter(this, arguments, void 0, function* (fullName, version = 'latest', isPrivate) {
|
|
451
539
|
const status = (yield this._axiosInstance.get(`/publish/check/${fullName}`, {
|
|
452
540
|
params: {
|
|
453
|
-
version
|
|
541
|
+
version,
|
|
454
542
|
private: isPrivate ? 'X' : 'N'
|
|
455
543
|
}
|
|
456
544
|
})).status;
|
|
@@ -459,35 +547,40 @@ class RegistryV2 {
|
|
|
459
547
|
}
|
|
460
548
|
});
|
|
461
549
|
}
|
|
462
|
-
publish(fullName, version, artifact,
|
|
550
|
+
publish(fullName, version, artifact, additionalData) {
|
|
463
551
|
return __awaiter(this, void 0, void 0, function* () {
|
|
552
|
+
var _a, _b;
|
|
464
553
|
const fileName = `${fullName}_v${version}`.replace('.', '_') + '.trm';
|
|
465
554
|
const formData = new FormData.default();
|
|
466
555
|
formData.append('artifact', artifact.binary, {
|
|
467
556
|
filename: fileName,
|
|
468
557
|
contentType: 'application/octet-stream'
|
|
469
558
|
});
|
|
470
|
-
if (readme) {
|
|
471
|
-
formData.append('readme', Buffer.from(readme), {
|
|
559
|
+
if (additionalData && additionalData.readme) {
|
|
560
|
+
formData.append('readme', Buffer.from(additionalData.readme), {
|
|
472
561
|
filename: 'readme.md',
|
|
473
562
|
contentType: 'text/markdown'
|
|
474
563
|
});
|
|
475
564
|
}
|
|
476
|
-
if (changelog) {
|
|
477
|
-
formData.append('changelog', Buffer.from(changelog), {
|
|
565
|
+
if (additionalData && additionalData.changelog) {
|
|
566
|
+
formData.append('changelog', Buffer.from(additionalData.changelog), {
|
|
478
567
|
filename: 'changelog.md',
|
|
479
568
|
contentType: 'text/markdown'
|
|
480
569
|
});
|
|
481
570
|
}
|
|
482
|
-
|
|
483
|
-
|
|
571
|
+
if (additionalData && additionalData.retainedCustomizing) {
|
|
572
|
+
formData.append('retainedCustomizing', JSON.stringify(additionalData.retainedCustomizing));
|
|
573
|
+
}
|
|
574
|
+
var params = { version, tags: additionalData && additionalData.tags ? additionalData.tags : undefined };
|
|
575
|
+
if (!params.tags) {
|
|
484
576
|
delete params.tags;
|
|
485
577
|
}
|
|
486
578
|
const response = yield this._axiosInstance.post(`/publish/${fullName}`, formData, {
|
|
487
579
|
params,
|
|
488
580
|
headers: formData.getHeaders()
|
|
489
581
|
});
|
|
490
|
-
|
|
582
|
+
this.assertStatus(response.status, [201, 202], 'Publish request');
|
|
583
|
+
if (response.status === 202) { //publish is async
|
|
491
584
|
let publishStatus = response.data;
|
|
492
585
|
const progressPoolUrl = publishStatus.progress_pool_url;
|
|
493
586
|
const logProgress = trm_commons_1.Logger.progressbar(`↑ ${fullName} ${version} [{bar}] {value}/{total} {message} | Last refresh: {lastRefresh}`, '>');
|
|
@@ -495,44 +588,76 @@ class RegistryV2 {
|
|
|
495
588
|
message: publishStatus.current_step_message || '',
|
|
496
589
|
lastRefresh: new Date().toLocaleTimeString()
|
|
497
590
|
});
|
|
591
|
+
//the outcome of a publish that can't be followed is unknown: never report it as a success
|
|
592
|
+
const unknownOutcome = (reason) => new Error(`${reason}; the outcome of publishing ${fullName} ${version} is unknown, check the registry before publishing again.`);
|
|
593
|
+
const deadline = Date.now() + PUBLISH_POLL_TIMEOUT_MS;
|
|
594
|
+
let pollFailures = 0;
|
|
498
595
|
try {
|
|
596
|
+
if (!isPublishStatus(publishStatus)) {
|
|
597
|
+
throw unknownOutcome(`Registry returned an invalid publish status`);
|
|
598
|
+
}
|
|
499
599
|
while (publishStatus.current_step < publishStatus.steps) {
|
|
500
|
-
|
|
501
|
-
|
|
600
|
+
if (Date.now() >= deadline) {
|
|
601
|
+
throw unknownOutcome(`Registry publish did not complete within ${PUBLISH_POLL_TIMEOUT_MS / 60000} minutes`);
|
|
602
|
+
}
|
|
603
|
+
yield new Promise(resolve => setTimeout(resolve, PUBLISH_POLL_INTERVAL_MS));
|
|
604
|
+
try {
|
|
605
|
+
publishStatus = (yield this._axiosInstance.get(progressPoolUrl)).data;
|
|
606
|
+
pollFailures = 0;
|
|
607
|
+
}
|
|
608
|
+
catch (e) {
|
|
609
|
+
//tolerate transient failures
|
|
610
|
+
pollFailures++;
|
|
611
|
+
trm_commons_1.Logger.error(e.toString(), true);
|
|
612
|
+
if (pollFailures >= PUBLISH_POLL_MAX_FAILURES) {
|
|
613
|
+
throw unknownOutcome(`Unable to check publish status on registry (${e.message || e})`);
|
|
614
|
+
}
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (!isPublishStatus(publishStatus)) {
|
|
618
|
+
throw unknownOutcome(`Registry returned an invalid publish status`);
|
|
619
|
+
}
|
|
502
620
|
logProgress.update(publishStatus.current_step, {
|
|
503
621
|
message: publishStatus.current_step_message || '',
|
|
504
|
-
|
|
622
|
+
lastRefresh: new Date().toLocaleTimeString()
|
|
505
623
|
});
|
|
506
624
|
}
|
|
507
625
|
}
|
|
508
|
-
catch (e) {
|
|
509
|
-
trm_commons_1.Logger.error(e.toString());
|
|
510
|
-
trm_commons_1.Logger.warning(`Unable to check status on registry, check manually`);
|
|
511
|
-
}
|
|
512
626
|
finally {
|
|
513
627
|
logProgress.stop();
|
|
514
628
|
}
|
|
629
|
+
//registry may report the outcome: a rejection or the integrity of the stored release (artifact may have been modified)
|
|
630
|
+
const error = (_a = publishStatus.data) === null || _a === void 0 ? void 0 : _a.error;
|
|
631
|
+
if (typeof error === 'string' && error.trim()) {
|
|
632
|
+
throw new Error(`Registry rejected publish: ${error}`);
|
|
633
|
+
}
|
|
634
|
+
const integrity = (_b = publishStatus.data) === null || _b === void 0 ? void 0 : _b.integrity;
|
|
635
|
+
if (typeof integrity === 'string' && integrity.trim()) {
|
|
636
|
+
return { integrity };
|
|
637
|
+
}
|
|
515
638
|
}
|
|
516
639
|
});
|
|
517
640
|
}
|
|
518
641
|
unpublish(fullName, version) {
|
|
519
642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
520
|
-
yield this._axiosInstance.post(`/unpublish/${fullName}`, null, {
|
|
643
|
+
const response = yield this._axiosInstance.post(`/unpublish/${fullName}`, null, {
|
|
521
644
|
params: {
|
|
522
|
-
version
|
|
645
|
+
version
|
|
523
646
|
}
|
|
524
647
|
});
|
|
648
|
+
this.assertStatus(response.status, [204], 'Unpublish request');
|
|
525
649
|
});
|
|
526
650
|
}
|
|
527
651
|
deprecate(fullName, version, deprecate) {
|
|
528
652
|
return __awaiter(this, void 0, void 0, function* () {
|
|
529
|
-
yield this._axiosInstance.post(`/deprecate/${fullName}`, {
|
|
653
|
+
const response = yield this._axiosInstance.post(`/deprecate/${fullName}`, {
|
|
530
654
|
deprecate_note: deprecate.deprecate_note
|
|
531
655
|
}, {
|
|
532
656
|
params: {
|
|
533
|
-
version
|
|
657
|
+
version
|
|
534
658
|
}
|
|
535
659
|
});
|
|
660
|
+
this.assertStatus(response.status, [204], 'Deprecate request');
|
|
536
661
|
});
|
|
537
662
|
}
|
|
538
663
|
addDistTag(fullName, distTag) {
|
|
@@ -555,20 +680,132 @@ class RegistryV2 {
|
|
|
555
680
|
}
|
|
556
681
|
batchCompare(packages) {
|
|
557
682
|
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
-
|
|
683
|
+
const response = yield this._axiosInstance.post('/batchCompare', packages);
|
|
684
|
+
this.assertStatus(response.status, [200], 'Batch comparison request');
|
|
685
|
+
return response.data;
|
|
559
686
|
});
|
|
560
687
|
}
|
|
561
|
-
|
|
562
|
-
return __awaiter(this,
|
|
688
|
+
delete(transport) {
|
|
689
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
690
|
+
var _a;
|
|
691
|
+
const formData = new FormData.default();
|
|
692
|
+
formData.append('header', transport.header, {
|
|
693
|
+
filename: 'header',
|
|
694
|
+
contentType: 'application/octet-stream'
|
|
695
|
+
});
|
|
696
|
+
formData.append('data', transport.data, {
|
|
697
|
+
filename: 'data',
|
|
698
|
+
contentType: 'application/octet-stream'
|
|
699
|
+
});
|
|
700
|
+
let deleteResponse;
|
|
701
|
+
try {
|
|
702
|
+
deleteResponse = yield this._axiosInstance.post('/delete', formData, {
|
|
703
|
+
headers: formData.getHeaders()
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
catch (e) {
|
|
707
|
+
if (this.getErrorStatus(e) === 401) {
|
|
708
|
+
throw new RegistryDeletionTransportUnauthorizedError_1.RegistryDeletionTransportUnauthorizedError(this.endpoint, e);
|
|
709
|
+
}
|
|
710
|
+
throw e;
|
|
711
|
+
}
|
|
712
|
+
this.assertStatus(deleteResponse.status, [200], 'Deletion transport request');
|
|
713
|
+
const transportDownload = deleteResponse.data;
|
|
714
|
+
const chunks = [];
|
|
715
|
+
let buffer;
|
|
716
|
+
const ping = this._cache.get('ping') && !(this._cache.get('ping') instanceof Error) ? this._cache.get('ping') : undefined;
|
|
717
|
+
const logProgress = trm_commons_1.Logger.progressbar(`↓ deletion transport [{bar}] {percentage}% | {value}/{total} bytes`, '>');
|
|
718
|
+
try {
|
|
719
|
+
const response = yield this._axiosInstance.get(transportDownload.download_link, {
|
|
720
|
+
headers: {
|
|
721
|
+
Accept: 'application/octet-stream'
|
|
722
|
+
},
|
|
723
|
+
maxRedirects: 10,
|
|
724
|
+
responseType: 'stream',
|
|
725
|
+
validateStatus: s => s >= 200 && s < 400
|
|
726
|
+
});
|
|
727
|
+
const totalBytes = Number((_a = response.headers['content-length']) !== null && _a !== void 0 ? _a : 0);
|
|
728
|
+
let downloadedBytes = 0;
|
|
729
|
+
if (totalBytes > 0) {
|
|
730
|
+
logProgress.start(totalBytes, 0);
|
|
731
|
+
}
|
|
732
|
+
yield new Promise((resolve, reject) => {
|
|
733
|
+
response.data.on('data', (chunk) => {
|
|
734
|
+
chunks.push(chunk);
|
|
735
|
+
downloadedBytes += chunk.length;
|
|
736
|
+
if (totalBytes > 0) {
|
|
737
|
+
logProgress.update(downloadedBytes);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
response.data.on('end', resolve);
|
|
741
|
+
response.data.on('error', reject);
|
|
742
|
+
});
|
|
743
|
+
if (totalBytes > 0) {
|
|
744
|
+
logProgress.stop();
|
|
745
|
+
}
|
|
746
|
+
buffer = Buffer.concat(chunks);
|
|
747
|
+
}
|
|
748
|
+
catch (e) {
|
|
749
|
+
try {
|
|
750
|
+
logProgress.stop();
|
|
751
|
+
}
|
|
752
|
+
catch (_b) {
|
|
753
|
+
// ignore stop errors
|
|
754
|
+
}
|
|
755
|
+
trm_commons_1.Logger.error(e.toString(), true);
|
|
756
|
+
trm_commons_1.Logger.error(`Failed to download deletion transport: ${e.message}`, { important: true });
|
|
757
|
+
throw e;
|
|
758
|
+
}
|
|
759
|
+
const checksum = (0, crypto_1.createHash)('sha512').update(buffer).digest('base64');
|
|
760
|
+
if (checksum !== transportDownload.checksum) {
|
|
761
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Deletion transport integrity does NOT match!`, { important: true });
|
|
762
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Expected SHA is ${transportDownload.checksum}, received SHA is ${checksum}`, { important: true });
|
|
763
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Please, report the issue to ${this.ping && ping.alert_email ? ping.alert_email : 'registry support team'}`, { important: true });
|
|
764
|
+
throw new Error(`Cannot continue due to security issues.`);
|
|
765
|
+
}
|
|
766
|
+
const zip = new AdmZip.default(buffer);
|
|
767
|
+
const kFile = zip.getEntries().find(o => o.name.startsWith('K'));
|
|
768
|
+
const rFile = zip.getEntries().find(o => o.name.startsWith('R'));
|
|
769
|
+
if (!kFile) {
|
|
770
|
+
throw new Error(`Missing header in deletion transport!`);
|
|
771
|
+
}
|
|
772
|
+
if (!rFile) {
|
|
773
|
+
throw new Error(`Missing data in deletion transport!`);
|
|
774
|
+
}
|
|
775
|
+
return {
|
|
776
|
+
header: kFile.getData(),
|
|
777
|
+
data: rFile.getData()
|
|
778
|
+
};
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
transport(trkorr, target) {
|
|
782
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
783
|
+
const response = yield this._axiosInstance.get(`/transport/${trkorr}`, {
|
|
784
|
+
params: {
|
|
785
|
+
target: target || undefined
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
this.assertStatus(response.status, [200], 'Transport request');
|
|
789
|
+
const transportDownload = response.data;
|
|
790
|
+
return this.downloadTransport(transportDownload, trkorr);
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
downloadTransport(transportDownload, label) {
|
|
794
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
563
795
|
var _a;
|
|
564
796
|
const chunks = [];
|
|
565
|
-
|
|
797
|
+
let buffer;
|
|
798
|
+
//from cache if it exists, else ignore
|
|
799
|
+
const ping = this._cache.get('ping') && !(this._cache.get('ping') instanceof Error) ? this._cache.get('ping') : undefined;
|
|
800
|
+
const logProgress = trm_commons_1.Logger.progressbar(`↓ ${label} [{bar}] {percentage}% | {value}/{total} bytes`, '>');
|
|
566
801
|
try {
|
|
567
|
-
const response = yield this._axiosInstance.get(
|
|
568
|
-
|
|
569
|
-
|
|
802
|
+
const response = yield this._axiosInstance.get(transportDownload.download_link, {
|
|
803
|
+
headers: {
|
|
804
|
+
Accept: 'application/octet-stream',
|
|
570
805
|
},
|
|
806
|
+
maxRedirects: 10,
|
|
571
807
|
responseType: 'stream',
|
|
808
|
+
validateStatus: s => s >= 200 && s < 400,
|
|
572
809
|
});
|
|
573
810
|
const totalBytes = Number((_a = response.headers['content-length']) !== null && _a !== void 0 ? _a : 0);
|
|
574
811
|
let downloadedBytes = 0;
|
|
@@ -589,18 +826,41 @@ class RegistryV2 {
|
|
|
589
826
|
if (totalBytes > 0) {
|
|
590
827
|
logProgress.stop();
|
|
591
828
|
}
|
|
592
|
-
|
|
593
|
-
return JSON.parse(buffer.toString('utf-8'));
|
|
829
|
+
buffer = Buffer.concat(chunks);
|
|
594
830
|
}
|
|
595
831
|
catch (e) {
|
|
596
832
|
try {
|
|
597
833
|
logProgress.stop();
|
|
598
834
|
}
|
|
599
|
-
catch (_b) {
|
|
835
|
+
catch (_b) {
|
|
836
|
+
// ignore stop errors
|
|
837
|
+
}
|
|
600
838
|
trm_commons_1.Logger.error(e.toString(), true);
|
|
601
|
-
trm_commons_1.Logger.error(`Failed to
|
|
839
|
+
trm_commons_1.Logger.error(`Failed to download transport ${label}: ${e.message}`, { important: true });
|
|
602
840
|
throw e;
|
|
603
841
|
}
|
|
842
|
+
const checksum = (0, crypto_1.createHash)("sha512").update(buffer).digest("base64");
|
|
843
|
+
if (checksum !== transportDownload.checksum) {
|
|
844
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Transport ${label} integrity does NOT match!`, { important: true });
|
|
845
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Expected SHA is ${transportDownload.checksum}, received SHA is ${checksum}`, { important: true });
|
|
846
|
+
trm_commons_1.Logger.error(`SECURITY ISSUE! Please, report the issue to ${this.ping && ping.alert_email ? ping.alert_email : 'registry support team'}`, { important: true });
|
|
847
|
+
throw new Error(`Cannot continue due to security issues.`);
|
|
848
|
+
}
|
|
849
|
+
const zip = new AdmZip.default(buffer);
|
|
850
|
+
//we can't assume custom registries will mark K and R file with comment in zip
|
|
851
|
+
//keeping it simple here with name starts with
|
|
852
|
+
const kFile = zip.getEntries().find(o => o.name.startsWith('K'));
|
|
853
|
+
const rFile = zip.getEntries().find(o => o.name.startsWith('R'));
|
|
854
|
+
if (!kFile) {
|
|
855
|
+
throw new Error(`Missing header in transport!`);
|
|
856
|
+
}
|
|
857
|
+
if (!rFile) {
|
|
858
|
+
throw new Error(`Missing data in transport!`);
|
|
859
|
+
}
|
|
860
|
+
return {
|
|
861
|
+
header: kFile.getData(),
|
|
862
|
+
data: rFile.getData()
|
|
863
|
+
};
|
|
604
864
|
});
|
|
605
865
|
}
|
|
606
866
|
}
|