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

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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +12801 -14208
  3. package/dist/commons/conditionals/conditionals.d.ts +30 -5
  4. package/dist/commons/conditionals/validate.d.ts +12 -17
  5. package/dist/commons/events/ActionConfig.d.ts +96433 -2006
  6. package/dist/commons/events/ActionDocument.d.ts +7832 -401
  7. package/dist/commons/events/ActionInput.d.ts +2292 -547
  8. package/dist/commons/events/ActionType.d.ts +26 -16
  9. package/dist/commons/events/AdvancedSearchConfig.d.ts +957 -22
  10. package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
  11. package/dist/commons/events/Conditional.d.ts +21 -5
  12. package/dist/commons/events/CreatedAtLocation.d.ts +3 -0
  13. package/dist/commons/events/Draft.d.ts +88 -60
  14. package/dist/commons/events/EventConfig.d.ts +46117 -1795
  15. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  16. package/dist/commons/events/EventDocument.d.ts +1106 -529
  17. package/dist/commons/events/EventIndex.d.ts +1239 -13
  18. package/dist/commons/events/EventInput.d.ts +13 -0
  19. package/dist/commons/events/EventMetadata.d.ts +277 -11
  20. package/dist/commons/events/FieldConfig.d.ts +4704 -786
  21. package/dist/commons/events/FieldType.d.ts +4 -3
  22. package/dist/commons/events/FieldTypeMapping.d.ts +33 -5
  23. package/dist/commons/events/FieldValue.d.ts +12 -7
  24. package/dist/commons/events/FormConfig.d.ts +43810 -73
  25. package/dist/commons/events/PageConfig.d.ts +10991 -0
  26. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  27. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  28. package/dist/commons/events/User.d.ts +5 -0
  29. package/dist/commons/events/WorkqueueConfig.d.ts +746 -20
  30. package/dist/commons/events/defineConfig.d.ts +7282 -224
  31. package/dist/commons/events/event.d.ts +54 -0
  32. package/dist/commons/events/field.d.ts +82 -0
  33. package/dist/commons/events/index.d.ts +5 -1
  34. package/dist/commons/events/scopes.d.ts +45 -0
  35. package/dist/commons/events/test.utils.d.ts +71 -325
  36. package/dist/commons/events/utils.d.ts +3700 -96
  37. package/dist/commons/events/utils.test.d.ts +2 -0
  38. package/dist/conditionals/index.js +191 -120
  39. package/dist/events/index.js +2905 -1344
  40. package/dist/scopes/index.d.ts +158 -1
  41. package/dist/scopes/index.js +152 -1
  42. package/package.json +3 -2
@@ -5,12 +5,12 @@ export declare const FieldType: {
5
5
  readonly TEXTAREA: "TEXTAREA";
6
6
  readonly EMAIL: "EMAIL";
7
7
  readonly DATE: "DATE";
8
+ readonly DATE_RANGE: "DATE_RANGE";
8
9
  readonly PARAGRAPH: "PARAGRAPH";
9
10
  readonly PAGE_HEADER: "PAGE_HEADER";
10
11
  readonly RADIO_GROUP: "RADIO_GROUP";
11
12
  readonly FILE: "FILE";
12
13
  readonly FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS";
13
- readonly HIDDEN: "HIDDEN";
14
14
  readonly BULLET_LIST: "BULLET_LIST";
15
15
  readonly CHECKBOX: "CHECKBOX";
16
16
  readonly SELECT: "SELECT";
@@ -21,11 +21,12 @@ 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" | "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
27
  export type FieldType = (typeof fieldTypes)[number];
27
28
  /**
28
29
  * Composite field types are field types that consist of multiple field values.
29
30
  */
30
- export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[];
31
+ export declare const compositeFieldTypes: ("ADDRESS" | "DATE_RANGE" | "FILE" | "FILE_WITH_OPTIONS")[];
31
32
  //# sourceMappingURL=FieldType.d.ts.map
@@ -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.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<{
162
162
  country: z.ZodString;
163
163
  addressType: z.ZodLiteral<"DOMESTIC">;
164
164
  province: z.ZodString;
@@ -283,7 +283,7 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
283
283
  option: string;
284
284
  filename: string;
285
285
  originalFilename: string;
286
- }[] | null | undefined;
286
+ }[] | [string, string] | null | undefined;
287
287
  }, {
288
288
  [x: string]: string | number | boolean | {
289
289
  type: string;
@@ -322,12 +322,12 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
322
322
  option: string;
323
323
  filename: string;
324
324
  originalFilename: string;
325
- }[] | null | undefined;
325
+ }[] | [string, string] | null | undefined;
326
326
  }>;
