(key: string)
| 175 | * If a tag conflicts with a reserved keyword, change it to `tags[key]:value` |
| 176 | */ |
| 177 | export function escapeIssueTagKey(key: string) { |
| 178 | if (key === '') { |
| 179 | return '""'; |
| 180 | } |
| 181 | |
| 182 | // Environment and project should be handled by the page filter |
| 183 | if (key === 'environment' || key === 'project') { |
| 184 | return key; |
| 185 | } |
| 186 | |
| 187 | // Reserved keywords that conflict with issue search query |
| 188 | if (['project.name', 'project_id'].includes(key)) { |
| 189 | return `tags[${key}]`; |
| 190 | } |
| 191 | |
| 192 | if (ISSUE_EVENT_FIELDS_THAT_MAY_CONFLICT_WITH_TAGS.has(key as FieldKey)) { |
| 193 | return `tags[${key}]`; |
| 194 | } |
| 195 | |
| 196 | return key; |
| 197 | } |
| 198 | |
| 199 | export function generateQueryWithTag(prevQuery: Query, tag: EventTag): Query { |
| 200 | const query = {...prevQuery}; |
no test coverage detected