{"version":3,"sources":["../../src/database/combineQueries.ts"],"sourcesContent":["import type { Where } from '../types/index.js'\n\nimport { hasWhereAccessResult } from '../auth/index.js'\n\n/**\n * Combines two queries into a single query, using an AND operator\n */\nexport const combineQueries = (where: Where, access: boolean | Where): Where => {\n if (!where && !access) {\n return {}\n }\n\n const and: Where[] = where ? [where] : []\n\n if (hasWhereAccessResult(access)) {\n and.push(access)\n }\n\n return {\n and,\n }\n}\n"],"names":["hasWhereAccessResult","combineQueries","where","access","and","push"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ,mBAAkB;AAEvD;;CAEC,GACD,OAAO,MAAMC,iBAAiB,CAACC,OAAcC;IAC3C,IAAI,CAACD,SAAS,CAACC,QAAQ;QACrB,OAAO,CAAC;IACV;IAEA,MAAMC,MAAeF,QAAQ;QAACA;KAAM,GAAG,EAAE;IAEzC,IAAIF,qBAAqBG,SAAS;QAChCC,IAAIC,IAAI,CAACF;IACX;IAEA,OAAO;QACLC;IACF;AACF,EAAC"}