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

teableio / teable / 8387093605

22 Mar 2024 07:48AM CUT coverage: 28.027% (-0.2%) from 28.222%
8387093605

Pull #484

github

web-flow
Merge 174ef76f7 into a06c6afb1
Pull Request #484: feat: support increment import

2099 of 3218 branches covered (65.23%)

24 of 703 new or added lines in 18 files covered. (3.41%)

49 existing lines in 6 files now uncovered.

25815 of 92109 relevant lines covered (28.03%)

5.52 hits per line

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

0.0
/packages/core/src/import/types.ts
1
import z from 'zod';
×
2
import { FieldType } from '../models';
×
3

×
4
export enum SUPPORTEDTYPE {
×
5
  CSV = 'csv',
×
6
  EXCEL = 'excel',
×
7
}
×
8

×
9
export const analyzeRoSchema = z.object({
×
10
  attachmentUrl: z.string().url().trim(),
×
11
  fileType: z.nativeEnum(SUPPORTEDTYPE),
×
12
});
×
13

×
14
export const analyzeColumnSchema = z.object({
×
15
  type: z.nativeEnum(FieldType),
×
16
  name: z.string(),
×
17
});
×
18

×
19
export const analyzeVoSchema = z.object({
×
20
  worksheets: z.record(
×
21
    z.string(),
×
22
    z.object({
×
23
      name: z.string(),
×
24
      columns: analyzeColumnSchema.array(),
×
25
    })
×
26
  ),
×
27
});
×
28

×
29
export type IAnalyzeRo = z.infer<typeof analyzeRoSchema>;
×
30

×
31
export type IAnalyzeVo = z.infer<typeof analyzeVoSchema>;
×
32

×
33
export type IAnalyzeColumn = z.infer<typeof analyzeColumnSchema>;
×
34

×
35
export type IValidateTypes =
×
36
  | FieldType.Number
×
37
  | FieldType.Date
×
38
  | FieldType.LongText
×
39
  | FieldType.Checkbox
×
40
  | FieldType.SingleLineText;
×
41

×
42
export const importColumnSchema = analyzeColumnSchema.extend({
×
43
  sourceColumnIndex: z.number(),
×
44
});
×
45

×
46
export const importSheetItem = z.object({
×
47
  name: z.string(),
×
48
  columns: importColumnSchema.array(),
×
49
  useFirstRowAsHeader: z.boolean(),
×
50
  importData: z.boolean(),
×
51
});
×
52

×
53
export const importOptionSchema = importSheetItem.pick({
×
54
  useFirstRowAsHeader: true,
×
55
  importData: true,
×
56
});
×
57

×
58
export const importOptionRoSchema = z.object({
×
59
  worksheets: z.record(z.string(), importSheetItem),
×
60
  attachmentUrl: z.string().url(),
×
61
  fileType: z.nativeEnum(SUPPORTEDTYPE),
×
62
});
×
63

×
NEW
64
export const inplaceImportOptionRoSchema = z.object({
×
NEW
65
  attachmentUrl: z.string().url(),
×
NEW
66
  fileType: z.nativeEnum(SUPPORTEDTYPE),
×
NEW
67
  insertConfig: z.object({
×
NEW
68
    sourceWorkSheetKey: z.string(),
×
NEW
69
    excludeFirstRow: z.boolean(),
×
NEW
70
    sourceColumnMap: z.record(z.number().nullable()),
×
NEW
71
  }),
×
NEW
72
});
×
NEW
73

×
74
export type IImportColumn = z.infer<typeof importColumnSchema>;
×
75

×
76
export type IImportOptionRo = z.infer<typeof importOptionRoSchema>;
×
77

×
78
export type IImportSheetItem = z.infer<typeof importSheetItem>;
×
79

×
80
export type IImportOption = z.infer<typeof importOptionSchema>;
×
NEW
81

×
NEW
82
export type IInplaceImportOptionRo = z.infer<typeof inplaceImportOptionRoSchema>;
×
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