Add max batch mutation (#17535)

Co-authored-by: Brainslug <br41nslug@users.noreply.github.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
ian
2023-04-08 00:25:25 +08:00
committed by GitHub
parent ec5852b23b
commit fdf0fa2fb8
20 changed files with 2376 additions and 67 deletions

View File

@@ -5,6 +5,7 @@
import type { BaseException } from '@directus/exceptions';
import type { EventContext } from '@directus/types';
import type { MutationTracker } from '../services/items.js';
export type Item = Record<string, any>;
@@ -24,17 +25,17 @@ export type MutationOptions = {
/**
* Callback function that's fired whenever a revision is made in the mutation
*/
onRevisionCreate?: (pk: PrimaryKey) => void;
onRevisionCreate?: ((pk: PrimaryKey) => void) | undefined;
/**
* Flag to disable the auto purging of the cache. Is ignored when CACHE_AUTO_PURGE isn't enabled.
*/
autoPurgeCache?: false;
autoPurgeCache?: false | undefined;
/**
* Flag to disable the auto purging of the system cache.
*/
autoPurgeSystemCache?: false;
autoPurgeSystemCache?: false | undefined;
/**
* Allow disabling the emitting of hooks. Useful if a custom hook is fired (like files.upload)
@@ -45,12 +46,22 @@ export type MutationOptions = {
* To bypass the emitting of action events if emitEvents is enabled
* Can be used to queue up the nested events from item service's create, update and delete
*/
bypassEmitAction?: (params: ActionEventParams) => void;
bypassEmitAction?: ((params: ActionEventParams) => void) | undefined;
/**
* To bypass limits so that functions would work as intended
*/
bypassLimits?: boolean | undefined;
/**
* To keep track of mutation limits
*/
mutationTracker?: MutationTracker | undefined;
/*
* The validation error to throw right before the mutation takes place
*/
preMutationException?: BaseException;
preMutationException?: BaseException | undefined;
};
export type ActionEventParams = {