@opencrvs/toolkit 1.8.0-rc.fc43738 → 1.8.0-rc.feaeeb7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
16
16
  createdBy: z.ZodString;
17
17
  createdAtLocation: z.ZodString;
18
18
  modifiedAt: z.ZodString;
19
- assignedTo: z.ZodNullable<z.ZodString>;
19
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
20
  updatedBy: z.ZodString;
21
21
  trackingId: z.ZodString;
22
22
  }, {
@@ -29,10 +29,10 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
29
29
  createdAt: string;
30
30
  createdBy: string;
31
31
  createdAtLocation: string;
32
- assignedTo: string | null;
33
32
  trackingId: string;
34
33
  modifiedAt: string;
35
34
  updatedBy: string;
35
+ assignedTo?: string | null | undefined;
36
36
  }, {
37
37
  type: string;
38
38
  id: string;
@@ -41,10 +41,10 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
41
41
  createdAt: string;
42
42
  createdBy: string;
43
43
  createdAtLocation: string;
44
- assignedTo: string | null;
45
44
  trackingId: string;
46
45
  modifiedAt: string;
47
46
  updatedBy: string;
47
+ assignedTo?: string | null | undefined;
48
48
  }>;
49
49
  export declare const EventSearchIndex: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
50
50
  type: z.ZodString;
@@ -47,7 +47,7 @@ export declare const EventMetadata: z.ZodObject<{
47
47
  createdBy: z.ZodString;
48
48
  createdAtLocation: z.ZodString;
49
49
  modifiedAt: z.ZodString;
50
- assignedTo: z.ZodNullable<z.ZodString>;
50
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
51
  updatedBy: z.ZodString;
52
52
  trackingId: z.ZodString;
53
53
  }, "strip", z.ZodTypeAny, {
@@ -57,10 +57,10 @@ export declare const EventMetadata: z.ZodObject<{
57
57
  createdAt: string;
58
58
  createdBy: string;
59
59
  createdAtLocation: string;
60
- assignedTo: string | null;
61
60
  trackingId: string;
62
61
  modifiedAt: string;
63
62
  updatedBy: string;
63
+ assignedTo?: string | null | undefined;
64
64
  }, {
65
65
  type: string;
66
66
  id: string;
@@ -68,10 +68,10 @@ export declare const EventMetadata: z.ZodObject<{
68
68
  createdAt: string;
69
69
  createdBy: string;
70
70
  createdAtLocation: string;
71
- assignedTo: string | null;
72
71
  trackingId: string;
73
72
  modifiedAt: string;
74
73
  updatedBy: string;
74
+ assignedTo?: string | null | undefined;
75
75
  }>;
76
76
  export type EventMetadata = z.infer<typeof EventMetadata>;
77
77
  export type EventMetadataKeys = `event.${keyof EventMetadata}`;
@@ -1170,6 +1170,8 @@ declare const DateField: z.ZodObject<z.objectUtil.extendShape<{
1170
1170
  } | undefined;
1171
1171
  }>;
1172
1172
  export type DateField = z.infer<typeof DateField>;
1173
+ declare const HtmlFontVariant: z.ZodEnum<["reg12", "reg14", "reg16", "reg18", "h4", "h3", "h2", "h1"]>;
1174
+ export type HtmlFontVariant = z.infer<typeof HtmlFontVariant>;
1173
1175
  declare const Paragraph: z.ZodObject<z.objectUtil.extendShape<{
1174
1176
  id: z.ZodString;
1175
1177
  defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodString, z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodObject<{
@@ -1,18 +1,24 @@
1
1
  import { z } from 'zod';
2
2
  import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField } from './FieldConfig';
3
3
  import { FieldType } from './FieldType';
4
- import { AddressFieldValue, FieldValue, FieldValueSchema, FileFieldValue, FileFieldWithOptionValue, OptionalFieldValueSchema } from './FieldValue';
4
+ import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
5
+ import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
5
6
  /**
6
7
  * FieldTypeMapping.ts should include functions that map field types to different formats dynamically.
7
8
  * File is separated from FieldType and FieldConfig to avoid circular dependencies.
8
9
  *
9
10
  * We can move the specific mapFieldTypeTo* functions where they are used once the core fields are implemented.
10
11
  */
12
+ /**
13
+ * Optionality of a field is defined in FieldConfig, not in FieldValue.
14
+ * Allows for nullishness of a field value during validations based on FieldConfig.
15
+ */
16
+ type NullishFieldValueSchema = z.ZodOptional<z.ZodNullable<FieldUpdateValueSchema>>;
11
17
  /**
12
18
  * Mapping of field types to Zod schema.
13
19
  * Useful for building dynamic validations against FieldConfig
14
20
  */
15
- export declare function mapFieldTypeToZod(type: FieldType, required?: boolean): z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodObject<{
21
+ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean): z.ZodString | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodObject<{
16
22
  filename: z.ZodString;
17
23
  originalFilename: z.ZodString;
18
24
  type: z.ZodString;
@@ -24,57 +30,69 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
24
30
  type: string;
25
31
  filename: string;
26
32
  originalFilename: string;
27
- }>> | z.ZodOptional<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
33
+ }> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
34
+ filename: z.ZodString;
35
+ originalFilename: z.ZodString;
36
+ type: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: string;
39
+ filename: string;
40
+ originalFilename: string;
41
+ }, {
42
+ type: string;
43
+ filename: string;
44
+ originalFilename: string;
45
+ }>>> | z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
28
46
  country: z.ZodString;
