(decls: (DataModel | TypeDef)[])
| 544 | * Returns `undefined` if no such model is found. |
| 545 | */ |
| 546 | export function getAuthDecl(decls: (DataModel | TypeDef)[]) { |
| 547 | let authModel = decls.find((d) => hasAttribute(d, '@@auth')); |
| 548 | if (!authModel) { |
| 549 | authModel = decls.find((d) => d.name === 'User'); |
| 550 | } |
| 551 | return authModel; |
| 552 | } |
| 553 | |
| 554 | // TODO: move to policy plugin |
| 555 | export function isBeforeInvocation(node: AstNode) { |
no test coverage detected