@hubspot/cli-lib
Advanced tools
const http = require('../http'); | ||
const path = require('path'); | ||
const MARKETPLACE_API_PATH = 'product/marketplace/v2/template/render'; | ||
const MARKETPLACE_TEMPLATE_API_PATH = 'product/marketplace/v2/template/render'; | ||
const MARKETPLACE_MODULE_API_PATH = 'product/marketplace/v2/module/render'; | ||
const MODULE_META_API_PATH = 'content/filemapper/v1/download'; | ||
/** | ||
@@ -12,5 +14,5 @@ * @async | ||
*/ | ||
async function fetchDependencies(accountId, sourceCode) { | ||
async function fetchTemplateDependencies(accountId, sourceCode) { | ||
return http.post(accountId, { | ||
uri: MARKETPLACE_API_PATH, | ||
uri: MARKETPLACE_TEMPLATE_API_PATH, | ||
body: { template_source: sourceCode }, | ||
@@ -20,4 +22,32 @@ }); | ||
/** | ||
* @async | ||
* @param {number} accountId | ||
* @param {string} sourceCode | ||
* @param {object} hublValidationOptions | ||
* @returns {Promise} | ||
*/ | ||
async function fetchModuleDependencies(accountId, relativePath) { | ||
return http.post(accountId, { | ||
uri: path.join(MARKETPLACE_MODULE_API_PATH, relativePath), | ||
}); | ||
} | ||
/** | ||
* @async | ||
* @param {number} accountId | ||
* @param {string} sourceCode | ||
* @param {object} hublValidationOptions | ||
* @returns {Promise} | ||
*/ | ||
async function fetchModuleMeta(accountId, relativePath) { | ||
return http.get(accountId, { | ||
uri: path.join(MODULE_META_API_PATH, `${relativePath}.module/meta.json`), | ||
}); | ||
} | ||
module.exports = { | ||
fetchDependencies, | ||
fetchTemplateDependencies, | ||
fetchModuleDependencies, | ||
fetchModuleMeta, | ||
}; |
{ | ||
"name": "@hubspot/cli-lib", | ||
"version": "3.0.13-beta.1", | ||
"version": "3.0.13-beta.2", | ||
"description": "Library for creating scripts for working with HubSpot", | ||
@@ -35,3 +35,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "1c84f581aac363971c008254b153613ace1241d9" | ||
"gitHead": "ff694f8c61c2326159f7ad4d3f2cfdb18f8c1875" | ||
} |
@@ -1,2 +0,1 @@ | ||
const { EXIT_CODES } = require('../cli/lib/enums/exitCodes'); | ||
const { createSandbox: _createSandbox } = require('./api/sandbox-hubs'); | ||
@@ -17,3 +16,3 @@ const { logger } = require('./logger'); | ||
logger.error(err.error.message); | ||
process.exit(EXIT_CODES.ERROR); | ||
process.exit(1); | ||
} | ||
@@ -20,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
372302
0.4%10669
0.26%