@opencrvs/toolkit 2.0.0-rc.cb6a4d5 → 2.0.0-rc.cc79560

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.
@@ -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
  };
@@ -365,7 +365,9 @@ var ScopeType2 = z6.enum([
365
365
  var EncodedScope2 = z6.string().brand("EncodedScope");
366
366
  var DEFAULT_SCOPE_OPTIONS = {
367
367
  placeOfEvent: JurisdictionFilter.enum.all,
368
- accessLevel: JurisdictionFilter.enum.all
368
+ accessLevel: JurisdictionFilter.enum.all,
369
+ registeredIn: JurisdictionFilter.enum.all,
370
+ declaredIn: JurisdictionFilter.enum.all
369
371
  };
370
372
 
371
373
  // ../commons/src/users/userReferences.ts
@@ -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,
@@ -705,7 +704,9 @@ var decodeScope = (query) => {
705
704
  };
706
705
  var DEFAULT_SCOPE_OPTIONS = {
707
706
  placeOfEvent: JurisdictionFilter.enum.all,
708
- accessLevel: JurisdictionFilter.enum.all
707
+ accessLevel: JurisdictionFilter.enum.all,
708
+ registeredIn: JurisdictionFilter.enum.all,
709
+ declaredIn: JurisdictionFilter.enum.all
709
710
  };
710
711
  function getAcceptedScopesByType({
711
712
  acceptedScopes,
@@ -1078,7 +1079,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
1078
1079
  ShowConditional,
1079
1080
  // Action can be shown to the user in the list but as disabled
1080
1081
  EnableConditional
1081
- ]);
1082
+ ]).meta({
1083
+ description: "Action conditional configuration",
1084
+ id: "ActionConditional"
1085
+ });
1082
1086
  var DisplayOnReviewConditional = z7.object({
1083
1087
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
1084
1088
  conditional: Conditional
@@ -1737,6 +1741,9 @@ var FlagConfig = z15.object({
1737
1741
  "Indicates if this flag expects an action to be performed to be cleared."
1738
1742
  ),
1739
1743
  label: TranslationConfig.describe("Human readable label of the flag.")
1744
+ }).meta({
1745
+ description: "Flag configuration",
1746
+ id: "FlagConfig"
1740
1747
  });
1741
1748
  var ActionFlagConfig = z15.object({
1742
1749
  id: Flag,
@@ -1744,6 +1751,9 @@ var ActionFlagConfig = z15.object({
1744
1751
  conditional: Conditional.optional().describe(
1745
1752
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1746
1753
  )
1754
+ }).meta({
1755
+ description: "Action flag configuration",
1756
+ id: "ActionFlagConfig"
1747
1757
  });
1748
1758
 
1749
1759
  // ../commons/src/events/EventMetadata.ts
@@ -1765,8 +1775,7 @@ var ActionCreationMetadata = z16.object({
1765
1775
  ),
1766
1776
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1767
1777
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1768
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1769
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1778
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1770
1779
  });
1771
1780
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1772
1781
  registrationNumber: z16.string().describe(
@@ -1794,9 +1803,6 @@ var EventMetadata = z16.object({
1794
1803
  createdAtLocation: UUID.nullish().describe(
1795
1804
  "Location of the user who created the event."
1796
1805
  ),
1797
- createdBySignature: DocumentPath.nullish().describe(
1798
- "Signature of the user who created the event."
1799
- ),
1800
1806
  updatedAtLocation: UUID.nullish().describe(
1801
1807
  "Location of the user who last changed the status."
1802
1808
  ),
@@ -2171,7 +2177,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
2171
2177
  }
2172
2178
  }).describe("Unique identifier for the field");
2173
2179
  var FieldReference = import_v43.default.object({
2174
- $$field: FieldId,
2180
+ $$field: FieldId.describe("Id of the field to reference"),
2175
2181
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
2176
2182
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
2177
2183
  )
@@ -2884,10 +2890,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2884
2890
  type: z21.literal(PageTypes.enum.VERIFICATION),
2885
2891
  actions: VerificationActionConfig
2886
2892
  });
2887
- var PageConfig = z21.discriminatedUnion("type", [
2888
- FormPageConfig,
2889
- VerificationPageConfig
2890
- ]);
2893
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2894
+ description: "Page configuration",
2895
+ id: "PageConfig"
2896
+ });
2891
2897
 
2892
2898
  // ../commons/src/events/FormConfig.ts
