@opencrvs/toolkit 2.0.0-rc.1f57a26 → 2.0.0-rc.1f6b78f

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 (37) hide show
  1. package/dist/application-config/index.js +24 -27
  2. package/dist/cli.js +389 -127
  3. package/dist/commons/api/router.d.ts +2642 -11347
  4. package/dist/commons/conditionals/validate.d.ts +1 -0
  5. package/dist/commons/events/ActionInput.d.ts +108 -0
  6. package/dist/commons/events/Draft.d.ts +3 -0
  7. package/dist/commons/events/EventIndex.d.ts +0 -3
  8. package/dist/commons/events/EventMetadata.d.ts +0 -7
  9. package/dist/commons/events/WorkqueueConfig.d.ts +146 -146
  10. package/dist/commons/events/state/index.d.ts +0 -4
  11. package/dist/commons/events/state/utils.d.ts +0 -2
  12. package/dist/commons/events/utils.d.ts +1 -1
  13. package/dist/events/index.js +51 -75
  14. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  15. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  16. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  17. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  18. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  19. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  20. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  21. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  22. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  23. package/dist/migrations/v2.0/index.d.ts +5 -3
  24. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  25. package/dist/migrations/v2.0/index.js +387 -125
  26. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  27. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  28. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  29. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  30. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  31. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  32. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  33. package/dist/notification/index.js +38 -45
  34. package/opencrvs-toolkit-2.0.0-rc.1f6b78f.tgz +0 -0
  35. package/package.json +1 -1
  36. package/tsconfig.tsbuildinfo +1 -1
  37. package/opencrvs-toolkit-2.0.0-rc.1f57a26.tgz +0 -0
@@ -910,6 +910,152 @@ export declare const WorkqueueConfigWithoutQuery: z.ZodObject<{
910
910
  export declare const WorkqueueConfigInput: z.ZodObject<{
911
911
  slug: z.ZodString;
912
912
  name: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
913
+ action: z.ZodOptional<z.ZodObject<{
914
+ type: z.ZodEnum<{
915
+ DELETE: "DELETE";
916
+ DECLARE: "DECLARE";
917
+ REGISTER: "REGISTER";
918
+ EDIT: "EDIT";
919
+ REJECT: "REJECT";
920
+ MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE";
921
+ ARCHIVE: "ARCHIVE";
922
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
923
+ REQUEST_CORRECTION: "REQUEST_CORRECTION";
924
+ READ: "READ";
925
+ }>;
926
+ }, z.core.$strip>>;
927
+ columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
928
+ label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
929
+ value: z.ZodObject<{
930
+ $event: z.ZodEnum<{
931
+ id: "id";
932
+ title: "title";
933
+ type: "type";
934
+ updatedAt: "updatedAt";
935
+ placeOfEvent: "placeOfEvent";
936
+ createdByUserType: "createdByUserType";
937
+ createdAt: "createdAt";
938
+ createdBy: "createdBy";
939
+ createdAtLocation: "createdAtLocation";
940
+ status: "status";
941
+ assignedTo: "assignedTo";
942
+ trackingId: "trackingId";
943
+ legalStatuses: "legalStatuses";
944
+ dateOfEvent: "dateOfEvent";
945
+ updatedByUserRole: "updatedByUserRole";
946
+ updatedAtLocation: "updatedAtLocation";
947
+ updatedBy: "updatedBy";
948
+ flags: "flags";
949
+ outbox: "outbox";
950
+ }>;
951
+ }, z.core.$strip>;
952
+ }, z.core.$strip>>>;
953
+ icon: z.ZodEnum<{
954
+ Archived: "Archived";
955
+ Assigned: "Assigned";
956
+ Briefcase: "Briefcase";
957
+ Certified: "Certified";
958
+ Close: "Close";
959
+ Collapse: "Collapse";
960
+ Draft: "Draft";
961
+ DuplicateYellow: "DuplicateYellow";
962
+ Expand: "Expand";
963
+ ExternalValidate: "ExternalValidate";
964
+ FilledCheck: "FilledCheck";
965
+ InReview: "InReview";
966
+ Offline: "Offline";
967
+ Registered: "Registered";
968
+ RequiresUpdates: "RequiresUpdates";
969
+ Sent: "Sent";
970
+ Validated: "Validated";
971
+ WaitingApproval: "WaitingApproval";
972
+ ChartActivity: "ChartActivity";
973
+ Activity: "Activity";
974
+ Archive: "Archive";
975
+ ArchiveTray: "ArchiveTray";
976
+ ArrowLeft: "ArrowLeft";
977
+ ArrowRight: "ArrowRight";
978
+ Buildings: "Buildings";
979
+ Circle: "Circle";
980
+ CaretDown: "CaretDown";
981
+ CaretLeft: "CaretLeft";
982
+ CaretRight: "CaretRight";
983
+ ChartBar: "ChartBar";
984
+ ChartLine: "ChartLine";
985
+ ChatCircle: "ChatCircle";
986
+ CheckSquare: "CheckSquare";
987
+ Compass: "Compass";
988
+ Check: "Check";
989
+ Copy: "Copy";
990
+ Database: "Database";
991
+ DotsThreeVertical: "DotsThreeVertical";
992
+ ArrowCounterClockwise: "ArrowCounterClockwise";
993
+ MagnifyingGlassMinus: "MagnifyingGlassMinus";
994
+ MagnifyingGlassPlus: "MagnifyingGlassPlus";
995
+ Export: "Export";
996
+ Eye: "Eye";
997
+ EyeSlash: "EyeSlash";
998
+ Envelope: "Envelope";
999
+ File: "File";
1000
+ FileSearch: "FileSearch";
1001
+ FileMinus: "FileMinus";
1002
+ FilePlus: "FilePlus";
1003
+ FileText: "FileText";
1004
+ FileX: "FileX";
1005
+ Handshake: "Handshake";
1006
+ Gear: "Gear";
1007
+ GitBranch: "GitBranch";
1008
+ IdentificationCard: "IdentificationCard";
1009
+ List: "List";
1010
+ ListBullets: "ListBullets";
1011
+ Lock: "Lock";
1012
+ MagnifyingGlass: "MagnifyingGlass";
1013
+ MapPin: "MapPin";
1014
+ Medal: "Medal";
1015
+ NotePencil: "NotePencil";
1016
+ Paperclip: "Paperclip";
1017
+ PaperPlaneTilt: "PaperPlaneTilt";
1018
+ Pen: "Pen";
1019
+ PenNib: "PenNib";
1020
+ Pencil: "Pencil";
1021
+ PencilSimpleLine: "PencilSimpleLine";
1022
+ Phone: "Phone";
1023
+ Plus: "Plus";
1024
+ Printer: "Printer";
1025
+ SignOut: "SignOut";
1026
+ Stamp: "Stamp";
1027
+ Star: "Star";
1028
+ Target: "Target";
1029
+ TextT: "TextT";
1030
+ Trash: "Trash";
1031
+ UploadSimple: "UploadSimple";
1032
+ User: "User";
1033
+ UserPlus: "UserPlus";
1034
+ Users: "Users";
1035
+ WarningCircle: "WarningCircle";
1036
+ X: "X";
1037
+ ChatText: "ChatText";
1038
+ CircleWavyCheck: "CircleWavyCheck";
1039
+ CircleWavyQuestion: "CircleWavyQuestion";
1040
+ ArchiveBox: "ArchiveBox";
1041
+ ArrowCircleDown: "ArrowCircleDown";
1042
+ FileArrowUp: "FileArrowUp";
1043
+ FileDotted: "FileDotted";
1044
+ Files: "Files";
1045
+ PencilLine: "PencilLine";
1046
+ PencilCircle: "PencilCircle";
1047
+ UserCircle: "UserCircle";
1048
+ Clock: "Clock";
1049
+ QrCode: "QrCode";
1050
+ Webcam: "Webcam";
1051
+ Sun: "Sun";
1052
+ DeviceTabletCamera: "DeviceTabletCamera";
1053
+ Globe: "Globe";
1054
+ Fingerprint: "Fingerprint";
1055
+ PushPin: "PushPin";
1056
+ Timer: "Timer";
1057
+ }>;
1058
+ emptyMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
913
1059
  query: z.ZodUnion<readonly [z.ZodObject<{
914
1060
  eventType: z.ZodOptional<z.ZodString>;
915
1061
  status: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
@@ -1838,152 +1984,6 @@ export declare const WorkqueueConfigInput: z.ZodObject<{
1838
1984
  data: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
1839
1985
  }, z.core.$strip>>;
1840
1986
  }, z.core.$strip>]>;
1841
- action: z.ZodOptional<z.ZodObject<{
1842
- type: z.ZodEnum<{
1843
- DELETE: "DELETE";
1844
- DECLARE: "DECLARE";
1845
- REGISTER: "REGISTER";
1846
- EDIT: "EDIT";
1847
- REJECT: "REJECT";
1848
- MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE";
1849
- ARCHIVE: "ARCHIVE";
1850
- PRINT_CERTIFICATE: "PRINT_CERTIFICATE";
1851
- REQUEST_CORRECTION: "REQUEST_CORRECTION";
1852
- READ: "READ";
1853
- }>;
1854
- }, z.core.$strip>>;
1855
- columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
1856
- label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
1857
- value: z.ZodObject<{
1858
- $event: z.ZodEnum<{
1859
- id: "id";
1860
- title: "title";
1861
- type: "type";
1862
- updatedAt: "updatedAt";
1863
- placeOfEvent: "placeOfEvent";
1864
- createdByUserType: "createdByUserType";
1865
- createdAt: "createdAt";
1866
- createdBy: "createdBy";
1867
- createdAtLocation: "createdAtLocation";
1868
- status: "status";
1869
- assignedTo: "assignedTo";
1870
- trackingId: "trackingId";
1871
- legalStatuses: "legalStatuses";
1872
- dateOfEvent: "dateOfEvent";
1873
- updatedByUserRole: "updatedByUserRole";
1874
- updatedAtLocation: "updatedAtLocation";
1875
- updatedBy: "updatedBy";
1876
- flags: "flags";
1877
- outbox: "outbox";
1878
- }>;
1879
- }, z.core.$strip>;
1880
- }, z.core.$strip>>>;
1881
- icon: z.ZodEnum<{
1882
- Archived: "Archived";
1883
- Assigned: "Assigned";
1884
- Briefcase: "Briefcase";
1885
- Certified: "Certified";
1886
- Close: "Close";
1887
- Collapse: "Collapse";
1888
- Draft: "Draft";
1889
- DuplicateYellow: "DuplicateYellow";
1890
- Expand: "Expand";
1891
- ExternalValidate: "ExternalValidate";
1892
- FilledCheck: "FilledCheck";
1893
- InReview: "InReview";
1894
- Offline: "Offline";
1895
- Registered: "Registered";
1896
- RequiresUpdates: "RequiresUpdates";
1897
- Sent: "Sent";
1898
- Validated: "Validated";
1899
- WaitingApproval: "WaitingApproval";
1900
- ChartActivity: "ChartActivity";
1901
- Activity: "Activity";
1902
- Archive: "Archive";
1903
- ArchiveTray: "ArchiveTray";
1904
- ArrowLeft: "ArrowLeft";
1905
- ArrowRight: "ArrowRight";
1906
- Buildings: "Buildings";
1907
- Circle: "Circle";
1908
- CaretDown: "CaretDown";
1909
- CaretLeft: "CaretLeft";
1910
- CaretRight: "CaretRight";
1911
- ChartBar: "ChartBar";
1912
- ChartLine: "ChartLine";
1913
- ChatCircle: "ChatCircle";
1914
- CheckSquare: "CheckSquare";
1915
- Compass: "Compass";
1916
- Check: "Check";
1917
- Copy: "Copy";
1918
- Database: "Database";
1919
- DotsThreeVertical: "DotsThreeVertical";
1920
- ArrowCounterClockwise: "ArrowCounterClockwise";
1921
- MagnifyingGlassMinus: "MagnifyingGlassMinus";
1922
- MagnifyingGlassPlus: "MagnifyingGlassPlus";
1923
- Export: "Export";
1924
- Eye: "Eye";
1925
- EyeSlash: "EyeSlash";
1926
- Envelope: "Envelope";
1927
- File: "File";
1928
- FileSearch: "FileSearch";
1929
- FileMinus: "FileMinus";
1930
- FilePlus: "FilePlus";
1931
- FileText: "FileText";
1932
- FileX: "FileX";
1933
- Handshake: "Handshake";
1934
- Gear: "Gear";
1935
- GitBranch: "GitBranch";
1936
- IdentificationCard: "IdentificationCard";
1937
- List: "List";
1938
- ListBullets: "ListBullets";
1939
- Lock: "Lock";
1940
- MagnifyingGlass: "MagnifyingGlass";
1941
- MapPin: "MapPin";
1942
- Medal: "Medal";
1943
- NotePencil: "NotePencil";
1944
- Paperclip: "Paperclip";
1945
- PaperPlaneTilt: "PaperPlaneTilt";
1946
- Pen: "Pen";
1947
- PenNib: "PenNib";
1948
- Pencil: "Pencil";
1949
- PencilSimpleLine: "PencilSimpleLine";
1950
- Phone: "Phone";
1951
- Plus: "Plus";
1952
- Printer: "Printer";
1953
- SignOut: "SignOut";
1954
- Stamp: "Stamp";
1955
- Star: "Star";
1956
- Target: "Target";
1957
- TextT: "TextT";
1958
- Trash: "Trash";
1959
- UploadSimple: "UploadSimple";
1960
- User: "User";
1961
- UserPlus: "UserPlus";
1962
- Users: "Users";
1963
- WarningCircle: "WarningCircle";
1964
- X: "X";
1965
- ChatText: "ChatText";
1966
- CircleWavyCheck: "CircleWavyCheck";
1967
- CircleWavyQuestion: "CircleWavyQuestion";
1968
- ArchiveBox: "ArchiveBox";
1969
- ArrowCircleDown: "ArrowCircleDown";
1970
- FileArrowUp: "FileArrowUp";
1971
- FileDotted: "FileDotted";
1972
- Files: "Files";
1973
- PencilLine: "PencilLine";
1974
- PencilCircle: "PencilCircle";
1975
- UserCircle: "UserCircle";
1976
- Clock: "Clock";
1977
- QrCode: "QrCode";
1978
- Webcam: "Webcam";
1979
- Sun: "Sun";
1980
- DeviceTabletCamera: "DeviceTabletCamera";
1981
- Globe: "Globe";
1982
- Fingerprint: "Fingerprint";
1983
- PushPin: "PushPin";
1984
- Timer: "Timer";
1985
- }>;
1986
- emptyMessage: z.ZodOptional<z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>>;
1987
1987
  }, z.core.$strip>;
1988
1988
  export type WorkqueueConfig = z.infer<typeof WorkqueueConfig>;
1989
1989
  export type WorkqueueConfigWithoutQuery = z.infer<typeof WorkqueueConfigWithoutQuery>;
@@ -9,7 +9,6 @@ import { UUID } from '../../uuid';
9
9
  import { DocumentPath } from '../../documents';
10
10
  export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
- export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): string | null;
13
12
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
14
13
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
15
14
  } : T extends UUID ? T : T extends DocumentPath ? T : T extends string ? NonNullable<T> : T extends (infer U)[] ? NonNullableDeep<U>[] : T extends object ? {
@@ -73,7 +72,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
73
72
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
74
73
  createdByUserType?: "user" | "system" | null | undefined;
75
74
  createdByRole?: string | undefined;
76
- createdBySignature?: string | null | undefined;
77
75
  } | null | undefined;
78
76
  REGISTERED?: {
79
77
  createdAt: string;
@@ -83,7 +81,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
83
81
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
84
82
  createdByUserType?: "user" | "system" | null | undefined;
85
83
  createdByRole?: string | undefined;
86
- createdBySignature?: string | null | undefined;
87
84
  } | null | undefined;
88
85
  };
89
86
  createdAt: string;
@@ -101,7 +98,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
101
98
  createdByUserType?: "user" | "system" | null | undefined;
