@opencrvs/toolkit 2.0.0-rc.fef9d21 → 2.0.0-rc.ff04b30

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 (52) hide show
  1. package/create-countryconfig/index.js +73 -0
  2. package/create-countryconfig/package.json +11 -0
  3. package/dist/application-config/index.js +68 -39
  4. package/dist/cli.js +539 -175
  5. package/dist/commons/api/router.d.ts +3334 -271
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  8. package/dist/commons/conditionals/validate.d.ts +1 -0
  9. package/dist/commons/events/ActionInput.d.ts +108 -0
  10. package/dist/commons/events/Draft.d.ts +3 -0
  11. package/dist/commons/events/EventIndex.d.ts +0 -3
  12. package/dist/commons/events/EventMetadata.d.ts +0 -7
  13. package/dist/commons/events/FieldConfig.d.ts +10 -0
  14. package/dist/commons/events/WorkqueueConfig.d.ts +146 -146
  15. package/dist/commons/events/locations.d.ts +38 -1
  16. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  17. package/dist/commons/events/scopes.d.ts +24 -1
  18. package/dist/commons/events/state/index.d.ts +0 -4
  19. package/dist/commons/events/state/utils.d.ts +0 -2
  20. package/dist/commons/events/utils.d.ts +1 -1
  21. package/dist/conditionals/index.js +40 -8
  22. package/dist/events/index.js +184 -83
  23. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  24. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  25. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  26. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  27. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  28. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  29. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  31. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  32. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  33. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  34. package/dist/migrations/v2.0/index.d.ts +5 -3
  35. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  36. package/dist/migrations/v2.0/index.js +537 -173
  37. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  39. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  40. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  42. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  44. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  46. package/dist/notification/index.js +78 -53
  47. package/dist/scopes/index.d.ts +87 -10
  48. package/dist/scopes/index.js +46 -9
  49. package/opencrvs-toolkit-2.0.0-rc.ff04b30.tgz +0 -0
  50. package/package.json +1 -1
  51. package/tsconfig.tsbuildinfo +1 -1
  52. package/opencrvs-toolkit-2.0.0-rc.fef9d21.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>;
@@ -1,7 +1,8 @@
1
+ import { UUID } from '../uuid';
1
2
  import * as z from 'zod/v4';
2
3
  import { EventIndex } from './EventIndex';
3
4
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
4
- import { RecordScopeV2 } from '../scopes';
5
+ import { RecordScopeV2, UserScopeV2 } from '../scopes';
5
6
  import { SystemContext, UserContext } from '../users/User';
6
7
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
7
8
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -51,11 +52,47 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
51
52
  *
52
53
  */
53
54
  export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
55
+ export type UserWithResolvedHierarchy = {
56
+ role: string;
57
+ administrativeHierarchy: UUID[];
58
+ primaryOfficeId: UUID;
59
+ };
60
+ export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
61
+ userToAccess: UserWithResolvedHierarchy;
62
+ scope: UserScopeV2;
63
+ user: UserContext | SystemContext;
64
+ }): boolean;
65
+ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
66
+ scopes: UserScopeV2[];
67
+ userToAccess: UserWithResolvedHierarchy;
68
+ user: UserContext | SystemContext;
69
+ }): boolean;
54
70
  /**
55
71
  * Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
56
72
  *
57
73
  * One of the scopes must allow access for the event to be accessible.
58
74
  */
59
75
  export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
76
+ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
77
+ id: string & z.core.$brand<"UUID">;
78
+ name: string;
79
+ parentId: (string & z.core.$brand<"UUID">) | null;
80
+ validUntil: string | null;
81
+ externalId?: string | null | undefined;
82
+ }[];
83
+ /**
84
+ * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
85
+ *
86
+ * If the ID refers to a `Location` (e.g. CRVS office), the hierarchy includes
87
+ * the administrative area ancestors followed by the location itself.
88
+ * If the ID refers to an `AdministrativeArea`, returns the area's ancestor chain (root-first).
89
+ *
90
+ * Uses `getAdministrativeAreaHierarchy` which returns leaf-first order,
91
+ * so the result is reversed to match the root-first convention used by the server.
92
+ */
93
+ export declare function getLocationHierarchy(selectedId: UUID, context: {
94
+ administrativeAreas: Map<UUID, AdministrativeArea>;
95
+ locations: Map<UUID, Location>;
96
+ }): UUID[];
60
97
  export {};
61
98
  //# sourceMappingURL=locations.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { AdministrativeArea, Location } from './locations';
2
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: AdministrativeArea[];
3
+ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
4
+ export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
5
+ id: string & import("zod").$brand<"UUID">;
6
+ name: string;
7
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8
+ validUntil: string | null;
9
+ locationType: string | null;
10
+ externalId?: string | null | undefined;
11
+ }>;
12
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
+ id: string & import("zod").$brand<"UUID">;
14
+ name: string;
15
+ parentId: (string & import("zod").$brand<"UUID">) | null;
16
+ validUntil: string | null;
17
+ externalId?: string | null | undefined;
18
+ }>;
19
+ //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope } from '../scopes';
2
+ import { EncodedScope, UserScopeV2 } from '../scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
6
+ import { UUID } from 'src/uuid';
6
7
  export declare const ACTION_SCOPE_MAP: {
7
8
  READ: "record.read"[];
8
9
  CREATE: "record.create"[];
@@ -53,4 +54,26 @@ export declare function isActionInScope({ scopes, action, event, currentUser }:
53
54
  event: EventIndexWithAdministrativeHierarchy;
54
55
  currentUser: UserContext;
55
56
  }): boolean;
57
+ /**
58
+ *
59
+ *
60
+ * @param allRoles - All possible roles in the system
61
+ * @param userLocation - The location and role information of the user whose role options are being determined
62
+ * @param acceptedScopes - The scopes of the user requesting the role update, used to determine which roles they can assign.
63
+ * @param userRequesting - The user context of the user requesting the role update, used to check location-based access to the target user's location.
64
+ *
65
+ * @returns An array of roles that the requesting user is allowed to assign to the target user based on their scopes and location
66
+ *
67
+ * 1) Used to determine which roles should be available in the dropdown when a user is editing another user's role in the user management interface.
68
+ * 2) Used to check if payload includes valid role.
69
+ */
70
+ export declare function getAvailableRolesForUserUpdatePayload({ allRoles, userLocation, acceptedScopes, userRequesting }: {
71
+ allRoles: string[];
72
+ userRequesting: UserContext;
73
+ acceptedScopes: UserScopeV2[];
74
+ userLocation: {
75
+ administrativeHierarchy: UUID[];
76
+ primaryOfficeId: UUID;
77
+ };
78
+ }): string[];
56
79
  //# sourceMappingURL=scopes.d.ts.map
@@ -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
  *
@@ -182,6 +182,10 @@ var scopeByEvent = z6.preprocess(
182
182
  (val) => val === void 0 ? void 0 : [val].flat(),
183
183
  z6.array(z6.string()).optional()
184
184
  ).describe("Event type, e.g. birth, death");
185
+ var userRole = z6.preprocess(
186
+ (val) => val === void 0 ? void 0 : [val].flat(),
187
+ z6.array(z6.string()).optional()
188
+ ).describe("User role, e.g. admin, field agent");
185
189
  var scopeOptionsPlaceEvent = z6.object({
186
190
  event: scopeByEvent,
187
191
  placeOfEvent: JurisdictionFilter.optional()
@@ -205,6 +209,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
205
209
  var AccessLevelOptions = z6.object({
206
210
  accessLevel: JurisdictionFilter.optional()
207
211
  });
212
+ var AllUserScopeOptions = AccessLevelOptions.extend({
213
+ role: userRole.optional()
214
+ });
208
215
  var WorkqueueOrDashboardOptions = z6.object({
209
216
  ids: z6.preprocess(
210
217
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -214,6 +221,7 @@ var WorkqueueOrDashboardOptions = z6.object({
214
221
  var AllScopeOptions = z6.object({
215
222
  ...AllRecordScopeOptions.shape,
216
223
  ...AccessLevelOptions.shape,
224
+ ...AllUserScopeOptions.shape,
217
225
  ...WorkqueueOrDashboardOptions.shape
218
226
  });
219
227
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -286,6 +294,30 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
286
294
  ]).describe(
287
295
  "Scopes used to check user's permission to perform actions on a record."
288
296
  );
297
+ var SystemScopeType = z6.enum([
298
+ "organisation.read-locations",
299
+ "user.read",
300
+ "user.create",
301
+ "user.edit",
302
+ "user.search"
303
+ ]);
304
+ var UserScopeType = SystemScopeType.extract([
305
+ "user.read",
306
+ "user.create",
307
+ "user.edit",
308
+ "user.search"
309
+ ]);
310
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
311
+ var UserScopeV2 = z6.discriminatedUnion("type", [
312
+ z6.object({
313
+ type: ScopesWithRoleOption,
314
+ options: AllUserScopeOptions.optional()
315
+ }),
316
+ z6.object({
317
+ type: UserScopeType.extract(["user.read", "user.search"]),
318
+ options: AccessLevelOptions.optional()
319
+ })
320
+ ]);
289
321
  var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
290
322
  z6.object({
291
323
  type: ScopesWithPlaceEventOptions,
@@ -306,16 +338,14 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
306
338
  }).optional()
307
339
  })
308
340
  ]).describe("Resolved scope with location/user IDs instead of filters.");
309
- var SystemScopeType = z6.enum([
310
- "organisation.read-locations",
311
- "user.read",
312
- "user.create",
313
- "user.edit"
314
- ]);
315
341
  var Scope2 = z6.discriminatedUnion("type", [
316
342
  z6.object({ type: PlainScopeType }),
317
343
  ...RecordScopeV2.options,
318
- z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
344
+ ...UserScopeV2.options,
345
+ z6.object({
346
+ type: z6.literal("organisation.read-locations"),
347
+ options: AccessLevelOptions.optional()
348
+ }),
319
349
  z6.object({
320
350
  type: z6.literal("workqueue"),
321
351
  options: WorkqueueOrDashboardOptions
@@ -335,7 +365,9 @@ var ScopeType2 = z6.enum([
335
365
  var EncodedScope2 = z6.string().brand("EncodedScope");
336
366
  var DEFAULT_SCOPE_OPTIONS = {
337
367
  placeOfEvent: JurisdictionFilter.enum.all,
338
- accessLevel: JurisdictionFilter.enum.all
368
+ accessLevel: JurisdictionFilter.enum.all,
369
+ registeredIn: JurisdictionFilter.enum.all,
370
+ declaredIn: JurisdictionFilter.enum.all
339
371
  };
340
372
 
341
373
  // ../commons/src/users/userReferences.ts