@opencrvs/toolkit 1.8.0-rc.fd754eb → 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 (33) hide show
  1. package/dist/commons/api/router.d.ts +4205 -7695
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -9
  3. package/dist/commons/conditionals/validate.d.ts +6 -4
  4. package/dist/commons/events/ActionConfig.d.ts +1680 -90025
  5. package/dist/commons/events/ActionDocument.d.ts +211 -542
  6. package/dist/commons/events/ActionInput.d.ts +240 -248
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +25 -369
  8. package/dist/commons/events/CompositeFieldValue.d.ts +0 -3
  9. package/dist/commons/events/Draft.d.ts +20 -33
  10. package/dist/commons/events/EventConfig.d.ts +1344 -42812
  11. package/dist/commons/events/EventDocument.d.ts +156 -337
  12. package/dist/commons/events/EventIndex.d.ts +13 -1346
  13. package/dist/commons/events/EventInput.d.ts +0 -13
  14. package/dist/commons/events/EventMetadata.d.ts +11 -273
  15. package/dist/commons/events/FieldConfig.d.ts +724 -3733
  16. package/dist/commons/events/FieldType.d.ts +3 -3
  17. package/dist/commons/events/FieldTypeMapping.d.ts +4 -11
  18. package/dist/commons/events/FieldValue.d.ts +4 -7
  19. package/dist/commons/events/FormConfig.d.ts +441 -40419
  20. package/dist/commons/events/PageConfig.d.ts +194 -10068
  21. package/dist/commons/events/SummaryConfig.d.ts +39 -95
  22. package/dist/commons/events/User.d.ts +0 -5
  23. package/dist/commons/events/WorkqueueConfig.d.ts +19 -1135
  24. package/dist/commons/events/defineConfig.d.ts +35 -6966
  25. package/dist/commons/events/index.d.ts +0 -3
  26. package/dist/commons/events/test.utils.d.ts +44 -7
  27. package/dist/commons/events/utils.d.ts +67 -3550
  28. package/dist/conditionals/index.js +33 -36
  29. package/dist/events/index.js +977 -1672
  30. package/package.json +2 -3
  31. package/dist/commons/events/event.d.ts +0 -27
  32. package/dist/commons/events/field.d.ts +0 -68
  33. package/dist/commons/events/scopes.d.ts +0 -26
@@ -65,11 +65,7 @@ export declare const user: {
65
65
  *
66
66
  * Generate conditional rules for event.
67
67
  */
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
- */
68
+ export declare const event: {
73
69
  hasAction: (action: ActionType) => JSONSchema;
74
70
  };
75
71
  type FieldReference = {
@@ -84,7 +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): {
84
+ /**
85
+ * @private Internal property used for field reference tracking.
86
+ */
87
+ _fieldId: string;
88
88
  isAfter: () => {
89
89
  days: (days: number) => {
90
90
  inPast: () => JSONSchema;
@@ -121,9 +121,6 @@ export declare function createFieldConditionals(fieldId: string): {
121
121
  */
122
122
  matches: (pattern: string) => JSONSchema;
123
123
  isBetween: (min: number, max: number) => JSONSchema;
124
- getId: () => {
125
- fieldId: string;
126
- };
127
124
  };
128
125
  export {};
129
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;
@@ -58,7 +55,12 @@ export declare function validateFieldInput({ field, value }: {
58
55
  }): {
59
56
  message: TranslationConfig;
60
57
  }[];
61
- 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 }: {
62
64
  field: FieldConfig;
63
65
  values: ActionUpdate;
64
66
  }): {