@opencrvs/toolkit 1.8.0-rc.fa49ae3 → 1.8.0-rc.fa564ca

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 (31) hide show
  1. package/dist/commons/api/router.d.ts +381 -6649
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -4
  3. package/dist/commons/conditionals/validate.d.ts +0 -6
  4. package/dist/commons/events/ActionConfig.d.ts +6326 -18678
  5. package/dist/commons/events/ActionDocument.d.ts +204 -1713
  6. package/dist/commons/events/ActionInput.d.ts +180 -1380
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -75
  8. package/dist/commons/events/CompositeFieldValue.d.ts +0 -28
  9. package/dist/commons/events/Constants.d.ts +0 -1
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -26
  11. package/dist/commons/events/Draft.d.ts +16 -117
  12. package/dist/commons/events/EventConfig.d.ts +2487 -8364
  13. package/dist/commons/events/EventDocument.d.ts +152 -1096
  14. package/dist/commons/events/EventIndex.d.ts +17 -283
  15. package/dist/commons/events/EventMetadata.d.ts +35 -38
  16. package/dist/commons/events/FieldConfig.d.ts +771 -1597
  17. package/dist/commons/events/FieldType.d.ts +1 -4
  18. package/dist/commons/events/FieldTypeMapping.d.ts +50 -89
  19. package/dist/commons/events/FieldValue.d.ts +5 -41
  20. package/dist/commons/events/FormConfig.d.ts +2444 -7640
  21. package/dist/commons/events/PageConfig.d.ts +1620 -2896
  22. package/dist/commons/events/SummaryConfig.d.ts +5 -0
  23. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  24. package/dist/commons/events/WorkqueueConfig.d.ts +24 -346
  25. package/dist/commons/events/defineConfig.d.ts +14 -960
  26. package/dist/commons/events/field.d.ts +0 -4
  27. package/dist/commons/events/test.utils.d.ts +38 -124
  28. package/dist/commons/events/utils.d.ts +8 -9659
  29. package/dist/conditionals/index.js +1 -18
  30. package/dist/events/index.js +413 -691
  31. package/package.json +1 -1
