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

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +17499 -10858
  3. package/dist/commons/conditionals/conditionals.d.ts +39 -8
  4. package/dist/commons/conditionals/validate-address.test.d.ts +2 -0
  5. package/dist/commons/conditionals/validate.d.ts +50 -22
  6. package/dist/commons/conditionals/validate.test.d.ts +2 -0
  7. package/dist/commons/events/ActionConfig.d.ts +116822 -2084
  8. package/dist/commons/events/ActionDocument.d.ts +12597 -1492
  9. package/dist/commons/events/ActionInput.d.ts +8325 -2272
  10. package/dist/commons/events/ActionType.d.ts +31 -12
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +1029 -22
  12. package/dist/commons/events/CompositeFieldValue.d.ts +445 -0
  13. package/dist/commons/events/Conditional.d.ts +21 -5
  14. package/dist/commons/events/Constants.d.ts +3 -0
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  16. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  17. package/dist/commons/events/Draft.d.ts +631 -217
  18. package/dist/commons/events/EventConfig.d.ts +56160 -1824
  19. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  20. package/dist/commons/events/EventDocument.d.ts +5979 -1899
  21. package/dist/commons/events/EventIndex.d.ts +1595 -27
  22. package/dist/commons/events/EventMetadata.d.ts +304 -45
  23. package/dist/commons/events/FieldConfig.d.ts +5822 -969
  24. package/dist/commons/events/FieldType.d.ts +10 -2
  25. package/dist/commons/events/FieldTypeMapping.d.ts +335 -51
  26. package/dist/commons/events/FieldValue.d.ts +177 -65
  27. package/dist/commons/events/FormConfig.d.ts +49317 -90
  28. package/dist/commons/events/PageConfig.d.ts +12337 -0
  29. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  30. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  31. package/dist/commons/events/User.d.ts +31 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  33. package/dist/commons/events/WorkqueueConfig.d.ts +4803 -20
  34. package/dist/commons/events/defineConfig.d.ts +9111 -307
  35. package/dist/commons/events/event.d.ts +54 -0
  36. package/dist/commons/events/field.d.ts +77 -0
  37. package/dist/commons/events/index.d.ts +11 -1
  38. package/dist/commons/events/scopes.d.ts +45 -0
  39. package/dist/commons/events/serializer.d.ts +2 -0
  40. package/dist/commons/events/test.utils.d.ts +262 -259
  41. package/dist/commons/events/transactions.d.ts +1 -1
  42. package/dist/commons/events/utils.d.ts +13481 -70
  43. package/dist/commons/events/utils.test.d.ts +2 -0
  44. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  45. package/dist/conditionals/index.js +233 -108
  46. package/dist/events/index.js +4955 -1910
  47. package/dist/scopes/index.d.ts +158 -1
  48. package/dist/scopes/index.js +152 -1
  49. package/package.json +3 -2
@@ -1,9 +1,33 @@
1
1
  import { z } from 'zod';
2
+ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue, NameFieldUpdateValue } 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 SignatureFieldValue: z.ZodString;
29
+ export type SignatureFieldValue = z.infer<typeof SignatureFieldValue>;
30
+ 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
31
  filename: z.ZodString;
8
32
  originalFilename: z.ZodString;
9
33
  type: z.ZodString;