2893
2899
  var DeclarationFormConfig = z22.object({
@@ -5368,7 +5374,7 @@ var _EventConfigBase = z33.object({
5368
5374
  ),
5369
5375
  label: TranslationConfig.describe("Human-readable label for the event type."),
5370
5376
  actions: z33.array(ActionConfig).describe(
5371
- "Configuration of system-defined actions associated with the event."
5377
+ "Configuration of core and custom actions associated with the event."
5372
5378
  ),
5373
5379
  actionOrder: z33.array(z33.string()).optional().describe(
5374
5380
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -5380,7 +5386,7 @@ var _EventConfigBase = z33.object({
5380
5386
  "Configuration of fields available in the advanced search feature."
5381
5387
  ),
5382
5388
  flags: z33.array(FlagConfig).optional().default([]).describe(
5383
- "Configuration of flags associated with the actions of this event type."
5389
+ "Configuration of custom flags associated with the actions of this event type."
5384
5390
  ),
5385
5391
  analytics: z33.boolean().optional().default(true).describe(
5386
5392
  "Indicates whether the records of this event type are included in analytics"
@@ -5819,18 +5825,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5819
5825
  query: true,
5820
5826
  columns: true
5821
5827
  });
5822
- var WorkqueueConfigInput = z37.object({
5823
- slug: z37.string().describe("Determines the url of the workqueue."),
5824
- name: TranslationConfig.describe(
5825
- "Title of the workflow (both in navigation and on the page)"
5826
- ),
5827
- query: CountryConfigQueryInputType,
5828
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
5829
- "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."
5830
- ),
5831
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
5832
- icon: AvailableIcons,
5833
- emptyMessage: TranslationConfig.optional()
5828
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
5829
+ query: CountryConfigQueryInputType
5830
+ }).meta({
5831
+ description: "Workqueue configuration",
5832
+ id: "WorkqueueConfig"
5834
5833
  });
5835
5834
  function defineWorkqueue(workqueueInput) {
5836
5835
  const queryInput = workqueueInput.query;
@@ -6147,7 +6146,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
6147
6146
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
6148
6147
  acceptedAt: acceptAction.createdAt,
6149
6148
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
6150
- createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
6151
6149
  registrationNumber
6152
6150
  };
6153
6151
  }
@@ -6361,17 +6359,6 @@ function getAssignedUserFromActions(actions) {
6361
6359
  return user2;
6362
6360
  }, null);
6363
6361
  }
