in marketing-analytics/activation/sheets-based-installer/src/apps_script/2_base/mojo.js [660:702]
checkResources_(mojoSheetRows, forceCheck) {
const mojoResource = this.solutionConfig.filter(({ category, resource }) => {
return category === mojoSheetRows[0].category
&& resource === mojoSheetRows[0].resource;
})[0];
const { checkFn: checkStatus, alwaysCheck, resource } = mojoResource;
console.log(`Start ${forceCheck ? 'FORCED ' : ''}checking:`, resource);
return mojoSheetRows.map((mojoSheetRow) => {
const { value, status, enable, rowIndex, propertyName } = mojoSheetRow;
if (!forceCheck && !alwaysCheck && status === RESOURCE_STATUS.OK) {
console.log(`Skip row [${rowIndex}] with status`, RESOURCE_STATUS.OK);
return;
}
if (enable === 'FALSE') {
console.log(`Skip row [${rowIndex}] as unchecked enable resource`);
if (propertyName) {
console.log(` unset property [${propertyName}]`);
this.updateProperty_(propertyName, '');
}
return;
}
if (typeof checkStatus === 'undefined') {
console.log(`Skip row [${rowIndex}] as no check function`);
return;
}
/** @type {CheckResult} */ let updatedStatus;
try {
updatedStatus = checkStatus(value, mojoSheetRow);
if (propertyName) {
this.updateProperty_(propertyName, updatedStatus.value || value);
}
} catch (error) {
updatedStatus = {
status: RESOURCE_STATUS.ERROR,
message: error.message,
};
}
console.log(`Row [${rowIndex}] checking result`, updatedStatus);
this.updateStatus_(updatedStatus, rowIndex);
return updatedStatus;
}).filter((checkResult) => checkResult !== undefined)
.every(({ status }) => status !== RESOURCE_STATUS.ERROR);
}