data-processor.interface.ts 982 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { Injector } from '@vendure/core';
  2. import { Serializable } from 'node:child_process';
  3. export interface DataProcessorInterface {
  4. init(injector: Injector): void;
  5. /**
  6. * @description
  7. * Returns the total number of results that can be expected from this search index.
  8. * It will be used to determine the number of batches that will be processed
  9. */
  10. getTotalResults(): Promise<number>;
  11. /**
  12. * @description
  13. * Returns the number of results that should be processed within a single batch
  14. */
  15. getBatchSize(): number;
  16. /**
  17. * @description Processes a batch of results
  18. * @param skip
  19. * @param limit
  20. * @param metadata
  21. */
  22. processBatch(
  23. skip: number,
  24. limit: number,
  25. metadata: Record<string, Serializable> | undefined,
  26. ): AsyncGenerator<void>;
  27. /**
  28. * @description Processes a single result by its ID
  29. * @param id
  30. */
  31. processOne(id: string): Promise<void>;
  32. }