@opencrvs/toolkit 1.8.1-rc.a372970 → 1.8.1-rc.be16155

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 (42) hide show
  1. package/dist/commons/api/router.d.ts +5934 -5078
  2. package/dist/commons/conditionals/conditionals.d.ts +9 -13
  3. package/dist/commons/conditionals/validate.d.ts +15 -6
  4. package/dist/commons/events/ActionConfig.d.ts +119326 -1729
  5. package/dist/commons/events/ActionDocument.d.ts +4860 -1270
  6. package/dist/commons/events/ActionInput.d.ts +3241 -1025
  7. package/dist/commons/events/ActionType.d.ts +10 -1
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1282 -22
  9. package/dist/commons/events/CompositeFieldValue.d.ts +40 -9
  10. package/dist/commons/events/Constants.d.ts +3 -0
  11. package/dist/commons/events/CountryConfigQueryInput.d.ts +4132 -0
  12. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  13. package/dist/commons/events/Draft.d.ts +288 -97
  14. package/dist/commons/events/EventConfig.d.ts +54363 -1357
  15. package/dist/commons/events/EventDocument.d.ts +2746 -833
  16. package/dist/commons/events/EventIndex.d.ts +2228 -29
  17. package/dist/commons/events/EventMetadata.d.ts +347 -47
  18. package/dist/commons/events/FieldConfig.d.ts +6756 -1260
  19. package/dist/commons/events/FieldType.d.ts +8 -3
  20. package/dist/commons/events/FieldTypeMapping.d.ts +161 -73
  21. package/dist/commons/events/FieldValue.d.ts +91 -20
  22. package/dist/commons/events/FormConfig.d.ts +55770 -522
  23. package/dist/commons/events/PageConfig.d.ts +13825 -209
  24. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  25. package/dist/commons/events/User.d.ts +34 -2
  26. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +8116 -20
  28. package/dist/commons/events/defineConfig.d.ts +8529 -77
  29. package/dist/commons/events/event.d.ts +46 -0
  30. package/dist/commons/events/field.d.ts +94 -0
  31. package/dist/commons/events/index.d.ts +8 -0
  32. package/dist/commons/events/scopes.d.ts +45 -0
  33. package/dist/commons/events/serializer.d.ts +2 -0
  34. package/dist/commons/events/test.utils.d.ts +210 -90
  35. package/dist/commons/events/transactions.d.ts +1 -1
  36. package/dist/commons/events/utils.d.ts +15436 -88
  37. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  38. package/dist/conditionals/index.js +66 -56
  39. package/dist/events/index.js +4662 -1786
  40. package/dist/scopes/index.d.ts +184 -7
  41. package/dist/scopes/index.js +140 -40
  42. package/package.json +4 -3
@@ -1,8 +1,8 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
2
  import { EventState } from '../events/ActionDocument';
3
3
  import { ITokenPayload as TokenPayload, Scope } from '../authentication';
4
- import { ActionType } from '../events/ActionType';
5
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
+ import { userSerializer } from '../events/serializers/user/serializer';
6
6
  /** @knipignore */
7
7
  export type JSONSchema = {
8
8
  readonly __nominal__type: 'JSONSchema';
@@ -58,19 +58,11 @@ export declare function never(): JSONSchema;
58
58
  *
59
59
  * Generate conditional rules for user.
60
60
  */
61
- export declare const user: {
61
+ export declare const user: typeof userSerializer & {
62
62
  hasScope: (scope: Scope) => JSONSchema;
63
63
  };
64
- /**
65
- *
66
- * Generate conditional rules for event.
67
- */
68
- export declare const event: {
69
- hasAction: (action: ActionType) => JSONSchema;
70
- };
71
64
  type FieldReference = {
72
- _fieldId: string;
73
- [key: string]: unknown;
65
+ $$field: string;
74
66
  };
75
67
  /**
76
68
  * Generate conditional rules for a form field.
@@ -80,11 +72,11 @@ type FieldReference = {
80
72
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
81
73
  *
82
74
  */
83
- export declare function field(fieldId: string): {
75
+ export declare function createFieldConditionals(fieldId: string): {
84
76
  /**
85
77
  * @private Internal property used for field reference tracking.
86
78
  */
87
- _fieldId: string;
79
+ $$field: string;
88
80
  isAfter: () => {
89
81
  days: (days: number) => {
90
82
  inPast: () => JSONSchema;
@@ -121,6 +113,10 @@ export declare function field(fieldId: string): {
121
113
  */
122
114
  matches: (pattern: string) => JSONSchema;
123
115
  isBetween: (min: number, max: number) => JSONSchema;
116
+ getId: () => {
117
+ fieldId: string;
118
+ };
119
+ object: (options: Record<string, any>) => JSONSchema;
124
120
  };
125
121
  export {};
126
122
  //# 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;
@@ -33,6 +36,16 @@ export declare const errorMessages: {
33
36
  description: string;
34
37
  id: string;
35
38
  };
39
+ unexpectedField: {
40
+ defaultMessage: string;
41
+ description: string;
42
+ id: string;
43
+ };
44
+ correctionNotAllowed: {
45
+ defaultMessage: string;
46
+ description: string;
47
+ id: string;
48
+ };
36
49
  };
37
50
  /**
38
51
  * Custom error map for Zod to override the default error messages in intl-formik format.
@@ -55,12 +68,7 @@ export declare function validateFieldInput({ field, value }: {
55
68
  }): {
56
69
  message: TranslationConfig;
57
70
  }[];
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 }: {
71
+ export declare function runFieldValidations({ field, values }: {
64
72
  field: FieldConfig;
65
73
  values: ActionUpdate;
66
74
  }): {
@@ -68,4 +76,5 @@ export declare function getFieldValidationErrors({ field, values }: {
68
76
  message: TranslationConfig;
69
77
  }[];
70
78
  };
79
+ export declare function getValidatorsForField(fieldId: FieldConfig['id'], validations: NonNullable<FieldConfig['validation']>): NonNullable<FieldConfig['validation']>;
71
80
  //# sourceMappingURL=validate.d.ts.map