MCPcopy
hub / github.com/directus/directus / createMutationTracker

Method createMutationTracker

api/src/services/items.ts:90–105  ·  view source on GitHub ↗
(initialCount = 0)

Source from the content-addressed store, hash-verified

88 }
89
90 createMutationTracker(initialCount = 0): MutationTracker {
91 const maxCount = Number(env['MAX_BATCH_MUTATION']);
92 let mutationCount = initialCount;
93 return {
94 trackMutations(count: number) {
95 mutationCount += count;
96
97 if (mutationCount > maxCount) {
98 throw new InvalidPayloadError({ reason: `Exceeded max batch mutation limit of ${maxCount}` });
99 }
100 },
101 getCount() {
102 return mutationCount;
103 },
104 };
105 }
106
107 async getKeysByQuery(query: Query): Promise<PrimaryKey[]> {
108 const primaryKeyField = this.schema.collections[this.collection]!.primary;

Callers 6

createOneMethod · 0.95
createManyMethod · 0.95
updateBatchMethod · 0.95
updateManyMethod · 0.95
upsertManyMethod · 0.95
deleteManyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected