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

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