Files
klz-cables.com/.pnpm-store/v10/files/4e/18d6a384d4a21adb00995fbcd101ffbb08dc96fac1a62b34f7ebd7d724fd046d47d5c9d9188774f1cb5390b8aeba484c75e64efd5d83e66b078ee948f4e0d8
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

38 lines
1.2 KiB
Plaintext

import { deepCopyObjectSimple } from '../index.js';
import { getQueryDraftsSelect } from './drafts/getQueryDraftsSelect.js';
export const saveSnapshot = async ({ id, autosave, collection, data, global, payload, publishSpecificLocale, req, select })=>{
const docData = deepCopyObjectSimple(data || {});
if (docData._id) {
delete docData._id;
}
const snapshotDate = new Date().toISOString();
const sharedCreateVersionArgs = {
autosave: Boolean(autosave),
createdAt: snapshotDate,
publishedLocale: publishSpecificLocale || undefined,
req,
returning: false,
select: getQueryDraftsSelect({
select
}),
updatedAt: snapshotDate,
versionData: docData
};
if (collection && id) {
return payload.db.createVersion({
...sharedCreateVersionArgs,
collectionSlug: collection.slug,
parent: id,
snapshot: true
});
}
if (global) {
return payload.db.createGlobalVersion({
...sharedCreateVersionArgs,
globalSlug: global.slug,
snapshot: true
});
}
};
//# sourceMappingURL=saveSnapshot.js.map