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
27 lines
993 B
Plaintext
27 lines
993 B
Plaintext
import { findVersionByIDOperation, isolateObjectProperty } from 'payload';
|
|
import { buildSelectForCollection } from '../../utilities/select.js';
|
|
export function findVersionByIDResolver(collection) {
|
|
return async function resolver(_, args, context, info) {
|
|
const req = context.req = isolateObjectProperty(context.req, [
|
|
'locale',
|
|
'fallbackLocale',
|
|
'transactionID'
|
|
]);
|
|
const select = context.select = args.select ? buildSelectForCollection(info) : undefined;
|
|
req.locale = args.locale || req.locale;
|
|
req.fallbackLocale = args.fallbackLocale || req.fallbackLocale;
|
|
req.query = req.query || {};
|
|
const options = {
|
|
id: args.id,
|
|
collection,
|
|
depth: 0,
|
|
req,
|
|
select,
|
|
trash: args.trash
|
|
};
|
|
const result = await findVersionByIDOperation(options);
|
|
return result;
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=findVersionByID.js.map |