@@ -15,10 +39,24 @@ export declare const FileFieldValue: z.ZodObject<{
15
39
  type: string;
16
40
  filename: string;
17
41
  originalFilename: string;
18
- }>;
19
- export type FileFieldValue = z.infer<typeof FileFieldValue>;
20
- export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
42
+ }>, z.ZodArray<z.ZodObject<{
43
+ filename: z.ZodString;
44
+ originalFilename: z.ZodString;
45
+ type: z.ZodString;
46
+ option: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ type: string;
49
+ option: string;
50
+ filename: string;
51
+ originalFilename: string;
52
+ }, {
53
+ type: string;
54
+ option: string;
55
+ filename: string;
56
+ originalFilename: string;
57
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
21
58
  country: z.ZodString;
59
+ addressType: z.ZodLiteral<"DOMESTIC">;
22
60
  province: z.ZodString;
23
61
  district: z.ZodString;
24
62
  }, {
@@ -31,6 +69,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
31
69
  }>, "strip", z.ZodTypeAny, {
32
70
  country: string;
33
71
  district: string;
72
+ addressType: "DOMESTIC";
34
73
  province: string;
35
74
  urbanOrRural: "URBAN";
36
75
  number?: string | undefined;
@@ -41,6 +80,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
41
80
  }, {
42
81
  country: string;
43
82
  district: string;
83
+ addressType: "DOMESTIC";
44
84
  province: string;
45
85
  urbanOrRural: "URBAN";
46
86
  number?: string | undefined;
@@ -50,6 +90,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
50
90
  zipCode?: string | undefined;
51
91
  }>, z.ZodObject<z.objectUtil.extendShape<{
52
92
  country: z.ZodString;
93
+ addressType: z.ZodLiteral<"DOMESTIC">;
53
94
  province: z.ZodString;
54
95
  district: z.ZodString;
55
96
  }, {
@@ -58,56 +99,74 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<"urbanOrRural",
58
99
  }>, "strip", z.ZodTypeAny, {
59
100
  country: string;
60
101
  district: string;
102
+ addressType: "DOMESTIC";
61
103
  province: string;
62
104
  urbanOrRural: "RURAL";
63
105
  village?: string | undefined;
64
106
  }, {
65
107
  country: string;
66
108
  district: string;
109
+ addressType: "DOMESTIC";
67
110
  province: string;
68
111
  urbanOrRural: "RURAL";
69
112
  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;
113
+ }>, z.ZodUndefined, z.ZodObject<{
114
+ country: z.ZodString;
115
+ addressType: z.ZodLiteral<"INTERNATIONAL">;
116
+ state: z.ZodString;
117
+ district2: z.ZodString;
118
+ cityOrTown: z.ZodOptional<z.ZodString>;
119
+ addressLine1: z.ZodOptional<z.ZodString>;
120
+ addressLine2: z.ZodOptional<z.ZodString>;
121
+ addressLine3: z.ZodOptional<z.ZodString>;
122
+ postcodeOrZip: z.ZodOptional<z.ZodString>;
77
123
  }, "strip", z.ZodTypeAny, {
78
- type: string;
79
- option: string;
80
- filename: string;
81
- originalFilename: string;
124
+ country: string;
125
+ state: string;
126
+ addressType: "INTERNATIONAL";
127
+ district2: string;
128
+ cityOrTown?: string | undefined;
129
+ addressLine1?: string | undefined;
130
+ addressLine2?: string | undefined;
131
+ addressLine3?: string | undefined;
132
+ postcodeOrZip?: string | undefined;
82
133
  }, {
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;
134
+ country: string;
135
+ state: string;
136
+ addressType: "INTERNATIONAL";
137
+ district2: string;
138
+ cityOrTown?: string | undefined;
139
+ addressLine1?: string | undefined;
140
+ addressLine2?: string | undefined;
141
+ addressLine3?: string | undefined;
142
+ postcodeOrZip?: string | undefined;
143
+ }>, z.ZodObject<{
144
+ firstname: z.ZodString;
145
+ surname: z.ZodString;
146
+ middlename: z.ZodOptional<z.ZodString>;
94
147
  }, "strip", z.ZodTypeAny, {
95
- type: string;
96
- option: string;
97
- filename: string;
98
- originalFilename: string;
148
+ firstname: string;
149
+ surname: string;
150
+ middlename?: string | undefined;
99
151
  }, {
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<{
152
+ firstname: string;
153
+ surname: string;
154
+ middlename?: string | undefined;
155
+ }>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
156
+ firstname: z.ZodString;
157
+ surname: z.ZodString;
158
+ middlename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
159
+ }, "strip", z.ZodTypeAny, {
160
+ firstname: string;
161
+ surname: string;
162
+ middlename?: string | null | undefined;
163
+ }, {
164
+ firstname: string;
165
+ surname: string;
166
+ middlename?: string | null | undefined;
167
+ }>, z.ZodNull]>, z.ZodUndefined]>]>;
168
+ export type FieldValue = z.infer<typeof FieldValue>;
169
+ 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
170
  filename: z.ZodString;
112
171
  originalFilename: z.ZodString;
113
172
  type: z.ZodString;
@@ -134,61 +193,114 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodObje
134
193
  option: string;
135
194
  filename: string;
136
195
  originalFilename: string;
137
- }>, "many">, z.ZodBoolean, z.ZodNumber, z.ZodObject<z.objectUtil.extendShape<{
196
+ }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
138
197
  country: z.ZodString;
198
+ addressType: z.ZodLiteral<"DOMESTIC">;
139
199
  province: z.ZodString;
140
200
  district: z.ZodString;
