( task: TaskInfo, propertyId: string, context: TaskCardPropertyAccessContext )
| 84 | } |
| 85 | |
| 86 | export function getTaskCardPropertyValue( |
| 87 | task: TaskInfo, |
| 88 | propertyId: string, |
| 89 | context: TaskCardPropertyAccessContext |
| 90 | ): unknown { |
| 91 | try { |
| 92 | const mappingKey = context.fieldMapper.lookupMappingKey(propertyId); |
| 93 | if (mappingKey && hasPropertyExtractor(mappingKey)) { |
| 94 | return getPropertyExtractorValue(task, mappingKey); |
| 95 | } |
| 96 | |
| 97 | if (hasPropertyExtractor(propertyId)) { |
| 98 | return getPropertyExtractorValue(task, propertyId); |
| 99 | } |
| 100 | |
| 101 | if (propertyId.startsWith("user:")) { |
| 102 | return getUserPropertyValue(task, propertyId, context); |
| 103 | } |
| 104 | |
| 105 | if (task.customProperties && propertyId in task.customProperties) { |
| 106 | return extractBasesValue(task.customProperties[propertyId]); |
| 107 | } |
| 108 | |
| 109 | if (task.customProperties) { |
| 110 | const filePropertyId = `file.${propertyId}`; |
| 111 | if (filePropertyId in task.customProperties) { |
| 112 | return extractBasesValue(task.customProperties[filePropertyId]); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | if (propertyId.startsWith("file.")) { |
| 117 | const basesData = getBasesDataGetter(task.basesData); |
| 118 | if (basesData) { |
| 119 | try { |
| 120 | const value = basesData.getValue(propertyId); |
| 121 | if (value !== null && value !== undefined) { |
| 122 | return extractBasesValue(value); |
| 123 | } |
| 124 | } catch { |
| 125 | // Bases property missing. |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | if (propertyId.startsWith("formula.")) { |
| 131 | try { |
| 132 | const basesData = getBasesDataGetter(task.basesData); |
| 133 | if (!basesData) { |
| 134 | return ""; |
| 135 | } |
| 136 | |
| 137 | const value = basesData.getValue(propertyId); |
| 138 | if (value === null || value === undefined) { |
| 139 | return ""; |
| 140 | } |
| 141 | |
| 142 | const extracted = extractBasesValue(value); |
| 143 | return extracted !== "" ? extracted : ""; |
no test coverage detected