29
47
  province: z.ZodString;
30
48
  district: z.ZodString;
31
49
  }, {
32
50
  urbanOrRural: z.ZodLiteral<"URBAN">;
33
- town: z.ZodOptional<z.ZodString>;
34
- residentialArea: z.ZodOptional<z.ZodString>;
35
- street: z.ZodOptional<z.ZodString>;
36
- number: z.ZodOptional<z.ZodString>;
37
- zipCode: z.ZodOptional<z.ZodString>;
51
+ town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
55
+ zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
56
  }>, "strip", z.ZodTypeAny, {
39
57
  country: string;
40
58
  district: string;
41
59
  province: string;
42
60
  urbanOrRural: "URBAN";
43
- number?: string | undefined;
44
- town?: string | undefined;
45
- residentialArea?: string | undefined;
46
- street?: string | undefined;
47
- zipCode?: string | undefined;
61
+ number?: string | null | undefined;
62
+ town?: string | null | undefined;
63
+ residentialArea?: string | null | undefined;
64
+ street?: string | null | undefined;
65
+ zipCode?: string | null | undefined;
48
66
  }, {
49
67
  country: string;
50
68
  district: string;
51
69
  province: string;
52
70
  urbanOrRural: "URBAN";
53
- number?: string | undefined;
54
- town?: string | undefined;
55
- residentialArea?: string | undefined;
56
- street?: string | undefined;
57
- zipCode?: string | undefined;
71
+ number?: string | null | undefined;
72
+ town?: string | null | undefined;
73
+ residentialArea?: string | null | undefined;
74
+ street?: string | null | undefined;
75
+ zipCode?: string | null | undefined;
58
76
  }>, z.ZodObject<z.objectUtil.extendShape<{
59
77
  country: z.ZodString;
60
78
  province: z.ZodString;
61
79
  district: z.ZodString;
62
80
  }, {
63
81
  urbanOrRural: z.ZodLiteral<"RURAL">;
64
- village: z.ZodOptional<z.ZodString>;
82
+ village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
83
  }>, "strip", z.ZodTypeAny, {
66
84
  country: string;
67
85
  district: string;
68
86
  province: string;
69
87
  urbanOrRural: "RURAL";
70
- village?: string | undefined;
88
+ village?: string | null | undefined;
71
89
  }, {
72
90
  country: string;
73
91
  district: string;
74
92
  province: string;
75
93
  urbanOrRural: "RURAL";
76
- village?: string | undefined;
77
- }>]>> | z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ village?: string | null | undefined;
95
+ }>]> | z.ZodArray<z.ZodObject<{
78
96
  filename: z.ZodString;
79
97
  originalFilename: z.ZodString;
80
98
  type: z.ZodString;
@@ -89,8 +107,73 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
89
107
  option: string;
90
108
  filename: string;
91
109
  originalFilename: string;
92
- }>, "many">> | z.ZodOptional<z.ZodBoolean> | z.ZodOptional<z.ZodNumber> | FieldValueSchema;
93
- export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldValueSchema | OptionalFieldValueSchema>, "strip", z.ZodTypeAny, {
110
+ }>, "many"> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
111
+ filename: z.ZodString;
112
+ originalFilename: z.ZodString;
113
+ type: z.ZodString;
114
+ option: z.ZodString;
115
+ }, "strip", z.ZodTypeAny, {
116
+ type: string;
117
+ option: string;
118
+ filename: string;
119
+ originalFilename: string;
120
+ }, {
121
+ type: string;
122
+ option: string;
123
+ filename: string;
124
+ originalFilename: string;
125
+ }>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
126
+ country: z.ZodString;
127
+ province: z.ZodString;
128
+ district: z.ZodString;
129
+ }, {
130
+ urbanOrRural: z.ZodLiteral<"URBAN">;
131
+ town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ }>, "strip", z.ZodTypeAny, {
137
+ country: string;
138
+ district: string;
139
+ province: string;
140
+ urbanOrRural: "URBAN";
141
+ number?: string | null | undefined;
142
+ town?: string | null | undefined;
143
+ residentialArea?: string | null | undefined;
144
+ street?: string | null | undefined;
145
+ zipCode?: string | null | undefined;
146
+ }, {
147
+ country: string;
148
+ district: string;
149
+ province: string;
150
+ urbanOrRural: "URBAN";
151
+ number?: string | null | undefined;
152
+ town?: string | null | undefined;
153
+ residentialArea?: string | null | undefined;
154
+ street?: string | null | undefined;
155
+ zipCode?: string | null | undefined;
156
+ }>, z.ZodObject<z.objectUtil.extendShape<{
157
+ country: z.ZodString;
158
+ province: z.ZodString;
159
+ district: z.ZodString;
160
+ }, {
161
+ urbanOrRural: z.ZodLiteral<"RURAL">;
162
+ village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
+ }>, "strip", z.ZodTypeAny, {
164
+ country: string;
165
+ district: string;
166
+ province: string;
167
+ urbanOrRural: "RURAL";
168
+ village?: string | null | undefined;
169
+ }, {
170
+ country: string;
171
+ district: string;
172
+ province: string;
173
+ urbanOrRural: "RURAL";
174
+ village?: string | null | undefined;
175
+ }>]>>>;
176
+ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldUpdateValueSchema | NullishFieldValueSchema>, "strip", z.ZodTypeAny, {
94
177
  [x: string]: string | number | boolean | {
95
178
  type: string;
96
179
  filename: string;
@@ -100,23 +183,23 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
100
183
  district: string;
101
184
  province: string;
102
185
  urbanOrRural: "URBAN";
103
- number?: string | undefined;
104
- town?: string | undefined;
105
- residentialArea?: string | undefined;
106
- street?: string | undefined;
107
- zipCode?: string | undefined;
186
+ number?: string | null | undefined;
187
+ town?: string | null | undefined;
188
+ residentialArea?: string | null | undefined;
189
+ street?: string | null | undefined;
190
+ zipCode?: string | null | undefined;
108
191
  } | {
109
192
  country: string;
110
193
  district: string;
111
194
  province: string;
112
195
  urbanOrRural: "RURAL";
113
- village?: string | undefined;
196
+ village?: string | null | undefined;
114
197
  } | {
115
198
  type: string;
116
199
  option: string;
117
200
  filename: string;
118
201
  originalFilename: string;
119
- }[] | undefined;
202
+ }[] | null | undefined;
120
203
  }, {
121
204
  [x: string]: string | number | boolean | {
122
205
  type: string;
@@ -127,23 +210,23 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
127
210
  district: string;
128
211
  province: string;
129
212
  urbanOrRural: "URBAN";
130
- number?: string | undefined;
131
- town?: string | undefined;
132
- residentialArea?: string | undefined;
133
- street?: string | undefined;
134
- zipCode?: string | undefined;
213
+ number?: string | null | undefined;
214
+ town?: string | null | undefined;
215
+ residentialArea?: string | null | undefined;
216
+ street?: string | null | undefined;
217
+ zipCode?: string | null | undefined;
135
218
  } | {
136
219
  country: string;
137
220
  district: string;
138
221
  province: string;
139
222
  urbanOrRural: "RURAL";
140
- village?: string | undefined;
223
+ village?: string | null | undefined;
141
224
  } | {
142
225
  type: string;
143
226
  option: string;
144
227
  filename: string;
145
228
  originalFilename: string;
146
- }[] | undefined;
229
+ }[] | null | undefined;
147
230
  }>;
