* Create a fork of the current service, allowing instantiation with different options.
(options?: Partial<AbstractServiceOptions>)
| 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']); |
no outgoing calls
no test coverage detected