@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fd936ab

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/dist/commons/api/router.d.ts +447 -14227
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -14
  3. package/dist/commons/conditionals/validate.d.ts +6 -10
  4. package/dist/commons/events/ActionConfig.d.ts +1726 -117415
  5. package/dist/commons/events/ActionDocument.d.ts +383 -2305
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1029
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -143
  11. package/dist/commons/events/EventConfig.d.ts +1361 -56376
  12. package/dist/commons/events/EventDocument.d.ts +264 -1428
  13. package/dist/commons/events/EventIndex.d.ts +25 -1590
  14. package/dist/commons/events/EventMetadata.d.ts +43 -299
  15. package/dist/commons/events/FieldConfig.d.ts +1060 -5458
  16. package/dist/commons/events/FieldType.d.ts +3 -6
  17. package/dist/commons/events/FieldTypeMapping.d.ts +54 -103
  18. package/dist/commons/events/FieldValue.d.ts +8 -49
  19. package/dist/commons/events/FormConfig.d.ts +524 -49166
  20. package/dist/commons/events/PageConfig.d.ts +208 -12210
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -31
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -4803
  24. package/dist/commons/events/defineConfig.d.ts +75 -9010
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -147
  27. package/dist/commons/events/utils.d.ts +68 -13352
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1504 -3807
  30. package/dist/scopes/index.d.ts +6 -94
  31. package/dist/scopes/index.js +21 -42
  32. package/package.json +2 -3
  33. package/dist/commons/events/Constants.d.ts +0 -3
  34. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -2982
  35. package/dist/commons/events/CreatedAtLocation.d.ts +0 -3
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  37. package/dist/commons/events/event.d.ts +0 -54
  38. package/dist/commons/events/field.d.ts +0 -77
  39. package/dist/commons/events/scopes.d.ts +0 -45
  40. package/dist/commons/events/serializer.d.ts +0 -2
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
@@ -1,19 +1,16 @@
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";
8
5
  readonly TEXTAREA: "TEXTAREA";
9
6
  readonly EMAIL: "EMAIL";
10
7
  readonly DATE: "DATE";
11
- readonly DATE_RANGE: "DATE_RANGE";
12
8
  readonly PARAGRAPH: "PARAGRAPH";
13
9
  readonly PAGE_HEADER: "PAGE_HEADER";
14
10
  readonly RADIO_GROUP: "RADIO_GROUP";
15
11
  readonly FILE: "FILE";
16
12
  readonly FILE_WITH_OPTIONS: "FILE_WITH_OPTIONS";
13
+ readonly HIDDEN: "HIDDEN";
17
14
  readonly BULLET_LIST: "BULLET_LIST";
18
15
  readonly CHECKBOX: "CHECKBOX";
19
16
  readonly SELECT: "SELECT";
@@ -26,10 +23,10 @@ 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" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "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.
33
30
  */
34
- export declare const compositeFieldTypes: ("ADDRESS" | "DATE_RANGE" | "FILE" | "FILE_WITH_OPTIONS")[];
31
+ export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[];
35
32
  //# sourceMappingURL=FieldType.d.ts.map
@@ -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.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;
@@ -339,7 +283,7 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
339
283
  option: string;
340
284
  filename: string;
341
285
  originalFilename: string;
342
- }[] | [string, string] | null | undefined;
286
+ }[] | null | undefined;
343
287
  }, {
344
288
  [x: string]: string | number | boolean | {
345
289
  type: 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;
@@ -386,8 +322,54 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
386
322
  option: string;
387
323
  filename: string;
388
324
  originalFilename: string;
389
- }[] | [string, string] | null | undefined;
325
+ }[] | 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 | 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
  */
@@ -434,13 +416,6 @@ export declare const isDateFieldType: (field: {
434
416
  value: string;
435
417
  config: DateField;
436
418
  };
437
- export declare const isDateRangeFieldType: (field: {
438
- config: FieldConfig;
439
- value: FieldValue;
440
- }) => field is {
441
- value: string;
442
- config: DateField;
443
- };
444
419
  export declare const isPageHeaderFieldType: (field: {
445
420
  config: FieldConfig;
446
421
  value: FieldValue;
@@ -462,27 +437,6 @@ export declare const isNumberFieldType: (field: {
462
437
  value: number;
463
438
  config: NumberField;
464
439
  };
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
440
  export declare const isTextAreaFieldType: (field: {
487
441
  config: FieldConfig;
488
442
  value: FieldValue;
@@ -492,9 +446,9 @@ export declare const isTextAreaFieldType: (field: {
492
446
  };
493
447
  export declare const isSignatureFieldType: (field: {
494
448
  config: FieldConfig;
495
- value: FieldValue | undefined;
449
+ value: FieldValue;
496
450
  }) => field is {
497
- value: FileFieldValue | undefined;
451
+ value: string;
498
452
  config: SignatureField;
499
453
  };
500
454
  export declare const isEmailFieldType: (field: {
@@ -602,8 +556,5 @@ export declare const isDataFieldType: (field: {
602
556
  value: undefined;
603
557
  config: DataField;
604
558
  };
605
- export type NonInteractiveFieldType = Divider | PageHeader | Paragraph | BulletList | DataField;
606
- export type InteractiveFieldType = Exclude<FieldConfig, NonInteractiveFieldType>;
607
- export declare const isNonInteractiveFieldType: (field: FieldConfig) => field is NonInteractiveFieldType;
608
559
  export {};
609
560
  //# sourceMappingURL=FieldTypeMapping.d.ts.map
@@ -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).
@@ -13,11 +13,8 @@ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWi
13
13
  *
14
14
  */
15
15
  export declare const TextValue: z.ZodString;
16
- export declare const NonEmptyTextValue: z.ZodString;
16
+ export declare const RequiredTextValue: 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>;
21
18
  export declare const EmailValue: z.ZodString;
22
19
  export declare const CheckboxFieldValue: z.ZodBoolean;
23
20
  export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
@@ -25,9 +22,7 @@ export declare const NumberFieldValue: z.ZodNumber;
25
22
  export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
26
23
  export declare const DataFieldValue: z.ZodUndefined;
27
24
  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<{
25
+ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
31
26
  filename: z.ZodString;
32
27
  originalFilename: z.ZodString;
33
28
  type: z.ZodString;
@@ -140,33 +135,9 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnio
140
135
  addressLine2?: string | undefined;
141
136
  addressLine3?: string | undefined;
142
137
  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]>]>;
138
+ }>]>;
168
139
  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<{
140
+ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
170
141
  filename: z.ZodString;
171
142
  originalFilename: z.ZodString;
172
143
  type: z.ZodString;
@@ -279,28 +250,16 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
279
250
  addressLine2?: string | null | undefined;
280
251
  addressLine3?: string | null | undefined;
281
252
  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]>]>;
253
+ }>]>;
295
254
  export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
296
255
  /**
297
256
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
298
257
  * */
299
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
258
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
300
259
  /**
301
260
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
302
261
  *
303
262
  * FieldValueInputSchema uses Input types which have set optional values as nullish
304
263
  * */
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;
264
+ export type FieldUpdateValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
306
265
  //# sourceMappingURL=FieldValue.d.ts.map