148
231
  /**
149
232
  * Quick-and-dirty mock data generator for event actions.
@@ -322,4 +405,5 @@ export declare const isOfficeFieldType: (field: {
322
405
  value: string;
323
406
  config: Office;
324
407
  };
408
+ export {};
325
409
  //# sourceMappingURL=FieldTypeMapping.d.ts.map
@@ -1,9 +1,26 @@
1
1
  import { z } from 'zod';
2
+ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
3
+ /**
4
+ * FieldValues defined in this file are primitive field values.
5
+ * FieldValues defined in CompositeFieldValue.ts are composed of multiple primitive field values (Address, File etc).
6
+ *
7
+ * FieldValue is a union of primitive and composite field values.
8
+ * FieldValue can never be null.
9
+ *
10
+ * FieldUpdateValue accepts null values for primitive field values when they are optional.
11
+ * API is build assuming partial (PATCH) updates. In order to edit and remove optional value, we need to accept null values.
12
+ * Omitting a field value in partial updates leaves it untouched.
13
+ *
14
+ */
2
15
  export declare const TextValue: z.ZodString;
3
16
  export declare const RequiredTextValue: z.ZodString;
4
17
  export declare const DateValue: z.ZodString;
5
18
  export declare const EmailValue: z.ZodString;
6
- export declare const FileFieldValue: z.ZodObject<{
19
+ export declare const CheckboxFieldValue: z.ZodBoolean;
20
+ export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
21
+ export declare const NumberFieldValue: z.ZodNumber;
22
+ export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
23
+ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
7
24
  filename: z.ZodString;
8
25
  originalFilename: z.ZodString;
9
26
  type: z.ZodString;
@@ -15,9 +32,22 @@ export declare const FileFieldValue: z.ZodObject<{
15
32
  type: string;
16
33
  filename: string;
17
34
  originalFilename: string;
18
- }>;
19
- export type FileFieldValue = z.infer<typeof FileFieldValue>;
20
- export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
35
+ }>, z.ZodArray<z.ZodObject<{
36
+ filename: z.ZodString;
37
+ originalFilename: z.ZodString;
38
+ type: z.ZodString;
39
+ option: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ type: string;
42
+ option: string;
43
+ filename: string;
44
+ originalFilename: string;
45
+ }, {
46
+ type: string;
47
+ option: string;
48
+ filename: string;
49
+ originalFilename: string;
50
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
21
51
  country: z.ZodString;
22
52
  province: z.ZodString;
23
53
  district: z.ZodString;
@@ -68,46 +98,8 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
68
98
  urbanOrRural: "RURAL";
69
99
  village?: string | undefined;
70
100
  }>]>;
