@ecrvs/opencrvs-toolkit 1.9.0-rc.27875 → 1.9.0-rc.4dc2d92

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 (36) hide show
  1. package/dist/commons/api/router.d.ts +367 -22534
  2. package/dist/commons/conditionals/conditionals.d.ts +471 -1
  3. package/dist/commons/conditionals/validate.d.ts +9 -4
  4. package/dist/commons/events/ActionConfig.d.ts +106 -106
  5. package/dist/commons/events/ActionDocument.d.ts +444 -31155
  6. package/dist/commons/events/ActionInput.d.ts +371 -24715
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +680 -755
  8. package/dist/commons/events/CompositeFieldValue.d.ts +88 -30
  9. package/dist/commons/events/CountryConfigQueryInput.d.ts +160 -160
  10. package/dist/commons/events/DeduplicationConfig.d.ts +4 -4
  11. package/dist/commons/events/Draft.d.ts +16 -1720
  12. package/dist/commons/events/DynamicFieldValue.d.ts +139 -0
  13. package/dist/commons/events/EventConfig.d.ts +384 -62
  14. package/dist/commons/events/EventDocument.d.ts +226 -17466
  15. package/dist/commons/events/EventIndex.d.ts +74 -3052
  16. package/dist/commons/events/FieldConfig.d.ts +884 -138
  17. package/dist/commons/events/FieldType.d.ts +2 -1
  18. package/dist/commons/events/FieldTypeMapping.d.ts +617 -377
  19. package/dist/commons/events/FieldValue.d.ts +270 -479
  20. package/dist/commons/events/FormConfig.d.ts +58 -58
  21. package/dist/commons/events/PageConfig.d.ts +28 -28
  22. package/dist/commons/events/WorkqueueColumnConfig.d.ts +7 -7
  23. package/dist/commons/events/WorkqueueConfig.d.ts +352 -1847
  24. package/dist/commons/events/defineConfig.d.ts +16 -10
  25. package/dist/commons/events/event.d.ts +4 -4
  26. package/dist/commons/events/field.d.ts +562 -0
  27. package/dist/commons/events/state/index.d.ts +1 -75
  28. package/dist/commons/events/state/utils.d.ts +34 -2346
  29. package/dist/commons/events/test.utils.d.ts +16 -1002
  30. package/dist/commons/events/utils.d.ts +85 -133
  31. package/dist/conditionals/index.js +55 -18
  32. package/dist/events/index.js +2494 -2273
  33. package/dist/notification/index.js +2001 -1816
  34. package/dist/scopes/index.d.ts +3 -17
  35. package/dist/scopes/index.js +3 -42
  36. package/package.json +1 -1
@@ -23,7 +23,7 @@ export type EventConditionalParameters = CommonConditionalParameters & {
23
23
  };
