@opencrvs/toolkit 1.9.12-rc.e767cdd → 1.9.12-rc.eae3bc3

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 (70) hide show
  1. package/build.sh +5 -0
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/application-config/index.d.ts +2 -0
  4. package/dist/application-config/index.d.ts.map +1 -0
  5. package/dist/application-config/index.js +124 -0
  6. package/dist/commons/api/router.d.ts +3163 -2251
  7. package/dist/commons/application-config/index.d.ts +87 -0
  8. package/dist/commons/conditionals/conditionals.d.ts +27 -3
  9. package/dist/commons/conditionals/validate.d.ts +13 -2
  10. package/dist/commons/events/ActionConfig.d.ts +415 -1555
  11. package/dist/commons/events/ActionDocument.d.ts +888 -1941
  12. package/dist/commons/events/ActionInput.d.ts +277 -1073
  13. package/dist/commons/events/ActionType.d.ts +91 -11
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +288 -1496
  15. package/dist/commons/events/AuditLog.d.ts +223 -0
  16. package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
  17. package/dist/commons/events/Conditional.d.ts +26 -38
  18. package/dist/commons/events/Constants.d.ts +1 -1
  19. package/dist/commons/events/CountryConfigQueryInput.d.ts +1345 -4495
  20. package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
  21. package/dist/commons/events/Draft.d.ts +72 -107
  22. package/dist/commons/events/DynamicFieldValue.d.ts +7 -91
  23. package/dist/commons/events/EventConfig.d.ts +35 -2420
  24. package/dist/commons/events/EventConfigInput.d.ts +0 -3
  25. package/dist/commons/events/EventDocument.d.ts +354 -1366
  26. package/dist/commons/events/EventIndex.d.ts +208 -1014
  27. package/dist/commons/events/EventInput.d.ts +3 -8
  28. package/dist/commons/events/EventMetadata.d.ts +130 -357
  29. package/dist/commons/events/FieldConfig.d.ts +2674 -12470
  30. package/dist/commons/events/FieldType.d.ts +25 -4
  31. package/dist/commons/events/FieldTypeMapping.d.ts +289 -907
  32. package/dist/commons/events/FieldValue.d.ts +121 -527
  33. package/dist/commons/events/FileUtils.d.ts +2 -2
  34. package/dist/commons/events/Flag.d.ts +67 -0
  35. package/dist/commons/events/FormConfig.d.ts +54 -721
  36. package/dist/commons/events/PageConfig.d.ts +58 -320
  37. package/dist/commons/events/PlainDate.d.ts +1 -1
  38. package/dist/commons/events/SummaryConfig.d.ts +14 -161
  39. package/dist/commons/events/TemplateConfig.d.ts +2 -3
  40. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  41. package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
  42. package/dist/commons/events/WorkqueueConfig.d.ts +2008 -7597
  43. package/dist/commons/events/deduplication.d.ts +3 -3
  44. package/dist/commons/events/defineConfig.d.ts +2 -243
  45. package/dist/commons/events/eventConfigValidation.d.ts +8 -0
  46. package/dist/commons/events/index.d.ts +3 -0
  47. package/dist/commons/events/locations.d.ts +57 -20
  48. package/dist/commons/events/scopes.d.ts +33 -33
  49. package/dist/commons/events/state/availableActions.d.ts +7 -2
  50. package/dist/commons/events/state/flags.d.ts +21 -3
  51. package/dist/commons/events/state/index.d.ts +30 -27
  52. package/dist/commons/events/state/utils.d.ts +190 -172
  53. package/dist/commons/events/test.utils.d.ts +52 -11
  54. package/dist/commons/events/transactions.d.ts +1 -1
  55. package/dist/commons/events/utils.d.ts +413 -310
  56. package/dist/commons/notification/UserNotifications.d.ts +55 -636
  57. package/dist/conditionals/index.d.ts.map +1 -1
  58. package/dist/conditionals/index.js +587 -14
  59. package/dist/events/deduplication.d.ts +3 -3
  60. package/dist/events/index.js +2704 -1891
  61. package/dist/notification/index.d.ts.map +1 -1
  62. package/dist/notification/index.js +2002 -1553
  63. package/dist/scopes/index.d.ts +352 -302
  64. package/dist/scopes/index.d.ts.map +1 -1
  65. package/dist/scopes/index.js +444 -210
  66. package/opencrvs-toolkit-1.9.12-rc.eae3bc3.tgz +0 -0
  67. package/package.json +11 -5
  68. package/tsconfig.json +9 -2
  69. package/tsconfig.tsbuildinfo +1 -1
  70. package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