71
- export type AddressFieldValue = z.infer<typeof AddressFieldValue>;
72
- export declare const FileFieldValueWithOption: z.ZodObject<{
73
- filename: z.ZodString;
74
- originalFilename: z.ZodString;
75
- type: z.ZodString;
76
- option: z.ZodString;
77
- }, "strip", z.ZodTypeAny, {
78
- type: string;
79
- option: string;
80
- filename: string;
81
- originalFilename: string;
82
- }, {
83
- type: string;
84
- option: string;
85
- filename: string;
86
- originalFilename: string;
87
- }>;
88
- export type FileFieldValueWithOption = z.infer<typeof FileFieldValueWithOption>;
89
- export declare const FileFieldWithOptionValue: z.ZodArray<z.ZodObject<{
90
- filename: z.ZodString;
91
- originalFilename: z.ZodString;
92
- type: z.ZodString;
93
- option: z.ZodString;
94
- }, "strip", z.ZodTypeAny, {
95
- type: string;
96
- option: string;
97
- filename: string;
98
- originalFilename: string;
99
- }, {
100
- type: string;
101
- option: string;
102
- filename: string;
103
- originalFilename: string;
104
- }>, "many">;
105
- export type FileFieldWithOptionValue = z.infer<typeof FileFieldWithOptionValue>;
106
- export declare const CheckboxFieldValue: z.ZodBoolean;
107
- export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
108
- export declare const NumberFieldValue: z.ZodNumber;
109
- export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
110
- export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObject<{
101
+ export type FieldValue = z.infer<typeof FieldValue>;
102
+ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
111
103
  filename: z.ZodString;
112
104
  originalFilename: z.ZodString;
113
105
  type: z.ZodString;
@@ -134,61 +126,66 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObje
134
126
  option: string;
135
127
  filename: string;
136
128
  originalFilename: string;
137
- }>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
129
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
138
130
  country: z.ZodString;
139
131
  province: z.ZodString;
140
132
  district: z.ZodString;
