@opencrvs/toolkit 1.8.0-rc.fc43738 → 1.8.0-rc.fd6feaa

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.
@@ -1,5 +1,5 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
- import { ActionFormData } from '../events/ActionDocument';
2
+ import { EventState } from '../events/ActionDocument';
3
3
  import { ITokenPayload as TokenPayload, Scope } from '../authentication';
4
4
  import { ActionType } from '../events/ActionType';
5
5
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
@@ -18,7 +18,7 @@ export type EventConditionalParameters = {
18
18
  };
19
19
  export type FormConditionalParameters = {
20
20
  $now: string;
21
- $form: ActionFormData | Record<string, any>;
21
+ $form: EventState | Record<string, any>;
22
22
  };
23
23
  export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters;
24
24
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validate-address.test.d.ts.map
@@ -1,11 +1,38 @@
1
1
  import { ConditionalParameters, JSONSchema } from './conditionals';
2
- import { ActionFormData } from '../events/ActionDocument';
2
+ import { EventState, ActionUpdate } from '../events/ActionDocument';
3
3
  import { FieldConfig } from '../events/FieldConfig';
4
- import { FieldValue } from '../events/FieldValue';
4
+ import { FieldUpdateValue } from '../events/FieldValue';
5
5
  import { TranslationConfig } from '../events/TranslationConfig';
6
6
  export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
7
- export declare function isFieldVisible(field: FieldConfig, form: ActionFormData): boolean;
8
- export declare function isFieldEnabled(field: FieldConfig, form: ActionFormData): boolean;
7
+ export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean;
8
+ export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean;
9
+ export declare const errorMessages: {
10
+ hiddenField: {
11
+ id: string;
12
+ defaultMessage: string;
13
+ description: string;
14
+ };
15
+ invalidDate: {
16
+ defaultMessage: string;
17
+ description: string;
18
+ id: string;
19
+ };
20
+ invalidEmail: {
21
+ defaultMessage: string;
22
+ description: string;
23
+ id: string;
24
+ };
25
+ requiredField: {
26
+ defaultMessage: string;
27
+ description: string;
28
+ id: string;
29
+ };
30
+ invalidInput: {
31
+ defaultMessage: string;
32
+ description: string;
33
+ id: string;
34
+ };
35
+ };
9
36
  /**
10
37
  * Custom error map for Zod to override the default error messages in intl-formik format.
11
38
  */
@@ -23,7 +50,7 @@ export type CustomZodToIntlErrorMap = {
23
50
  */
24
51
  export declare function getFieldValidationErrors({ field, values }: {
25
52
  field: FieldConfig;
26
- values: ActionFormData;
53
+ values: ActionUpdate;
27
54
  }): {
28
55
  errors: {
29
56
  message: {
@@ -40,7 +67,7 @@ export declare function getFieldValidationErrors({ field, values }: {
40
67
  */
41
68
  export declare function validateFieldInput({ field, value }: {
42
69
  field: FieldConfig;
43
- value: FieldValue;
70
+ value: FieldUpdateValue;
44
71
  }): {
45
72
  message: TranslationConfig;
46
73
  }[];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validate.test.d.ts.map
@@ -791,11 +791,8 @@ declare const RejectDeclarationConfig: z.ZodObject<z.objectUtil.extendShape<{
791
791
  }>, "many">;
792
792
  }, {
793
793
  type: z.ZodLiteral<"REJECT">;
794
- comment: z.ZodString;
795
- isDuplicate: z.ZodBoolean;
796
794
  }>, "strip", z.ZodTypeAny, {
797
795
  type: "REJECT";
798
- comment: string;
799
796
  conditionals: ({
800
797
  type: "SHOW";
801
798
  conditional: import(".").JSONSchema;
@@ -821,11 +818,9 @@ declare const RejectDeclarationConfig: z.ZodObject<z.objectUtil.extendShape<{
821
818
  fields: import("./FieldConfig").Inferred[];
822
819
  };
823
820
  }[];
824
- isDuplicate: boolean;
825
821
  draft?: boolean | undefined;
826
822
  }, {
827
823
  type: "REJECT";
828
- comment: string;
829
824
  label: {
830
825
  id: string;
831
826
  description: string;
@@ -864,7 +859,6 @@ declare const RejectDeclarationConfig: z.ZodObject<z.objectUtil.extendShape<{
864
859
  };
865
860
  active?: boolean | undefined;
866
861
  }[];
867
- isDuplicate: boolean;
868
862
  draft?: boolean | undefined;
869
863
  conditionals?: ({
870
864
  type: "SHOW";
@@ -1015,11 +1009,8 @@ declare const MarkedAsDuplicateConfig: z.ZodObject<z.objectUtil.extendShape<{
1015
1009
  }>, "many">;
1016
1010
  }, {
1017
1011
  type: z.ZodLiteral<"MARKED_AS_DUPLICATE">;
1018
- comment: z.ZodString;
1019
- duplicates: z.ZodArray<z.ZodString, "many">;
1020
1012
  }>, "strip", z.ZodTypeAny, {
1021
1013
  type: "MARKED_AS_DUPLICATE";
1022
- comment: string;
1023
1014
  conditionals: ({
1024
1015
  type: "SHOW";
1025
1016
  conditional: import(".").JSONSchema;
@@ -1045,11 +1036,9 @@ declare const MarkedAsDuplicateConfig: z.ZodObject<z.objectUtil.extendShape<{
1045
1036
  fields: import("./FieldConfig").Inferred[];
1046
1037
  };
1047
1038
  }[];
1048
- duplicates: string[];
1049
1039
  draft?: boolean | undefined;
1050
1040
  }, {
1051
1041
  type: "MARKED_AS_DUPLICATE";
1052
- comment: string;
1053
1042
  label: {
1054
1043
  id: string;
1055
1044
  description: string;
@@ -1088,7 +1077,6 @@ declare const MarkedAsDuplicateConfig: z.ZodObject<z.objectUtil.extendShape<{
1088
1077
  };
1089
1078
  active?: boolean | undefined;
1090
1079
  }[];
1091
- duplicates: string[];
1092
1080
  draft?: boolean | undefined;
1093
1081
  conditionals?: ({
1094
1082
  type: "SHOW";
@@ -1098,7 +1086,7 @@ declare const MarkedAsDuplicateConfig: z.ZodObject<z.objectUtil.extendShape<{
1098
1086
  conditional: import(".").JSONSchema;
1099
1087
  })[] | undefined;
1100
1088
  }>;
1101
- declare const ArchivedConfig: z.ZodObject<z.objectUtil.extendShape<{
1089
+ declare const ArchiveConfig: z.ZodObject<z.objectUtil.extendShape<{
1102
1090
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, "strip", z.ZodTypeAny, TranslationConfig, {
1103
1091
  id: string;
1104
1092
  description: string;
@@ -1238,12 +1226,9 @@ declare const ArchivedConfig: z.ZodObject<z.objectUtil.extendShape<{
1238
1226
  active?: boolean | undefined;
1239
1227
  }>, "many">;
1240
1228
  }, {
1241
- type: z.ZodLiteral<"ARCHIVED">;
1242
- comment: z.ZodString;
1243
- isDuplicate: z.ZodBoolean;
1229
+ type: z.ZodLiteral<"ARCHIVE">;
1244
1230
  }>, "strip", z.ZodTypeAny, {
1245
- type: "ARCHIVED";
1246
- comment: string;
1231
+ type: "ARCHIVE";
1247
1232
  conditionals: ({
1248
1233
  type: "SHOW";
1249
1234
  conditional: import(".").JSONSchema;
@@ -1269,11 +1254,9 @@ declare const ArchivedConfig: z.ZodObject<z.objectUtil.extendShape<{
1269
1254
  fields: import("./FieldConfig").Inferred[];
1270
1255
  };
1271
1256
  }[];
1272
- isDuplicate: boolean;
1273
1257
  draft?: boolean | undefined;
1274
1258
  }, {
1275
- type: "ARCHIVED";
1276
- comment: string;
1259
+ type: "ARCHIVE";
1277
1260
  label: {
1278
1261
  id: string;
1279
1262
  description: string;
@@ -1312,7 +1295,6 @@ declare const ArchivedConfig: z.ZodObject<z.objectUtil.extendShape<{
1312
1295
  };
1313
1296
  active?: boolean | undefined;
1314
1297
  }[];
1315
- isDuplicate: boolean;
1316
1298
  draft?: boolean | undefined;
1317
1299
  conditionals?: ({
1318
1300
  type: "SHOW";
@@ -2919,9 +2901,9 @@ declare const CustomConfig: z.ZodObject<z.objectUtil.extendShape<{
2919
2901
  })[] | undefined;
2920
2902
  }>;
2921
2903
  /** @knipignore */
2922
- export type AllActionConfigFields = typeof DeclareConfig | typeof ValidateConfig | typeof RejectDeclarationConfig | typeof MarkedAsDuplicateConfig | typeof ArchivedConfig | typeof RegisterConfig | typeof DeleteConfig | typeof PrintCertificateActionConfig | typeof RequestCorrectionConfig | typeof RejectCorrectionConfig | typeof ApproveCorrectionConfig | typeof CustomConfig;
2904
+ export type AllActionConfigFields = typeof DeclareConfig | typeof ValidateConfig | typeof RejectDeclarationConfig | typeof MarkedAsDuplicateConfig | typeof ArchiveConfig | typeof RegisterConfig | typeof DeleteConfig | typeof PrintCertificateActionConfig | typeof RequestCorrectionConfig | typeof RejectCorrectionConfig | typeof ApproveCorrectionConfig | typeof CustomConfig;
2923
2905
  /** @knipignore */
2924
- export type InferredActionConfig = z.infer<typeof DeclareConfig> | z.infer<typeof ValidateConfig> | z.infer<typeof RejectDeclarationConfig> | z.infer<typeof MarkedAsDuplicateConfig> | z.infer<typeof ArchivedConfig> | z.infer<typeof RegisterConfig> | z.infer<typeof DeleteConfig> | z.infer<typeof PrintCertificateActionConfig> | z.infer<typeof RequestCorrectionConfig> | z.infer<typeof RejectCorrectionConfig> | z.infer<typeof ApproveCorrectionConfig> | z.infer<typeof CustomConfig>;
2906
+ export type InferredActionConfig = z.infer<typeof DeclareConfig> | z.infer<typeof ValidateConfig> | z.infer<typeof RejectDeclarationConfig> | z.infer<typeof MarkedAsDuplicateConfig> | z.infer<typeof ArchiveConfig> | z.infer<typeof RegisterConfig> | z.infer<typeof DeleteConfig> | z.infer<typeof PrintCertificateActionConfig> | z.infer<typeof RequestCorrectionConfig> | z.infer<typeof RejectCorrectionConfig> | z.infer<typeof ApproveCorrectionConfig> | z.infer<typeof CustomConfig>;
2925
2907
  export declare const ActionConfig: z.ZodDiscriminatedUnion<"type", AllActionConfigFields[]>;
2926
2908
  export type ActionConfig = InferredActionConfig;
2927
2909
  export {};