| 192 | const logger = log4js.getLogger('table-manager') |
| 193 | |
| 194 | const convertToLabel = (propertyName: string): string => { |
| 195 | // We only use the last field for the name if it's a nested property. |
| 196 | const propertyNames = propertyName.split('.') |
| 197 | return propertyNames[propertyNames.length - 1] |
| 198 | .replace(/([a-z])([A-Z])/g, '$1 $2') |
| 199 | .replace(/^([a-z])/, text => text.toUpperCase()) |
| 200 | .replace(/\bUri\b/, 'URI') |
| 201 | .replace(/\bUrl\b/, 'URL') |
| 202 | .replace(/\bArn\b/, 'ARN') |
| 203 | .replace(/\bO ?[Aa]uth\b/, 'OAuth') |
| 204 | .replace(/^Is /, '') |
| 205 | } |
| 206 | |
| 207 | const getLabelFor = <T extends object>(definition: TableFieldDefinition<T>): string => { |
| 208 | if (typeof definition !== 'object') { |