141
133
  }, {
142
134
  urbanOrRural: z.ZodLiteral<"URBAN">;
143
- town: z.ZodOptional<z.ZodString>;
144
- residentialArea: z.ZodOptional<z.ZodString>;
145
- street: z.ZodOptional<z.ZodString>;
146
- number: z.ZodOptional<z.ZodString>;
147
- zipCode: z.ZodOptional<z.ZodString>;
135
+ town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
+ street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
140
  }>, "strip", z.ZodTypeAny, {
149
141
  country: string;
150
142
  district: string;
151
143
  province: string;
152
144
  urbanOrRural: "URBAN";
153
- number?: string | undefined;
154
- town?: string | undefined;
155
- residentialArea?: string | undefined;
156
- street?: string | undefined;
157
- zipCode?: string | undefined;
145
+ number?: string | null | undefined;
146
+ town?: string | null | undefined;
147
+ residentialArea?: string | null | undefined;
148
+ street?: string | null | undefined;
149
+ zipCode?: string | null | undefined;
158
150
  }, {
159
151
  country: string;
160
152
  district: string;
161
153
  province: string;
162
154
  urbanOrRural: "URBAN";
163
- number?: string | undefined;
164
- town?: string | undefined;
165
- residentialArea?: string | undefined;
166
- street?: string | undefined;
167
- zipCode?: string | undefined;
155
+ number?: string | null | undefined;
156
+ town?: string | null | undefined;
157
+ residentialArea?: string | null | undefined;
158
+ street?: string | null | undefined;
159
+ zipCode?: string | null | undefined;
168
160
  }>, z.ZodObject<z.objectUtil.extendShape<{
169
161
  country: z.ZodString;
170
162
  province: z.ZodString;
171
163
  district: z.ZodString;
172
164
  }, {
173
165
  urbanOrRural: z.ZodLiteral<"RURAL">;
174
- village: z.ZodOptional<z.ZodString>;
166
+ village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
167
  }>, "strip", z.ZodTypeAny, {
176
168
  country: string;
177
169
  district: string;
178
170
  province: string;
179
171
  urbanOrRural: "RURAL";
180
- village?: string | undefined;
172
+ village?: string | null | undefined;
181
173
  }, {
182
174
  country: string;
183
175
  district: string;
184
176
  province: string;
185
177
  urbanOrRural: "RURAL";
186
- village?: string | undefined;
178
+ village?: string | null | undefined;
187
179
  }>]>;
188
- export type FieldValue = z.infer<typeof FieldValue>;
180
+ export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
189
181
  /**
190
182
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
191
183
  * */
192
184
  export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
193
- export type OptionalFieldValueSchema = z.ZodOptional<FieldValueSchema>;
185
+ /**
186
+ * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
187
+ *
188
+ * FieldValueInputSchema uses Input types which have set optional values as nullish
189
+ * */
190
+ export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
194
191
  //# sourceMappingURL=FieldValue.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { FieldValue } from './FieldValue';
2
+ export type DefaultValue = FieldValue | MetaFieldsDotted | Record<string, MetaFieldsDotted | FieldValue>;
3
+ export declare function isTemplateVariable(value: DefaultValue): value is MetaFieldsDotted;
4
+ export declare function isFieldValue(value: DefaultValue): value is FieldValue;
5
+ export declare function isFieldValueWithoutTemplates(value: DefaultValue): value is FieldValue;
6
+ export declare function isDefaultValue(value: any): value is DefaultValue;
7
+ export interface MetaFields {
8
+ $user: {
9
+ province: string;
10
+ district: string;
11
+ };
12
+ }
13
+ type DottedKeys<T, Prefix extends string = ''> = {
14
+ [K in keyof T]: T[K] extends Record<string, string> ? DottedKeys<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
15
+ }[keyof T];
16
+ export type MetaFieldsDotted = DottedKeys<MetaFields>;
17
+ export {};
18
+ //# sourceMappingURL=TemplateConfig.d.ts.map
@@ -15,6 +15,7 @@ export * from './ActionDocument';
15
15
  export * from './EventIndex';
16
16
  export * from './TranslationConfig';
17
17
  export * from './FieldValue';
18
+ export * from './CompositeFieldValue';
18
19
  export * from './state';
19
20
  export * from './utils';
20
21
  export * from './defineConfig';
@@ -27,6 +28,7 @@ export * from './FieldTypeMapping';
27
28
  export * from './Conditional';
28
29
  export * from './AdvancedSearchConfig';
29
30
  export * from './test.utils';
31
+ export * from './TemplateConfig';
30
32
  export * from '../conditionals/conditionals';
31
33
  export * from '../conditionals/validate';
32
34
  //# sourceMappingURL=index.d.ts.map