@opencrvs/toolkit 1.8.0-rc.fd1df48 → 1.8.0-rc.fd49b3a

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/dist/commons/api/router.d.ts +1806 -922
  2. package/dist/commons/conditionals/conditionals.d.ts +0 -12
  3. package/dist/commons/events/ActionConfig.d.ts +7830 -2014
  4. package/dist/commons/events/ActionDocument.d.ts +1948 -904
  5. package/dist/commons/events/ActionInput.d.ts +1680 -780
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +82 -33
  7. package/dist/commons/events/CompositeFieldValue.d.ts +9 -9
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +1086 -684
  9. package/dist/commons/events/Draft.d.ts +142 -70
  10. package/dist/commons/events/EventConfig.d.ts +3649 -935
  11. package/dist/commons/events/EventDocument.d.ts +1236 -588
  12. package/dist/commons/events/EventIndex.d.ts +339 -120
  13. package/dist/commons/events/FieldConfig.d.ts +455 -30
  14. package/dist/commons/events/FieldType.d.ts +2 -1
  15. package/dist/commons/events/FieldTypeMapping.d.ts +57 -25
  16. package/dist/commons/events/FieldValue.d.ts +45 -16
  17. package/dist/commons/events/FormConfig.d.ts +3005 -557
  18. package/dist/commons/events/PageConfig.d.ts +646 -38
  19. package/dist/commons/events/User.d.ts +6 -3
  20. package/dist/commons/events/WorkqueueConfig.d.ts +1990 -1174
  21. package/dist/commons/events/defineConfig.d.ts +498 -34
  22. package/dist/commons/events/event.d.ts +10 -18
  23. package/dist/commons/events/field.d.ts +13 -1
  24. package/dist/commons/events/test.utils.d.ts +43 -19
  25. package/dist/commons/events/utils.d.ts +2543 -77
  26. package/dist/conditionals/index.js +2 -34
  27. package/dist/events/index.js +963 -801
  28. package/dist/scopes/index.d.ts +92 -6
  29. package/dist/scopes/index.js +38 -9
  30. package/package.json +3 -3