102
99
  updatedByUserRole?: string | null | undefined;
103
100
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
104
- createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
105
101
  updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
106
102
  assignedTo?: string | null | undefined;
107
103
  updatedBy?: string | null | undefined;
@@ -312,7 +312,6 @@ export declare function getLegalStatuses(actions: Action[]): {
312
312
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
313
313
  acceptedAt: string;
314
314
  createdByRole: string | undefined;
315
- createdBySignature: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
316
315
  registrationNumber: string | null | undefined;
317
316
  } | null;
318
317
  REGISTERED: {
@@ -322,7 +321,6 @@ export declare function getLegalStatuses(actions: Action[]): {
322
321
  createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
323
322
  acceptedAt: string;
324
323
  createdByRole: string | undefined;
325
- createdBySignature: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
326
324
  registrationNumber: string | null | undefined;
327
325
  } | null;
328
326
  };
@@ -131,7 +131,7 @@ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate
131
131
  * * @param validatorContext - custom validation context
132
132
  * @returns {Partial<T>} A new object containing only the values for visible fields
133
133
  */
134
- export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean, declarationContext?: EventState): Partial<T>;
134
+ export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<T>;
135
135
  export declare function omitHiddenPaginatedFields<T extends EventState | ActionUpdate>(formConfig: FormConfig, values: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<Partial<T>>;
136
136
  /**
137
137
  *
@@ -306,7 +306,6 @@ __export(events_exports, {
306
306
  getAllUniqueFields: () => getAllUniqueFields,
307
307
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
308
308
  getAssignedUserFromActions: () => getAssignedUserFromActions,
309
- getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
310
309
  getAssignmentStatus: () => getAssignmentStatus,
311
310
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
312
311
  getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
@@ -1078,7 +1077,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
1078
1077
  ShowConditional,
1079
1078
  // Action can be shown to the user in the list but as disabled
1080
1079
  EnableConditional
1081
- ]);
1080
+ ]).meta({
1081
+ description: "Action conditional configuration",
1082
+ id: "ActionConditional"
1083
+ });
1082
1084
  var DisplayOnReviewConditional = z7.object({
1083
1085
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
1084
1086
  conditional: Conditional
@@ -1414,28 +1416,20 @@ function schemaPriority(schema) {
1414
1416
  return idx === -1 ? 9999 : idx;
1415
1417
  }
1416
1418
  function safeUnion(schemas) {
1419
+ const sortedSchemas = [...schemas].sort(
1420
+ (a, b) => schemaPriority(a) - schemaPriority(b)
1421
+ );
1417
1422
  return z12.any().superRefine((val, ctx) => {
1418
- const successful = schemas.filter((s) => s.safeParse(val).success);
1419
- if (successful.length === 1) {
1420
- return;
1421
- }
1422
- if (successful.length === 0) {
1423
- ctx.addIssue({
1424
- code: "invalid_type",
1425
- expected: "custom",
1426
- message: "Value does not match any schema"
1427
- });
1428
- return;
1429
- }
1430
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
1431
- const best = successful[0];
1432
- if (!best.safeParse(val).success) {
1433
- ctx.addIssue({
1434
- expected: "custom",
1435
- code: "invalid_type",
1436
- message: "Value did not match the best schema"
1437
- });
1423
+ for (const schema of sortedSchemas) {
1424
+ if (schema.safeParse(val).success) {
1425
+ return;
1426
+ }
1438
1427
  }
1428
+ ctx.addIssue({
1429
+ code: "invalid_type",
1430
+ expected: "custom",
1431
+ message: "Value does not match any schema"
1432
+ });
1439
1433
  }).meta({
1440
1434
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1441
1435
  });
@@ -1745,6 +1739,9 @@ var FlagConfig = z15.object({
1745
1739
  "Indicates if this flag expects an action to be performed to be cleared."
1746
1740
  ),
1747
1741
  label: TranslationConfig.describe("Human readable label of the flag.")
1742
+ }).meta({
1743
+ description: "Flag configuration",
1744
+ id: "FlagConfig"
1748
1745
  });
1749
1746
  var ActionFlagConfig = z15.object({
1750
1747
  id: Flag,
@@ -1752,6 +1749,9 @@ var ActionFlagConfig = z15.object({
1752
1749
  conditional: Conditional.optional().describe(
1753
1750
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1754
1751
  )
1752
+ }).meta({
1753
+ description: "Action flag configuration",
1754
+ id: "ActionFlagConfig"
1755
1755
  });
1756
1756
 
1757
1757
  // ../commons/src/events/EventMetadata.ts
@@ -1773,8 +1773,7 @@ var ActionCreationMetadata = z16.object({
1773
1773
  ),
1774
1774
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1775
1775
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1776
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1777
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1776
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1778
1777
  });
1779
1778
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1780
1779
  registrationNumber: z16.string().describe(
@@ -1802,9 +1801,6 @@ var EventMetadata = z16.object({
1802
1801
  createdAtLocation: UUID.nullish().describe(
1803
1802
  "Location of the user who created the event."
1804
1803
  ),
1805
- createdBySignature: DocumentPath.nullish().describe(
1806
- "Signature of the user who created the event."
1807
- ),
1808
1804
  updatedAtLocation: UUID.nullish().describe(
1809
1805
  "Location of the user who last changed the status."
1810
1806
  ),
@@ -2179,7 +2175,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
2179
2175
  }
2180
2176
  }).describe("Unique identifier for the field");
2181
2177
  var FieldReference = import_v43.default.object({
2182
- $$field: FieldId,
2178
+ $$field: FieldId.describe("Id of the field to reference"),
2183
2179
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
2184
2180
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
2185
2181
  )
@@ -2892,10 +2888,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2892
2888
  type: z21.literal(PageTypes.enum.VERIFICATION),
2893
2889
  actions: VerificationActionConfig
2894
2890
  });
2895
- var PageConfig = z21.discriminatedUnion("type", [
2896
- FormPageConfig,
2897
- VerificationPageConfig
2898
- ]);
2891
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2892
+ description: "Page configuration",
2893
+ id: "PageConfig"
2894
+ });
2899
2895
 
2900
2896
  // ../commons/src/events/FormConfig.ts
2901
2897
  var DeclarationFormConfig = z22.object({
@@ -3804,6 +3800,9 @@ function precompileActionSchemas(eventConfigurations) {
3804
3800
  function isAgeValue(value) {
3805
3801
  return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
3806
3802
  }
3803
+ function mergeWithBaseFormState(values, context) {
3804
+ return { ...context.baseFormState, ...values };
3805
+ }
3807
3806
  function validate(schema, data) {
3808
3807
  const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
3809
3808
  if ("$form" in data) {
@@ -3842,7 +3841,7 @@ function isOnline() {
3842
3841
  }
3843
3842
  function isConditionMet(conditional, values, context, eventIndex) {
3844
3843
  return validate(conditional, {
3845
- $form: values,
3844
+ $form: mergeWithBaseFormState(values, context),
3846
3845
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3847
3846
  $online: isOnline(),
3848
3847
  $user: context.user,
@@ -3871,7 +3870,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
3871
3870
  return true;
3872
3871
  }
3873
3872
  const validConditionals = getConditionalActionsForField(field3, {
3874
- $form: form,
3873
+ $form: mergeWithBaseFormState(form, context),
3875
3874
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3876
3875
  $online: isOnline(),
3877
3876
  $user: context.user,
@@ -4063,7 +4062,7 @@ function runFieldValidations({
4063
4062
  return [];
4064
4063
  }
4065
4064
  const conditionalParameters = {
4066
- $form: form,
4065
+ $form: mergeWithBaseFormState(form, context),
4067
4066
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
4068
4067
  /**
4069
4068
  * In real use cases, there can be hundreds of thousands of locations.
@@ -4307,17 +4306,16 @@ function isPageVisible(page, formValues, context) {
4307
4306
  }
4308
4307
  return isConditionMet(page.conditional, formValues, context);
4309
4308
  }
4310
- function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false, declarationContext) {
4309
+ function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
4311
4310
  const base = (0, import_lodash.cloneDeep)(formValues);
4312
4311
  function fn(prevVisibilityContext) {
4313
- const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
4314
4312
  const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
4315
4313
  const fieldConfig = fields.filter((f) => f.id === fieldId);
4316
4314
  if (!fieldConfig.length) {
4317
4315
  return false;
4318
4316
  }
4319
4317
  const isHidden = fieldConfig.every(
4320
- (f) => !isFieldVisible(f, visibilityForm, validatorContext)
4318
+ (f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
4321
4319
  );
4322
4320
  if (!isHidden) {
4323
4321
  return false;
@@ -4335,7 +4333,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
4335
4333
  const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4336
4334
  const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4337
4335
  const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
4338
- return hiddenFields.some((f) => f.id === fieldId);
4336
+ return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
4339
4337
  });
4340
4338
  return omitHiddenFields(
4341
4339
  visibleFields,
@@ -4382,13 +4380,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
4382
4380
  }
4383
4381
  function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
4384
4382
  const annotationFields = getActionAnnotationFields(actionConfig);
4385
- return omitHiddenFields(
4386
- annotationFields,
4387
- annotation,
4388
- context,
4389
- false,
4390
- declaration
4391
- );
4383
+ return omitHiddenFields(annotationFields, annotation, {
4384
+ ...context,
4385
+ baseFormState: declaration
4386
+ });
4392
4387
  }
4393
4388
  function deepMerge(currentDocument, actionDocument) {
4394
4389
  const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
@@ -5377,7 +5372,7 @@ var _EventConfigBase = z33.object({
5377
5372
  ),
5378
5373
  label: TranslationConfig.describe("Human-readable label for the event type."),
5379
5374
  actions: z33.array(ActionConfig).describe(
5380
- "Configuration of system-defined actions associated with the event."
5375
+ "Configuration of core and custom actions associated with the event."
5381
5376
  ),
5382
5377
  actionOrder: z33.array(z33.string()).optional().describe(
5383
5378
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -5389,7 +5384,7 @@ var _EventConfigBase = z33.object({
5389
5384
  "Configuration of fields available in the advanced search feature."
5390
5385
  ),
5391
5386
  flags: z33.array(FlagConfig).optional().default([]).describe(
5392
- "Configuration of flags associated with the actions of this event type."
5387
+ "Configuration of custom flags associated with the actions of this event type."
5393
5388
  ),
5394
5389
  analytics: z33.boolean().optional().default(true).describe(
5395
5390
  "Indicates whether the records of this event type are included in analytics"
@@ -5828,18 +5823,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5828
5823
  query: true,
5829
5824
  columns: true
5830
5825
  });
5831
- var WorkqueueConfigInput = z37.object({
5832
- slug: z37.string().describe("Determines the url of the workqueue."),
5833
- name: TranslationConfig.describe(
5834
- "Title of the workflow (both in navigation and on the page)"
5835
- ),
5836
- query: CountryConfigQueryInputType,
5837
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
5838
- "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
5839
- ),
5840
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
5841
- icon: AvailableIcons,
5842
- emptyMessage: TranslationConfig.optional()
5826
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
5827
+ query: CountryConfigQueryInputType
5828
+ }).meta({
5829
+ description: "Workqueue configuration",
5830
+ id: "WorkqueueConfig"
5843
5831
  });
5844
5832
  function defineWorkqueue(workqueueInput) {
5845
5833
  const queryInput = workqueueInput.query;
@@ -5900,6 +5888,9 @@ var BaseActionInput = z38.object({
5900
5888
  originalActionId: UUID.optional(),
5901
5889
  // should not be part of base action.
5902
5890
  keepAssignment: z38.boolean().optional(),
5891
+ keepAssignmentIfAccepted: z38.boolean().optional(),
5892
+ keepAssignmentIfRejected: z38.boolean().optional(),
5893
+ waitFor: z38.boolean().optional(),
5903
5894
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5904
5895
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
5905
5896
  createdAtLocation: UUID.nullish().describe(
@@ -6153,7 +6144,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
6153
6144
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
6154
6145
  acceptedAt: acceptAction.createdAt,
6155
6146
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
6156
- createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
6157
6147
  registrationNumber
6158
6148
  };
6159
6149
  }
@@ -6367,17 +6357,6 @@ function getAssignedUserFromActions(actions) {
6367
6357
  return user2;
6368
6358
  }, null);
6369
6359
  }
6370
- function getAssignedUserSignatureFromActions(actions) {
6371
- return actions.reduce((signature, action) => {
6372
- if (action.type === ActionType.ASSIGN) {
6373
- return action.createdBySignature || null;
6374
- }
6375
- if (action.type === ActionType.UNASSIGN) {
6376
- return null;
6377
- }
6378
- return signature;
6379
- }, null);
6380
- }
6381
6360
  function deepDropNulls(obj) {
6382
6361
  if (Array.isArray(obj)) {
6383
6362
  return obj.map(deepDropNulls);
@@ -6473,10 +6452,8 @@ function getCurrentEventState(event2, config) {
6473
6452
  createdBy: creationAction.createdBy,
6474
6453
  createdByUserType: creationAction.createdByUserType,
6475
6454
  createdAtLocation: creationAction.createdAtLocation,
6476
- createdBySignature: creationAction.createdBySignature,
6477
6455
  updatedAt: acceptedActionMetadata.createdAt,
6478
6456
  assignedTo: getAssignedUserFromActions(acceptedActions),
6479
- assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
6480
6457
  updatedBy: requestActionMetadata.createdBy,
6481
6458
  updatedAtLocation: requestActionMetadata.createdAtLocation,
6482
6459
  declaration,
@@ -9735,7 +9712,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
9735
9712
  createdBy: overrides.createdBy ?? generateUuid(rng),
9736
9713
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
9737
9714
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
9738
- createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
9739
9715
  updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
9740
9716
  assignedTo: overrides.assignedTo ?? null,
9741
9717
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -1,5 +1,5 @@
1
1
  export declare const UPSTREAM_URL = "https://github.com/opencrvs/opencrvs-countryconfig.git";
2
- export declare const UPSTREAM_BRANCH = "develop";
2
+ export declare const UPSTREAM_BRANCH = "release-v2.0.0";
3
3
  /**
4
4
  * Runs a git command in the country config working directory.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAG1D,eAAO,MAAM,eAAe,YAAY,CAAA;AAcxC;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"checkout-upstream-files.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/checkout-upstream-files.ts"],"names":[],"mappings":"AA8CA,eAAO,MAAM,YAAY,2DACiC,CAAA;AAE1D,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAc/C;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,EAAE,MAAc,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,MAAM,CAMR;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAO9C;AAED,wBAAgB,eAAe,IAAI,IAAI,CAMtC;AAID,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}