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

Gestell-AI / node-sdk / #11

15 May 2025 11:50PM UTC coverage: 91.743%. Remained the same
#11

push

ChrisCates
v1.4.0 - Refactored Shapes & SDK

- Expose types with clearer shapes
- Add PII controls
- Support single-entry categories
- Update table records & prompt features
- Refactor code & IntelliSense
- Enhance API shape tests
- Cleaned project structure

243 of 244 new or added lines in 19 files covered. (99.59%)

46 existing lines in 6 files now uncovered.

1400 of 1526 relevant lines covered (91.74%)

21.06 hits per line

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

94.87
/src/query/exportTable.ts
1
import type { BaseRequest, BaseResponse } from '@gestell/types/base'
2
import loadFetch from '@gestell/util/fetch'
44✔
3

4
export interface ExportTableRequest {
5
  collectionId: string
6
  categoryId: string
7
  format?: 'json' | 'csv'
8
  take?: number
9
  skip?: number
10
}
11

12
export interface ExportTableResponse extends BaseResponse {
13
  result: Record<string, string>[] | string
14
}
15

16
export async function exportTable({
9✔
17
  apiKey,
9✔
18
  apiUrl,
9✔
19
  debug,
8✔
20
  collectionId,
15✔
21
  categoryId,
13✔
22
  format = 'json',
18✔
23
  skip = 0,
11✔
24
  take = 10
11✔
25
}: ExportTableRequest & BaseRequest): Promise<ExportTableResponse | string> {
3✔
26
  const fetch = await loadFetch()
34✔
27
  const url = new URL(
20✔
28
    `/api/collection/${collectionId}/table/export?categoryId=${categoryId}&format=${format}&skip=${skip}&take=${take}`,
116✔
29
    apiUrl
6✔
30
  )
4✔
31

32
  const payload = await fetch(url, {
38✔
33
    method: 'GET',
18✔
34
    headers: {
16✔
35
      Authorization: `BEARER ${apiKey}`
37✔
36
    }
3✔
37
  })
5✔
38

39
  if (!payload.ok) {
21✔
40
    const errorResponse = await payload.json().catch(() => null)
54✔
41
    if (debug) {
17✔
42
      console.log(errorResponse)
31✔
43
    }
4✔
44
    return {
14✔
45
      status: 'ERROR',
22✔
46
      message:
9✔
47
        errorResponse?.message || 'There was an error exporting the table',
73✔
48
      result: []
14✔
49
    }
1✔
50
  }
2✔
51

52
  if (format === 'json') {
27✔
53
    const response = (await payload.json()) as ExportTableResponse
42✔
54
    return response
15✔
UNCOV
55
  } else {
×
UNCOV
56
    return await payload.text()
×
57
  }
58
}
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