327
327
  /**
328
328
  * Quick-and-dirty mock data generator for event actions.
329
329
  */
330
- export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | 19 | {
330
+ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number): string | true | string[] | 19 | {
331
331
  country: string;
332
332
  addressType: "DOMESTIC";
333
333
  province: string;
@@ -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.
@@ -402,6 +416,13 @@ export declare const isDateFieldType: (field: {
402
416
  value: string;
403
417
  config: DateField;
404
418
  };
419
+ export declare const isDateRangeFieldType: (field: {
420
+ config: FieldConfig;
421
+ value: FieldValue;
422
+ }) => field is {
423
+ value: string;
424
+ config: DateField;
425
+ };
405
426
  export declare const isPageHeaderFieldType: (field: {
406
427
  config: FieldConfig;
407
428
  value: FieldValue;
@@ -535,5 +556,12 @@ export declare const isOfficeFieldType: (field: {
535
556
  value: string;
536
557
  config: Office;
537
558
  };
559
+ export declare const isDataFieldType: (field: {
560
+ config: FieldConfig;
561
+ value: FieldValue;
562
+ }) => field is {
563
+ value: undefined;
564
+ config: DataField;
565
+ };
538
566
  export {};
539
567
  //# sourceMappingURL=FieldTypeMapping.d.ts.map
@@ -13,14 +13,19 @@ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWi
13
13
  *
14
14
  */
15
15
  export declare const TextValue: z.ZodString;
16
- export declare const RequiredTextValue: z.ZodString;
16
+ export declare const NonEmptyTextValue: z.ZodString;
17
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>;
18
21
  export declare const EmailValue: z.ZodString;
19
22
  export declare const CheckboxFieldValue: z.ZodBoolean;
20
23
  export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
21
24
  export declare const NumberFieldValue: z.ZodNumber;
22
25
  export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
23
- export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
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<{
24
29
  filename: z.ZodString;
25
30
  originalFilename: z.ZodString;
26
31
  type: z.ZodString;
@@ -103,7 +108,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
103
108
  province: string;
104
109
  urbanOrRural: "RURAL";
105
110
  village?: string | undefined;
106
- }>, z.ZodObject<{
111
+ }>, z.ZodUndefined, z.ZodObject<{
107
112
  country: z.ZodString;
108
113
  addressType: z.ZodLiteral<"INTERNATIONAL">;
109
114
  state: z.ZodString;
@@ -135,7 +140,7 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBool
135
140
  postcodeOrZip?: string | undefined;
136
141
  }>]>;
137
142
  export type FieldValue = z.infer<typeof FieldValue>;
138
- export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
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<{
139
144
  filename: z.ZodString;
140
145
  originalFilename: z.ZodString;
141
146
  type: z.ZodString;
@@ -218,7 +223,7 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
218
223
  province: string;
219
224
  urbanOrRural: "RURAL";
220
225
  village?: string | null | undefined;
221
- }>, z.ZodObject<{
226
+ }>, z.ZodUndefined, z.ZodObject<{
222
227
  country: z.ZodString;
223
228
  addressType: z.ZodLiteral<"INTERNATIONAL">;
224
229
  state: z.ZodString;
@@ -253,11 +258,11 @@ export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
253
258
  /**
254
259
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
255
260
  * */
256
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
261
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
257
262
  /**
258
263
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
259
264
  *
260
265
  * FieldValueInputSchema uses Input types which have set optional values as nullish
261
266
  * */
262
- export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | z.ZodString | z.ZodBoolean;
267
+ export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
263
268
  //# sourceMappingURL=FieldValue.d.ts.map