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
31 lines
943 B
Plaintext
31 lines
943 B
Plaintext
import { traverseFields } from './traverseFields.js';
|
|
/**
|
|
* This function is responsible for the following actions, in order:
|
|
* - Sanitize incoming data
|
|
* - Execute field hooks
|
|
* - Execute field access control
|
|
* - Merge original document data into incoming data
|
|
* - Compute default values for undefined fields
|
|
*/ export const beforeValidate = async ({ id, collection, context, data: incomingData, doc, global, operation, overrideAccess, req })=>{
|
|
await traverseFields({
|
|
id,
|
|
collection,
|
|
context,
|
|
data: incomingData,
|
|
doc,
|
|
fields: collection?.fields || global?.fields,
|
|
global,
|
|
operation,
|
|
overrideAccess,
|
|
parentIndexPath: '',
|
|
parentIsLocalized: false,
|
|
parentPath: '',
|
|
parentSchemaPath: '',
|
|
req,
|
|
siblingData: incomingData,
|
|
siblingDoc: doc
|
|
});
|
|
return incomingData;
|
|
};
|
|
|
|
//# sourceMappingURL=index.js.map |