@opencrvs/toolkit 1.8.0-rc.fe87a15 → 1.8.0-rc.fe8c092

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 (38) hide show
  1. package/dist/commons/api/router.d.ts +6884 -614
  2. package/dist/commons/conditionals/conditionals.d.ts +4 -0
  3. package/dist/commons/conditionals/validate.d.ts +6 -0
  4. package/dist/commons/events/ActionConfig.d.ts +18678 -6326
  5. package/dist/commons/events/ActionDocument.d.ts +1923 -414
  6. package/dist/commons/events/ActionInput.d.ts +1504 -304
  7. package/dist/commons/events/ActionType.d.ts +6 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +75 -3
  9. package/dist/commons/events/CompositeFieldValue.d.ts +28 -0
  10. package/dist/commons/events/Constants.d.ts +1 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +254 -168
  12. package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
  13. package/dist/commons/events/Draft.d.ts +134 -33
  14. package/dist/commons/events/EventConfig.d.ts +8242 -2365
  15. package/dist/commons/events/EventDocument.d.ts +1242 -298
  16. package/dist/commons/events/EventIndex.d.ts +798 -123
  17. package/dist/commons/events/EventMetadata.d.ts +62 -59
  18. package/dist/commons/events/FieldConfig.d.ts +1572 -746
  19. package/dist/commons/events/FieldType.d.ts +4 -1
  20. package/dist/commons/events/FieldTypeMapping.d.ts +89 -50
  21. package/dist/commons/events/FieldValue.d.ts +41 -5
  22. package/dist/commons/events/FormConfig.d.ts +7640 -2444
  23. package/dist/commons/events/PageConfig.d.ts +2816 -1540
  24. package/dist/commons/events/SummaryConfig.d.ts +0 -5
  25. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  26. package/dist/commons/events/WorkqueueConfig.d.ts +3277 -1512
  27. package/dist/commons/events/defineConfig.d.ts +959 -13
  28. package/dist/commons/events/field.d.ts +4 -0
  29. package/dist/commons/events/index.d.ts +1 -0
  30. package/dist/commons/events/scopes.d.ts +1 -2
  31. package/dist/commons/events/test.utils.d.ts +138 -40
  32. package/dist/commons/events/transactions.d.ts +1 -1
  33. package/dist/commons/events/utils.d.ts +9666 -16
  34. package/dist/conditionals/index.js +18 -1
  35. package/dist/events/index.js +1592 -1011
  36. package/dist/scopes/index.d.ts +4 -1
  37. package/dist/scopes/index.js +67 -17
  38. 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;
@@ -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).
@@ -140,7 +140,31 @@ 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
- }>]>;
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]>]>;
144
168
  export type FieldValue = z.infer<typeof FieldValue>;
145
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<{
146
170
  filename: z.ZodString;
@@ -255,16 +279,28 @@ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.Z
255
279
  addressLine2?: string | null | undefined;
256
280
  addressLine3?: string | null | undefined;
257
281
  postcodeOrZip?: string | null | undefined;
258
- }>]>;
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]>]>;
259
295
  export type FieldUpdateValue = z.infer<typeof FieldUpdateValue>;
260
296
  /**
261
297
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
262
298
  * */
263
- 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;
264
300
  /**
265
301
  * NOTE: This is an exception. We need schema as a type in order to generate schema dynamically.
266
302
  *
267
303
  * FieldValueInputSchema uses Input types which have set optional values as nullish
268
304
  * */
269
- 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;
270
306
  //# sourceMappingURL=FieldValue.d.ts.map