6364
- function getAssignedUserSignatureFromActions(actions) {
6365
- return actions.reduce((signature, action) => {
6366
- if (action.type === ActionType.ASSIGN) {
6367
- return action.createdBySignature || null;
6368
- }
6369
- if (action.type === ActionType.UNASSIGN) {
6370
- return null;
6371
- }
6372
- return signature;
6373
- }, null);
6374
- }
6375
6362
  function deepDropNulls(obj) {
6376
6363
  if (Array.isArray(obj)) {
6377
6364
  return obj.map(deepDropNulls);
@@ -6467,10 +6454,8 @@ function getCurrentEventState(event2, config) {
6467
6454
  createdBy: creationAction.createdBy,
6468
6455
  createdByUserType: creationAction.createdByUserType,
6469
6456
  createdAtLocation: creationAction.createdAtLocation,
6470
- createdBySignature: creationAction.createdBySignature,
6471
6457
  updatedAt: acceptedActionMetadata.createdAt,
6472
6458
  assignedTo: getAssignedUserFromActions(acceptedActions),
6473
- assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
6474
6459
  updatedBy: requestActionMetadata.createdBy,
6475
6460
  updatedAtLocation: requestActionMetadata.createdAtLocation,
6476
6461
  declaration,
@@ -9729,7 +9714,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
9729
9714
  createdBy: overrides.createdBy ?? generateUuid(rng),
9730
9715
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
9731
9716
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
9732
- createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
9733
9717
  updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
9734
9718
  assignedTo: overrides.assignedTo ?? null,
9735
9719
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -0,0 +1,3 @@
1
+ declare function main(): Promise<void>;
2
+ export { main };
3
+ //# sourceMappingURL=fix-accept-requested-registration-function-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-accept-requested-registration-function-type.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/fix-accept-requested-registration-function-type.ts"],"names":[],"mappings":"AAuFA,iBAAe,IAAI,kBA6ClB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ /*
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
+ *
7
+ * OpenCRVS is also distributed under the terms of the Civil Registration
8
+ * & Healthcare Disclaimer located at http://opencrvs.org/license.
9
+ *
10
+ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
11
+ */
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.main = main;
26
+ /**
27
+ * Codemod: In `acceptRequestedRegistration`, update the `action` parameter type from:
28
+ * action: ActionInput
29
+ * to:
30
+ * action: Extract<ActionInput, { type?: 'REGISTER' }>
31
+ *
32
+ * What it does:
33
+ * - Scans all TypeScript files under `src/`
34
+ * - Finds `acceptRequestedRegistration` (function declaration or const assignment)
35
+ * - Rewrites only the `action` parameter when its type is exactly `ActionInput`
36
+ * - Saves modified files in-place
37
+ */
38
+ /* eslint-disable no-console */
39
+ const ts_morph_1 = require("ts-morph");
40
+ const path_1 = __importDefault(require("path"));
41
+ const TARGET_FUNCTION_NAME = 'acceptRequestedRegistration';
42
+ const ACTION_PARAMETER_NAME = 'action';
43
+ const OLD_TYPE = 'ActionInput';
44
+ const NEW_TYPE = "Extract<ActionInput, { type?: 'REGISTER' }>";
45
+ function isAcceptRequestedRegistrationParameter(parameter) {
46
+ const functionDeclaration = parameter.getFirstAncestorByKind(ts_morph_1.SyntaxKind.FunctionDeclaration);
47
+ if ((functionDeclaration === null || functionDeclaration === void 0 ? void 0 : functionDeclaration.getName()) === TARGET_FUNCTION_NAME) {
48
+ return true;
49
+ }
50
+ const arrowFunction = parameter.getFirstAncestorByKind(ts_morph_1.SyntaxKind.ArrowFunction);
51
+ const variableDeclaration = arrowFunction === null || arrowFunction === void 0 ? void 0 : arrowFunction.getFirstAncestorByKind(ts_morph_1.SyntaxKind.VariableDeclaration);
52
+ return (variableDeclaration === null || variableDeclaration === void 0 ? void 0 : variableDeclaration.getName()) === TARGET_FUNCTION_NAME;
53
+ }
54
+ function processFile(filePath, project) {
55
+ const sourceFile = project.getSourceFile(filePath);
56
+ if (!sourceFile)
57
+ return 0;
58
+ let updatedCount = 0;
59
+ for (const parameter of sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.Parameter)) {
60
+ if (parameter.getName() !== ACTION_PARAMETER_NAME) {
61
+ continue;
62
+ }
63
+ if (!isAcceptRequestedRegistrationParameter(parameter)) {
64
+ continue;
65
+ }
66
+ const typeNode = parameter.getTypeNode();
67
+ if (!typeNode || typeNode.getText() !== OLD_TYPE) {
68
+ continue;
69
+ }
70
+ parameter.setType(NEW_TYPE);
71
+ updatedCount++;
72
+ console.log(` [${path_1.default.relative(process.cwd(), filePath)}] Updated '${ACTION_PARAMETER_NAME}' in ${TARGET_FUNCTION_NAME} to ${NEW_TYPE}`);
73
+ }
74
+ return updatedCount;
75
+ }
76
+ function main() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const srcDir = path_1.default.join(process.cwd(), 'src');
79
+ console.log(`Scanning for ${TARGET_FUNCTION_NAME} in: ${srcDir}\n`);
80
+ const project = new ts_morph_1.Project({
81
+ tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
82
+ skipAddingFilesFromTsConfig: false
83
+ });
84
+ const sourceFiles = project.getSourceFiles().filter((sf) => {
85
+ const filePath = sf.getFilePath();
86
+ return filePath.includes('/src/') && !filePath.includes('/node_modules/');
87
+ });
88
+ let totalUpdated = 0;
89
+ const modifiedFiles = [];
90
+ for (const sourceFile of sourceFiles) {
91
+ const filePath = sourceFile.getFilePath();
92
+ const updated = processFile(filePath, project);
93
+ if (updated > 0) {
94
+ totalUpdated += updated;
95
+ modifiedFiles.push(filePath);
96
+ }
97
+ }
98
+ if (modifiedFiles.length === 0) {
99
+ console.log(`No '${ACTION_PARAMETER_NAME}: ${OLD_TYPE}' parameter in ${TARGET_FUNCTION_NAME} found. Nothing to do.`);
100
+ return;
101
+ }
102
+ console.log(`\nSaving ${modifiedFiles.length} modified file(s)...`);
103
+ for (const filePath of modifiedFiles) {
104
+ const sourceFile = project.getSourceFileOrThrow(filePath);
105
+ yield sourceFile.save();
106
+ console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
107
+ }
108
+ console.log(`\nDone. Updated ${totalUpdated} parameter type annotation(s) in ${TARGET_FUNCTION_NAME}.`);
109
+ });
110
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAgCpD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/index.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,iBAiCpD"}