eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 608 B
JavaScript
function matchAuthorizationCallbacks(e,t){let n=[],r=[],i=new Set;for(let a of t){let t=a.authorizationCallback;if(t===void 0){r.push(a);continue}let o=e.challenges.find(e=>e.name===t.connectionName&&typeof t.attemptId==`string`&&e.attemptId===t.attemptId),s=o?.attemptId;o===void 0||s===void 0||o.principal===void 0||i.has(s)||(i.add(s),n.push({authorization:o.challenge,candidateId:o.candidateId,result:{attemptId:s,callback:t.callback,hookUrl:o.hookUrl,instanceId:o.instanceId,name:o.name,principal:o.principal,resume:o.resume}}))}return{matches:n,remainingPayloads:r}}export{matchAuthorizationCallbacks};