@opencrvs/toolkit 1.8.0-rc.fca3e39 → 1.8.0-rc.fcf46fc

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 (30) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +6922 -14585
  3. package/dist/commons/conditionals/conditionals.d.ts +25 -3
  4. package/dist/commons/conditionals/validate.d.ts +14 -17
  5. package/dist/commons/events/ActionConfig.d.ts +1123 -2056
  6. package/dist/commons/events/ActionDocument.d.ts +7447 -347
  7. package/dist/commons/events/ActionInput.d.ts +2259 -522
  8. package/dist/commons/events/ActionType.d.ts +26 -16
  9. package/dist/commons/events/Conditional.d.ts +21 -5
  10. package/dist/commons/events/Draft.d.ts +67 -52
  11. package/dist/commons/events/EventConfig.d.ts +551 -1206
  12. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  13. package/dist/commons/events/EventDocument.d.ts +850 -454
  14. package/dist/commons/events/EventIndex.d.ts +6 -3
  15. package/dist/commons/events/EventMetadata.d.ts +3 -0
  16. package/dist/commons/events/FieldConfig.d.ts +465 -73
  17. package/dist/commons/events/FieldType.d.ts +2 -1
  18. package/dist/commons/events/FieldTypeMapping.d.ts +23 -2
  19. package/dist/commons/events/FieldValue.d.ts +6 -4
  20. package/dist/commons/events/FormConfig.d.ts +633 -48
  21. package/dist/commons/events/PageConfig.d.ts +335 -0
  22. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  23. package/dist/commons/events/defineConfig.d.ts +91 -216
  24. package/dist/commons/events/index.d.ts +2 -1
  25. package/dist/commons/events/test.utils.d.ts +70 -287
  26. package/dist/commons/events/utils.d.ts +89 -83
  27. package/dist/commons/events/utils.test.d.ts +2 -0
  28. package/dist/conditionals/index.js +161 -93
  29. package/dist/events/index.js +1264 -781
  30. package/package.json +1 -1
@@ -21,8 +21,9 @@ export declare const FieldType: {
21
21
  readonly FACILITY: "FACILITY";
22
22
  readonly OFFICE: "OFFICE";
23
23
  readonly SIGNATURE: "SIGNATURE";
24
+ readonly DATA: "DATA";
24
25
  };
25
- export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE")[];
26
+ export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[];
26
27
  export type FieldType = (typeof fieldTypes)[number];
27
28
  /**
28
29
  * Composite field types are field types that consist of multiple field values.
@@ -1,5 +1,5 @@
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 } 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
5
  import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
@@ -158,7 +158,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
158
158
  option: string;
159
159
  filename: string;
160
160
  originalFilename: string;
161
- }>, "many">>> | z.ZodBoolean | z.ZodOptional<z.ZodNullable<z.ZodBoolean>> | z.ZodNumber | z.ZodOptional<z.ZodNullable<z.ZodNumber>> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
161
+ }>, "many">>> | 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<{
162
162
  country: z.ZodString;
163
163
  addressType: z.ZodLiteral<"DOMESTIC">;
164
164
  province: z.ZodString;
@@ -355,6 +355,20 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
355
355
  street?: undefined;
356
356
  number?: undefined;
357
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;
358
372
  } | null;
359
373
  /**
360
374
  * Maps complex or nested field types, such as Address fields, to their corresponding empty values.
@@ -535,5 +549,12 @@ export declare const isOfficeFieldType: (field: {
535
549
  value: string;
536
550
  config: Office;
537
551
  };
552
+ export declare const isDataFieldType: (field: {
553
+ config: FieldConfig;
554
+ value: FieldValue;
555
+ }) => field is {
556
+ value: undefined;
557
+ config: DataField;
558
+ };
538
559
  export {};
539
560
  //# sourceMappingURL=FieldTypeMapping.d.ts.map
@@ -20,6 +20,8 @@ export declare const CheckboxFieldValue: z.ZodBoolean;
20
20
  export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
21
21
  export declare const NumberFieldValue: z.ZodNumber;
22
22
  export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
23
+ export declare const DataFieldValue: z.ZodUndefined;
24
+ export type DataFieldValue = z.infer<typeof DataFieldValue>;
23
25
  export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
24
26
  filename: z.ZodString;
25
27
  originalFilename: z.ZodString;
@@ -103,7 +105,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
103
105
  province: string;
104
106
  urbanOrRural: "RURAL";
105
107
  village?: string | undefined;
106
- }>, z.ZodObject<{
108
+ }>, z.ZodUndefined, z.ZodObject<{
107
109
  country: z.ZodString;
108
110
  addressType: z.ZodLiteral<"INTERNATIONAL">;
109
111
  state: z.ZodString;
@@ -218,7 +220,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
218
220
  province: string;
219
221
  urbanOrRural: "RURAL";
220
222
  village?: string | null | undefined;
221
- }>, z.ZodObject<{
223
+ }>, z.ZodUndefined, z.ZodObject<{
222
224
  country: z.ZodString;
223
225
  addressType: z.ZodLiteral<"INTERNATIONAL">;
224
226
  state: z.ZodString;
@@ -253,11 +255,11 @@ export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
253
255
  /**
254
256
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
255
257
  * */
256
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
258
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
257
259
  /**
258
260
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
259
261
  *
260
262
  * FieldValueInputSchema uses Input types which have set optional values as nullish
261
263
  * */
262
- export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
264
+ export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
263
265
  //# sourceMappingURL=FieldValue.d.ts.map