@@ -1,7 +1,4 @@
1
1
  export declare const FieldType: {
2
- readonly NAME: "NAME";
3
- readonly PHONE: "PHONE";
4
- readonly ID: "ID";
5
2
  readonly ADDRESS: "ADDRESS";
6
3
  readonly TEXT: "TEXT";
7
4
  readonly NUMBER: "NUMBER";
@@ -26,7 +23,7 @@ export declare const FieldType: {
26
23
  readonly SIGNATURE: "SIGNATURE";
27
24
  readonly DATA: "DATA";
28
25
  };
29
- export declare const fieldTypes: ("ID" | "NAME" | "PHONE" | "ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "DATE_RANGE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[];
26
+ export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "DATE_RANGE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[];
30
27
  export type FieldType = (typeof fieldTypes)[number];
31
28
  /**
32
29
  * Composite field types are field types that consist of multiple field values.
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
- import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField, DataField, NameField, PhoneField, IdField } from './FieldConfig';
2
+ import { AddressField, AdministrativeArea, BulletList, Checkbox, Country, DateField, Divider, Facility, EmailField, FieldConfig, File, FileUploadWithOptions, Location, Office, PageHeader, Paragraph, RadioGroup, SelectField, SignatureField, TextAreaField, TextField, NumberField, DataField } from './FieldConfig';
3
3
  import { FieldType } from './FieldType';
4
4
  import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
5
- import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue } from './CompositeFieldValue';
5
+ import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
6
6
  /**
7
7
  * FieldTypeMapping.ts should include functions that map field types to different formats dynamically.
8
8
  * File is separated from FieldType and FieldConfig to avoid circular dependencies.
@@ -42,55 +42,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
42
42
  type: string;
43
43
  filename: string;
44
44
  originalFilename: string;
45
- }>>> | z.ZodObject<{
46
- firstname: z.ZodString;
47
- surname: z.ZodString;
48
- middlename: z.ZodOptional<z.ZodString>;
49
- }, "strip", z.ZodTypeAny, {
50
- firstname: string;
51
- surname: string;
52
- middlename?: string | undefined;
53
- }, {
54
- firstname: string;
55
- surname: string;
56
- middlename?: string | undefined;
57
- }> | z.ZodUndefined | z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
58
- firstname: z.ZodString;
59
- surname: z.ZodString;
60
- middlename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
- }, "strip", z.ZodTypeAny, {
62
- firstname: string;
63
- surname: string;
64
- middlename?: string | null | undefined;
65
- }, {
66
- firstname: string;
67
- surname: string;
68
- middlename?: string | null | undefined;
69
- }>, z.ZodNull]>, z.ZodUndefined]> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
- firstname: z.ZodString;
71
- surname: z.ZodString;
72
- middlename: z.ZodOptional<z.ZodString>;
73
- }, "strip", z.ZodTypeAny, {
74
- firstname: string;
75
- surname: string;
76
- middlename?: string | undefined;
77
- }, {
78
- firstname: string;
79
- surname: string;
80
- middlename?: string | undefined;
81
- }>>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
82
- firstname: z.ZodString;
83
- surname: z.ZodString;
84
- middlename: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
- }, "strip", z.ZodTypeAny, {
86
- firstname: string;
87
- surname: string;
88
- middlename?: string | null | undefined;
89
- }, {
90
- firstname: string;
91
- surname: string;
92
- middlename?: string | null | undefined;
93
- }>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
45
+ }>>> | z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
94
46
  country: z.ZodString;
95
47
  addressType: z.ZodLiteral<"DOMESTIC">;
96
48
  province: z.ZodString;
@@ -206,7 +158,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
206
158
  option: string;
207
159
  filename: string;
208
160
  originalFilename: string;
209
- }>, "many">>> | z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodUndefined>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
161
+ }>, "many">>> | z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodUndefined | z.ZodOptional<z.ZodNullable<z.ZodUndefined>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
210
162
  country: z.ZodString;
211
163
  addressType: z.ZodLiteral<"DOMESTIC">;
212
164
  province: z.ZodString;
@@ -309,14 +261,6 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
309
261
  residentialArea?: string | null | undefined;
310
262
  street?: string | null | undefined;
311
263
  zipCode?: string | null | undefined;
312
- } | {
313
- firstname: string;
314
- surname: string;
315
- middlename?: string | undefined;
316
- } | {
317
- firstname: string;
318
- surname: string;
319
- middlename?: string | null | undefined;
320
264
  } | {
321
265
  country: string;
322
266
  district: string;
@@ -356,14 +300,6 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
356
300
  residentialArea?: string | null | undefined;
357
301
  street?: string | null | undefined;
358
302
  zipCode?: string | null | undefined;
359
- } | {
360
- firstname: string;
361
- surname: string;
362
- middlename?: string | undefined;
363
- } | {
364
- firstname: string;
365
- surname: string;
366
- middlename?: string | null | undefined;
367
303
  } | {
368
304
  country: string;
369
305
  district: string;
@@ -388,6 +324,52 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
388
324
  originalFilename: string;
389
325
  }[] | [string, string] | null | undefined;
390
326
  }>;
327
+ /**
328
+ * Quick-and-dirty mock data generator for event actions.
329
+ */
330
+ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | string[] | 19 | {
331
+ country: string;
332
+ addressType: "DOMESTIC";
333
+ province: string;
334
+ district: string;
335
+ urbanOrRural: string;
336
+ town: string;
337
+ residentialArea: string;
338
+ street: string;
339
+ number: string;
340
+ zipCode: string;
341
+ filename?: undefined;
342
+ originalFilename?: undefined;
343
+ type?: undefined;
344
+ } | {
345
+ filename: string;
346
+ originalFilename: string;
347
+ type: string;
348
+ country?: undefined;
349
+ addressType?: undefined;
350
+ province?: undefined;
351
+ district?: undefined;
352
+ urbanOrRural?: undefined;
353
+ town?: undefined;
354
+ residentialArea?: undefined;
355
+ street?: undefined;
356
+ number?: undefined;
357
+ zipCode?: undefined;
358
+ } | {
359
+ country?: undefined;
360
+ addressType?: undefined;
361
+ province?: undefined;
362
+ district?: undefined;
363
+ urbanOrRural?: undefined;
364
+ town?: undefined;
365
+ residentialArea?: undefined;
366
+ street?: undefined;
367
+ number?: undefined;
368
+ zipCode?: undefined;
369
+ filename?: undefined;
370
+ originalFilename?: undefined;
371
+ type?: undefined;
372
+ } | null;
391
373
  /**
392
374
  * Maps complex or nested field types, such as Address fields, to their corresponding empty values.
393
375
  */
@@ -462,27 +444,6 @@ export declare const isNumberFieldType: (field: {
462
444
  value: number;
463
445
  config: NumberField;
464
446
  };
465
- export declare const isNameFieldType: (field: {
466
- config: FieldConfig;
467
- value: FieldValue;
468
- }) => field is {
469
- value: NameFieldValue;
470
- config: NameField;
471
- };
472
- export declare const isPhoneFieldType: (field: {
473
- config: FieldConfig;
474
- value: FieldValue;
475
- }) => field is {
476
- value: string;
477
- config: PhoneField;
478
- };
479
- export declare const isIdFieldType: (field: {
480
- config: FieldConfig;
481
- value: FieldValue;
482
- }) => field is {
483
- value: string;
484
- config: IdField;
485
- };
486
447
  export declare const isTextAreaFieldType: (field: {
487
448
  config: FieldConfig;
488
449
  value: FieldValue;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue, NameFieldUpdateValue } from './CompositeFieldValue';
2
+ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
3
3
  /**
4
4
  * FieldValues defined in this file are primitive field values.
5
5
  * FieldValues defined in CompositeFieldValue.ts are composed of multiple primitive field values (Address, File etc).
@@ -140,31 +140,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnio
140
140
  addressLine2?: string | undefined;
141
141
  addressLine3?: string | undefined;
142
142
  postcodeOrZip?: string | undefined;
143
- }>, z.ZodObject<{
144
- firstname: z.ZodString;
145
- surname: z.ZodString;
146
- middlename: z.ZodOptional<z.ZodString>;
147
- }, "strip", z.ZodTypeAny, {
148
- firstname: string;
149
- surname: string;
150
- middlename?: string | undefined;
151
- }, {
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]>]>;
143
+ }>]>;
168
144
  export type FieldValue = z.infer<typeof FieldValue>;
169
145
  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<{
170
146
  filename: z.ZodString;
@@ -279,28 +255,16 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
279
255
  addressLine2?: string | null | undefined;
280
256
  addressLine3?: string | null | undefined;
281
257
  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]>]>;
258
+ }>]>;
295
259
  export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
296
260
  /**
297
261
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
298
262
  * */
299
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
263
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
300
264
  /**
301
265
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
302
266
  *
303
267
  * FieldValueInputSchema uses Input types which have set optional values as nullish
304
268
  * */
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;
269
+ export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
306
270
  //# sourceMappingURL=FieldValue.d.ts.map