@opencrvs/toolkit 1.8.1-rc.8c25e85 → 1.8.1-rc.a372970

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 +5078 -5910
  2. package/dist/commons/conditionals/conditionals.d.ts +13 -9
  3. package/dist/commons/conditionals/validate.d.ts +6 -15
  4. package/dist/commons/events/ActionConfig.d.ts +1718 -119315
  5. package/dist/commons/events/ActionDocument.d.ts +1325 -4879
  6. package/dist/commons/events/ActionInput.d.ts +1025 -3205
  7. package/dist/commons/events/ActionType.d.ts +1 -10
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1282
  9. package/dist/commons/events/CompositeFieldValue.d.ts +9 -40
  10. package/dist/commons/events/Draft.d.ts +97 -288
  11. package/dist/commons/events/EventConfig.d.ts +1359 -54365
  12. package/dist/commons/events/EventDocument.d.ts +833 -2720
  13. package/dist/commons/events/EventIndex.d.ts +29 -2228
  14. package/dist/commons/events/EventMetadata.d.ts +47 -347
  15. package/dist/commons/events/FieldConfig.d.ts +1250 -6746
  16. package/dist/commons/events/FieldType.d.ts +3 -8
  17. package/dist/commons/events/FieldTypeMapping.d.ts +73 -161
  18. package/dist/commons/events/FieldValue.d.ts +20 -91
  19. package/dist/commons/events/FormConfig.d.ts +533 -55781
  20. package/dist/commons/events/PageConfig.d.ts +208 -13824
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -34
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -8116
  24. package/dist/commons/events/defineConfig.d.ts +99 -8551
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +90 -206
  27. package/dist/commons/events/transactions.d.ts +1 -1
  28. package/dist/commons/events/utils.d.ts +94 -15442
  29. package/dist/conditionals/index.js +56 -66
  30. package/dist/events/index.js +1835 -4707
  31. package/dist/scopes/index.d.ts +7 -184
  32. package/dist/scopes/index.js +40 -140
  33. package/package.json +3 -4
  34. package/dist/commons/events/Constants.d.ts +0 -3
  35. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -4132
  36. package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
  37. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  38. package/dist/commons/events/event.d.ts +0 -46
  39. package/dist/commons/events/field.d.ts +0 -94
  40. package/dist/commons/events/scopes.d.ts +0 -45
  41. package/dist/commons/events/serializer.d.ts +0 -2
  42. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -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';
4
5
  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,11 +58,19 @@ export declare function never(): JSONSchema;
58
58
  *
59
59
  * Generate conditional rules for user.
60
60
  */
61
- export declare const user: typeof userSerializer & {
61
+ export declare const user: {
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
+ };
64
71
  type FieldReference = {
65
- $$field: string;
72
+ _fieldId: string;
73
+ [key: string]: unknown;
66
74
  };
67
75
  /**
68
76
  * Generate conditional rules for a form field.
@@ -72,11 +80,11 @@ type FieldReference = {
72
80
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
73
81
  *
74
82
  */
75
- export declare function createFieldConditionals(fieldId: string): {
83
+ export declare function field(fieldId: string): {
76
84
  /**
77
85
  * @private Internal property used for field reference tracking.
78
86
  */
79
- $$field: string;
87
+ _fieldId: string;
80
88
  isAfter: () => {
81
89
  days: (days: number) => {
82
90
  inPast: () => JSONSchema;
@@ -113,10 +121,6 @@ export declare function createFieldConditionals(fieldId: string): {
113
121
  */
114
122
  matches: (pattern: string) => JSONSchema;
115
123
  isBetween: (min: number, max: number) => JSONSchema;
116
- getId: () => {
117
- fieldId: string;
118
- };
119
- object: (options: Record<string, any>) => JSONSchema;
120
124
  };
121
125
  export {};
122
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,16 +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
- correctionNotAllowed: {
45
- defaultMessage: string;
46
- description: string;
47
- id: string;
48
- };
49
36
  };
50
37
  /**
51
38
  * Custom error map for Zod to override the default error messages in intl-formik format.
@@ -68,7 +55,12 @@ export declare function validateFieldInput({ field, value }: {
68
55
  }): {
69
56
  message: TranslationConfig;
70
57
  }[];
71
- 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 }: {
72
64
  field: FieldConfig;
73
65
  values: ActionUpdate;
74
66
  }): {
@@ -76,5 +68,4 @@ export declare function runFieldValidations({ field, values }: {
76
68
  message: TranslationConfig;
77
69
  }[];
78
70
  };
79
- export declare function getValidatorsForField(fieldId: FieldConfig['id'], validations: NonNullable<FieldConfig['validation']>): NonNullable<FieldConfig['validation']>;
80
71
  //# sourceMappingURL=validate.d.ts.map