@opencrvs/toolkit 1.8.0-rc.fb2e700 → 1.8.0-rc.fbb40d1

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 (41) hide show
  1. package/dist/commons/api/router.d.ts +11542 -4327
  2. package/dist/commons/conditionals/conditionals.d.ts +11 -7
  3. package/dist/commons/conditionals/validate.d.ts +4 -6
  4. package/dist/commons/events/ActionConfig.d.ts +104357 -1720
  5. package/dist/commons/events/ActionDocument.d.ts +865 -452
  6. package/dist/commons/events/ActionInput.d.ts +443 -363
  7. package/dist/commons/events/AdvancedSearchConfig.d.ts +957 -22
  8. package/dist/commons/events/CompositeFieldValue.d.ts +3 -0
  9. package/dist/commons/events/Constants.d.ts +2 -0
  10. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  11. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  12. package/dist/commons/events/Draft.d.ts +52 -39
  13. package/dist/commons/events/EventConfig.d.ts +50126 -1345
  14. package/dist/commons/events/EventDocument.d.ts +550 -330
  15. package/dist/commons/events/EventIndex.d.ts +1327 -18
  16. package/dist/commons/events/EventMetadata.d.ts +269 -16
  17. package/dist/commons/events/FieldConfig.d.ts +4280 -754
  18. package/dist/commons/events/FieldType.d.ts +3 -3
  19. package/dist/commons/events/FieldTypeMapping.d.ts +11 -4
  20. package/dist/commons/events/FieldValue.d.ts +7 -4
  21. package/dist/commons/events/FormConfig.d.ts +43591 -439
  22. package/dist/commons/events/PageConfig.d.ts +10860 -204
  23. package/dist/commons/events/SummaryConfig.d.ts +95 -39
  24. package/dist/commons/events/User.d.ts +31 -2
  25. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  26. package/dist/commons/events/WorkqueueConfig.d.ts +4525 -20
  27. package/dist/commons/events/defineConfig.d.ts +7940 -28
  28. package/dist/commons/events/event.d.ts +54 -0
  29. package/dist/commons/events/field.d.ts +82 -0
  30. package/dist/commons/events/index.d.ts +7 -0
  31. package/dist/commons/events/scopes.d.ts +45 -0
  32. package/dist/commons/events/serializer.d.ts +2 -0
  33. package/dist/commons/events/test.utils.d.ts +22 -51
  34. package/dist/commons/events/transactions.d.ts +1 -1
  35. package/dist/commons/events/utils.d.ts +3670 -71
  36. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  37. package/dist/conditionals/index.js +55 -35
  38. package/dist/events/index.js +3662 -1691
  39. package/dist/scopes/index.d.ts +94 -6
  40. package/dist/scopes/index.js +42 -21
  41. package/package.json +3 -2
@@ -3,6 +3,7 @@ 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';
6
7
  /** @knipignore */
7
8
  export type JSONSchema = {
8
9
  readonly __nominal__type: 'JSONSchema';
@@ -58,14 +59,18 @@ export declare function never(): JSONSchema;
58
59
  *
59
60
  * Generate conditional rules for user.
60
61
  */
61
- export declare const user: {
62
+ export declare const user: typeof userSerializer & {
62
63
  hasScope: (scope: Scope) => JSONSchema;
63
64
  };
64
65
  /**
65
66
  *
66
67
  * Generate conditional rules for event.
67
68
  */
68
- export declare const event: {
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
+ */
69
74
  hasAction: (action: ActionType) => JSONSchema;
70
75
  };
71
76
  type FieldReference = {
@@ -80,11 +85,7 @@ type FieldReference = {
80
85
  * and(field('foo').isEqualTo('bar'), field('baz').isUndefined())
81
86
  *
82
87
  */
83
- export declare function field(fieldId: string): {
84
- /**
85
- * @private Internal property used for field reference tracking.
86
- */
87
- _fieldId: string;
88
+ export declare function createFieldConditionals(fieldId: string): {
88
89
  isAfter: () => {
89
90
  days: (days: number) => {
90
91
  inPast: () => JSONSchema;
@@ -121,6 +122,9 @@ export declare function field(fieldId: string): {
121
122
  */
122
123
  matches: (pattern: string) => JSONSchema;
123
124
  isBetween: (min: number, max: number) => JSONSchema;
125
+ getId: () => {
126
+ fieldId: string;
127
+ };
124
128
  };
125
129
  export {};
126
130
  //# 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,12 +58,7 @@ export declare function validateFieldInput({ field, value }: {
55
58
  }): {
56
59
  message: TranslationConfig;
57
60
  }[];
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 }: {
61
+ export declare function runFieldValidations({ field, values }: {
64
62
  field: FieldConfig;
65
63
  values: ActionUpdate;
66
64
  }): {