24
24
  export type FormConditionalParameters = CommonConditionalParameters & {
25
25
  $form: EventState | Record<string, unknown>;
26
- $locations?: Array<{
26
+ $leafAdminStructureLocationIds?: Array<{
27
27
  id: UUID;
28
28
  }>;
29
29
  };
@@ -103,6 +103,73 @@ export declare function createFieldConditionals(fieldId: string): {
103
103
  */
104
104
  $$field: string;
105
105
  get(fieldPath: string): any;
106
+ getByPath(fieldPath: string[]): {
107
+ $$subfield: string[];
108
+ /**
109
+ * @private Internal property used for field reference tracking.
110
+ */
111
+ $$field: string;
112
+ get(fieldPath: string): any;
113
+ getByPath(fieldPath: string[]): any;
114
+ asDob(): any;
115
+ asAge(): any;
116
+ isAfter(): {
117
+ days: (days: number) => {
118
+ inPast: () => JSONSchema;
119
+ inFuture: () => JSONSchema;
120
+ };
121
+ date: (date: string | FieldReference) => JSONSchema;
122
+ now: () => JSONSchema;
123
+ };
124
+ isBefore(): {
125
+ days: (days: number) => {
126
+ inPast: () => JSONSchema;
127
+ inFuture: () => JSONSchema;
128
+ };
129
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
130
+ now: () => JSONSchema;
131
+ };
132
+ isGreaterThan(value: number | FieldReference): JSONSchema;
133
+ isLessThan(value: number | FieldReference): JSONSchema;
134
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
135
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
136
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
137
+ isAbbreviation(): JSONSchema;
138
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
139
+ /**
140
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
141
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
142
+ * @returns whether the field is falsy (undefined, false, null, empty string)
143
+ *
144
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
145
+ *
146
+ */
147
+ isFalsy(): JSONSchema;
148
+ isUndefined(): JSONSchema;
149
+ inArray(values: string[]): JSONSchema;
150
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
151
+ isValidAdministrativeLeafLevel(): JSONSchema;
152
+ /**
153
+ * Checks if the field value matches a given regular expression pattern.
154
+ * @param pattern - The regular expression pattern to match the field value against.
155
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
156
+ */
157
+ matches(pattern: string): JSONSchema;
158
+ isBetween(min: number, max: number): JSONSchema;
159
+ getId: () => {
160
+ fieldId: string;
161
+ };
162
+ /**
163
+ * @deprecated
164
+ * use field(fieldId).get(nestedProperty) instead
165
+ * with 'and' combinator e.g.
166
+ * and(
167
+ * field('child.name').get('firstname').isEqualTo('John'),
168
+ * field('child.name').get('surname').isEqualTo('Doe')
169
+ * )
170
+ */
171
+ object: (options: Record<string, any>) => JSONSchema;
172
+ };
106
173
  asDob(): any;
107
174
  asAge(): any;
108
175
  isAfter(): {
@@ -125,6 +192,272 @@ export declare function createFieldConditionals(fieldId: string): {
125
192
  isLessThan(value: number | FieldReference): JSONSchema;
126
193
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
127
194
  isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
195
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
196
+ isAbbreviation(): JSONSchema;
197
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
198
+ /**
199
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
200
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
201
+ * @returns whether the field is falsy (undefined, false, null, empty string)
202
+ *
203
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
204
+ *
205
+ */
206
+ isFalsy(): JSONSchema;
207
+ isUndefined(): JSONSchema;
208
+ inArray(values: string[]): JSONSchema;
209
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
210
+ isValidAdministrativeLeafLevel(): JSONSchema;
211
+ /**
212
+ * Checks if the field value matches a given regular expression pattern.
213
+ * @param pattern - The regular expression pattern to match the field value against.
214
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
215
+ */
216
+ matches(pattern: string): JSONSchema;
217
+ isBetween(min: number, max: number): JSONSchema;
218
+ getId: () => {
219
+ fieldId: string;
220
+ };
221
+ /**
222
+ * @deprecated
223
+ * use field(fieldId).get(nestedProperty) instead
224
+ * with 'and' combinator e.g.
225
+ * and(
226
+ * field('child.name').get('firstname').isEqualTo('John'),
227
+ * field('child.name').get('surname').isEqualTo('Doe')
228
+ * )
229
+ */
230
+ object: (options: Record<string, any>) => JSONSchema;
231
+ };
232
+ getByPath(fieldPath: string[]): {
233
+ $$subfield: string[];
234
+ /**
235
+ * @private Internal property used for field reference tracking.
236
+ */
237
+ $$field: string;
238
+ get(fieldPath: string): {
239
+ $$subfield: string[];
240
+ /**
241
+ * @private Internal property used for field reference tracking.
242
+ */
243
+ $$field: string;
244
+ get(fieldPath: string): any;
245
+ getByPath(fieldPath: string[]): any;
246
+ asDob(): any;
247
+ asAge(): any;
248
+ isAfter(): {
249
+ days: (days: number) => {
250
+ inPast: () => JSONSchema;
251
+ inFuture: () => JSONSchema;
252
+ };
253
+ date: (date: string | FieldReference) => JSONSchema;
254
+ now: () => JSONSchema;
255
+ };
256
+ isBefore(): {
257
+ days: (days: number) => {
258
+ inPast: () => JSONSchema;
259
+ inFuture: () => JSONSchema;
260
+ };
261
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
262
+ now: () => JSONSchema;
263
+ };
264
+ isGreaterThan(value: number | FieldReference): JSONSchema;
265
+ isLessThan(value: number | FieldReference): JSONSchema;
266
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
267
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
268
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
269
+ isAbbreviation(): JSONSchema;
270
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
271
+ /**
272
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
273
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
274
+ * @returns whether the field is falsy (undefined, false, null, empty string)
275
+ *
276
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
277
+ *
278
+ */
279
+ isFalsy(): JSONSchema;
280
+ isUndefined(): JSONSchema;
281
+ inArray(values: string[]): JSONSchema;
282
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
283
+ isValidAdministrativeLeafLevel(): JSONSchema;
284
+ /**
285
+ * Checks if the field value matches a given regular expression pattern.
286
+ * @param pattern - The regular expression pattern to match the field value against.
287
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
288
+ */
289
+ matches(pattern: string): JSONSchema;
290
+ isBetween(min: number, max: number): JSONSchema;
291
+ getId: () => {
292
+ fieldId: string;
293
+ };
294
+ /**
295
+ * @deprecated
296
+ * use field(fieldId).get(nestedProperty) instead
297
+ * with 'and' combinator e.g.
298
+ * and(
299
+ * field('child.name').get('firstname').isEqualTo('John'),
300
+ * field('child.name').get('surname').isEqualTo('Doe')
301
+ * )
302
+ */
303
+ object: (options: Record<string, any>) => JSONSchema;
304
+ };
305
+ getByPath(fieldPath: string[]): any;
306
+ asDob(): {
307
+ $$subfield: string[];
308
+ /**
309
+ * @private Internal property used for field reference tracking.
310
+ */
311
+ $$field: string;
312
+ get(fieldPath: string): any;
313
+ getByPath(fieldPath: string[]): any;
314
+ asDob(): any;
315
+ asAge(): any;
316
+ isAfter(): {
317
+ days: (days: number) => {
318
+ inPast: () => JSONSchema;
319
+ inFuture: () => JSONSchema;
320
+ };
321
+ date: (date: string | FieldReference) => JSONSchema;
322
+ now: () => JSONSchema;
323
+ };
324
+ isBefore(): {
325
+ days: (days: number) => {
326
+ inPast: () => JSONSchema;
327
+ inFuture: () => JSONSchema;
328
+ };
329
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
330
+ now: () => JSONSchema;
331
+ };
332
+ isGreaterThan(value: number | FieldReference): JSONSchema;
333
+ isLessThan(value: number | FieldReference): JSONSchema;
334
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
335
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
336
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
337
+ isAbbreviation(): JSONSchema;
338
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
339
+ /**
340
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
341
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
342
+ * @returns whether the field is falsy (undefined, false, null, empty string)
343
+ *
344
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
345
+ *
346
+ */
347
+ isFalsy(): JSONSchema;
348
+ isUndefined(): JSONSchema;
349
+ inArray(values: string[]): JSONSchema;
350
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
351
+ isValidAdministrativeLeafLevel(): JSONSchema;
352
+ /**
353
+ * Checks if the field value matches a given regular expression pattern.
354
+ * @param pattern - The regular expression pattern to match the field value against.
355
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
356
+ */
357
+ matches(pattern: string): JSONSchema;
358
+ isBetween(min: number, max: number): JSONSchema;
359
+ getId: () => {
360
+ fieldId: string;
361
+ };
362
+ /**
363
+ * @deprecated
364
+ * use field(fieldId).get(nestedProperty) instead
365
+ * with 'and' combinator e.g.
366
+ * and(
367
+ * field('child.name').get('firstname').isEqualTo('John'),
368
+ * field('child.name').get('surname').isEqualTo('Doe')
369
+ * )
370
+ */
371
+ object: (options: Record<string, any>) => JSONSchema;
372
+ };
373
+ asAge(): {
374
+ $$subfield: string[];
375
+ /**
376
+ * @private Internal property used for field reference tracking.
377
+ */
378
+ $$field: string;
379
+ get(fieldPath: string): any;
380
+ getByPath(fieldPath: string[]): any;
381
+ asDob(): any;
382
+ asAge(): any;
383
+ isAfter(): {
384
+ days: (days: number) => {
385
+ inPast: () => JSONSchema;
386
+ inFuture: () => JSONSchema;
387
+ };
388
+ date: (date: string | FieldReference) => JSONSchema;
389
+ now: () => JSONSchema;
390
+ };
391
+ isBefore(): {
392
+ days: (days: number) => {
393
+ inPast: () => JSONSchema;
394
+ inFuture: () => JSONSchema;
395
+ };
396
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
397
+ now: () => JSONSchema;
398
+ };
399
+ isGreaterThan(value: number | FieldReference): JSONSchema;
400
+ isLessThan(value: number | FieldReference): JSONSchema;
401
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
402
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
403
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
404
+ isAbbreviation(): JSONSchema;
405
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
406
+ /**
407
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
408
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
409
+ * @returns whether the field is falsy (undefined, false, null, empty string)
410
+ *
411
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
412
+ *
413
+ */
414
+ isFalsy(): JSONSchema;
415
+ isUndefined(): JSONSchema;
416
+ inArray(values: string[]): JSONSchema;
417
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
418
+ isValidAdministrativeLeafLevel(): JSONSchema;
419
+ /**
420
+ * Checks if the field value matches a given regular expression pattern.
421
+ * @param pattern - The regular expression pattern to match the field value against.
422
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
423
+ */
424
+ matches(pattern: string): JSONSchema;
425
+ isBetween(min: number, max: number): JSONSchema;
426
+ getId: () => {
427
+ fieldId: string;
428
+ };
429
+ /**
430
+ * @deprecated
431
+ * use field(fieldId).get(nestedProperty) instead
432
+ * with 'and' combinator e.g.
433
+ * and(
434
+ * field('child.name').get('firstname').isEqualTo('John'),
435
+ * field('child.name').get('surname').isEqualTo('Doe')
436
+ * )
437
+ */
438
+ object: (options: Record<string, any>) => JSONSchema;
439
+ };
440
+ isAfter(): {
441
+ days: (days: number) => {
442
+ inPast: () => JSONSchema;
443
+ inFuture: () => JSONSchema;
444
+ };
445
+ date: (date: string | FieldReference) => JSONSchema;
446
+ now: () => JSONSchema;
447
+ };
448
+ isBefore(): {
449
+ days: (days: number) => {
450
+ inPast: () => JSONSchema;
451
+ inFuture: () => JSONSchema;
452
+ };
453
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
454
+ now: () => JSONSchema;
455
+ };
456
+ isGreaterThan(value: number | FieldReference): JSONSchema;
457
+ isLessThan(value: number | FieldReference): JSONSchema;
458
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
459
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
460
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
128
461
  isAbbreviation(): JSONSchema;
129
462
  isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
130
463
  /**
@@ -168,6 +501,73 @@ export declare function createFieldConditionals(fieldId: string): {
168
501
  */
169
502
  $$field: string;
170
503
  get(fieldPath: string): any;
504
+ getByPath(fieldPath: string[]): {
505
+ $$subfield: string[];
506
+ /**
507
+ * @private Internal property used for field reference tracking.
508
+ */
509
+ $$field: string;
510
+ get(fieldPath: string): any;
511
+ getByPath(fieldPath: string[]): any;
512
+ asDob(): any;
513
+ asAge(): any;
514
+ isAfter(): {
515
+ days: (days: number) => {
516
+ inPast: () => JSONSchema;
517
+ inFuture: () => JSONSchema;
518
+ };
519
+ date: (date: string | FieldReference) => JSONSchema;
520
+ now: () => JSONSchema;
521
+ };
522
+ isBefore(): {
523
+ days: (days: number) => {
524
+ inPast: () => JSONSchema;
525
+ inFuture: () => JSONSchema;
526
+ };
527
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
528
+ now: () => JSONSchema;
529
+ };
530
+ isGreaterThan(value: number | FieldReference): JSONSchema;
531
+ isLessThan(value: number | FieldReference): JSONSchema;
532
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
533
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
534
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
535
+ isAbbreviation(): JSONSchema;
536
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
537
+ /**
538
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
539
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
540
+ * @returns whether the field is falsy (undefined, false, null, empty string)
541
+ *
542
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
543
+ *
544
+ */
545
+ isFalsy(): JSONSchema;
546
+ isUndefined(): JSONSchema;
547
+ inArray(values: string[]): JSONSchema;
548
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
549
+ isValidAdministrativeLeafLevel(): JSONSchema;
550
+ /**
551
+ * Checks if the field value matches a given regular expression pattern.
552
+ * @param pattern - The regular expression pattern to match the field value against.
553
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
554
+ */
555
+ matches(pattern: string): JSONSchema;
556
+ isBetween(min: number, max: number): JSONSchema;
557
+ getId: () => {
558
+ fieldId: string;
559
+ };
560
+ /**
561
+ * @deprecated
562
+ * use field(fieldId).get(nestedProperty) instead
563
+ * with 'and' combinator e.g.
564
+ * and(
565
+ * field('child.name').get('firstname').isEqualTo('John'),
566
+ * field('child.name').get('surname').isEqualTo('Doe')
567
+ * )
568
+ */
569
+ object: (options: Record<string, any>) => JSONSchema;
570
+ };
171
571
  asDob(): any;
172
572
  asAge(): any;
173
573
  isAfter(): {
@@ -190,6 +590,7 @@ export declare function createFieldConditionals(fieldId: string): {
190
590
  isLessThan(value: number | FieldReference): JSONSchema;
191
591
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
192
592
  isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
593
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
193
594
  isAbbreviation(): JSONSchema;
194
595
  isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
195
596
  /**
@@ -233,6 +634,73 @@ export declare function createFieldConditionals(fieldId: string): {
233
634
  */
234
635
  $$field: string;
235
636
  get(fieldPath: string): any;
637
+ getByPath(fieldPath: string[]): {
638
+ $$subfield: string[];
639
+ /**
640
+ * @private Internal property used for field reference tracking.
641
+ */
642
+ $$field: string;
643
+ get(fieldPath: string): any;
644
+ getByPath(fieldPath: string[]): any;
645
+ asDob(): any;
646
+ asAge(): any;
647
+ isAfter(): {
648
+ days: (days: number) => {
649
+ inPast: () => JSONSchema;
650
+ inFuture: () => JSONSchema;
651
+ };
652
+ date: (date: string | FieldReference) => JSONSchema;
653
+ now: () => JSONSchema;
654
+ };
655
+ isBefore(): {
656
+ days: (days: number) => {
657
+ inPast: () => JSONSchema;
658
+ inFuture: () => JSONSchema;
659
+ };
660
+ date: (date: `${string}-${string}-${string}` | FieldReference) => JSONSchema;
661
+ now: () => JSONSchema;
662
+ };
663
+ isGreaterThan(value: number | FieldReference): JSONSchema;
664
+ isLessThan(value: number | FieldReference): JSONSchema;
665
+ isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
666
+ isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
667
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
668
+ isAbbreviation(): JSONSchema;
669
+ isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
670
+ /**
671
+ * Use case: Some fields are rendered when selection is not made, or boolean false is explicitly selected.
672
+ * @example field('recommender.none').isFalsy() vs not(field('recommender.none').isEqualTo(true))
673
+ * @returns whether the field is falsy (undefined, false, null, empty string)
674
+ *
675
+ * NOTE: For now, this only works with string, boolean, and null types. 0 is still allowed.
676
+ *
677
+ */
678
+ isFalsy(): JSONSchema;
679
+ isUndefined(): JSONSchema;
680
+ inArray(values: string[]): JSONSchema;
681
+ isValidEnglishName(isRequiredField?: boolean): JSONSchema;
682
+ isValidAdministrativeLeafLevel(): JSONSchema;
683
+ /**
684
+ * Checks if the field value matches a given regular expression pattern.
685
+ * @param pattern - The regular expression pattern to match the field value against.
686
+ * @returns A JSONSchema conditional that validates the field value against the pattern.
687
+ */
688
+ matches(pattern: string): JSONSchema;
689
+ isBetween(min: number, max: number): JSONSchema;
690
+ getId: () => {
691
+ fieldId: string;
692
+ };
693
+ /**
694
+ * @deprecated
695
+ * use field(fieldId).get(nestedProperty) instead
696
+ * with 'and' combinator e.g.
697
+ * and(
698
+ * field('child.name').get('firstname').isEqualTo('John'),
699
+ * field('child.name').get('surname').isEqualTo('Doe')
700
+ * )
701
+ */
702
+ object: (options: Record<string, any>) => JSONSchema;
703
+ };
236
704
  asDob(): any;
237
705
  asAge(): any;
238
706
  isAfter(): {
@@ -255,6 +723,7 @@ export declare function createFieldConditionals(fieldId: string): {
255
723
  isLessThan(value: number | FieldReference): JSONSchema;
256
724
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
257
725
  isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
726
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
258
727
  isAbbreviation(): JSONSchema;
259
728
  isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
260
729
  /**
@@ -311,6 +780,7 @@ export declare function createFieldConditionals(fieldId: string): {
311
780
  isLessThan(value: number | FieldReference): JSONSchema;
312
781
  isEqualTo(value: string | boolean | number | FieldReference): JSONSchema;
313
782
  isEqualToSumOf(val1: FieldReference, val2: FieldReference): JSONSchema;
783
+ isValidDeceasedAge(dobField: FieldReference, dodField: FieldReference, todField: FieldReference, format: "years" | "months" | "days" | "hours"): JSONSchema;
314
784
  isAbbreviation(): JSONSchema;
315
785
  isIllDefined(causesOfDeathFields: FieldReference[], threshold: number): JSONSchema;
316
786
  /**
@@ -6,9 +6,12 @@ import { FieldUpdateValue, FieldValue } from '../events/FieldValue';
6
6
  import { TranslationConfig } from '../events/TranslationConfig';
7
7
  import { ITokenPayload } from '../authentication';
8
8
  import { UUID } from '../uuid';
9
+ import { ActionType } from '../client';
10
+ export declare const isValidDateFormat: (date: string) => boolean;
9
11
  export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
12
+ export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
10
13
  export declare function isOnline(): boolean;
11
- export declare function isConditionMet(conditional: JSONSchema, values: Record<string, FieldValue>, context: ValidatorContext): boolean;
14
+ export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
12
15
  export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext): boolean;
13
16
  export type ValidatorContext = {
14
17
  user?: ITokenPayload;
@@ -16,7 +19,7 @@ export type ValidatorContext = {
16
19
  id: UUID;
17
20
  }>;
18
21
  };
19
- export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
22
+ export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
20
23
  export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
21
24
  export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
22
25
  export declare const errorMessages: {
@@ -71,16 +74,18 @@ export type CustomZodToIntlErrorMap = {
71
74
  * e.g. email is proper format, date is a valid date, etc.
72
75
  * for custom validations @see runCustomFieldValidations
73
76
  */
74
- export declare function validateFieldInput({ field, value }: {
77
+ export declare function validateFieldInput({ field, value, actionType }: {
75
78
  field: FieldConfig;
76
79
  value: FieldUpdateValue;
80
+ actionType?: ActionType;
77
81
  }): {
78
82
  message: TranslationConfig;
79
83
  }[];
80
- export declare function runStructuralValidations({ field, values, context }: {
84
+ export declare function runStructuralValidations({ field, values, context, actionType }: {
81
85
  field: FieldConfig;
82
86
  values: ActionUpdate;
83
87
  context: ValidatorContext;
88
+ actionType?: ActionType;
84
89
  }): {
85
90
  message: TranslationConfig;
86
91
  }[];