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

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.
Files changed (33) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +6945 -9633
  3. package/dist/commons/conditionals/conditionals.d.ts +28 -5
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +44 -16
  6. package/dist/commons/conditionals/validate.test.d.ts +2 -0
  7. package/dist/commons/events/ActionConfig.d.ts +1116 -2067
  8. package/dist/commons/events/ActionDocument.d.ts +10565 -1388
  9. package/dist/commons/events/ActionInput.d.ts +6853 -2170
  10. package/dist/commons/events/ActionType.d.ts +25 -12
  11. package/dist/commons/events/CompositeFieldValue.d.ts +414 -0
  12. package/dist/commons/events/Conditional.d.ts +21 -5
  13. package/dist/commons/events/Draft.d.ts +496 -199
  14. package/dist/commons/events/EventConfig.d.ts +559 -1238
  15. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  16. package/dist/commons/events/EventDocument.d.ts +4630 -1719
  17. package/dist/commons/events/EventIndex.d.ts +9 -6
  18. package/dist/commons/events/EventMetadata.d.ts +6 -3
  19. package/dist/commons/events/FieldConfig.d.ts +529 -74
  20. package/dist/commons/events/FieldType.d.ts +6 -1
  21. package/dist/commons/events/FieldTypeMapping.d.ts +274 -39
  22. package/dist/commons/events/FieldValue.d.ts +136 -65
  23. package/dist/commons/events/FormConfig.d.ts +633 -48
  24. package/dist/commons/events/PageConfig.d.ts +335 -0
  25. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  26. package/dist/commons/events/User.d.ts +1 -0
  27. package/dist/commons/events/defineConfig.d.ts +91 -222
  28. package/dist/commons/events/index.d.ts +4 -1
  29. package/dist/commons/events/test.utils.d.ts +175 -242
  30. package/dist/commons/events/utils.d.ts +188 -70
  31. package/dist/conditionals/index.js +166 -81
  32. package/dist/events/index.js +1589 -883
  33. package/package.json +1 -1
@@ -1,9 +1,28 @@
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 DataFieldValue: z.ZodUndefined;
24
+ export type DataFieldValue = z.infer<typeof DataFieldValue>;
25
+ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
7
26
  filename: z.ZodString;
8
27
  originalFilename: z.ZodString;
9
28
  type: z.ZodString;
@@ -15,10 +34,24 @@ export declare const FileFieldValue: z.ZodObject<{
15
34
  type: string;
16
35
  filename: string;
17
36
  originalFilename: string;
18
- }>;
19
- export type FileFieldValue = z.infer<typeof FileFieldValue>;
20
- export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
37
+ }>, z.ZodArray<z.ZodObject<{
38
+ filename: z.ZodString;
39
+ originalFilename: z.ZodString;
40
+ type: z.ZodString;
41
+ option: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ type: string;
44
+ option: string;
45
+ filename: string;
46
+ originalFilename: string;
47
+ }, {
48
+ type: string;
49
+ option: string;
50
+ filename: string;
51
+ originalFilename: string;
52
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
21
53
  country: z.ZodString;
54
+ addressType: z.ZodLiteral<"DOMESTIC">;
22
55
  province: z.ZodString;
23
56
  district: z.ZodString;
24
57
  }, {
@@ -31,6 +64,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
31
64
  }>, "strip", z.ZodTypeAny, {
32
65
  country: string;
33
66
  district: string;
67
+ addressType: "DOMESTIC";
34
68
  province: string;
35
69
  urbanOrRural: "URBAN";
36
70
  number?: string | undefined;
@@ -41,6 +75,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
41
75
  }, {
42
76
  country: string;
43
77
  district: string;
78
+ addressType: "DOMESTIC";
44
79
  province: string;
45
80
  urbanOrRural: "URBAN";
46
81
  number?: string | undefined;
@@ -50,6 +85,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
50
85
  zipCode?: string | undefined;
51
86
  }>, z.ZodObject<z.objectUtil.extendShape<{
52
87
  country: z.ZodString;
88
+ addressType: z.ZodLiteral<"DOMESTIC">;
53
89
  province: z.ZodString;
54
90
  district: z.ZodString;
55
91
  }, {
@@ -58,56 +94,50 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
58
94
  }>, "strip", z.ZodTypeAny, {
59
95
  country: string;
60
96
  district: string;
97
+ addressType: "DOMESTIC";
61
98
  province: string;
62
99
  urbanOrRural: "RURAL";
63
100
  village?: string | undefined;
64
101
  }, {
65
102
  country: string;
66
103
  district: string;
104
+ addressType: "DOMESTIC";
67
105
  province: string;
68
106
  urbanOrRural: "RURAL";
69
107
  village?: string | undefined;
70
- }>]>;
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;
108
+ }>, z.ZodUndefined, z.ZodObject<{
109
+ country: z.ZodString;
110
+ addressType: z.ZodLiteral<"INTERNATIONAL">;
111
+ state: z.ZodString;
112
+ district2: z.ZodString;
113
+ cityOrTown: z.ZodOptional<z.ZodString>;
114
+ addressLine1: z.ZodOptional<z.ZodString>;
115
+ addressLine2: z.ZodOptional<z.ZodString>;
116
+ addressLine3: z.ZodOptional<z.ZodString>;
117
+ postcodeOrZip: z.ZodOptional<z.ZodString>;
94
118
  }, "strip", z.ZodTypeAny, {
95
- type: string;
96
- option: string;
97
- filename: string;
98
- originalFilename: string;
119
+ country: string;
120
+ state: string;
121
+ addressType: "INTERNATIONAL";
122
+ district2: string;
123
+ cityOrTown?: string | undefined;
124
+ addressLine1?: string | undefined;
125
+ addressLine2?: string | undefined;
126
+ addressLine3?: string | undefined;
127
+ postcodeOrZip?: string | undefined;
99
128
  }, {
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<{
129
+ country: string;
130
+ state: string;
131
+ addressType: "INTERNATIONAL";
132
+ district2: string;
133
+ cityOrTown?: string | undefined;
134
+ addressLine1?: string | undefined;
135
+ addressLine2?: string | undefined;
136
+ addressLine3?: string | undefined;
137
+ postcodeOrZip?: string | undefined;
138
+ }>]>;
139
+ export type FieldValue = z.infer<typeof FieldValue>;
140
+ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
111
141
  filename: z.ZodString;
