@opencrvs/toolkit 1.9.13-rc.0f86459 → 1.9.13-rc.1045e45
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.
- package/dist/commons/api/router.d.ts +0 -1
- package/dist/commons/conditionals/conditionals.d.ts +2 -345
- package/dist/commons/conditionals/validate.d.ts +0 -8
- package/dist/commons/events/EventConfig.d.ts +0 -7
- package/dist/commons/events/FieldConfig.d.ts +88 -1489
- package/dist/commons/events/defineConfig.d.ts +0 -1
- package/dist/commons/events/field.d.ts +1 -47
- package/dist/commons/events/utils.d.ts +1 -2
- package/dist/conditionals/index.js +1 -48
- package/dist/events/index.js +44 -139
- package/dist/notification/index.js +35 -112
- package/package.json +1 -1
|
@@ -300,7 +300,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
300
300
|
dateOfEvent?: {
|
|
301
301
|
$$field: string;
|
|
302
302
|
$$subfield: string[];
|
|
303
|
-
$$code?: string | undefined;
|
|
304
303
|
} | {
|
|
305
304
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
306
305
|
} | undefined;
|
|
@@ -5,7 +5,7 @@ import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
|
|
|
5
5
|
import { userSerializer } from '../events/serializers/user/serializer';
|
|
6
6
|
import { UUID } from '../uuid';
|
|
7
7
|
import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
|
|
8
|
-
import {
|
|
8
|
+
import { FieldReference } from '../events/FieldConfig';
|
|
9
9
|
/** @knipignore */
|
|
10
10
|
export type JSONSchema = {
|
|
11
11
|
$id: string;
|
|
@@ -81,9 +81,7 @@ export declare const user: typeof userSerializer & {
|
|
|
81
81
|
};
|
|
82
82
|
};
|
|
83
83
|
export declare function isFieldReference(value: unknown): value is FieldReference;
|
|
84
|
-
export declare function isEventFieldReference(value: unknown): value is
|
|
85
|
-
$$event: string;
|
|
86
|
-
};
|
|
84
|
+
export declare function isEventFieldReference(value: unknown): value is FieldReference;
|
|
87
85
|
/**
|
|
88
86
|
* Generate conditional rules for a form field.
|
|
89
87
|
*
|
|
@@ -174,37 +172,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
174
172
|
* )
|
|
175
173
|
*/
|
|
176
174
|
object: (options: Record<string, any>) => JSONSchema;
|
|
177
|
-
/**
|
|
178
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
179
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
180
|
-
* available inside the function body — all logic must be self-contained.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* field('nid').customClientValidator((value) => {
|
|
184
|
-
* // LUHN check — all logic must be inline
|
|
185
|
-
* const digits = String(value).split('').map(Number)
|
|
186
|
-
* // ...
|
|
187
|
-
* return isValid
|
|
188
|
-
* })
|
|
189
|
-
*/
|
|
190
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
191
|
-
/**
|
|
192
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
193
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
194
|
-
* The function receives the referenced field's value as the first argument and
|
|
195
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
196
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
197
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
198
|
-
*
|
|
199
|
-
* For computing a default value without referencing a specific field, use
|
|
200
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
204
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
205
|
-
* )
|
|
206
|
-
*/
|
|
207
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
208
175
|
};
|
|
209
176
|
asDob(): any;
|
|
210
177
|
asAge(): any;
|
|
@@ -264,37 +231,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
264
231
|
* )
|
|
265
232
|
*/
|
|
266
233
|
object: (options: Record<string, any>) => JSONSchema;
|
|
267
|
-
/**
|
|
268
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
269
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
270
|
-
* available inside the function body — all logic must be self-contained.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* field('nid').customClientValidator((value) => {
|
|
274
|
-
* // LUHN check — all logic must be inline
|
|
275
|
-
* const digits = String(value).split('').map(Number)
|
|
276
|
-
* // ...
|
|
277
|
-
* return isValid
|
|
278
|
-
* })
|
|
279
|
-
*/
|
|
280
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
281
|
-
/**
|
|
282
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
283
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
284
|
-
* The function receives the referenced field's value as the first argument and
|
|
285
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
286
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
287
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
288
|
-
*
|
|
289
|
-
* For computing a default value without referencing a specific field, use
|
|
290
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
294
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
295
|
-
* )
|
|
296
|
-
*/
|
|
297
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
298
234
|
};
|
|
299
235
|
getByPath(fieldPath: string[]): {
|
|
300
236
|
$$subfield: string[];
|
|
@@ -368,37 +304,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
368
304
|
* )
|
|
369
305
|
*/
|
|
370
306
|
object: (options: Record<string, any>) => JSONSchema;
|
|
371
|
-
/**
|
|
372
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
373
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
374
|
-
* available inside the function body — all logic must be self-contained.
|
|
375
|
-
*
|
|
376
|
-
* @example
|
|
377
|
-
* field('nid').customClientValidator((value) => {
|
|
378
|
-
* // LUHN check — all logic must be inline
|
|
379
|
-
* const digits = String(value).split('').map(Number)
|
|
380
|
-
* // ...
|
|
381
|
-
* return isValid
|
|
382
|
-
* })
|
|
383
|
-
*/
|
|
384
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
385
|
-
/**
|
|
386
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
387
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
388
|
-
* The function receives the referenced field's value as the first argument and
|
|
389
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
390
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
391
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
392
|
-
*
|
|
393
|
-
* For computing a default value without referencing a specific field, use
|
|
394
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
395
|
-
*
|
|
396
|
-
* @example
|
|
397
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
398
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
399
|
-
* )
|
|
400
|
-
*/
|
|
401
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
402
307
|
};
|
|
403
308
|
getByPath(fieldPath: string[]): any;
|
|
404
309
|
asDob(): {
|
|
@@ -467,37 +372,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
467
372
|
* )
|
|
468
373
|
*/
|
|
469
374
|
object: (options: Record<string, any>) => JSONSchema;
|
|
470
|
-
/**
|
|
471
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
472
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
473
|
-
* available inside the function body — all logic must be self-contained.
|
|
474
|
-
*
|
|
475
|
-
* @example
|
|
476
|
-
* field('nid').customClientValidator((value) => {
|
|
477
|
-
* // LUHN check — all logic must be inline
|
|
478
|
-
* const digits = String(value).split('').map(Number)
|
|
479
|
-
* // ...
|
|
480
|
-
* return isValid
|
|
481
|
-
* })
|
|
482
|
-
*/
|
|
483
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
484
|
-
/**
|
|
485
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
486
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
487
|
-
* The function receives the referenced field's value as the first argument and
|
|
488
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
489
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
490
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
491
|
-
*
|
|
492
|
-
* For computing a default value without referencing a specific field, use
|
|
493
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
494
|
-
*
|
|
495
|
-
* @example
|
|
496
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
497
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
498
|
-
* )
|
|
499
|
-
*/
|
|
500
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
501
375
|
};
|
|
502
376
|
asAge(): {
|
|
503
377
|
$$subfield: string[];
|
|
@@ -565,37 +439,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
565
439
|
* )
|
|
566
440
|
*/
|
|
567
441
|
object: (options: Record<string, any>) => JSONSchema;
|
|
568
|
-
/**
|
|
569
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
570
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
571
|
-
* available inside the function body — all logic must be self-contained.
|
|
572
|
-
*
|
|
573
|
-
* @example
|
|
574
|
-
* field('nid').customClientValidator((value) => {
|
|
575
|
-
* // LUHN check — all logic must be inline
|
|
576
|
-
* const digits = String(value).split('').map(Number)
|
|
577
|
-
* // ...
|
|
578
|
-
* return isValid
|
|
579
|
-
* })
|
|
580
|
-
*/
|
|
581
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
582
|
-
/**
|
|
583
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
584
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
585
|
-
* The function receives the referenced field's value as the first argument and
|
|
586
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
587
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
588
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
589
|
-
*
|
|
590
|
-
* For computing a default value without referencing a specific field, use
|
|
591
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
592
|
-
*
|
|
593
|
-
* @example
|
|
594
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
595
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
596
|
-
* )
|
|
597
|
-
*/
|
|
598
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
599
442
|
};
|
|
600
443
|
isAfter(): {
|
|
601
444
|
days: (days: number) => {
|
|
@@ -653,37 +496,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
653
496
|
* )
|
|
654
497
|
*/
|
|
655
498
|
object: (options: Record<string, any>) => JSONSchema;
|
|
656
|
-
/**
|
|
657
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
658
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
659
|
-
* available inside the function body — all logic must be self-contained.
|
|
660
|
-
*
|
|
661
|
-
* @example
|
|
662
|
-
* field('nid').customClientValidator((value) => {
|
|
663
|
-
* // LUHN check — all logic must be inline
|
|
664
|
-
* const digits = String(value).split('').map(Number)
|
|
665
|
-
* // ...
|
|
666
|
-
* return isValid
|
|
667
|
-
* })
|
|
668
|
-
*/
|
|
669
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
670
|
-
/**
|
|
671
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
672
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
673
|
-
* The function receives the referenced field's value as the first argument and
|
|
674
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
675
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
676
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
677
|
-
*
|
|
678
|
-
* For computing a default value without referencing a specific field, use
|
|
679
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
680
|
-
*
|
|
681
|
-
* @example
|
|
682
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
683
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
684
|
-
* )
|
|
685
|
-
*/
|
|
686
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
687
499
|
};
|
|
688
500
|
asDob(): {
|
|
689
501
|
$$subfield: string[];
|
|
@@ -758,37 +570,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
758
570
|
* )
|
|
759
571
|
*/
|
|
760
572
|
object: (options: Record<string, any>) => JSONSchema;
|
|
761
|
-
/**
|
|
762
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
763
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
764
|
-
* available inside the function body — all logic must be self-contained.
|
|
765
|
-
*
|
|
766
|
-
* @example
|
|
767
|
-
* field('nid').customClientValidator((value) => {
|
|
768
|
-
* // LUHN check — all logic must be inline
|
|
769
|
-
* const digits = String(value).split('').map(Number)
|
|
770
|
-
* // ...
|
|
771
|
-
* return isValid
|
|
772
|
-
* })
|
|
773
|
-
*/
|
|
774
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
775
|
-
/**
|
|
776
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
777
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
778
|
-
* The function receives the referenced field's value as the first argument and
|
|
779
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
780
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
781
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
782
|
-
*
|
|
783
|
-
* For computing a default value without referencing a specific field, use
|
|
784
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
785
|
-
*
|
|
786
|
-
* @example
|
|
787
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
788
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
789
|
-
* )
|
|
790
|
-
*/
|
|
791
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
792
573
|
};
|
|
793
574
|
asDob(): any;
|
|
794
575
|
asAge(): any;
|
|
@@ -848,37 +629,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
848
629
|
* )
|
|
849
630
|
*/
|
|
850
631
|
object: (options: Record<string, any>) => JSONSchema;
|
|
851
|
-
/**
|
|
852
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
853
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
854
|
-
* available inside the function body — all logic must be self-contained.
|
|
855
|
-
*
|
|
856
|
-
* @example
|
|
857
|
-
* field('nid').customClientValidator((value) => {
|
|
858
|
-
* // LUHN check — all logic must be inline
|
|
859
|
-
* const digits = String(value).split('').map(Number)
|
|
860
|
-
* // ...
|
|
861
|
-
* return isValid
|
|
862
|
-
* })
|
|
863
|
-
*/
|
|
864
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
865
|
-
/**
|
|
866
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
867
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
868
|
-
* The function receives the referenced field's value as the first argument and
|
|
869
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
870
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
871
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
872
|
-
*
|
|
873
|
-
* For computing a default value without referencing a specific field, use
|
|
874
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
875
|
-
*
|
|
876
|
-
* @example
|
|
877
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
878
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
879
|
-
* )
|
|
880
|
-
*/
|
|
881
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
882
632
|
};
|
|
883
633
|
asAge(): {
|
|
884
634
|
$$subfield: string[];
|
|
@@ -953,37 +703,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
953
703
|
* )
|
|
954
704
|
*/
|
|
955
705
|
object: (options: Record<string, any>) => JSONSchema;
|
|
956
|
-
/**
|
|
957
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
958
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
959
|
-
* available inside the function body — all logic must be self-contained.
|
|
960
|
-
*
|
|
961
|
-
* @example
|
|
962
|
-
* field('nid').customClientValidator((value) => {
|
|
963
|
-
* // LUHN check — all logic must be inline
|
|
964
|
-
* const digits = String(value).split('').map(Number)
|
|
965
|
-
* // ...
|
|
966
|
-
* return isValid
|
|
967
|
-
* })
|
|
968
|
-
*/
|
|
969
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
970
|
-
/**
|
|
971
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
972
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
973
|
-
* The function receives the referenced field's value as the first argument and
|
|
974
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
975
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
976
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
977
|
-
*
|
|
978
|
-
* For computing a default value without referencing a specific field, use
|
|
979
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
980
|
-
*
|
|
981
|
-
* @example
|
|
982
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
983
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
984
|
-
* )
|
|
985
|
-
*/
|
|
986
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
987
706
|
};
|
|
988
707
|
asDob(): any;
|
|
989
708
|
asAge(): any;
|
|
@@ -1043,37 +762,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
1043
762
|
* )
|
|
1044
763
|
*/
|
|
1045
764
|
object: (options: Record<string, any>) => JSONSchema;
|
|
1046
|
-
/**
|
|
1047
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
1048
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
1049
|
-
* available inside the function body — all logic must be self-contained.
|
|
1050
|
-
*
|
|
1051
|
-
* @example
|
|
1052
|
-
* field('nid').customClientValidator((value) => {
|
|
1053
|
-
* // LUHN check — all logic must be inline
|
|
1054
|
-
* const digits = String(value).split('').map(Number)
|
|
1055
|
-
* // ...
|
|
1056
|
-
* return isValid
|
|
1057
|
-
* })
|
|
1058
|
-
*/
|
|
1059
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
1060
|
-
/**
|
|
1061
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
1062
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
1063
|
-
* The function receives the referenced field's value as the first argument and
|
|
1064
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
1065
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
1066
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
1067
|
-
*
|
|
1068
|
-
* For computing a default value without referencing a specific field, use
|
|
1069
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
1070
|
-
*
|
|
1071
|
-
* @example
|
|
1072
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
1073
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
1074
|
-
* )
|
|
1075
|
-
*/
|
|
1076
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
1077
765
|
};
|
|
1078
766
|
isAfter(): {
|
|
1079
767
|
days: (days: number) => {
|
|
@@ -1131,37 +819,6 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
1131
819
|
* )
|
|
1132
820
|
*/
|
|
1133
821
|
object: (options: Record<string, any>) => JSONSchema;
|
|
1134
|
-
/**
|
|
1135
|
-
* Custom client-side validator. The provided function is serialised and executed
|
|
1136
|
-
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
1137
|
-
* available inside the function body — all logic must be self-contained.
|
|
1138
|
-
*
|
|
1139
|
-
* @example
|
|
1140
|
-
* field('nid').customClientValidator((value) => {
|
|
1141
|
-
* // LUHN check — all logic must be inline
|
|
1142
|
-
* const digits = String(value).split('').map(Number)
|
|
1143
|
-
* // ...
|
|
1144
|
-
* return isValid
|
|
1145
|
-
* })
|
|
1146
|
-
*/
|
|
1147
|
-
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
1148
|
-
/**
|
|
1149
|
-
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
1150
|
-
* that can be used as the `value` property or a DATA component entry.
|
|
1151
|
-
* The function receives the referenced field's value as the first argument and
|
|
1152
|
-
* the full form context as the second; its return value replaces the field reference.
|
|
1153
|
-
* The function is serialised and executed just-in-time on the client only.
|
|
1154
|
-
* External references (e.g. lodash) are not available inside the function body.
|
|
1155
|
-
*
|
|
1156
|
-
* For computing a default value without referencing a specific field, use
|
|
1157
|
-
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
1158
|
-
*
|
|
1159
|
-
* @example
|
|
1160
|
-
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
1161
|
-
* Number(aValue) + Number(ctx.$form.b)
|
|
1162
|
-
* )
|
|
1163
|
-
*/
|
|
1164
|
-
customClientEvaluation(computationFn: (fieldValue: unknown, context: FormConditionalParameters) => unknown): CodeToEvaluate;
|
|
1165
822
|
};
|
|
1166
823
|
export {};
|
|
1167
824
|
//# sourceMappingURL=conditionals.d.ts.map
|
|
@@ -9,14 +9,6 @@ import { UUID } from '../uuid';
|
|
|
9
9
|
import { FormState } from '../events/utils';
|
|
10
10
|
import { ActionType } from '../events/ActionType';
|
|
11
11
|
import { EventDocument } from '../events/EventDocument';
|
|
12
|
-
/** Returns today's date as an ISO date string (YYYY-MM-DD). */
|
|
13
|
-
export declare function todayISO(): string;
|
|
14
|
-
/**
|
|
15
|
-
* Deserialises a serialised function string (produced by `.toString()`) into a callable.
|
|
16
|
-
* Results are cached by code string so each unique function body is compiled at most once.
|
|
17
|
-
* Runs in a clean scope — no access to outer closures or external imports.
|
|
18
|
-
*/
|
|
19
|
-
export declare function compileClientFunction(code: string): (...args: unknown[]) => unknown;
|
|
20
12
|
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
|
|
21
13
|
export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
|
|
22
14
|
export declare function isOnline(): boolean;
|
|
@@ -17,15 +17,12 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
17
17
|
dateOfEvent: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
18
18
|
$$field: z.ZodEffects<z.ZodString, string, string>;
|
|
19
19
|
$$subfield: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
20
|
-
$$code: z.ZodOptional<z.ZodString>;
|
|
21
20
|
}, "strip", z.ZodTypeAny, {
|
|
22
21
|
$$field: string;
|
|
23
22
|
$$subfield: string[];
|
|
24
|
-
$$code?: string | undefined;
|
|
25
23
|
}, {
|
|
26
24
|
$$field: string;
|
|
27
25
|
$$subfield?: string[] | undefined;
|
|
28
|
-
$$code?: string | undefined;
|
|
29
26
|
}>, z.ZodObject<{
|
|
30
27
|
$$event: z.ZodEnum<["createdAt", "updatedAt", "legalStatuses.DECLARED.createdAt", "legalStatuses.DECLARED.acceptedAt", "legalStatuses.REGISTERED.createdAt", "legalStatuses.REGISTERED.acceptedAt"]>;
|
|
31
28
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1290,7 +1287,6 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1290
1287
|
dateOfEvent?: {
|
|
1291
1288
|
$$field: string;
|
|
1292
1289
|
$$subfield: string[];
|
|
1293
|
-
$$code?: string | undefined;
|
|
1294
1290
|
} | {
|
|
1295
1291
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1296
1292
|
} | undefined;
|
|
@@ -1622,7 +1618,6 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1622
1618
|
dateOfEvent?: {
|
|
1623
1619
|
$$field: string;
|
|
1624
1620
|
$$subfield?: string[] | undefined;
|
|
1625
|
-
$$code?: string | undefined;
|
|
1626
1621
|
} | {
|
|
1627
1622
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1628
1623
|
} | undefined;
|
|
@@ -1978,7 +1973,6 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1978
1973
|
dateOfEvent?: {
|
|
1979
1974
|
$$field: string;
|
|
1980
1975
|
$$subfield: string[];
|
|
1981
|
-
$$code?: string | undefined;
|
|
1982
1976
|
} | {
|
|
1983
1977
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1984
1978
|
} | undefined;
|
|
@@ -2310,7 +2304,6 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
2310
2304
|
dateOfEvent?: {
|
|
2311
2305
|
$$field: string;
|
|
2312
2306
|
$$subfield?: string[] | undefined;
|
|
2313
|
-
$$code?: string | undefined;
|
|
2314
2307
|
} | {
|
|
2315
2308
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
2316
2309
|
} | undefined;
|