payload
Version:
Node, React, Headless CMS and Application Framework built on Next.js
24 lines • 1.1 kB
TypeScript
import type { SanitizedCollectionConfig } from '../collections/config/types.js';
import type { SanitizedGlobalConfig } from '../globals/config/types.js';
import type { Payload } from '../index.js';
import type { JsonObject, PayloadRequest } from '../types/index.js';
type Args<TData extends JsonObject> = {
collection?: SanitizedCollectionConfig;
global?: SanitizedGlobalConfig;
id?: number | string;
now: string;
payload: Payload;
req?: PayloadRequest;
shouldUpdate?: (latestVersion: JsonObject) => boolean;
versionData: TData;
};
/**
* Finds the latest version and updates it in place if `shouldUpdate` returns true.
* Used by both the unpublish and autosave paths in `saveVersion` to avoid creating
* a redundant new version.
*
* Returns the updated version result, or `undefined` if no update was performed.
*/
export declare function updateLatestVersion<TData extends JsonObject>({ id, collection, global, now, payload, req, shouldUpdate, versionData, }: Args<TData>): Promise<JsonObject | undefined>;
export {};
//# sourceMappingURL=updateLatestVersion.d.ts.map