MCPcopy Create free account
hub / github.com/directus/directus / fork

Method fork

api/src/services/items.ts:68–88  ·  view source on GitHub ↗

* Create a fork of the current service, allowing instantiation with different options.

(options?: Partial<AbstractServiceOptions>)

Source from the content-addressed store, hash-verified

66 * Create a fork of the current service, allowing instantiation with different options.
67 */
68 private fork(options?: Partial<AbstractServiceOptions>): ItemsService<AnyItem> {
69 const Service = this.constructor;
70
71 // ItemsService expects `collection` and `options` as parameters,
72 // while the other services only expect `options`
73 const isItemsService = Service.length === 2;
74
75 const newOptions = {
76 knex: this.knex,
77 accountability: this.accountability,
78 schema: this.schema,
79 nested: this.nested,
80 ...options,
81 };
82
83 if (isItemsService) {
84 return new ItemsService(this.collection, newOptions);
85 }
86
87 return new (Service as new (options: AbstractServiceOptions) => this)(newOptions);
88 }
89
90 createMutationTracker(initialCount = 0): MutationTracker {
91 const maxCount = Number(env['MAX_BATCH_MUTATION']);

Callers 3

createManyMethod · 0.95
updateBatchMethod · 0.95
upsertManyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected