@opencrvs/toolkit 1.9.4-rc.0e695b2 → 1.9.4-rc.469f912

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 (58) hide show
  1. package/dist/commons/api/router.d.ts +2440 -28495
  2. package/dist/commons/conditionals/conditionals.d.ts +1 -10
  3. package/dist/commons/conditionals/validate.d.ts +4 -11
  4. package/dist/commons/events/ActionConfig.d.ts +1552 -23416
  5. package/dist/commons/events/ActionDocument.d.ts +1856 -803
  6. package/dist/commons/events/ActionInput.d.ts +1073 -277
  7. package/dist/commons/events/ActionType.d.ts +9 -86
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -228
  9. package/dist/commons/events/CompositeFieldValue.d.ts +176 -27
  10. package/dist/commons/events/Conditional.d.ts +38 -26
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +4169 -931
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
  15. package/dist/commons/events/Draft.d.ts +105 -70
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2120 -18663
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1332 -320
  20. package/dist/commons/events/EventIndex.d.ts +967 -197
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +346 -106
  23. package/dist/commons/events/FieldConfig.d.ts +11774 -4259
  24. package/dist/commons/events/FieldType.d.ts +4 -20
  25. package/dist/commons/events/FieldTypeMapping.d.ts +813 -181
  26. package/dist/commons/events/FieldValue.d.ts +356 -83
  27. package/dist/commons/events/FormConfig.d.ts +721 -13140
  28. package/dist/commons/events/PageConfig.d.ts +319 -8780
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TemplateConfig.d.ts +3 -3
  31. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
  33. package/dist/commons/events/WorkqueueConfig.d.ts +7080 -1615
  34. package/dist/commons/events/deduplication.d.ts +3 -3
  35. package/dist/commons/events/defineConfig.d.ts +163 -25639
  36. package/dist/commons/events/event.d.ts +4 -4
  37. package/dist/commons/events/index.d.ts +0 -1
  38. package/dist/commons/events/locations.d.ts +19 -15
  39. package/dist/commons/events/scopes.d.ts +4 -5
  40. package/dist/commons/events/state/availableActions.d.ts +1 -2
  41. package/dist/commons/events/state/flags.d.ts +3 -21
  42. package/dist/commons/events/state/index.d.ts +19 -23
  43. package/dist/commons/events/state/utils.d.ts +112 -130
  44. package/dist/commons/events/test.utils.d.ts +8 -17
  45. package/dist/commons/events/transactions.d.ts +1 -1
  46. package/dist/commons/events/utils.d.ts +373 -51350
  47. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  48. package/dist/conditionals/index.d.ts.map +1 -1
  49. package/dist/conditionals/index.js +5 -38
  50. package/dist/events/deduplication.d.ts +3 -3
  51. package/dist/events/index.js +1545 -1805
  52. package/dist/notification/index.d.ts.map +1 -1
  53. package/dist/notification/index.js +1412 -1430
  54. package/dist/scopes/index.d.ts +132 -167
  55. package/dist/scopes/index.d.ts.map +1 -1
  56. package/dist/scopes/index.js +94 -133
  57. package/package.json +5 -5
  58. package/dist/commons/events/Flag.d.ts +0 -70
@@ -10,7 +10,7 @@ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConf
10
10
  */
