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

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/dist/commons/api/router.d.ts +15318 -5028
  2. package/dist/commons/conditionals/conditionals.d.ts +8 -3
  3. package/dist/commons/conditionals/validate.d.ts +6 -0
  4. package/dist/commons/events/ActionConfig.d.ts +56387 -29043
  5. package/dist/commons/events/ActionDocument.d.ts +1900 -309
  6. package/dist/commons/events/ActionInput.d.ts +1455 -183
  7. package/dist/commons/events/ActionType.d.ts +4 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +675 -12
  9. package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
  10. package/dist/commons/events/Constants.d.ts +3 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  12. package/dist/commons/events/CreatedAtLocation.d.ts +3 -0
  13. package/dist/commons/events/Draft.d.ts +122 -21
  14. package/dist/commons/events/EventConfig.d.ts +27593 -14046
  15. package/dist/commons/events/EventDocument.d.ts +1228 -245
  16. package/dist/commons/events/EventIndex.d.ts +585 -353
  17. package/dist/commons/events/EventInput.d.ts +0 -13
  18. package/dist/commons/events/EventMetadata.d.ts +70 -76
  19. package/dist/commons/events/FieldConfig.d.ts +2500 -1111
  20. package/dist/commons/events/FieldType.d.ts +4 -1
  21. package/dist/commons/events/FieldTypeMapping.d.ts +94 -52
  22. package/dist/commons/events/FieldValue.d.ts +43 -5
  23. package/dist/commons/events/FormConfig.d.ts +18485 -9821
  24. package/dist/commons/events/PageConfig.d.ts +3600 -1472
  25. package/dist/commons/events/SummaryConfig.d.ts +0 -5
  26. package/dist/commons/events/User.d.ts +31 -7
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  28. package/dist/commons/events/WorkqueueConfig.d.ts +4205 -538
  29. package/dist/commons/events/defineConfig.d.ts +2639 -635
  30. package/dist/commons/events/event.d.ts +37 -10
  31. package/dist/commons/events/field.d.ts +26 -17
  32. package/dist/commons/events/index.d.ts +5 -0
  33. package/dist/commons/events/scopes.d.ts +20 -1
  34. package/dist/commons/events/serializer.d.ts +2 -0
  35. package/dist/commons/events/test.utils.d.ts +147 -41
  36. package/dist/commons/events/utils.d.ts +10110 -309
  37. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  38. package/dist/conditionals/index.js +45 -8
  39. package/dist/events/index.js +2708 -1100
  40. package/dist/scopes/index.d.ts +94 -6
  41. package/dist/scopes/index.js +42 -21
  42. package/package.json +1 -1
