import { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js';
import { traverseFields } from './traverseFields.js';
/**
 * This function is responsible for running beforeDuplicate hooks
 * against a document including all locale data.
 * It will run each field's beforeDuplicate hook
 * and return the resulting docWithLocales.
 */ export const beforeDuplicate = async ({ id, collection, context, doc, overrideAccess, req })=>{
    const newDoc = deepCopyObjectSimple(doc);
    await traverseFields({
        id,
        collection,
        context,
        doc: newDoc,
        fields: collection?.fields,
        overrideAccess,
        path: [],
        req,
        schemaPath: [],
        siblingDoc: newDoc
    });
    return newDoc;
};

//# sourceMappingURL=index.js.map