@hotglue/cli
Version:
hotglue CLI tools
32 lines (25 loc) • 841 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isV2Flow = exports.getEntityLabel = void 0;
var _utils = require("./utils");
const isV2Flow = async (s3, envId, tenantId, flowId) => {
try {
const fileStream = s3.getObject({
Bucket: envId,
Key: `${tenantId}/flows/${flowId}/flow.json`
}).createReadStream();
const fileString = await (0, _utils.streamToString)(fileStream);
const fileJson = JSON.parse(fileString);
return fileJson.version === 2;
} catch (error) {
return false;
}
};
exports.isV2Flow = isV2Flow;
const getEntityLabel = async (s3, envId, tenantId, flowId, isV2 = undefined) => {
const _isV2Flow = isV2 ?? (await isV2Flow(s3, envId, tenantId, flowId));
return _isV2Flow ? 'connectors' : 'taps';
};
exports.getEntityLabel = getEntityLabel;