• 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/exportFeatures.ts
1
import type { BaseRequest, BaseResponse } from '@gestell/types/base'
2
import loadFetch from '@gestell/util/fetch'
44✔
3

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

12
export interface ExportFeaturesResponse extends BaseResponse {
13
  result: object[] | string
14
}
15

16
export async function exportFeatures({
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
}: ExportFeaturesRequest & BaseRequest): Promise<
26
  ExportFeaturesResponse | string
27
> {
3✔
28
  const fetch = await loadFetch()
34✔
29
  const url = new URL(
20✔
30
    `/api/collection/${collectionId}/features/export?categoryId=${categoryId}&format=${format}&skip=${skip}&take=${take}`,
119✔
31
    apiUrl
6✔
32
  )
4✔
33

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

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

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