@@ -9,6 +9,7 @@ export declare const FieldType: {
9
9
  readonly EMAIL: "EMAIL";
10
10
  readonly DATE: "DATE";
11
11
  readonly DATE_RANGE: "DATE_RANGE";
12
+ readonly SELECT_DATE_RANGE: "SELECT_DATE_RANGE";
12
13
  readonly PARAGRAPH: "PARAGRAPH";
13
14
  readonly PAGE_HEADER: "PAGE_HEADER";
14
15
  readonly RADIO_GROUP: "RADIO_GROUP";
@@ -26,7 +27,7 @@ export declare const FieldType: {
26
27
  readonly SIGNATURE: "SIGNATURE";
27
28
  readonly DATA: "DATA";
28
29
  };
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")[];
30
+ export declare const fieldTypes: ("ID" | "NAME" | "PHONE" | "ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA")[];
30
31
  export type FieldType = (typeof fieldTypes)[number];
31
32
  /**
32
33
  * Composite field types are field types that consist of multiple field values.
@@ -1,7 +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, NameField, PhoneField, IdField, DateRangeField, SelectDateRangeField } from './FieldConfig';
3
3
  import { FieldType } from './FieldType';
4
- import { FieldValue, FieldUpdateValueSchema } from './FieldValue';
4
+ import { FieldValue, FieldUpdateValueSchema, DateRangeFieldValue, SelectDateRangeValue } from './FieldValue';
5
+ import { FullDocumentPath } from '../documents';
5
6
  import { AddressFieldValue, FileFieldValue, FileFieldWithOptionValue, NameFieldValue } from './CompositeFieldValue';
6
7
  /**
7
8
  * FieldTypeMapping.ts should include functions that map field types to different formats dynamically.
@@ -19,28 +20,28 @@ type NullishFieldValueSchema = z.ZodOptional<z.ZodNullable<FieldUpdateValueSchem
19
20
  * Useful for building dynamic validations against FieldConfig
20
21
  */
21
22
  export declare function mapFieldTypeToZod(type: FieldType, required?: boolean): z.ZodString | z.ZodOptional<z.ZodNullable<z.ZodString>> | z.ZodObject<{
22
- filename: z.ZodString;
23
+ path: z.ZodEffects<z.ZodString, string, string>;
23
24
  originalFilename: z.ZodString;
24
25
  type: z.ZodString;
25
26
  }, "strip", z.ZodTypeAny, {
26
27
  type: string;
27
- filename: string;
28
+ path: string;
28
29
  originalFilename: string;
29
30
  }, {
30
31
  type: string;
31
- filename: string;
32
+ path: string;
32
33
  originalFilename: string;
33
34
  }> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
34
- filename: z.ZodString;
35
+ path: z.ZodEffects<z.ZodString, string, string>;
35
36
  originalFilename: z.ZodString;
36
37
  type: z.ZodString;
37
38
  }, "strip", z.ZodTypeAny, {
38
39
  type: string;
39
- filename: string;
40
+ path: string;
40
41
  originalFilename: string;
41
42
  }, {
42
43
  type: string;
43
- filename: string;
44
+ path: string;
44
45
  originalFilename: string;
45
46
  }>>> | z.ZodObject<{
46
47
  firstname: z.ZodString;
@@ -177,36 +178,54 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
177
178
  addressLine3?: string | null | undefined;
178
179
  postcodeOrZip?: string | null | undefined;
179
180
  }>]> | z.ZodArray<z.ZodObject<{
180
- filename: z.ZodString;
181
+ path: z.ZodEffects<z.ZodString, string, string>;
181
182
  originalFilename: z.ZodString;
182
183
  type: z.ZodString;
183
184
  option: z.ZodString;
184
185
  }, "strip", z.ZodTypeAny, {
185
186
  type: string;
186
187
  option: string;
187
- filename: string;
188
+ path: string;
188
189
  originalFilename: string;
189
190
  }, {
190
191
  type: string;
191
192
  option: string;
192
- filename: string;
193
+ path: string;
193
194
  originalFilename: string;
194
195
  }>, "many"> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
195
- filename: z.ZodString;
196
+ path: z.ZodEffects<z.ZodString, string, string>;
196
197
  originalFilename: z.ZodString;
197
198
  type: z.ZodString;
198
199
  option: z.ZodString;
199
200
  }, "strip", z.ZodTypeAny, {
200
201
  type: string;
201
202
  option: string;
202
- filename: string;
203
+ path: string;
203
204
  originalFilename: string;
204
205
  }, {
205
206
  type: string;
206
207
  option: string;
207
- filename: string;
208
+ path: string;
208
209
  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<{
210
+ }>, "many">>> | z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]> | z.ZodUnion<[z.ZodObject<{
211
+ start: z.ZodString;
212
+ end: z.ZodString;
213
+ }, "strip", z.ZodTypeAny, {
214
+ start: string;
215
+ end: string;
216
+ }, {
217
+ start: string;
218
+ end: string;
219
+ }>, z.ZodString]> | z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
220
+ start: z.ZodString;
221
+ end: z.ZodString;
222
+ }, "strip", z.ZodTypeAny, {
223
+ start: string;
224
+ end: string;
225
+ }, {
226
+ start: string;
227
+ end: string;
228
+ }>, z.ZodString]>>> | z.ZodOptional<z.ZodNullable<z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>>> | 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<{
210
229
  country: z.ZodString;
211
230
  addressType: z.ZodLiteral<"DOMESTIC">;
212
231
  province: z.ZodString;
@@ -296,7 +315,7 @@ export declare function mapFieldTypeToZod(type: FieldType, required?: boolean):
296
315
  export declare function createValidationSchema(config: FieldConfig[]): z.ZodObject<Record<string, FieldUpdateValueSchema | NullishFieldValueSchema>, "strip", z.ZodTypeAny, {
297
316
  [x: string]: string | number | boolean | {
298
317
  type: string;
299
- filename: string;
318
+ path: string;
300
319
  originalFilename: string;
301
320
  } | {
302
321
  country: string;
@@ -337,13 +356,16 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
337
356
  } | {
338
357
  type: string;
339
358
  option: string;
340
- filename: string;
359
+ path: string;
341
360
  originalFilename: string;
342
- }[] | [string, string] | null | undefined;
361
+ }[] | {
362
+ start: string;
363
+ end: string;
364
+ } | null | undefined;
343
365
  }, {
344
366
  [x: string]: string | number | boolean | {
345
367
  type: string;
346
- filename: string;
368
+ path: string;
347
369
  originalFilename: string;
348
370
  } | {
349
371
  country: string;
@@ -384,9 +406,12 @@ export declare function createValidationSchema(config: FieldConfig[]): z.ZodObje
384
406
  } | {
385
407
  type: string;
386
408
  option: string;
387
- filename: string;
409
+ path: string;
388
410
  originalFilename: string;
389
- }[] | [string, string] | null | undefined;
411
+ }[] | {
412
+ start: string;
413
+ end: string;
414
+ } | null | undefined;
390
415
  }>;
