Files
klz-cables.com/.pnpm-store/v10/files/2a/153707f884c3a522a9df2e69a525c2b002b88a62e7bf8a5ff78454d268d8b0ca0d1e23fa9a8670667c405e434b07e993299275977378c999d6ad5a6b4aa13e
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

47 lines
1.7 KiB
Plaintext

import { APIError } from '../../../errors/index.js';
import { getFileByPath } from '../../../uploads/getFileByPath.js';
import { createLocalReq } from '../../../utilities/createLocalReq.js';
import { updateOperation } from '../update.js';
import { updateByIDOperation } from '../updateByID.js';
async function updateLocal(payload, options) {
const { id, autosave, collection: collectionSlug, data, depth, disableTransaction, draft, file, filePath, limit, overrideAccess = true, overrideLock, overwriteExistingFiles = false, populate, publishAllLocales, publishSpecificLocale, select, showHiddenFields, sort, trash = false, unpublishAllLocales, where } = options;
const collection = payload.collections[collectionSlug];
if (!collection) {
throw new APIError(`The collection with slug ${String(collectionSlug)} can't be found. Update Operation.`);
}
const req = await createLocalReq(options, payload);
req.file = file ?? await getFileByPath(filePath);
const args = {
id,
autosave,
collection,
data,
depth,
disableTransaction,
draft,
limit,
overrideAccess,
overrideLock,
overwriteExistingFiles,
payload,
populate,
publishAllLocales,
publishSpecificLocale,
req,
select,
showHiddenFields,
sort,
trash,
unpublishAllLocales,
where
};
if (options.id) {
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
return updateByIDOperation(args);
}
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
return updateOperation(args);
}
export { updateLocal };
//# sourceMappingURL=update.js.map