112
142
  originalFilename: z.ZodString;
113
143
  type: z.ZodString;
@@ -134,61 +164,102 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObje
134
164
  option: string;
135
165
  filename: string;
136
166
  originalFilename: string;
137
- }>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
167
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
138
168
  country: z.ZodString;
169
+ addressType: z.ZodLiteral<"DOMESTIC">;
139
170
  province: z.ZodString;
140
171
  district: z.ZodString;
141
172
  }, {
142
173
  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>;
174
+ town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
+ residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
+ street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
179
  }>, "strip", z.ZodTypeAny, {
149
180
  country: string;
150
181
  district: string;
182
+ addressType: "DOMESTIC";
151
183
  province: string;
152
184
  urbanOrRural: "URBAN";
153
- number?: string | undefined;
154
- town?: string | undefined;
155
- residentialArea?: string | undefined;
156
- street?: string | undefined;
157
- zipCode?: string | undefined;
185
+ number?: string | null | undefined;
186
+ town?: string | null | undefined;
187
+ residentialArea?: string | null | undefined;
188
+ street?: string | null | undefined;
189
+ zipCode?: string | null | undefined;
158
190
  }, {
159
191
  country: string;
160
192
  district: string;
193
+ addressType: "DOMESTIC";
161
194
  province: string;
162
195
  urbanOrRural: "URBAN";
163
- number?: string | undefined;
164
- town?: string | undefined;
165
- residentialArea?: string | undefined;
166
- street?: string | undefined;
167
- zipCode?: string | undefined;
196
+ number?: string | null | undefined;
197
+ town?: string | null | undefined;
198
+ residentialArea?: string | null | undefined;
199
+ street?: string | null | undefined;
200
+ zipCode?: string | null | undefined;
168
201
  }>, z.ZodObject<z.objectUtil.extendShape<{
169
202
  country: z.ZodString;
203
+ addressType: z.ZodLiteral<"DOMESTIC">;
170
204
  province: z.ZodString;
171
205
  district: z.ZodString;
172
206
  }, {
173
207
  urbanOrRural: z.ZodLiteral<"RURAL">;
174
- village: z.ZodOptional<z.ZodString>;
208
+ village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
209
  }>, "strip", z.ZodTypeAny, {
176
210
  country: string;
177
211
  district: string;
212
+ addressType: "DOMESTIC";
178
213
  province: string;
179
214
  urbanOrRural: "RURAL";
180
- village?: string | undefined;
215
+ village?: string | null | undefined;
181
216
  }, {
182
217
  country: string;
183
218
  district: string;
219
+ addressType: "DOMESTIC";
184
220
  province: string;
185
221
  urbanOrRural: "RURAL";
186
- village?: string | undefined;
222
+ village?: string | null | undefined;
223
+ }>, z.ZodUndefined, z.ZodObject<{
224
+ country: z.ZodString;
225
+ addressType: z.ZodLiteral<"INTERNATIONAL">;
226
+ state: z.ZodString;
227
+ district2: z.ZodString;
228
+ cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
+ addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
232
+ postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ country: string;
235
+ state: string;
236
+ addressType: "INTERNATIONAL";
237
+ district2: string;
238
+ cityOrTown?: string | null | undefined;
239
+ addressLine1?: string | null | undefined;
240
+ addressLine2?: string | null | undefined;
241
+ addressLine3?: string | null | undefined;
242
+ postcodeOrZip?: string | null | undefined;
243
+ }, {
244
+ country: string;
245
+ state: string;
246
+ addressType: "INTERNATIONAL";
247
+ district2: string;
248
+ cityOrTown?: string | null | undefined;
249
+ addressLine1?: string | null | undefined;
250
+ addressLine2?: string | null | undefined;
251
+ addressLine3?: string | null | undefined;
252
+ postcodeOrZip?: string | null | undefined;
187
253
  }>]>;
188
- export type FieldValue = z.infer<typeof FieldValue>;
254
+ export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
255
+ /**
256
+ * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
257
+ * */
258
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
189
259
  /**
190
260
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
261
+ *
262
+ * FieldValueInputSchema uses Input types which have set optional values as nullish
191
263
  * */
192
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
193
- export type OptionalFieldValueSchema = z.ZodOptional<FieldValueSchema>;
264
+ export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
194
265
  //# sourceMappingURL=FieldValue.d.ts.map