Files
klz-cables.com/.pnpm-store/v10/files/0d/292af64148cc72737886b23516f232e38161602521d5e7c868d32762488f0c8fdccd8000762b2eac47cd3561c7ecefb9a5f41449f875cef817771323040788
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
1.7 KiB
Plaintext

{"version":3,"sources":["../../src/utilities/combineWhereConstraints.ts"],"sourcesContent":["import type { Where } from '../types/index.js'\n\nexport function combineWhereConstraints(\n constraints: Array<undefined | Where>,\n as: 'and' | 'or' = 'and',\n): Where {\n if (constraints.length === 0) {\n return {}\n }\n\n const reducedConstraints = constraints.reduce<Partial<Where>>(\n (acc: Partial<Where>, constraint) => {\n if (constraint && typeof constraint === 'object' && Object.keys(constraint).length > 0) {\n if (as in constraint) {\n // merge the objects under the shared key\n acc[as] = [...(acc[as] as Where[]), ...(constraint[as] as Where[])]\n } else {\n // the constraint does not share the key\n acc[as]?.push(constraint)\n }\n }\n\n return acc\n },\n { [as]: [] } satisfies Where,\n )\n\n if (reducedConstraints[as]?.length === 0) {\n // If there are no constraints, return an empty object\n return {}\n }\n\n return reducedConstraints as Where\n}\n"],"names":["combineWhereConstraints","constraints","as","length","reducedConstraints","reduce","acc","constraint","Object","keys","push"],"mappings":"AAEA,OAAO,SAASA,wBACdC,WAAqC,EACrCC,KAAmB,KAAK;IAExB,IAAID,YAAYE,MAAM,KAAK,GAAG;QAC5B,OAAO,CAAC;IACV;IAEA,MAAMC,qBAAqBH,YAAYI,MAAM,CAC3C,CAACC,KAAqBC;QACpB,IAAIA,cAAc,OAAOA,eAAe,YAAYC,OAAOC,IAAI,CAACF,YAAYJ,MAAM,GAAG,GAAG;YACtF,IAAID,MAAMK,YAAY;gBACpB,yCAAyC;gBACzCD,GAAG,CAACJ,GAAG,GAAG;uBAAKI,GAAG,CAACJ,GAAG;uBAAkBK,UAAU,CAACL,GAAG;iBAAa;YACrE,OAAO;gBACL,wCAAwC;gBACxCI,GAAG,CAACJ,GAAG,EAAEQ,KAAKH;YAChB;QACF;QAEA,OAAOD;IACT,GACA;QAAE,CAACJ,GAAG,EAAE,EAAE;IAAC;IAGb,IAAIE,kBAAkB,CAACF,GAAG,EAAEC,WAAW,GAAG;QACxC,sDAAsD;QACtD,OAAO,CAAC;IACV;IAEA,OAAOC;AACT"}