@opencrvs/toolkit 1.8.0-rc.f7a451a → 1.8.0-rc.f7bcb31

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 +4206 -8342
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -11
  3. package/dist/commons/conditionals/validate.d.ts +6 -4
  4. package/dist/commons/events/ActionConfig.d.ts +1727 -97087
  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 +22 -957
  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 +1350 -46327
  11. package/dist/commons/events/EventDocument.d.ts +156 -324
  12. package/dist/commons/events/EventIndex.d.ts +13 -1821
  13. package/dist/commons/events/EventMetadata.d.ts +11 -277
  14. package/dist/commons/events/FieldConfig.d.ts +754 -4280
  15. package/dist/commons/events/FieldType.d.ts +3 -3
  16. package/dist/commons/events/FieldTypeMapping.d.ts +4 -11
  17. package/dist/commons/events/FieldValue.d.ts +4 -7
  18. package/dist/commons/events/FormConfig.d.ts +441 -43593
  19. package/dist/commons/events/PageConfig.d.ts +208 -10864
  20. package/dist/commons/events/SummaryConfig.d.ts +39 -95
  21. package/dist/commons/events/User.d.ts +2 -31
  22. package/dist/commons/events/WorkqueueConfig.d.ts +20 -5341
  23. package/dist/commons/events/defineConfig.d.ts +35 -7218
  24. package/dist/commons/events/index.d.ts +0 -6
  25. package/dist/commons/events/test.utils.d.ts +46 -10
  26. package/dist/commons/events/utils.d.ts +67 -3665
  27. package/dist/conditionals/index.js +35 -55
  28. package/dist/events/index.js +1075 -2461
  29. package/dist/scopes/index.d.ts +4 -91
  30. package/dist/scopes/index.js +21 -39
  31. package/package.json +2 -3
  32. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -3008
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -42
  34. package/dist/commons/events/event.d.ts +0 -54
  35. package/dist/commons/events/field.d.ts +0 -82
  36. package/dist/commons/events/scopes.d.ts +0 -45
  37. package/dist/commons/events/serializer.d.ts +0 -2
  38. 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,18 +58,14 @@ 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 = {
@@ -85,7 +80,11 @@ type FieldReference = {
85
80
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
86
81
  *
87
82
  */
88
- 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;
89
88
  isAfter: () => {
90
89
  days: (days: number) => {
91
90
  inPast: () => JSONSchema;
@@ -122,9 +121,6 @@ export declare function createFieldConditionals(fieldId: string): {
122
121
  */
123
122
  matches: (pattern: string) => JSONSchema;
124
123
  isBetween: (min: number, max: number) => JSONSchema;
125
- getId: () => {
126
- fieldId: string;
127
- };
128
124
  };
129
125
  export {};
130
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
  }): {