( source: PermissionApprovalSource | PermissionRejectionSource, )
| 66 | |
| 67 | // Flattens structured source into a string label for analytics/OTel events |
| 68 | function sourceToString( |
| 69 | source: PermissionApprovalSource | PermissionRejectionSource, |
| 70 | ): string { |
| 71 | if ( |
| 72 | (feature('BASH_CLASSIFIER') || feature('TRANSCRIPT_CLASSIFIER')) && |
| 73 | source.type === 'classifier' |
| 74 | ) { |
| 75 | return 'classifier' |
| 76 | } |
| 77 | switch (source.type) { |
| 78 | case 'hook': |
| 79 | return 'hook' |
| 80 | case 'user': |
| 81 | return source.permanent ? 'user_permanent' : 'user_temporary' |
| 82 | case 'user_abort': |
| 83 | return 'user_abort' |
| 84 | case 'user_reject': |
| 85 | return 'user_reject' |
| 86 | default: |
| 87 | return 'unknown' |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | function baseMetadata( |
| 92 | messageId: string, |
no test coverage detected