141
201
  }, {
142
202
  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>;
203
+ town: z.ZodOptional<z.ZodNullable<z.ZodString>>;
204
+ residentialArea: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
+ street: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
207
+ zipCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
148
208
  }>, "strip", z.ZodTypeAny, {
149
209
  country: string;
150
210
  district: string;
211
+ addressType: "DOMESTIC";
151
212
  province: string;
152
213
  urbanOrRural: "URBAN";
153
- number?: string | undefined;
154
- town?: string | undefined;
155
- residentialArea?: string | undefined;
156
- street?: string | undefined;
157
- zipCode?: string | undefined;
214
+ number?: string | null | undefined;
215
+ town?: string | null | undefined;
216
+ residentialArea?: string | null | undefined;
217
+ street?: string | null | undefined;
218
+ zipCode?: string | null | undefined;
158
219
  }, {
159
220
  country: string;
160
221
  district: string;
222
+ addressType: "DOMESTIC";
161
223
  province: string;
162
224
  urbanOrRural: "URBAN";
163
- number?: string | undefined;
164
- town?: string | undefined;
165
- residentialArea?: string | undefined;
166
- street?: string | undefined;
167
- zipCode?: string | undefined;
225
+ number?: string | null | undefined;
226
+ town?: string | null | undefined;
227
+ residentialArea?: string | null | undefined;
228
+ street?: string | null | undefined;
229
+ zipCode?: string | null | undefined;
168
230
  }>, z.ZodObject<z.objectUtil.extendShape<{
169
231
  country: z.ZodString;
232
+ addressType: z.ZodLiteral<"DOMESTIC">;
170
233
  province: z.ZodString;
171
234
  district: z.ZodString;
172
235
  }, {
173
236
  urbanOrRural: z.ZodLiteral<"RURAL">;
174
- village: z.ZodOptional<z.ZodString>;
237
+ village: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
238
  }>, "strip", z.ZodTypeAny, {
176
239
  country: string;
177
240
  district: string;
241
+ addressType: "DOMESTIC";
178
242
  province: string;
179
243
  urbanOrRural: "RURAL";
180
- village?: string | undefined;
244
+ village?: string | null | undefined;
181
245
  }, {
182
246
  country: string;
183
247
  district: string;
248
+ addressType: "DOMESTIC";
184
249
  province: string;
185
250
  urbanOrRural: "RURAL";
186
- village?: string | undefined;
187
- }>]>;
188
- export type FieldValue = z.infer<typeof FieldValue>;
251
+ village?: string | null | undefined;
252
+ }>, z.ZodUndefined, z.ZodObject<{
253
+ country: z.ZodString;
254
+ addressType: z.ZodLiteral<"INTERNATIONAL">;
255
+ state: z.ZodString;
256
+ district2: z.ZodString;
257
+ cityOrTown: z.ZodOptional<z.ZodNullable<z.ZodString>>;
258
+ addressLine1: z.ZodOptional<z.ZodNullable<z.ZodString>>;
259
+ addressLine2: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
+ addressLine3: z.ZodOptional<z.ZodNullable<z.ZodString>>;
261
+ postcodeOrZip: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ }, "strip", z.ZodTypeAny, {
263
+ country: string;
264
+ state: string;
265
+ addressType: "INTERNATIONAL";
266
+ district2: string;
267
+ cityOrTown?: string | null | undefined;
268
+ addressLine1?: string | null | undefined;
269
+ addressLine2?: string | null | undefined;
270
+ addressLine3?: string | null | undefined;
271
+ postcodeOrZip?: string | null | undefined;
272
+ }, {
273
+ country: string;
274
+ state: string;
275
+ addressType: "INTERNATIONAL";
276
+ district2: string;
277
+ cityOrTown?: string | null | undefined;
278
+ addressLine1?: string | null | undefined;
279
+ addressLine2?: string | null | undefined;
280
+ addressLine3?: string | null | undefined;
281
+ postcodeOrZip?: string | null | undefined;
282
+ }>, z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
283
+ firstname: z.ZodString;
284
+ surname: z.ZodString;
285
+ middlename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ firstname: string;
288
+ surname: string;
289
+ middlename?: string | null | undefined;
290
+ }, {
291
+ firstname: string;
292
+ surname: string;
293
+ middlename?: string | null | undefined;
294
+ }>, z.ZodNull]>, z.ZodUndefined]>]>;
295
+ export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
296
+ /**
297
+ * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
298
+ * */
299
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
189
300
  /**
190
301
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
302
+ *
303
+ * FieldValueInputSchema uses Input types which have set optional values as nullish
191
304
  * */
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>;
305
+ export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | typeof NameFieldUpdateValue | z.ZodString | z.ZodBoolean;
194
306
  //# sourceMappingURL=FieldValue.d.ts.map