MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / getAuthDecl

Function getAuthDecl

packages/language/src/utils.ts:546–552  ·  view source on GitHub ↗
(decls: (DataModel | TypeDef)[])

Source from the content-addressed store, hash-verified

544 * Returns `undefined` if no such model is found.
545 */
546export 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
555export function isBeforeInvocation(node: AstNode) {

Callers 2

createScopeForAuthMethod · 0.90
resolveInvocationMethod · 0.90

Calls 2

findMethod · 0.80
hasAttributeFunction · 0.70

Tested by

no test coverage detected