UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 665 B
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?t.legacy===!0?e.attemptId===void 0:e.attemptId===t.attemptId:!1),s=o?.attemptId??o?.candidateId??o?.name;o===void 0||s===void 0||o.principal===void 0&&t.legacy!==!0||i.has(s)||(i.add(s),n.push({authorization:o.challenge,candidateId:o.candidateId,result:{attemptId:o.attemptId,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};