Files
klz-cables.com/.pnpm-store/v10/files/2c/22ea56aff540ae8363af67002e2f8c71baeab39288d5805bba620c349110e648233c41994e2561a9ad75e72132f1164081e179422d832b3c9c65a4c8f8d7a0
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
2.7 KiB
Plaintext

{"version":3,"sources":["../../src/sqlite/insert.ts"],"sourcesContent":["import type { BaseSQLiteAdapter, Insert } from './types.js'\n\nexport const insert: Insert = async function (\n // Here 'this' is not a parameter. See:\n // https://www.typescriptlang.org/docs/handbook/2/classes.html#this-parameters\n this: BaseSQLiteAdapter,\n { db, onConflictDoUpdate, tableName, values },\n): Promise<Record<string, unknown>[]> {\n const table = this.tables[tableName]\n\n // Batch insert if limitedBoundParameters: true\n if (this.limitedBoundParameters && Array.isArray(values)) {\n const results: Record<string, unknown>[] = []\n const colsPerRow = Object.keys(values[0]).length\n const maxParams = 100\n const maxRowsPerBatch = Math.max(1, Math.floor(maxParams / colsPerRow))\n\n for (let i = 0; i < values.length; i += maxRowsPerBatch) {\n const batch = values.slice(i, i + maxRowsPerBatch)\n\n const batchResult = onConflictDoUpdate\n ? await db.insert(table).values(batch).onConflictDoUpdate(onConflictDoUpdate).returning()\n : await db.insert(table).values(batch).returning()\n\n results.push(...(batchResult as Record<string, unknown>[]))\n }\n\n return results\n }\n\n const result = onConflictDoUpdate\n ? await db.insert(table).values(values).onConflictDoUpdate(onConflictDoUpdate).returning()\n : await db.insert(table).values(values).returning()\n\n // See https://github.com/payloadcms/payload/pull/11831#discussion_r2010431908\n return result as Record<string, unknown>[]\n}\n"],"names":["insert","db","onConflictDoUpdate","tableName","values","table","tables","limitedBoundParameters","Array","isArray","results","colsPerRow","Object","keys","length","maxParams","maxRowsPerBatch","Math","max","floor","i","batch","slice","batchResult","returning","push","result"],"mappings":"AAEA,OAAO,MAAMA,SAAiB,eAI5B,EAAEC,EAAE,EAAEC,kBAAkB,EAAEC,SAAS,EAAEC,MAAM,EAAE;IAE7C,MAAMC,QAAQ,IAAI,CAACC,MAAM,CAACH,UAAU;IAEpC,+CAA+C;IAC/C,IAAI,IAAI,CAACI,sBAAsB,IAAIC,MAAMC,OAAO,CAACL,SAAS;QACxD,MAAMM,UAAqC,EAAE;QAC7C,MAAMC,aAAaC,OAAOC,IAAI,CAACT,MAAM,CAAC,EAAE,EAAEU,MAAM;QAChD,MAAMC,YAAY;QAClB,MAAMC,kBAAkBC,KAAKC,GAAG,CAAC,GAAGD,KAAKE,KAAK,CAACJ,YAAYJ;QAE3D,IAAK,IAAIS,IAAI,GAAGA,IAAIhB,OAAOU,MAAM,EAAEM,KAAKJ,gBAAiB;YACvD,MAAMK,QAAQjB,OAAOkB,KAAK,CAACF,GAAGA,IAAIJ;YAElC,MAAMO,cAAcrB,qBAChB,MAAMD,GAAGD,MAAM,CAACK,OAAOD,MAAM,CAACiB,OAAOnB,kBAAkB,CAACA,oBAAoBsB,SAAS,KACrF,MAAMvB,GAAGD,MAAM,CAACK,OAAOD,MAAM,CAACiB,OAAOG,SAAS;YAElDd,QAAQe,IAAI,IAAKF;QACnB;QAEA,OAAOb;IACT;IAEA,MAAMgB,SAASxB,qBACX,MAAMD,GAAGD,MAAM,CAACK,OAAOD,MAAM,CAACA,QAAQF,kBAAkB,CAACA,oBAAoBsB,SAAS,KACtF,MAAMvB,GAAGD,MAAM,CAACK,OAAOD,MAAM,CAACA,QAAQoB,SAAS;IAEnD,8EAA8E;IAC9E,OAAOE;AACT,EAAC"}