• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

teableio / teable / 20015007456

08 Dec 2025 02:44AM UTC coverage: 71.706% (+0.004%) from 71.702%
20015007456

push

github

web-flow
Merge pull request #2227 from teableio/feat/last-modified-by-tracking

feat/last modified by tracking

22065 of 24768 branches covered (89.09%)

83 of 109 new or added lines in 4 files covered. (76.15%)

19 existing lines in 6 files now uncovered.

55840 of 77874 relevant lines covered (71.71%)

4325.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.29
/apps/nestjs-backend/src/features/base/BatchProcessor.class.ts
1
import type { TransformCallback } from 'stream';
7✔
2
import { Transform } from 'stream';
3

4
export class BatchProcessor<T> extends Transform {
7✔
5
  private buffer: T[] = [];
7✔
6
  private totalProcessed = 0;
7✔
7
  public static BATCH_SIZE = 1000;
7✔
8

9
  constructor(private readonly handler: (chunk: T[]) => Promise<void>) {
7✔
10
    super({ objectMode: true });
7✔
11
  }
7✔
12

13
  // eslint-disable-next-line @typescript-eslint/naming-convention
7✔
14
  async _transform(chunk: T, encoding: BufferEncoding, callback: TransformCallback) {
7✔
15
    this.buffer.push(chunk);
95✔
16
    this.totalProcessed++;
95✔
17

18
    if (this.buffer.length >= BatchProcessor.BATCH_SIZE) {
95!
19
      const currentBatch = [...this.buffer];
×
20
      this.buffer = [];
×
21

22
      try {
×
23
        await this.handler(currentBatch);
×
24
        this.emit('progress', { processed: this.totalProcessed });
×
25
        callback();
×
26
      } catch (err: unknown) {
×
27
        callback(err as Error);
×
28
      }
×
29
    } else {
95✔
30
      callback();
95✔
31
    }
95✔
32
  }
95✔
33

34
  // eslint-disable-next-line @typescript-eslint/naming-convention
7✔
35
  async _flush(callback: TransformCallback) {
7✔
36
    if (this.buffer.length > 0) {
7✔
37
      try {
7✔
38
        await this.handler(this.buffer);
7✔
39
        this.emit('progress', { processed: this.totalProcessed });
7✔
40
        callback();
7✔
41
      } catch (err: unknown) {
7!
UNCOV
42
        callback(err as Error);
×
UNCOV
43
      }
×
44
    } else {
7!
45
      callback();
×
46
    }
×
47
  }
7✔
48
}
7✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc