@nira-opencrvs/toolkit 1.9.11-rc.1f36427
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/README.md +70 -0
- package/build.sh +56 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +52 -0
- package/dist/commons/api/router.d.ts +4125 -0
- package/dist/commons/conditionals/conditionals.d.ts +824 -0
- package/dist/commons/conditionals/index.d.ts +2 -0
- package/dist/commons/conditionals/validate.d.ts +101 -0
- package/dist/commons/events/ActionConfig.d.ts +1609 -0
- package/dist/commons/events/ActionDocument.d.ts +2180 -0
- package/dist/commons/events/ActionInput.d.ts +1229 -0
- package/dist/commons/events/ActionType.d.ts +52 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +1538 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +280 -0
- package/dist/commons/events/Conditional.d.ts +55 -0
- package/dist/commons/events/Constants.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +4784 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/DeduplicationConfig.d.ts +233 -0
- package/dist/commons/events/Draft.d.ts +118 -0
- package/dist/commons/events/DynamicFieldValue.d.ts +139 -0
- package/dist/commons/events/EventConfig.d.ts +2255 -0
- package/dist/commons/events/EventConfigInput.d.ts +10 -0
- package/dist/commons/events/EventDocument.d.ts +1457 -0
- package/dist/commons/events/EventIndex.d.ts +1134 -0
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +413 -0
- package/dist/commons/events/FieldConfig.d.ts +12935 -0
- package/dist/commons/events/FieldType.d.ts +55 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1289 -0
- package/dist/commons/events/FieldValue.d.ts +512 -0
- package/dist/commons/events/FileUtils.d.ts +4 -0
- package/dist/commons/events/FormConfig.d.ts +755 -0
- package/dist/commons/events/PageConfig.d.ts +342 -0
- package/dist/commons/events/PlainDate.d.ts +19 -0
- package/dist/commons/events/SummaryConfig.d.ts +170 -0
- package/dist/commons/events/TemplateConfig.d.ts +66 -0
- package/dist/commons/events/TranslationConfig.d.ts +15 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +7957 -0
- package/dist/commons/events/deduplication.d.ts +69 -0
- package/dist/commons/events/defineConfig.d.ts +234 -0
- package/dist/commons/events/event.d.ts +80 -0
- package/dist/commons/events/field.d.ts +514 -0
- package/dist/commons/events/index.d.ts +45 -0
- package/dist/commons/events/locations.d.ts +24 -0
- package/dist/commons/events/scopes.d.ts +55 -0
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/state/availableActions.d.ts +6 -0
- package/dist/commons/events/state/flags.d.ts +4 -0
- package/dist/commons/events/state/index.d.ts +119 -0
- package/dist/commons/events/state/utils.d.ts +311 -0
- package/dist/commons/events/test.utils.d.ts +248 -0
- package/dist/commons/events/transactions.d.ts +2 -0
- package/dist/commons/events/utils.d.ts +486 -0
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/commons/notification/UserNotifications.d.ts +762 -0
- package/dist/commons/notification/index.d.ts +2 -0
- package/dist/conditionals/index.d.ts +2 -0
- package/dist/conditionals/index.d.ts.map +1 -0
- package/dist/conditionals/index.js +689 -0
- package/dist/events/deduplication.d.ts +69 -0
- package/dist/events/deduplication.d.ts.map +1 -0
- package/dist/events/deduplication.js +101 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +9327 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/index.js +6674 -0
- package/dist/scopes/index.d.ts +385 -0
- package/dist/scopes/index.d.ts.map +1 -0
- package/dist/scopes/index.js +349 -0
- package/package.json +40 -0
- package/tsconfig.json +27 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ConditionalParameters, JSONSchema } from './conditionals';
|
|
2
|
+
import { ActionUpdate, EventState } from '../events/ActionDocument';
|
|
3
|
+
import { FieldConditional } from '../events/Conditional';
|
|
4
|
+
import { FieldConfig } from '../events/FieldConfig';
|
|
5
|
+
import { FieldUpdateValue, FieldValue } from '../events/FieldValue';
|
|
6
|
+
import { TranslationConfig } from '../events/TranslationConfig';
|
|
7
|
+
import { ITokenPayload } from '../authentication';
|
|
8
|
+
import { UUID } from '../uuid';
|
|
9
|
+
import { ActionType, EventDocument } from '../client';
|
|
10
|
+
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
|
|
11
|
+
export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
|
|
12
|
+
export declare function isOnline(): boolean;
|
|
13
|
+
export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
|
|
14
|
+
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext): boolean;
|
|
15
|
+
export type ValidatorContext = {
|
|
16
|
+
user?: ITokenPayload;
|
|
17
|
+
leafAdminStructureLocationIds?: Array<{
|
|
18
|
+
id: UUID;
|
|
19
|
+
}>;
|
|
20
|
+
event?: EventDocument;
|
|
21
|
+
};
|
|
22
|
+
export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
|
|
23
|
+
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
24
|
+
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
25
|
+
export declare const errorMessages: {
|
|
26
|
+
hiddenField: {
|
|
27
|
+
id: string;
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
invalidDate: {
|
|
32
|
+
defaultMessage: string;
|
|
33
|
+
description: string;
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
invalidEmail: {
|
|
37
|
+
defaultMessage: string;
|
|
38
|
+
description: string;
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
requiredField: {
|
|
42
|
+
defaultMessage: string;
|
|
43
|
+
description: string;
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
46
|
+
invalidInput: {
|
|
47
|
+
defaultMessage: string;
|
|
48
|
+
description: string;
|
|
49
|
+
id: string;
|
|
50
|
+
};
|
|
51
|
+
unexpectedField: {
|
|
52
|
+
defaultMessage: string;
|
|
53
|
+
description: string;
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
correctionNotAllowed: {
|
|
57
|
+
defaultMessage: string;
|
|
58
|
+
description: string;
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Custom error map for Zod to override the default error messages in intl-formik format.
|
|
64
|
+
*/
|
|
65
|
+
export type CustomZodToIntlErrorMap = {
|
|
66
|
+
/** Zod by default expects { message: string } */
|
|
67
|
+
message: {
|
|
68
|
+
/** Override it to match current intl-formik model */
|
|
69
|
+
message: TranslationConfig;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Validates primitive fields defined by the FieldConfig type.
|
|
74
|
+
* e.g. email is proper format, date is a valid date, etc.
|
|
75
|
+
* for custom validations @see runCustomFieldValidations
|
|
76
|
+
*/
|
|
77
|
+
export declare function validateFieldInput({ field, value, actionType }: {
|
|
78
|
+
field: FieldConfig;
|
|
79
|
+
value: FieldUpdateValue;
|
|
80
|
+
actionType?: ActionType;
|
|
81
|
+
}): {
|
|
82
|
+
message: TranslationConfig;
|
|
83
|
+
}[];
|
|
84
|
+
export declare function runStructuralValidations({ field, values, context, actionType }: {
|
|
85
|
+
field: FieldConfig;
|
|
86
|
+
values: ActionUpdate;
|
|
87
|
+
context: ValidatorContext;
|
|
88
|
+
actionType?: ActionType;
|
|
89
|
+
}): {
|
|
90
|
+
message: TranslationConfig;
|
|
91
|
+
}[];
|
|
92
|
+
export declare function runFieldValidations({ field, values, context }: {
|
|
93
|
+
field: FieldConfig;
|
|
94
|
+
values: ActionUpdate;
|
|
95
|
+
context: ValidatorContext;
|
|
96
|
+
}): {
|
|
97
|
+
message: TranslationConfig;
|
|
98
|
+
}[];
|
|
99
|
+
export declare function getValidatorsForField(fieldId: FieldConfig['id'], validations: NonNullable<FieldConfig['validation']>): NonNullable<FieldConfig['validation']>;
|
|
100
|
+
export declare function areCertificateConditionsMet(conditions: FieldConditional[], values: ConditionalParameters): boolean;
|
|
101
|
+
//# sourceMappingURL=validate.d.ts.map
|