@opencrvs/toolkit 1.9.7-rc.7a61745 → 1.9.7-rc.80d99a5
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 +29385 -2317
- package/dist/commons/conditionals/conditionals.d.ts +10 -1
- package/dist/commons/conditionals/validate.d.ts +15 -18
- package/dist/commons/events/ActionConfig.d.ts +24973 -1552
- package/dist/commons/events/ActionDocument.d.ts +803 -1856
- package/dist/commons/events/ActionInput.d.ts +277 -1073
- package/dist/commons/events/ActionType.d.ts +86 -9
- package/dist/commons/events/AdvancedSearchConfig.d.ts +228 -1238
- package/dist/commons/events/CompositeFieldValue.d.ts +29 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1195 -4223
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +70 -105
- package/dist/commons/events/DynamicFieldValue.d.ts +7 -91
- package/dist/commons/events/EventConfig.d.ts +19932 -2120
- package/dist/commons/events/EventConfigInput.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +320 -1332
- package/dist/commons/events/EventIndex.d.ts +193 -980
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +106 -347
- package/dist/commons/events/FieldConfig.d.ts +4518 -12590
- package/dist/commons/events/FieldType.d.ts +20 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +192 -896
- package/dist/commons/events/FieldValue.d.ts +87 -396
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +13980 -721
- package/dist/commons/events/PageConfig.d.ts +9340 -319
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +1865 -7177
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +26563 -147
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locations.d.ts +26 -19
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/availableActions.d.ts +0 -2
- package/dist/commons/events/state/flags.d.ts +21 -3
- package/dist/commons/events/state/index.d.ts +22 -19
- package/dist/commons/events/state/utils.d.ts +130 -112
- package/dist/commons/events/test.utils.d.ts +17 -8
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +53164 -367
- package/dist/commons/notification/UserNotifications.d.ts +55 -636
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +45 -11
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2005 -1801
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1659 -1590
- package/dist/scopes/index.d.ts +167 -132
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +133 -94
- package/package.json +5 -5
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -5,6 +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 { EventStatus } from '../events/EventMetadata';
|
|
8
9
|
/** @knipignore */
|
|
9
10
|
export type JSONSchema = {
|
|
10
11
|
$id: string;
|
|
@@ -28,7 +29,11 @@ export type FormConditionalParameters = CommonConditionalParameters & {
|
|
|
28
29
|
id: UUID;
|
|
29
30
|
}>;
|
|
30
31
|
};
|
|
31
|
-
export type
|
|
32
|
+
export type EventStateConditionalParameters = CommonConditionalParameters & {
|
|
33
|
+
$flags: string[];
|
|
34
|
+
$status: EventStatus;
|
|
35
|
+
};
|
|
36
|
+
export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters | EventStateConditionalParameters;
|
|
32
37
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
33
38
|
type AjvJSONSchema = AjvJSONSchemaType<UnionToIntersection<ConditionalParameters>>;
|
|
34
39
|
/**
|
|
@@ -84,6 +89,10 @@ export declare const user: typeof userSerializer & {
|
|
|
84
89
|
};
|
|
85
90
|
};
|
|
86
91
|
export declare function isFieldReference(value: unknown): value is FieldReference;
|
|
92
|
+
/** Check if an event flag is present */
|
|
93
|
+
export declare function flag(flagvalue: string): JSONSchema;
|
|
94
|
+
/** Check if an event flag is present */
|
|
95
|
+
export declare function status(statusValue: EventStatus): JSONSchema;
|
|
87
96
|
/**
|
|
88
97
|
* Generate conditional rules for a form field.
|
|
89
98
|
*
|
|
@@ -6,14 +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 {
|
|
10
|
-
import { ActionType } from '../events/ActionType';
|
|
11
|
-
import { EventDocument } from '../events/EventDocument';
|
|
9
|
+
import { ActionConfig, ActionType, EventIndex, EventDocument } from '../client';
|
|
12
10
|
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
|
|
13
11
|
export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
|
|
14
12
|
export declare function isOnline(): boolean;
|
|
15
|
-
export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
|
|
16
|
-
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext): boolean;
|
|
13
|
+
export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext, eventIndex?: EventIndex): boolean;
|
|
14
|
+
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, event: EventIndex): boolean;
|
|
17
15
|
export type ValidatorContext = {
|
|
18
16
|
user?: ITokenPayload;
|
|
19
17
|
leafAdminStructureLocationIds?: Array<{
|
|
@@ -24,6 +22,9 @@ export type ValidatorContext = {
|
|
|
24
22
|
export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
|
|
25
23
|
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
26
24
|
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
|
|
25
|
+
export declare function isActionEnabled(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
26
|
+
export declare function isActionVisible(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
27
|
+
export declare function isActionAvailable(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
|
|
27
28
|
export declare const errorMessages: {
|
|
28
29
|
hiddenField: {
|
|
29
30
|
id: string;
|
|
@@ -91,21 +92,17 @@ export declare function runStructuralValidations({ field, values, context, actio
|
|
|
91
92
|
}): {
|
|
92
93
|
message: TranslationConfig;
|
|
93
94
|
}[];
|
|
94
|
-
|
|
95
|
-
[id: string]: FieldError<T> | undefined;
|
|
96
|
-
};
|
|
97
|
-
export type FormErrors<T> = IndexMap<FieldError<T>>;
|
|
98
|
-
export declare function flattenErrors<T>(errors: FieldError<T[]>): T[];
|
|
99
|
-
export declare function mapErrors<T, R>(errors: FormErrors<T>, fn: (err: T) => R): FormErrors<R>;
|
|
100
|
-
export declare function runFieldValidations({ field: config, form, value, context }: {
|
|
95
|
+
export declare function runFieldValidations({ field, values, context }: {
|
|
101
96
|
field: FieldConfig;
|
|
102
|
-
|
|
103
|
-
form: ActionUpdate;
|
|
97
|
+
values: ActionUpdate;
|
|
104
98
|
context: ValidatorContext;
|
|
105
|
-
}):
|
|
106
|
-
message:
|
|
107
|
-
|
|
99
|
+
}): {
|
|
100
|
+
message: {
|
|
101
|
+
id: string;
|
|
102
|
+
defaultMessage: string;
|
|
103
|
+
description: string;
|
|
104
|
+
};
|
|
105
|
+
}[];
|
|
108
106
|
export declare function getValidatorsForField(fieldId: FieldConfig['id'], validations: NonNullable<FieldConfig['validation']>): NonNullable<FieldConfig['validation']>;
|
|
109
107
|
export declare function areCertificateConditionsMet(conditions: FieldConditional[], values: ConditionalParameters): boolean;
|
|
110
|
-
export {};
|
|
111
108
|
//# sourceMappingURL=validate.d.ts.map
|