@@ -1,4 +1,7 @@
1
1
  export declare const FieldType: {
2
+ readonly NAME: "NAME";
3
+ readonly PHONE: "PHONE";
4
+ readonly ID: "ID";
2
5
  readonly ADDRESS: "ADDRESS";
3
6
  readonly TEXT: "TEXT";
4
7
  readonly NUMBER: "NUMBER";
@@ -23,7 +26,7 @@ export declare const FieldType: {
23
26
  readonly SIGNATURE: "SIGNATURE";
24
27
  readonly DATA: "DATA";
25
28
  };
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")[];
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")[];
27
30
  export type FieldType = (typeof fieldTypes)[number];
28
31
  /**
29
32
  * 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 } 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, NameField, PhoneField, IdField } from './FieldConfig';
3
3
  import { FieldType } from './FieldType';
4
4
  import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
5
- import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
5
+ import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue } 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,7 +42,55 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
42
42
  type: string;
43
43
  filename: string;
44
44
  originalFilename: string;
45
- }>>> | z.ZodUnion<[z.ZodDiscriminatedUnion<"urbanOrRural", [z.ZodObject<z.objectUtil.extendShape<{
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<{
46
94
  country: z.ZodString;
47
95
  addressType: z.ZodLiteral<"DOMESTIC">;
48
96
  province: z.ZodString;
@@ -158,7 +206,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
158
206
  option: string;
159
207
  filename: string;
160
208
  originalFilename: string;
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<{
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<{
162
210
  country: z.ZodString;
163
211
  addressType: z.ZodLiteral<"DOMESTIC">;
164
212
  province: z.ZodString;
@@ -261,6 +309,14 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
261
309
  residentialArea?: string | null | undefined;
262
310
  street?: string | null | undefined;
263
311
  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;
264
320
  } | {
265
321
  country: string;
266
322
  district: string;
@@ -300,6 +356,14 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
300
356
  residentialArea?: string | null | undefined;
301
357
  street?: string | null | undefined;
302
358
  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;
303
367
  } | {
304
368
  country: string;
305
369
  district: string;
@@ -324,52 +388,6 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
324
388
  originalFilename: string;
325
389
  }[] | [string, string] | null | undefined;
326
390
  }>;
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;
373
391
  /**
374
392
  * Maps complex or nested field types, such as Address fields, to their corresponding empty values.
375
393
  */
@@ -444,6 +462,27 @@ export declare const isNumberFieldType: (field: {
444
462
  value: number;
445
463
  config: NumberField;
446
464
  };
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
+ };
447
486
  export declare const isTextAreaFieldType: (field: {
448
487
  config: FieldConfig;
449
488
  value: FieldValue;
@@ -453,9 +492,9 @@ export declare const isTextAreaFieldType: (field: {
453
492
  };
454
493
  export declare const isSignatureFieldType: (field: {
455
494
  config: FieldConfig;
456
- value: FieldValue;
495
+ value: FieldValue | undefined;
457
496
  }) => field is {
458
- value: string;
497
+ value: FileFieldValue | undefined;
459
498
  config: SignatureField;
460
499
  };
461
500
  export declare const isEmailFieldType: (field: {
@@ -563,5 +602,8 @@ export declare const isDataFieldType: (field: {
563
602
  value: undefined;
564
603
  config: DataField;
565
604
  };
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;
566
608
  export {};
567
609
  //# sourceMappingURL=FieldTypeMapping.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue } from './CompositeFieldValue';
2
+ import { AddressFieldValue, AddressFieldUpdateValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue, NameFieldUpdateValue } 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).
@@ -25,6 +25,8 @@ export declare const NumberFieldValue: z.ZodNumber;
25
25
  export type NumberFieldValue = z.infer<typeof NumberFieldValue>;
26
26
  export declare const DataFieldValue: z.ZodUndefined;
27
27
  export type DataFieldValue = z.infer<typeof DataFieldValue>;
28
+ export declare const SignatureFieldValue: z.ZodString;
29
+ export type SignatureFieldValue = z.infer<typeof SignatureFieldValue>;
28
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<{
29
31
  filename: z.ZodString;
30
32
  originalFilename: z.ZodString;
@@ -138,7 +140,31 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnio
138
140
  addressLine2?: string | undefined;
139
141
  addressLine3?: string | undefined;
140
142
  postcodeOrZip?: string | undefined;
141
- }>]>;
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]>]>;
142
168
  export type FieldValue = z.infer<typeof FieldValue>;
143
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<{
144
170
  filename: z.ZodString;
@@ -253,16 +279,28 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
253
279
  addressLine2?: string | null | undefined;
254
280
  addressLine3?: string | null | undefined;
255
281
  postcodeOrZip?: string | null | undefined;
256
- }>]>;
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]>]>;
257
295
  export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
258
296
  /**
259
297
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
260
298
  * */
261
- export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
299
+ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | z.ZodString | z.ZodBoolean;
262
300
  /**
263
301
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
264
302
  *
265
303
  * FieldValueInputSchema uses Input types which have set optional values as nullish
266
304
  * */
267
- export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | z.ZodString | z.ZodBoolean;
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;
268
306
  //# sourceMappingURL=FieldValue.d.ts.map