391
416
  /**
392
417
  * Maps complex or nested field types, such as Address fields, to their corresponding empty values.
@@ -402,11 +427,11 @@ export declare function mapFieldTypeToEmptyValue(field: FieldConfig): never[] |
402
427
  street: null;
403
428
  number: null;
404
429
  zipCode: null;
405
- filename?: undefined;
430
+ path?: undefined;
406
431
  originalFilename?: undefined;
407
432
  type?: undefined;
408
433
  } | {
409
- filename: string;
434
+ path: FullDocumentPath;
410
435
  originalFilename: string;
411
436
  type: string;
412
437
  country?: undefined;
@@ -438,8 +463,15 @@ export declare const isDateRangeFieldType: (field: {
438
463
  config: FieldConfig;
439
464
  value: FieldValue;
440
465
  }) => field is {
441
- value: string;
442
- config: DateField;
466
+ value: DateRangeFieldValue;
467
+ config: DateRangeField;
468
+ };
469
+ export declare const isSelectDateRangeFieldType: (field: {
470
+ config: FieldConfig;
471
+ value: FieldValue;
472
+ }) => field is {
473
+ value: SelectDateRangeValue;
474
+ config: SelectDateRangeField;
443
475
  };
444
476
  export declare const isPageHeaderFieldType: (field: {
445
477
  config: FieldConfig;
@@ -16,8 +16,19 @@ export declare const TextValue: z.ZodString;
16
16
  export declare const NonEmptyTextValue: z.ZodString;
17
17
  export declare const DateValue: z.ZodString;
18
18
  export declare const DatetimeValue: z.ZodString;
19
- export declare const DateRangeFieldValue: z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>]>;
19
+ export declare const SelectDateRangeValue: z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>;
20
+ export declare const DateRangeFieldValue: z.ZodUnion<[z.ZodObject<{
21
+ start: z.ZodString;
22
+ end: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ start: string;
25
+ end: string;
26
+ }, {
27
+ start: string;
28
+ end: string;
29
+ }>, z.ZodString]>;
20
30
  export type DateRangeFieldValue = z.infer<typeof DateRangeFieldValue>;
31
+ export type SelectDateRangeValue = z.infer<typeof SelectDateRangeValue>;
21
32
  export declare const EmailValue: z.ZodString;
22
33
  export declare const CheckboxFieldValue: z.ZodBoolean;
23
34
  export type CheckboxFieldValue = z.infer<typeof CheckboxFieldValue>;
@@ -27,32 +38,41 @@ export declare const DataFieldValue: z.ZodUndefined;
27
38
  export type DataFieldValue = z.infer<typeof DataFieldValue>;
28
39
  export declare const SignatureFieldValue: z.ZodString;
29
40
  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<{
31
- filename: z.ZodString;
41
+ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodObject<{
42
+ start: z.ZodString;
43
+ end: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ start: string;
46
+ end: string;
47
+ }, {
48
+ start: string;
49
+ end: string;
50
+ }>, z.ZodString]>, z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
51
+ path: z.ZodEffects<z.ZodString, string, string>;
32
52
  originalFilename: z.ZodString;
33
53
  type: z.ZodString;
34
54
  }, "strip", z.ZodTypeAny, {
35
55
  type: string;
36
- filename: string;
56
+ path: string;
37
57
  originalFilename: string;
38
58
  }, {
39
59
  type: string;
40
- filename: string;
60
+ path: string;
41
61
  originalFilename: string;
42
62
  }>, z.ZodArray<z.ZodObject<{
43
- filename: z.ZodString;
63
+ path: z.ZodEffects<z.ZodString, string, string>;
44
64
  originalFilename: z.ZodString;
45
65
  type: z.ZodString;
46
66
  option: z.ZodString;
47
67
  }, "strip", z.ZodTypeAny, {
48
68
  type: string;
49
69
  option: string;
50
- filename: string;
70
+ path: string;
51
71
  originalFilename: string;
52
72
  }, {
53
73
  type: string;
54
74
  option: string;
55
- filename: string;
75
+ path: string;
56
76
  originalFilename: string;
57
77
  }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
58
78
  country: z.ZodString;
@@ -166,32 +186,41 @@ export declare const FieldValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnio
166
186
  middlename?: string | null | undefined;
167
187
  }>, z.ZodNull]>, z.ZodUndefined]>]>;
168
188
  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<{
170
- filename: z.ZodString;
189
+ export declare const FieldUpdateValue: z.ZodUnion<[z.ZodString, z.ZodString, z.ZodUnion<[z.ZodObject<{
190
+ start: z.ZodString;
191
+ end: z.ZodString;
192
+ }, "strip", z.ZodTypeAny, {
193
+ start: string;
194
+ end: string;
195
+ }, {
196
+ start: string;
197
+ end: string;
198
+ }>, z.ZodString]>, z.ZodEnum<["last7Days", "last30Days", "last90Days", "last365Days"]>, z.ZodBoolean, z.ZodNumber, z.ZodObject<{
199
+ path: z.ZodEffects<z.ZodString, string, string>;
171
200
  originalFilename: z.ZodString;
172
201
  type: z.ZodString;
173
202
  }, "strip", z.ZodTypeAny, {
174
203
  type: string;
175
- filename: string;
204
+ path: string;
176
205
  originalFilename: string;
177
206
  }, {
178
207
  type: string;
179
- filename: string;
208
+ path: string;
180
209
  originalFilename: string;
181
210
  }>, z.ZodArray<z.ZodObject<{
182
- filename: z.ZodString;
211
+ path: z.ZodEffects<z.ZodString, string, string>;
183
212
  originalFilename: z.ZodString;
184
213
  type: z.ZodString;
185
214
  option: z.ZodString;
186
215
  }, "strip", z.ZodTypeAny, {
187
216
  type: string;
188
217
  option: string;
189
- filename: string;
218
+ path: string;
190
219
  originalFilename: string;
191
220
  }, {
192
221
  type: string;
193
222
  option: string;
194
- filename: string;
223
+ path: string;
195
224
  originalFilename: string;
196
225
  }>, "many">, z.ZodObject<z.objectUtil.extendShape<{
197
226
  country: z.ZodString;
@@ -302,5 +331,5 @@ export type FieldValueSchema = typeof FileFieldValue | typeof FileFieldWithOptio
302
331
  *
303
332
  * FieldValueInputSchema uses Input types which have set optional values as nullish
304
333
  * */
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;
334
+ export type FieldUpdateValueSchema = typeof DateRangeFieldValue | typeof SelectDateRangeValue | typeof FileFieldValue | typeof FileFieldWithOptionValue | typeof CheckboxFieldValue | typeof AddressFieldUpdateValue | typeof NumberFieldValue | typeof DataFieldValue | typeof NameFieldValue | typeof NameFieldUpdateValue | z.ZodString | z.ZodBoolean;
306
335
  //# sourceMappingURL=FieldValue.d.ts.map