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

teableio / teable / 14828572373

05 May 2025 03:40AM CUT coverage: 80.511% (-0.001%) from 80.512%
14828572373

Pull #1504

github

web-flow
Merge cc5349b00 into f701856cc
Pull Request #1504: feat: multi-line field names & batch collapse by group

7698 of 8166 branches covered (94.27%)

22 of 23 new or added lines in 1 file covered. (95.65%)

5 existing lines in 2 files now uncovered.

36829 of 45744 relevant lines covered (80.51%)

1759.57 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';
4✔
2
import { Transform } from 'stream';
3

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

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

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

18
    if (this.buffer.length >= BatchProcessor.BATCH_SIZE) {
88!
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 {
88✔
30
      callback();
88✔
31
    }
88✔
32
  }
88✔
33

34
  // eslint-disable-next-line @typescript-eslint/naming-convention
4✔
35
  async _flush(callback: TransformCallback) {
4✔
36
    if (this.buffer.length > 0) {
4✔
37
      try {
4✔
38
        await this.handler(this.buffer);
4✔
39
        this.emit('progress', { processed: this.totalProcessed });
4✔
40
        callback();
4✔
41
      } catch (err: unknown) {
4!
UNCOV
42
        callback(err as Error);
×
UNCOV
43
      }
×
44
    } else {
4!
45
      callback();
×
46
    }
×
47
  }
4✔
48
}
4✔
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

© 2025 Coveralls, Inc