@opencrvs/toolkit 1.9.13-rc.1d7f578 → 1.9.13-rc.2299d16
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 +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +80 -28
- package/dist/commons/events/EventConfig.d.ts +7 -0
- package/dist/commons/events/FieldConfig.d.ts +1676 -3364
- package/dist/commons/events/defineConfig.d.ts +1 -0
- package/dist/commons/events/field.d.ts +47 -23
- package/dist/commons/events/utils.d.ts +2 -1
- package/dist/conditionals/index.js +7 -1984
- package/dist/events/index.js +67 -66
- package/dist/notification/index.js +53 -48
- package/package.json +1 -1
|
@@ -300,6 +300,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
300
300
|
dateOfEvent?: {
|
|
301
301
|
$$field: string;
|
|
302
302
|
$$subfield: string[];
|
|
303
|
+
$$code?: string | undefined;
|
|
303
304
|
} | {
|
|
304
305
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
305
306
|
} | undefined;
|
|
@@ -81,12 +81,9 @@ 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
|
-
|
|
86
|
-
|
|
87
|
-
* and in {@link parseFieldReferenceToValue}, not at every call site.
|
|
88
|
-
*/
|
|
89
|
-
export declare function isResolvableValueReference(value: unknown): value is FieldReference | CodeToEvaluate;
|
|
84
|
+
export declare function isEventFieldReference(value: unknown): value is {
|
|
85
|
+
$$event: string;
|
|
86
|
+
};
|
|
90
87
|
/**
|
|
91
88
|
* Generate conditional rules for a form field.
|
|
92
89
|
*
|
|
@@ -192,11 +189,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
192
189
|
*/
|
|
193
190
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
194
191
|
/**
|
|
195
|
-
* Custom client-side evaluation. Returns a {@link
|
|
196
|
-
* that can be used as `value
|
|
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.
|
|
197
196
|
* The function is serialised and executed just-in-time on the client only.
|
|
198
197
|
* External references (e.g. lodash) are not available inside the function body.
|
|
199
198
|
*
|
|
199
|
+
* For computing a default value without referencing a specific field, use
|
|
200
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
201
|
+
*
|
|
200
202
|
* @example
|
|
201
203
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
202
204
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -277,11 +279,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
277
279
|
*/
|
|
278
280
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
279
281
|
/**
|
|
280
|
-
* Custom client-side evaluation. Returns a {@link
|
|
281
|
-
* that can be used as `value
|
|
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.
|
|
282
286
|
* The function is serialised and executed just-in-time on the client only.
|
|
283
287
|
* External references (e.g. lodash) are not available inside the function body.
|
|
284
288
|
*
|
|
289
|
+
* For computing a default value without referencing a specific field, use
|
|
290
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
291
|
+
*
|
|
285
292
|
* @example
|
|
286
293
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
287
294
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -376,11 +383,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
376
383
|
*/
|
|
377
384
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
378
385
|
/**
|
|
379
|
-
* Custom client-side evaluation. Returns a {@link
|
|
380
|
-
* that can be used as `value
|
|
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.
|
|
381
390
|
* The function is serialised and executed just-in-time on the client only.
|
|
382
391
|
* External references (e.g. lodash) are not available inside the function body.
|
|
383
392
|
*
|
|
393
|
+
* For computing a default value without referencing a specific field, use
|
|
394
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
395
|
+
*
|
|
384
396
|
* @example
|
|
385
397
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
386
398
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -470,11 +482,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
470
482
|
*/
|
|
471
483
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
472
484
|
/**
|
|
473
|
-
* Custom client-side evaluation. Returns a {@link
|
|
474
|
-
* that can be used as `value
|
|
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.
|
|
475
489
|
* The function is serialised and executed just-in-time on the client only.
|
|
476
490
|
* External references (e.g. lodash) are not available inside the function body.
|
|
477
491
|
*
|
|
492
|
+
* For computing a default value without referencing a specific field, use
|
|
493
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
494
|
+
*
|
|
478
495
|
* @example
|
|
479
496
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
480
497
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -563,11 +580,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
563
580
|
*/
|
|
564
581
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
565
582
|
/**
|
|
566
|
-
* Custom client-side evaluation. Returns a {@link
|
|
567
|
-
* that can be used as `value
|
|
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.
|
|
568
587
|
* The function is serialised and executed just-in-time on the client only.
|
|
569
588
|
* External references (e.g. lodash) are not available inside the function body.
|
|
570
589
|
*
|
|
590
|
+
* For computing a default value without referencing a specific field, use
|
|
591
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
592
|
+
*
|
|
571
593
|
* @example
|
|
572
594
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
573
595
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -646,11 +668,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
646
668
|
*/
|
|
647
669
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
648
670
|
/**
|
|
649
|
-
* Custom client-side evaluation. Returns a {@link
|
|
650
|
-
* that can be used as `value
|
|
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.
|
|
651
675
|
* The function is serialised and executed just-in-time on the client only.
|
|
652
676
|
* External references (e.g. lodash) are not available inside the function body.
|
|
653
677
|
*
|
|
678
|
+
* For computing a default value without referencing a specific field, use
|
|
679
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
680
|
+
*
|
|
654
681
|
* @example
|
|
655
682
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
656
683
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -746,11 +773,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
746
773
|
*/
|
|
747
774
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
748
775
|
/**
|
|
749
|
-
* Custom client-side evaluation. Returns a {@link
|
|
750
|
-
* that can be used as `value
|
|
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.
|
|
751
780
|
* The function is serialised and executed just-in-time on the client only.
|
|
752
781
|
* External references (e.g. lodash) are not available inside the function body.
|
|
753
782
|
*
|
|
783
|
+
* For computing a default value without referencing a specific field, use
|
|
784
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
785
|
+
*
|
|
754
786
|
* @example
|
|
755
787
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
756
788
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -831,11 +863,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
831
863
|
*/
|
|
832
864
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
833
865
|
/**
|
|
834
|
-
* Custom client-side evaluation. Returns a {@link
|
|
835
|
-
* that can be used as `value
|
|
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.
|
|
836
870
|
* The function is serialised and executed just-in-time on the client only.
|
|
837
871
|
* External references (e.g. lodash) are not available inside the function body.
|
|
838
872
|
*
|
|
873
|
+
* For computing a default value without referencing a specific field, use
|
|
874
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
875
|
+
*
|
|
839
876
|
* @example
|
|
840
877
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
841
878
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -931,11 +968,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
931
968
|
*/
|
|
932
969
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
933
970
|
/**
|
|
934
|
-
* Custom client-side evaluation. Returns a {@link
|
|
935
|
-
* that can be used as `value
|
|
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.
|
|
936
975
|
* The function is serialised and executed just-in-time on the client only.
|
|
937
976
|
* External references (e.g. lodash) are not available inside the function body.
|
|
938
977
|
*
|
|
978
|
+
* For computing a default value without referencing a specific field, use
|
|
979
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
980
|
+
*
|
|
939
981
|
* @example
|
|
940
982
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
941
983
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -1016,11 +1058,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
1016
1058
|
*/
|
|
1017
1059
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
1018
1060
|
/**
|
|
1019
|
-
* Custom client-side evaluation. Returns a {@link
|
|
1020
|
-
* that can be used as `value
|
|
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.
|
|
1021
1065
|
* The function is serialised and executed just-in-time on the client only.
|
|
1022
1066
|
* External references (e.g. lodash) are not available inside the function body.
|
|
1023
1067
|
*
|
|
1068
|
+
* For computing a default value without referencing a specific field, use
|
|
1069
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
1070
|
+
*
|
|
1024
1071
|
* @example
|
|
1025
1072
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
1026
1073
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -1099,11 +1146,16 @@ export declare function createFieldConditionals(fieldId: string): {
|
|
|
1099
1146
|
*/
|
|
1100
1147
|
customClientValidator(validationFn: (fieldValue: unknown, context: FormConditionalParameters) => boolean): JSONSchema;
|
|
1101
1148
|
/**
|
|
1102
|
-
* Custom client-side evaluation. Returns a {@link
|
|
1103
|
-
* that can be used as `value
|
|
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.
|
|
1104
1153
|
* The function is serialised and executed just-in-time on the client only.
|
|
1105
1154
|
* External references (e.g. lodash) are not available inside the function body.
|
|
1106
1155
|
*
|
|
1156
|
+
* For computing a default value without referencing a specific field, use
|
|
1157
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
1158
|
+
*
|
|
1107
1159
|
* @example
|
|
1108
1160
|
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
1109
1161
|
* Number(aValue) + Number(ctx.$form.b)
|
|
@@ -17,12 +17,15 @@ 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>;
|
|
20
21
|
}, "strip", z.ZodTypeAny, {
|
|
21
22
|
$$field: string;
|
|
22
23
|
$$subfield: string[];
|
|
24
|
+
$$code?: string | undefined;
|
|
23
25
|
}, {
|
|
24
26
|
$$field: string;
|
|
25
27
|
$$subfield?: string[] | undefined;
|
|
28
|
+
$$code?: string | undefined;
|
|
26
29
|
}>, z.ZodObject<{
|
|
27
30
|
$$event: z.ZodEnum<["createdAt", "updatedAt", "legalStatuses.DECLARED.createdAt", "legalStatuses.DECLARED.acceptedAt", "legalStatuses.REGISTERED.createdAt", "legalStatuses.REGISTERED.acceptedAt"]>;
|
|
28
31
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1287,6 +1290,7 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1287
1290
|
dateOfEvent?: {
|
|
1288
1291
|
$$field: string;
|
|
1289
1292
|
$$subfield: string[];
|
|
1293
|
+
$$code?: string | undefined;
|
|
1290
1294
|
} | {
|
|
1291
1295
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1292
1296
|
} | undefined;
|
|
@@ -1618,6 +1622,7 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1618
1622
|
dateOfEvent?: {
|
|
1619
1623
|
$$field: string;
|
|
1620
1624
|
$$subfield?: string[] | undefined;
|
|
1625
|
+
$$code?: string | undefined;
|
|
1621
1626
|
} | {
|
|
1622
1627
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1623
1628
|
} | undefined;
|
|
@@ -1973,6 +1978,7 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
1973
1978
|
dateOfEvent?: {
|
|
1974
1979
|
$$field: string;
|
|
1975
1980
|
$$subfield: string[];
|
|
1981
|
+
$$code?: string | undefined;
|
|
1976
1982
|
} | {
|
|
1977
1983
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
1978
1984
|
} | undefined;
|
|
@@ -2304,6 +2310,7 @@ export declare const EventConfig: z.ZodEffects<z.ZodObject<{
|
|
|
2304
2310
|
dateOfEvent?: {
|
|
2305
2311
|
$$field: string;
|
|
2306
2312
|
$$subfield?: string[] | undefined;
|
|
2313
|
+
$$code?: string | undefined;
|
|
2307
2314
|
} | {
|
|
2308
2315
|
$$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
|
|
2309
2316
|
} | undefined;
|