@opencrvs/toolkit 1.8.0-rc.f8e4107 → 1.8.0-rc.f97f8f2
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 +8418 -4827
- package/dist/commons/conditionals/conditionals.d.ts +9 -70
- package/dist/commons/conditionals/validate.d.ts +4 -6
- package/dist/commons/events/ActionConfig.d.ts +90025 -1680
- package/dist/commons/events/ActionDocument.d.ts +643 -417
- package/dist/commons/events/ActionInput.d.ts +248 -240
- package/dist/commons/events/AdvancedSearchConfig.d.ts +274 -23
- package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1506 -0
- package/dist/commons/events/Draft.d.ts +38 -30
- package/dist/commons/events/EventConfig.d.ts +42787 -1385
- package/dist/commons/events/EventDocument.d.ts +413 -312
- package/dist/commons/events/EventIndex.d.ts +948 -155
- package/dist/commons/events/EventInput.d.ts +13 -0
- package/dist/commons/events/EventMetadata.d.ts +274 -11
- package/dist/commons/events/FieldConfig.d.ts +3778 -769
- package/dist/commons/events/FieldType.d.ts +3 -3
- package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
- package/dist/commons/events/FieldValue.d.ts +7 -4
- package/dist/commons/events/FormConfig.d.ts +40417 -439
- package/dist/commons/events/PageConfig.d.ts +10077 -203
- package/dist/commons/events/SummaryConfig.d.ts +95 -39
- package/dist/commons/events/User.d.ts +31 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +42 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +2834 -19
- package/dist/commons/events/defineConfig.d.ts +7008 -81
- package/dist/commons/events/event.d.ts +27 -0
- package/dist/commons/events/field.d.ts +68 -0
- package/dist/commons/events/index.d.ts +6 -0
- package/dist/commons/events/scopes.d.ts +26 -0
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +7 -44
- package/dist/commons/events/utils.d.ts +3551 -65
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +54 -83
- package/dist/events/index.js +2044 -1072
- package/dist/scopes/index.d.ts +105 -1
- package/dist/scopes/index.js +140 -0
- package/package.json +3 -2
@@ -3,8 +3,7 @@ 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';
|
6
|
-
import {
|
7
|
-
import { MetadataField } from '../utils';
|
6
|
+
import { userSerializer } from '../events/serializers/user/serializer';
|
8
7
|
/** @knipignore */
|
9
8
|
export type JSONSchema = {
|
10
9
|
readonly __nominal__type: 'JSONSchema';
|
@@ -60,14 +59,18 @@ export declare function never(): JSONSchema;
|
|
60
59
|
*
|
61
60
|
* Generate conditional rules for user.
|
62
61
|
*/
|
63
|
-
export declare const user: {
|
62
|
+
export declare const user: typeof userSerializer & {
|
64
63
|
hasScope: (scope: Scope) => JSONSchema;
|
65
64
|
};
|
66
65
|
/**
|
67
66
|
*
|
68
67
|
* Generate conditional rules for event.
|
69
68
|
*/
|
70
|
-
export declare
|
69
|
+
export declare function createEventConditionals(): {
|
70
|
+
/**
|
71
|
+
* Checks if the event contains a specific action type.
|
72
|
+
* @param action - The action type to check for.
|
73
|
+
*/
|
71
74
|
hasAction: (action: ActionType) => JSONSchema;
|
72
75
|
};
|
73
76
|
type FieldReference = {
|
@@ -82,11 +85,7 @@ type FieldReference = {
|
|
82
85
|
* and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
|
83
86
|
*
|
84
87
|
*/
|
85
|
-
export declare function
|
86
|
-
/**
|
87
|
-
* @private Internal property used for field reference tracking.
|
88
|
-
*/
|
89
|
-
_fieldId: string;
|
88
|
+
export declare function createFieldConditionals(fieldId: string): {
|
90
89
|
isAfter: () => {
|
91
90
|
days: (days: number) => {
|
92
91
|
inPast: () => JSONSchema;
|
@@ -123,68 +122,8 @@ export declare function field(fieldId: string): {
|
|
123
122
|
*/
|
124
123
|
matches: (pattern: string) => JSONSchema;
|
125
124
|
isBetween: (min: number, max: number) => JSONSchema;
|
126
|
-
|
127
|
-
* Creates a range configuration for the specified field.
|
128
|
-
*
|
129
|
-
* @returns An object containing the field ID and a configuration object with a type of 'RANGE'.
|
130
|
-
*
|
131
|
-
* @example field('age').range()
|
132
|
-
* // {
|
133
|
-
* // fieldId: 'age',
|
134
|
-
* // config: { type: 'RANGE' }
|
135
|
-
* // }
|
136
|
-
*/
|
137
|
-
range: () => {
|
125
|
+
getId: () => {
|
138
126
|
fieldId: string;
|
139
|
-
config: {
|
140
|
-
type: "RANGE";
|
141
|
-
};
|
142
|
-
};
|
143
|
-
/**
|
144
|
-
* Creates a configuration for exact matching of the specified field.
|
145
|
-
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
146
|
-
* @example field('dob').exact()
|
147
|
-
* // {
|
148
|
-
* // fieldId: 'dob',
|
149
|
-
* // config: { type: 'EXACT' }
|
150
|
-
* // }
|
151
|
-
*/
|
152
|
-
exact: () => {
|
153
|
-
fieldId: string;
|
154
|
-
config: {
|
155
|
-
type: "EXACT";
|
156
|
-
};
|
157
|
-
};
|
158
|
-
/**
|
159
|
-
* Creates a configuration for fuzzy matching of the specified field.
|
160
|
-
* @returns An object containing the field ID and a configuration object with a type of 'EXACT'.
|
161
|
-
* @example field('name').fuzzy()
|
162
|
-
* // {
|
163
|
-
* // fieldId: 'name',
|
164
|
-
* // config: { type: 'FUZZY' }
|
165
|
-
* // }
|
166
|
-
*/
|
167
|
-
fuzzy: () => {
|
168
|
-
fieldId: string;
|
169
|
-
config: {
|
170
|
-
type: "FUZZY";
|
171
|
-
};
|
172
|
-
};
|
173
|
-
};
|
174
|
-
/**
|
175
|
-
* @param fieldId - The field ID condition is applied to.
|
176
|
-
* @param options - The options for the select field.
|
177
|
-
* @returns An object containing the configuration for the searching the metadata fields of an event.
|
178
|
-
* @example eventField('status', [{ label: 'Option 1', value: '1' }])
|
179
|
-
*/
|
180
|
-
export declare function eventField(fieldId: MetadataField, options?: SelectOption[]): {
|
181
|
-
fieldId: "status" | "trackingId";
|
182
|
-
options: {
|
183
|
-
value: string;
|
184
|
-
label: import("..").TranslationConfig;
|
185
|
-
}[] | undefined;
|
186
|
-
config: {
|
187
|
-
type: "EXACT";
|
188
127
|
};
|
189
128
|
};
|
190
129
|
export {};
|
@@ -3,7 +3,10 @@ import { EventState, ActionUpdate } from '../events/ActionDocument';
|
|
3
3
|
import { FieldConfig } from '../events/FieldConfig';
|
4
4
|
import { FieldUpdateValue } from '../events/FieldValue';
|
5
5
|
import { TranslationConfig } from '../events/TranslationConfig';
|
6
|
+
import { FieldConditional } from '../events/Conditional';
|
6
7
|
export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
|
8
|
+
export declare function isConditionMet(conditional: JSONSchema, values: Record<string, unknown>): boolean;
|
9
|
+
export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, unknown>): boolean;
|
7
10
|
export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean;
|
8
11
|
export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean;
|
9
12
|
export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState): boolean;
|
@@ -55,12 +58,7 @@ export declare function validateFieldInput({ field, value }: {
|
|
55
58
|
}): {
|
56
59
|
message: TranslationConfig;
|
57
60
|
}[];
|
58
|
-
|
59
|
-
* Gets applicable validation errors based on its type and custom validators.
|
60
|
-
*
|
61
|
-
* @returns an array of error messages for the field
|
62
|
-
*/
|
63
|
-
export declare function getFieldValidationErrors({ field, values }: {
|
61
|
+
export declare function runFieldValidations({ field, values }: {
|
64
62
|
field: FieldConfig;
|
65
63
|
values: ActionUpdate;
|
66
64
|
}): {
|