11
11
  declare function eventFn(fieldId: EventFieldIdInput): {
12
12
  range: () => {
13
- fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
13
+ fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
14
14
  fieldType: "event";
15
15
  } & {
16
16
  config: {
@@ -18,7 +18,7 @@ declare function eventFn(fieldId: EventFieldIdInput): {
18
18
  };
19
19
  };
20
20
  exact: () => {
21
- fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
21
+ fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
22
22
  fieldType: "event";
23
23
  } & {
24
24
  config: {
@@ -26,7 +26,7 @@ declare function eventFn(fieldId: EventFieldIdInput): {
26
26
  };
27
27
  };
28
28
  fuzzy: () => {
29
- fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
29
+ fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
30
30
  fieldType: "event";
31
31
  } & {
32
32
  config: {
@@ -34,7 +34,7 @@ declare function eventFn(fieldId: EventFieldIdInput): {
34
34
  };
35
35
  };
36
36
  within: () => {
37
- fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
37
+ fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
38
38
  fieldType: "event";
39
39
  } & {
40
40
  config: {
@@ -39,7 +39,6 @@ export * from './FileUtils';
39
39
  export * from '../conditionals/conditionals';
40
40
  export * from '../conditionals/validate';
41
41
  export * from './field';
42
- export * from './Flag';
43
42
  export * from './event';
44
43
  export * from './locations';
45
44
  export { UUID } from '../uuid';
@@ -1,20 +1,24 @@
1
- import * as z from 'zod/v4';
2
- export declare const LocationType: z.ZodEnum<{
3
- ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
4
- HEALTH_FACILITY: "HEALTH_FACILITY";
5
- CRVS_OFFICE: "CRVS_OFFICE";
6
- }>;
1
+ import { z } from 'zod';
2
+ export declare const LocationType: z.ZodEnum<["ADMIN_STRUCTURE", "CRVS_OFFICE", "HEALTH_FACILITY"]>;
7
3
  export type LocationType = z.infer<typeof LocationType>;
8
4
  export declare const Location: z.ZodObject<{
9
- id: z.core.$ZodBranded<z.ZodUUID, "UUID">;
5
+ id: z.ZodBranded<z.ZodString, "UUID">;
10
6
  name: z.ZodString;
11
- parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>;
12
- validUntil: z.ZodNullable<z.ZodISODateTime>;
13
- locationType: z.ZodNullable<z.ZodEnum<{
14
- ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
15
- HEALTH_FACILITY: "HEALTH_FACILITY";
16
- CRVS_OFFICE: "CRVS_OFFICE";
17
- }>>;
18
- }, z.core.$strip>;
7
+ parentId: z.ZodNullable<z.ZodBranded<z.ZodString, "UUID">>;
8
+ validUntil: z.ZodNullable<z.ZodString>;
9
+ locationType: z.ZodNullable<z.ZodEnum<["ADMIN_STRUCTURE", "CRVS_OFFICE", "HEALTH_FACILITY"]>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ id: string & z.BRAND<"UUID">;
12
+ name: string;
13
+ parentId: (string & z.BRAND<"UUID">) | null;
14
+ validUntil: string | null;
15
+ locationType: "ADMIN_STRUCTURE" | "HEALTH_FACILITY" | "CRVS_OFFICE" | null;
16
+ }, {
17
+ id: string;
18
+ name: string;
19
+ parentId: string | null;
20
+ validUntil: string | null;
21
+ locationType: "ADMIN_STRUCTURE" | "HEALTH_FACILITY" | "CRVS_OFFICE" | null;
22
+ }>;
19
23
  export type Location = z.infer<typeof Location>;
20
24
  //# sourceMappingURL=locations.d.ts.map
@@ -5,9 +5,9 @@ export declare const ACTION_SCOPE_MAP: {
5
5
  READ: "record.read"[];
6
6
  CREATE: "record.create"[];
7
7
  NOTIFY: "record.notify"[];
8
- DECLARE: ("record.register" | "record.declare")[];
9
- EDIT: "record.declared.edit"[];
8
+ DECLARE: ("record.register" | "record.declare" | "record.declared.validate")[];
10
9
  DELETE: "record.declare"[];
10
+ VALIDATE: ("record.register" | "record.declared.validate")[];
11
11
  REGISTER: "record.register"[];
12
12
  PRINT_CERTIFICATE: "record.registered.print-certified-copies"[];
13
13
  REQUEST_CORRECTION: ("record.registered.request-correction" | "record.registered.correct")[];
@@ -21,10 +21,9 @@ export declare const ACTION_SCOPE_MAP: {
21
21
  ASSIGN: null;
22
22
  UNASSIGN: null;
23
23
  DUPLICATE_DETECTED: never[];
24
- CUSTOM: never[];
25
24
  };
26
25
  export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
27
- export declare function configurableEventScopeAllowed(scopes: Scope[], allowedConfigurableScopes: ConfigurableScopeType[], eventType: string, customActionType?: string): boolean;
26
+ export declare function configurableEventScopeAllowed(scopes: Scope[], allowedConfigurableScopes: ConfigurableScopeType[], eventType: string): boolean;
28
27
  /**
29
28
  * Checks if a given action is allowed for the provided scopes and event type.
30
29
  *
@@ -37,7 +36,7 @@ export declare function configurableEventScopeAllowed(scopes: Scope[], allowedCo
37
36
  * @param {string} eventType - The type of event for which the action is being checked.
38
37
  * @returns {boolean} True if the action is in scope for the user, otherwise false.
39
38
  */
40
- export declare function isActionInScope(scopes: Scope[], action: DisplayableAction, eventType: string, customActionType?: string): boolean;
39
+ export declare function isActionInScope(scopes: Scope[], action: DisplayableAction, eventType: string): boolean;
41
40
  /**
42
41
  * A shared utility to check if the user can read a record.
43
42
  * This will be removed in 1.10 and implemented by scopes.
@@ -1,7 +1,6 @@
1
1
  import { DisplayableAction } from '../ActionType';
2
2
  import { EventIndex } from '../EventIndex';
3
- import { EventStatus } from '../EventMetadata';
4
- import { Flag } from '../Flag';
3
+ import { EventStatus, Flag } from '../EventMetadata';
5
4
  export declare function getAvailableActions(status: EventStatus, flags: Flag[]): DisplayableAction[];
6
5
  export declare function getAvailableActionsForEvent(event: EventIndex): DisplayableAction[];
7
6
  //# sourceMappingURL=availableActions.d.ts.map
@@ -1,22 +1,4 @@
1
- import { Flag, CustomFlag } from '../Flag';
2
- import { EventConfig } from '../EventConfig';
3
- import { EventDocument } from '../EventDocument';
4
- /**
5
- * This function resolves custom flags for an event based on its actions.
6
- * Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
7
- *
8
- * Processes accepted actions in chronological order, evaluating flag conditions
9
- * at each action step. Flags can be added or removed based on action configurations
10
- * and conditional logic. Duplicate flags are filtered out.
11
- *
12
- * @param event - The event document containing actions and metadata
13
- * @param eventConfiguration - The configuration object for the event type defining action rules and flag behaviors
14
- * @returns An array of unique custom flag IDs that apply to the event after processing all non-meta actions
15
- *
16
- * @example
17
- * const flags = resolveEventCustomFlags(eventDoc, config);
18
- * // Returns: ['flag-1', 'flag-3']
19
- */
20
- export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
21
- export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
1
+ import { Action } from '../ActionDocument';
2
+ import { Flag } from '../EventMetadata';
3
+ export declare function getFlagsFromActions(actions: Action[]): Flag[];
22
4
  //# sourceMappingURL=flags.d.ts.map
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
9
  import { DocumentPath, FullDocumentPath, FullDocumentUrl } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "DECLARED" | "REGISTERED" | "CREATED" | "NOTIFIED";
10
+ export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
12
  export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): string | null;
13
13
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
@@ -28,14 +28,9 @@ export declare const DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
28
28
  export declare function resolveDateOfEvent(eventMetadata: {
29
29
  createdAt: string;
30
30
  }, declaration: EventState, config: EventConfig): string | undefined;
31
- export declare const DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
32
- export declare function resolvePlaceOfEvent(eventMetadata: {
33
- createdAtLocation?: UUID | undefined | null;
34
- }, declaration: EventState, config: EventConfig): UUID | undefined | null;
35
31
  export declare function extractPotentialDuplicatesFromActions(actions: Action[]): PotentialDuplicate[];
36
32
  /**
37
33
  * NOTE: This function should not run field validations. It should return the state based on the actions, without considering context (users, roles, permissions, etc).
38
- createdAtLocation: CreatedAtLocation
39
34
  *
40
35
  * If you update this function, please ensure @EventIndex type is updated accordingly.
41
36
  * In most cases, you won't need to add new parameters to this function. Discuss with the team before doing so.
@@ -43,7 +38,9 @@ createdAtLocation: CreatedAtLocation
43
38
  * @returns Calculates a snapshot summary of the event based on the actions taken on it.
44
39
  * @see EventIndex for the description of the returned object.
45
40
  */
46
- export declare function getCurrentEventState(event: EventDocument, config: EventConfig): EventIndex;
41
+ export declare function getCurrentEventState(event: EventDocument,
42
+ /** @TODO: remove config parameter, it is only used by resolveDateOfEvent. See if it can be achieved in some other way. */
43
+ config: EventConfig): EventIndex;
47
44
  /**
48
45
  * @returns the future state of the event with drafts applied to all fields.
49
46
  *
@@ -65,48 +62,47 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
65
62
  *
66
63
  */
67
64
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
68
- id: string & import("zod/v4").$brand<"UUID">;
69
65
  type: string;
70
- status: "ARCHIVED" | "DECLARED" | "REGISTERED" | "CREATED" | "NOTIFIED";
66
+ id: string & import("zod").BRAND<"UUID">;
67
+ status: "ARCHIVED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED";
68
+ createdAt: string;
69
+ createdBy: string;
70
+ declaration: Record<string, import("..").FieldValue>;
71
+ trackingId: string;
72
+ updatedAt: string;
71
73
  legalStatuses: {
72
74
  DECLARED?: {
73
75
  createdAt: string;
74
76
  createdBy: string;
75
- acceptedAt: string;
76
77
  createdByRole: string;
77
- createdAtLocation?: (string & import("zod/v4").$brand<"UUID">) | null | undefined;
78
+ acceptedAt: string;
78
79
  createdByUserType?: "system" | "user" | null | undefined;
79
80
  createdBySignature?: string | null | undefined;
81
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
80
82
  } | null | undefined;
81
83
  REGISTERED?: {
82
84
  createdAt: string;
83
85
  createdBy: string;
84
- acceptedAt: string;
85
86
  createdByRole: string;
86
87
  registrationNumber: string;
87
- createdAtLocation?: (string & import("zod/v4").$brand<"UUID">) | null | undefined;
88
+ acceptedAt: string;
88
89
  createdByUserType?: "system" | "user" | null | undefined;
89
90
  createdBySignature?: string | null | undefined;
91
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
90
92
  } | null | undefined;
91
93
  };
92
- createdAt: string;
93
- createdBy: string;
94
94
  updatedByUserRole: string;
95
- updatedAt: string;
96
- trackingId: string;
97
95
  potentialDuplicates: {
98
- id: string & import("zod/v4").$brand<"UUID">;
96
+ id: string & import("zod").BRAND<"UUID">;
99
97
  trackingId: string;
100
98
  }[];
101
99
  flags: string[];
102
- declaration: Record<string, import("..").FieldValue>;
103
- dateOfEvent?: string | null | undefined;
104
- placeOfEvent?: (string & import("zod/v4").$brand<"UUID">) | null | undefined;
105
100
  createdByUserType?: "system" | "user" | null | undefined;
106
- createdAtLocation?: (string & import("zod/v4").$brand<"UUID">) | null | undefined;
107
101
  createdBySignature?: string | null | undefined;
108
- updatedAtLocation?: (string & import("zod/v4").$brand<"UUID">) | null | undefined;
102
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
109
103
  assignedTo?: string | null | undefined;
104
+ dateOfEvent?: string | null | undefined;
105
+ updatedAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
110
106
  updatedBy?: string | null | undefined;
111
107
  };
112
108
  /**