( request: AcpPermissionRequest, kinds: Array<string>, )
| 12 | const EDIT_KINDS = new Set(['edit', 'move', 'delete']) |
| 13 | |
| 14 | function pickOption( |
| 15 | request: AcpPermissionRequest, |
| 16 | kinds: Array<string>, |
| 17 | ): AcpPermissionOutcome { |
| 18 | for (const kind of kinds) { |
| 19 | const option = request.options.find((candidate) => candidate.kind === kind) |
| 20 | if (option) return { outcome: 'selected', optionId: option.optionId } |
| 21 | } |
| 22 | return { outcome: 'cancelled' } |
| 23 | } |
| 24 | |
| 25 | export function resolvePermission( |
| 26 | request: AcpPermissionRequest, |