@@ -0,0 +1,87 @@
1
+ import * as z from 'zod/v4';
2
+ export declare const SearchCriteria: z.ZodEnum<{
3
+ TRACKING_ID: "TRACKING_ID";
4
+ REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
5
+ NATIONAL_ID: "NATIONAL_ID";
6
+ NAME: "NAME";
7
+ PHONE_NUMBER: "PHONE_NUMBER";
8
+ EMAIL: "EMAIL";
9
+ }>;
10
+ export declare const ApplicationConfig: z.ZodObject<{
11
+ APPLICATION_NAME: z.ZodString;
12
+ COUNTRY_LOGO: z.ZodObject<{
13
+ fileName: z.ZodString;
14
+ file: z.ZodString;
15
+ }, z.core.$strip>;
16
+ SYSTEM_IANA_TIMEZONE: z.ZodString;
17
+ CURRENCY: z.ZodObject<{
18
+ languagesAndCountry: z.ZodArray<z.ZodString>;
19
+ isoCode: z.ZodString;
20
+ }, z.core.$strip>;
21
+ ADMIN_STRUCTURE: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodString;
23
+ label: z.ZodObject<{
24
+ id: z.ZodString;
25
+ defaultMessage: z.ZodString;
26
+ description: z.ZodString;
27
+ }, z.core.$strip>;
28
+ }, z.core.$strip>>;
29
+ PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
30
+ USER_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
31
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
32
+ SEARCH_DEFAULT_CRITERIA: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
33
+ TRACKING_ID: "TRACKING_ID";
34
+ REGISTRATION_NUMBER: "REGISTRATION_NUMBER";
35
+ NATIONAL_ID: "NATIONAL_ID";
36
+ NAME: "NAME";
37
+ PHONE_NUMBER: "PHONE_NUMBER";
38
+ EMAIL: "EMAIL";
39
+ }>>>;
40
+ }, z.core.$strip>;
41
+ export type ApplicationConfig = z.infer<typeof ApplicationConfig>;
42
+ export declare const defineApplicationConfig: (config: z.input<typeof ApplicationConfig>) => ApplicationConfig;
43
+ export declare const BackgroundConfig: z.ZodObject<{
44
+ backgroundColor: z.ZodOptional<z.ZodString>;
45
+ backgroundImage: z.ZodOptional<z.ZodString>;
46
+ imageFit: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ export declare const LoginConfig: z.ZodObject<{
49
+ COUNTRY: z.ZodString;
50
+ LANGUAGES: z.ZodArray<z.ZodString>;
51
+ USER_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
52
+ INFORMANT_NOTIFICATION_DELIVERY_METHOD: z.ZodString;
53
+ PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
54
+ LOGIN_BACKGROUND: z.ZodObject<{
55
+ backgroundColor: z.ZodOptional<z.ZodString>;
56
+ backgroundImage: z.ZodOptional<z.ZodString>;
57
+ imageFit: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strip>;
59
+ SENTRY: z.ZodString;
60
+ }, z.core.$strip>;
61
+ export type LoginConfig = z.infer<typeof LoginConfig>;
62
+ export declare const defineLoginConfig: (config: z.input<typeof LoginConfig>) => LoginConfig;
63
+ export declare const ClientConfig: z.ZodObject<{
64
+ COUNTRY: z.ZodString;
65
+ LANGUAGES: z.ZodArray<z.ZodString>;
66
+ SENTRY: z.ZodString;
67
+ REGISTER_BACKGROUND: z.ZodObject<{
68
+ backgroundColor: z.ZodOptional<z.ZodString>;
69
+ backgroundImage: z.ZodOptional<z.ZodString>;
70
+ imageFit: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ DASHBOARDS: z.ZodArray<z.ZodObject<{
73
+ id: z.ZodString;
74
+ title: z.ZodObject<{
75
+ id: z.ZodString;
76
+ defaultMessage: z.ZodString;
77
+ description: z.ZodString;
78
+ }, z.core.$strip>;
79
+ url: z.ZodString;
80
+ }, z.core.$strip>>;
81
+ FEATURES: z.ZodDefault<z.ZodOptional<z.ZodObject<{
82
+ V2_EVENTS: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
83
+ }, z.core.$strip>>>;
84
+ }, z.core.$strip>;
85
+ export type ClientConfig = z.infer<typeof ClientConfig>;
86
+ export declare const defineClientConfig: (config: z.input<typeof ClientConfig>) => ClientConfig;
87
+ //# sourceMappingURL=application-config.d.ts.map
@@ -1,10 +1,11 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
2
  import { EventState } from '../events/ActionDocument';
3
- import { ITokenPayload as TokenPayload, Scope } from '../authentication';
3
+ import { ITokenPayload as TokenPayload } from '../authentication';
4
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
5
  import { userSerializer } from '../events/serializers/user/serializer';
6
6
  import { UUID } from '../uuid';
7
7
  import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
8
+ import { EventStatus } from '../events/EventMetadata';
8
9
  import { FieldReference } from '../events/FieldConfig';
9
10
  /** @knipignore */
10
11
  export type JSONSchema = {
@@ -29,7 +30,11 @@ export type FormConditionalParameters = CommonConditionalParameters & {
29
30
  id: UUID;
30
31
  }>;
31
32
  };
32
- export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters;
33
+ export type EventStateConditionalParameters = CommonConditionalParameters & {
34
+ $flags: string[];
35
+ $status: EventStatus;
36
+ };
37
+ export type ConditionalParameters = UserConditionalParameters | EventConditionalParameters | FormConditionalParameters | EventStateConditionalParameters;
33
38
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
34
39
  type AjvJSONSchema = AjvJSONSchemaType<UnionToIntersection<ConditionalParameters>>;
35
40
  /**
@@ -71,7 +76,7 @@ export declare const now: typeof todayDateTimeValueSerializer;
71
76
  * Generate conditional rules for user.
72
77
  */
73
78
  export declare const user: typeof userSerializer & {
74
- hasScope: (scope: Scope) => JSONSchema;
79
+ hasScope: (scope: string) => JSONSchema;
75
80
  hasRole: (role: string) => JSONSchema;
76
81
  isOnline: () => JSONSchema;
77
82
  locationLevel: (adminLevelId: string) => {
@@ -79,9 +84,28 @@ export declare const user: typeof userSerializer & {
79
84
  $location: string;
80
85
  };
81
86
  };
87
+ scope: (scope: import("../scopes").RecordScopeTypeV2) => {
88
+ attribute: (option: import("../scopes").ScopeOptionKey) => {
89
+ $scope: "record.create" | "record.read" | "record.declare" | "record.notify" | "record.register" | "record.unassign-others" | "record.review-duplicates" | "record.search" | "record.edit" | "record.reject" | "record.archive" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.custom-action";
90
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy";
91
+ };
92
+ };
93
+ jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
94
+ $scope: "record.create" | "record.read" | "record.declare" | "record.notify" | "record.register" | "record.unassign-others" | "record.review-duplicates" | "record.search" | "record.edit" | "record.reject" | "record.archive" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.custom-action";
95
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy";
96
+ }) => {
97
+ $jurisdiction: "all" | "administrativeArea" | "location" | {
98
+ $scope: "record.create" | "record.read" | "record.declare" | "record.notify" | "record.register" | "record.unassign-others" | "record.review-duplicates" | "record.search" | "record.edit" | "record.reject" | "record.archive" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.custom-action";
99
+ $option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy";
100
+ };
101
+ };
82
102
  };
83
103
  export declare function isFieldReference(value: unknown): value is FieldReference;
84
104
  export declare function isEventFieldReference(value: unknown): value is FieldReference;
105
+ /** Check if an event flag is present */
106
+ export declare function flag(flagvalue: string): JSONSchema;
107
+ /** Check if an event flag is present */
108
+ export declare function status(statusValue: EventStatus): JSONSchema;
85
109
  /**
86
110
  * Generate conditional rules for a form field.
87
111
  *
@@ -7,13 +7,21 @@ import { TranslationConfig } from '../events/TranslationConfig';
7
7
  import { ITokenPayload } from '../authentication';
8
8
  import { UUID } from '../uuid';
9
9
  import { FormState } from '../events/utils';
10
+ import { ActionConfig } from '../events/ActionConfig';
10
11
  import { ActionType } from '../events/ActionType';
12
+ import { EventConfig } from '../events/EventConfig';
11
13
  import { EventDocument } from '../events/EventDocument';
14
+ import { EventIndex } from '../events/EventIndex';
15
+ /**
16
+ * Precompiles action conditional schemas from the event configurations to improve performance of condition validation later on.
17
+ * Best called once on application startup before any condition validation is done.
18
+ */
19
+ export declare function precompileActionSchemas(eventConfigurations: EventConfig[]): void;
12
20
  export declare function validate(schema: JSONSchema, data: ConditionalParameters): boolean;
13
21
  export declare function validateValue(schema: JSONSchema, data: unknown): boolean;
14
22
  export declare function isOnline(): boolean;
15
- export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext): boolean;
16
- export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext): boolean;
23
+ export declare function isConditionMet(conditional: JSONSchema, values: EventState | ActionUpdate, context: ValidatorContext, eventIndex?: EventIndex): boolean;
24
+ export declare function areConditionsMet(conditions: FieldConditional[], values: Record<string, FieldValue>, context: ValidatorContext, event: EventIndex): boolean;
17
25
  export type ValidatorContext = {
18
26
  user?: ITokenPayload;
19
27
  leafAdminStructureLocationIds?: Array<{
@@ -24,6 +32,9 @@ export type ValidatorContext = {
24
32
  export declare function isFieldVisible(field: FieldConfig, form: Partial<ActionUpdate | EventState>, context: ValidatorContext): boolean;
25
33
  export declare function isFieldEnabled(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
26
34
  export declare function isFieldDisplayedOnReview(field: FieldConfig, form: ActionUpdate | EventState, context: ValidatorContext): boolean;
35
+ export declare function isActionEnabled(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
36
+ export declare function isActionVisible(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
37
+ export declare function isActionAvailable(actionConfig: ActionConfig, event: EventIndex, context: ValidatorContext): boolean;
27
38
  export declare const errorMessages: {
28
39
  hiddenField: {
29
40
  id: string;