@opencrvs/toolkit 1.8.0-rc.fd31705 → 1.8.0-rc.fd754eb

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 (38) hide show
  1. package/dist/commons/api/router.d.ts +7717 -4214
  2. package/dist/commons/conditionals/conditionals.d.ts +9 -6
  3. package/dist/commons/conditionals/validate.d.ts +5 -11
  4. package/dist/commons/events/ActionConfig.d.ts +90025 -1680
  5. package/dist/commons/events/ActionDocument.d.ts +544 -207
  6. package/dist/commons/events/ActionInput.d.ts +466 -368
  7. package/dist/commons/events/ActionType.d.ts +2 -0
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +369 -25
  9. package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
  10. package/dist/commons/events/Draft.d.ts +39 -23
  11. package/dist/commons/events/EventConfig.d.ts +42812 -1344
  12. package/dist/commons/events/EventDocument.d.ts +339 -153
  13. package/dist/commons/events/EventIndex.d.ts +1346 -13
  14. package/dist/commons/events/EventInput.d.ts +13 -0
  15. package/dist/commons/events/EventMetadata.d.ts +273 -11
  16. package/dist/commons/events/FieldConfig.d.ts +3733 -724
  17. package/dist/commons/events/FieldType.d.ts +3 -3
  18. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  19. package/dist/commons/events/FieldValue.d.ts +7 -4
  20. package/dist/commons/events/FormConfig.d.ts +40417 -439
  21. package/dist/commons/events/PageConfig.d.ts +10077 -203
  22. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  23. package/dist/commons/events/TemplateConfig.d.ts +4 -4
  24. package/dist/commons/events/User.d.ts +5 -0
  25. package/dist/commons/events/WorkqueueConfig.d.ts +1135 -19
  26. package/dist/commons/events/defineConfig.d.ts +6971 -40
  27. package/dist/commons/events/event.d.ts +27 -0
  28. package/dist/commons/events/field.d.ts +68 -0
  29. package/dist/commons/events/index.d.ts +3 -0
  30. package/dist/commons/events/scopes.d.ts +26 -0
  31. package/dist/commons/events/test.utils.d.ts +8 -45
  32. package/dist/commons/events/utils.d.ts +3562 -71
  33. package/dist/commons/events/utils.test.d.ts +2 -0
  34. package/dist/conditionals/index.js +36 -33
  35. package/dist/events/index.js +1864 -1099
  36. package/dist/scopes/index.d.ts +70 -1
  37. package/dist/scopes/index.js +130 -0
  38. package/package.json +3 -2
@@ -65,7 +65,11 @@ export declare const user: {
65
65
  *
66
66
  * Generate conditional rules for event.
67
67
  */
68
- export declare const event: {
68
+ export declare function createEventConditionals(): {
69
+ /**
70
+ * Checks if the event contains a specific action type.
71
+ * @param action - The action type to check for.
72
+ */
69
73
  hasAction: (action: ActionType) => JSONSchema;
70
74
  };
71
75
  type FieldReference = {
@@ -80,11 +84,7 @@ type FieldReference = {
80
84
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
81
85
  *
82
86
  */
83
- export declare function field(fieldId: string): {
84
- /**
85
- * @private Internal property used for field reference tracking.
86
- */
87
- _fieldId: string;
87
+ export declare function createFieldConditionals(fieldId: string): {
88
88
  isAfter: () => {
89
89
  days: (days: number) => {
90
90
  inPast: () => JSONSchema;
@@ -121,6 +121,9 @@ export declare function field(fieldId: string): {
121
121
  */
122
122
  matches: (pattern: string) => JSONSchema;
123
123
  isBetween: (min: number, max: number) => JSONSchema;
124
+ getId: () => {
125
+ fieldId: string;
126
+ };
124
127
  };
125
128
  export {};
126
129
  //# sourceMappingURL=conditionals.d.ts.map
@@ -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,21 +58,12 @@ export declare function validateFieldInput({ field, value }: {
55
58
  }): {
56
59
  message: TranslationConfig;
57
60
  }[];
58
- /**
59
- * Checks if a field has validation errors based on its type and custom conditionals.
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
  }): {
67
65
  errors: {
68
- message: {
69
- id: string;
70
- defaultMessage: string;
71
- description: string;
72
- };
66
+ message: TranslationConfig;
73
67
  }[];
74
68
  };
75
69
  //# sourceMappingURL=validate.d.ts.map