@opencrvs/toolkit 1.8.0-rc.fd8a78f → 1.8.0-rc.fd936ab

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.
Files changed (41) hide show
  1. package/dist/commons/api/router.d.ts +447 -14227
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -14
  3. package/dist/commons/conditionals/validate.d.ts +6 -10
  4. package/dist/commons/events/ActionConfig.d.ts +1726 -117415
  5. package/dist/commons/events/ActionDocument.d.ts +383 -2305
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -4
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1029
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -143
  11. package/dist/commons/events/EventConfig.d.ts +1361 -56376
  12. package/dist/commons/events/EventDocument.d.ts +264 -1428
  13. package/dist/commons/events/EventIndex.d.ts +25 -1590
  14. package/dist/commons/events/EventMetadata.d.ts +43 -299
  15. package/dist/commons/events/FieldConfig.d.ts +1060 -5458
  16. package/dist/commons/events/FieldType.d.ts +3 -6
  17. package/dist/commons/events/FieldTypeMapping.d.ts +54 -103
  18. package/dist/commons/events/FieldValue.d.ts +8 -49
  19. package/dist/commons/events/FormConfig.d.ts +524 -49166
  20. package/dist/commons/events/PageConfig.d.ts +208 -12210
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -31
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -4803
  24. package/dist/commons/events/defineConfig.d.ts +75 -9010
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -147
  27. package/dist/commons/events/utils.d.ts +68 -13352
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1504 -3807
  30. package/dist/scopes/index.d.ts +6 -94
  31. package/dist/scopes/index.js +21 -42
  32. package/package.json +2 -3
  33. package/dist/commons/events/Constants.d.ts +0 -3
  34. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -2982
  35. package/dist/commons/events/CreatedAtLocation.d.ts +0 -3
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  37. package/dist/commons/events/event.d.ts +0 -54
  38. package/dist/commons/events/field.d.ts +0 -77
  39. package/dist/commons/events/scopes.d.ts +0 -45
  40. package/dist/commons/events/serializer.d.ts +0 -2
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
@@ -3,7 +3,6 @@ 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 { userSerializer } from '../events/serializers/user/serializer';
7
6
  /** @knipignore */
8
7
  export type JSONSchema = {
9
8
  readonly __nominal__type: 'JSONSchema';
@@ -59,22 +58,19 @@ export declare function never(): JSONSchema;
59
58
  *
60
59
  * Generate conditional rules for user.
61
60
  */
62
- export declare const user: typeof userSerializer & {
61
+ export declare const user: {
63
62
  hasScope: (scope: Scope) => JSONSchema;
64
63
  };
65
64
  /**
66
65
  *
67
66
  * Generate conditional rules for event.
68
67
  */
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
- */
68
+ export declare const event: {
74
69
  hasAction: (action: ActionType) => JSONSchema;
75
70
  };
76
71
  type FieldReference = {
77
- $$field: string;
72
+ _fieldId: string;
73
+ [key: string]: unknown;
78
74
  };
79
75
  /**
80
76
  * Generate conditional rules for a form field.
@@ -84,11 +80,11 @@ type FieldReference = {
84
80
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
85
81
  *
86
82
  */
87
- export declare function createFieldConditionals(fieldId: string): {
83
+ export declare function field(fieldId: string): {
88
84
  /**
89
85
  * @private Internal property used for field reference tracking.
90
86
  */
91
- $$field: string;
87
+ _fieldId: string;
92
88
  isAfter: () => {
93
89
  days: (days: number) => {
94
90
  inPast: () => JSONSchema;
@@ -125,10 +121,6 @@ export declare function createFieldConditionals(fieldId: string): {
125
121
  */
126
122
  matches: (pattern: string) => JSONSchema;
127
123
  isBetween: (min: number, max: number) => JSONSchema;
128
- getId: () => {
129
- fieldId: string;
130
- };
131
- object: (options: Record<string, any>) => JSONSchema;
132
124
  };
133
125
  export {};
134
126
  //# sourceMappingURL=conditionals.d.ts.map
@@ -3,10 +3,7 @@ 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';
7
6
  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;
10
7
  export declare function isFieldVisible(field: FieldConfig, form: ActionUpdate | EventState): boolean;
11
8
  export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState): boolean;
12
9
  export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState): boolean;
@@ -36,11 +33,6 @@ export declare const errorMessages: {
36
33
  description: string;
37
34
  id: string;
38
35
  };
39
- unexpectedField: {
40
- defaultMessage: string;
41
- description: string;
42
- id: string;
43
- };
44
36
  };
45
37
  /**
46
38
  * Custom error map for Zod to override the default error messages in intl-formik format.
@@ -63,7 +55,12 @@ export declare function validateFieldInput({ field, value }: {
63
55
  }): {
64
56
  message: TranslationConfig;
65
57
  }[];
66
- export declare function runFieldValidations({ field, values }: {
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 }: {
67
64
  field: FieldConfig;
68
65
  values: ActionUpdate;
69
66
  }): {
@@ -71,5 +68,4 @@ export declare function runFieldValidations({ field, values }: {
71
68
  message: TranslationConfig;
72
69
  }[];
73
70
  };
74
- export declare function getValidatorsForField(fieldId: FieldConfig['id'], validations: NonNullable<FieldConfig['validation']>): NonNullable<FieldConfig['validation']>;
75
71
  //# sourceMappingURL=validate.d.ts.map