@opencrvs/toolkit 1.9.13-rc.72233cd → 1.9.13-rc.797da9b

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 (122) hide show
  1. package/build.sh +0 -13
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/commons/api/router.d.ts +4561 -3370
  4. package/dist/commons/conditionals/conditionals.d.ts +295 -28
  5. package/dist/commons/conditionals/validate.d.ts +9 -11
  6. package/dist/commons/events/ActionConfig.d.ts +1555 -415
  7. package/dist/commons/events/ActionDocument.d.ts +1941 -888
  8. package/dist/commons/events/ActionInput.d.ts +1277 -277
  9. package/dist/commons/events/ActionType.d.ts +11 -91
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +1496 -294
  11. package/dist/commons/events/CompositeFieldValue.d.ts +190 -30
  12. package/dist/commons/events/Conditional.d.ts +38 -26
  13. package/dist/commons/events/Constants.d.ts +1 -1
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +4471 -1592
  15. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  16. package/dist/commons/events/DeduplicationConfig.d.ts +171 -15
  17. package/dist/commons/events/Draft.d.ts +113 -72
  18. package/dist/commons/events/DynamicFieldValue.d.ts +78 -12
  19. package/dist/commons/events/EventConfig.d.ts +2420 -35
  20. package/dist/commons/events/EventConfigInput.d.ts +3 -0
  21. package/dist/commons/events/EventDocument.d.ts +1366 -354
  22. package/dist/commons/events/EventIndex.d.ts +1010 -212
  23. package/dist/commons/events/EventInput.d.ts +8 -3
  24. package/dist/commons/events/EventMetadata.d.ts +357 -130
  25. package/dist/commons/events/FieldConfig.d.ts +16025 -2936
  26. package/dist/commons/events/FieldType.d.ts +4 -26
  27. package/dist/commons/events/FieldTypeMapping.d.ts +906 -314
  28. package/dist/commons/events/FieldValue.d.ts +527 -149
  29. package/dist/commons/events/FileUtils.d.ts +2 -2
  30. package/dist/commons/events/FormConfig.d.ts +721 -54
  31. package/dist/commons/events/PageConfig.d.ts +320 -58
  32. package/dist/commons/events/PlainDate.d.ts +1 -1
  33. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  34. package/dist/commons/events/TemplateConfig.d.ts +3 -2
  35. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
  37. package/dist/commons/events/WorkqueueConfig.d.ts +7480 -2135
  38. package/dist/commons/events/deduplication.d.ts +3 -3
  39. package/dist/commons/events/defineConfig.d.ts +247 -2
  40. package/dist/commons/events/field.d.ts +22 -0
  41. package/dist/commons/events/index.d.ts +0 -3
  42. package/dist/commons/events/locations.d.ts +20 -57
  43. package/dist/commons/events/scopes.d.ts +34 -35
  44. package/dist/commons/events/state/availableActions.d.ts +2 -7
  45. package/dist/commons/events/state/flags.d.ts +3 -21
  46. package/dist/commons/events/state/index.d.ts +27 -30
  47. package/dist/commons/events/state/utils.d.ts +172 -190
  48. package/dist/commons/events/test.utils.d.ts +11 -52
  49. package/dist/commons/events/transactions.d.ts +1 -1
  50. package/dist/commons/events/utils.d.ts +273 -373
  51. package/dist/commons/notification/UserNotifications.d.ts +637 -61
  52. package/dist/conditionals/index.d.ts.map +1 -1
  53. package/dist/conditionals/index.js +2006 -270
  54. package/dist/events/deduplication.d.ts +3 -3
  55. package/dist/events/index.js +2203 -2847
  56. package/dist/notification/index.d.ts.map +1 -1
  57. package/dist/notification/index.js +1844 -2076
  58. package/dist/scopes/index.d.ts +353 -640
  59. package/dist/scopes/index.d.ts.map +1 -1
  60. package/dist/scopes/index.js +300 -340
  61. package/package.json +3 -13
  62. package/tsconfig.json +2 -12
  63. package/tsconfig.tsbuildinfo +1 -1
  64. package/dist/application-config/index.d.ts +0 -2
  65. package/dist/application-config/index.d.ts.map +0 -1
  66. package/dist/application-config/index.js +0 -2128
  67. package/dist/cli.d.ts +0 -2
  68. package/dist/cli.d.ts.map +0 -1
  69. package/dist/cli.js +0 -3237
  70. package/dist/commons/application-config/index.d.ts +0 -84
  71. package/dist/commons/events/AuditLog.d.ts +0 -405
  72. package/dist/commons/events/Flag.d.ts +0 -67
  73. package/dist/commons/events/eventConfigValidation.d.ts +0 -8
  74. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  75. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  76. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -405
  77. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  78. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  79. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -829
  80. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  81. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  82. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -159
  83. package/dist/migrations/v2.0/index.d.ts +0 -7
  84. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  85. package/dist/migrations/v2.0/index.js +0 -3176
  86. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  87. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  88. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -344
  89. package/dist/migrations/v2.0/migrate-scopes.d.ts +0 -3
  90. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  91. package/dist/migrations/v2.0/migrate-scopes.js +0 -282
  92. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  93. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  94. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -268
  95. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  96. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  97. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -237
  98. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  99. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  100. package/dist/migrations/v2.0/remove-delete-actions.js +0 -157
  101. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  102. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  103. package/dist/migrations/v2.0/remove-demo-scope.js +0 -75
  104. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  105. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  106. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -97
  107. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  108. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  109. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -78
  110. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  111. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  112. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -110
  113. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  114. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  115. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -164
  116. package/dist/migrations/v2.0/rename-api-paths.d.ts +0 -3
  117. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  118. package/dist/migrations/v2.0/rename-api-paths.js +0 -188
  119. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  120. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  121. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -181
  122. package/opencrvs-toolkit-1.9.13-rc.72233cd.tgz +0 -0
@@ -1,672 +1,385 @@
1
- import * as z from 'zod/v4';
2
- import { Role } from './roles';
3
- export declare const JurisdictionFilter: z.ZodEnum<{
4
- administrativeArea: "administrativeArea";
5
- location: "location";
6
- all: "all";
7
- }>;
8
- export type JurisdictionFilter = z.infer<typeof JurisdictionFilter>;
9
- export declare const UserFilter: z.ZodEnum<{
10
- user: "user";
11
- }>;
12
- export type UserFilter = z.infer<typeof UserFilter>;
13
- /**
14
- * The different types of scopes that can be used to control access to records. Each type has different options that can be used to further filter the records that the scope applies to.
15
- * When adding new scope types, they should be added to the appropriate section based on the options they require.
16
- *
17
- * @see scopeOptionsPlaceEvent @see scopeOptionsDeclared @see scopeOptionsFull
18
- */
19
- export declare const RecordScopeTypeV2: z.ZodEnum<{
20
- "record.search": "record.search";
21
- "record.create": "record.create";
22
- "record.read": "record.read";
23
- "record.declare": "record.declare";
24
- "record.notify": "record.notify";
25
- "record.edit": "record.edit";
26
- "record.reject": "record.reject";
27
- "record.archive": "record.archive";
28
- "record.review-duplicates": "record.review-duplicates";
29
- "record.register": "record.register";
30
- "record.print-certified-copies": "record.print-certified-copies";
31
- "record.request-correction": "record.request-correction";
32
- "record.correct": "record.correct";
33
- "record.unassign-others": "record.unassign-others";
34
- "record.custom-action": "record.custom-action";
35
- }>;
36
- export type RecordScopeTypeV2 = z.infer<typeof RecordScopeTypeV2>;
37
- declare const AllScopeOptions: z.ZodObject<{
38
- ids: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodArray<z.ZodString>>;
39
- accessLevel: z.ZodOptional<z.ZodEnum<{
40
- administrativeArea: "administrativeArea";
41
- location: "location";
42
- all: "all";
43
- }>>;
44
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
45
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
46
- administrativeArea: "administrativeArea";
47
- location: "location";
48
- all: "all";
49
- }>>;
50
- declaredIn: z.ZodOptional<z.ZodEnum<{
51
- administrativeArea: "administrativeArea";
52
- location: "location";
53
- all: "all";
54
- }>>;
55
- declaredBy: z.ZodOptional<z.ZodEnum<{
56
- user: "user";
57
- }>>;
58
- registeredIn: z.ZodOptional<z.ZodEnum<{
59
- administrativeArea: "administrativeArea";
60
- location: "location";
61
- all: "all";
62
- }>>;
63
- registeredBy: z.ZodOptional<z.ZodEnum<{
64
- user: "user";
65
- }>>;
66
- }, z.core.$strip>;
67
- type AllScopeOptions = z.infer<typeof AllScopeOptions>;
68
- export declare const ScopeOptionKey: z.ZodEnum<{
69
- event: "event";
70
- placeOfEvent: "placeOfEvent";
71
- declaredIn: "declaredIn";
72
- declaredBy: "declaredBy";
73
- registeredIn: "registeredIn";
74
- registeredBy: "registeredBy";
75
- accessLevel: "accessLevel";
76
- ids: "ids";
77
- }>;
78
- export type ScopeOptionKey = z.infer<typeof ScopeOptionKey>;
79
- export declare const ScopesWithPlaceEventOptions: z.ZodEnum<{
80
- "record.create": "record.create";
81
- "record.declare": "record.declare";
82
- "record.notify": "record.notify";
83
- }>;
84
- export declare const ScopesWithDeclaredOptions: z.ZodEnum<{
85
- "record.edit": "record.edit";
86
- "record.reject": "record.reject";
87
- "record.archive": "record.archive";
88
- "record.review-duplicates": "record.review-duplicates";
89
- "record.register": "record.register";
90
- }>;
91
- export declare const ScopesWithFullOptions: z.ZodEnum<{
92
- "record.search": "record.search";
93
- "record.read": "record.read";
94
- "record.request-correction": "record.request-correction";
95
- "record.correct": "record.correct";
96
- "record.unassign-others": "record.unassign-others";
97
- }>;
98
- export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
99
- type: z.ZodEnum<{
100
- "record.create": "record.create";
101
- "record.declare": "record.declare";
102
- "record.notify": "record.notify";
103
- }>;
104
- options: z.ZodOptional<z.ZodObject<{
105
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
106
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
107
- administrativeArea: "administrativeArea";
108
- location: "location";
109
- all: "all";
110
- }>>;
111
- }, z.core.$strip>>;
112
- }, z.core.$strip>, z.ZodObject<{
113
- type: z.ZodEnum<{
114
- "record.edit": "record.edit";
115
- "record.reject": "record.reject";
116
- "record.archive": "record.archive";
117
- "record.review-duplicates": "record.review-duplicates";
118
- "record.register": "record.register";
119
- }>;
120
- options: z.ZodOptional<z.ZodObject<{
121
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
122
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
123
- administrativeArea: "administrativeArea";
124
- location: "location";
125
- all: "all";
126
- }>>;
127
- declaredIn: z.ZodOptional<z.ZodEnum<{
128
- administrativeArea: "administrativeArea";
129
- location: "location";
130
- all: "all";
131
- }>>;
132
- declaredBy: z.ZodOptional<z.ZodEnum<{
133
- user: "user";
134
- }>>;
135
- }, z.core.$strip>>;
136
- }, z.core.$strip>, z.ZodObject<{
137
- type: z.ZodEnum<{
138
- "record.search": "record.search";
139
- "record.read": "record.read";
140
- "record.request-correction": "record.request-correction";
141
- "record.correct": "record.correct";
142
- "record.unassign-others": "record.unassign-others";
1
+ import { z } from 'zod';
2
+ import { SearchScopeAccessLevels } from './events';
3
+ export declare const SCOPES: {
4
+ readonly BYPASSRATELIMIT: "bypassratelimit";
5
+ readonly REGISTER: "register";
6
+ readonly DEMO: "demo";
7
+ readonly CONFIG: "config";
8
+ readonly WEBHOOK: "webhook";
9
+ readonly NATIONALID: "nationalId";
10
+ readonly NOTIFICATION_API: "notification-api";
11
+ readonly RECORDSEARCH: "recordsearch";
12
+ readonly RECORD_IMPORT: "record.import";
13
+ readonly RECORD_EXPORT: "record.export";
14
+ readonly RECORD_REINDEX: "record.reindex";
15
+ readonly RECORD_DECLARE_BIRTH: "record.declare-birth";
16
+ readonly RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction";
17
+ readonly RECORD_DECLARE_DEATH: "record.declare-death";
18
+ readonly RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction";
19
+ readonly RECORD_DECLARE_MARRIAGE: "record.declare-marriage";
20
+ readonly RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction";
21
+ readonly RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete";
22
+ readonly RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review";
23
+ readonly RECORD_UNASSIGN_OTHERS: "record.unassign-others";
24
+ readonly RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval";
25
+ readonly RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates";
26
+ readonly RECORD_DECLARATION_EDIT: "record.declaration-edit";
27
+ readonly RECORD_REVIEW_DUPLICATES: "record.review-duplicates";
28
+ readonly RECORD_DECLARATION_ARCHIVE: "record.declaration-archive";
29
+ readonly RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate";
30
+ readonly RECORD_REGISTER: "record.register";
31
+ /**
32
+ * This scope is used to **print and **issue certified copies of a record
33
+ * after it has been registered. Previously Registrars had this permission.
34
+ */
35
+ readonly RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies";
36
+ readonly RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction";
37
+ readonly RECORD_REGISTRATION_CORRECT: "record.registration-correct";
38
+ readonly RECORD_CONFIRM_REGISTRATION: "record.confirm-registration";
39
+ readonly RECORD_REJECT_REGISTRATION: "record.reject-registration";
40
+ readonly SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction";
41
+ readonly SEARCH_BIRTH: "search.birth";
42
+ readonly SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction";
43
+ readonly SEARCH_DEATH: "search.death";
44
+ readonly SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction";
45
+ readonly SEARCH_MARRIAGE: "search.marriage";
46
+ readonly RECORD_READ: "record.read";
47
+ readonly PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature";
48
+ readonly PERFORMANCE_READ: "performance.read";
49
+ readonly PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards";
50
+ readonly PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export";
51
+ readonly ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all";
52
+ readonly ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office";
53
+ readonly ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction";
54
+ readonly USER_READ: "user.read:all";
55
+ readonly USER_READ_MY_OFFICE: "user.read:my-office";
56
+ readonly USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction";
57
+ readonly USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit";
58
+ readonly USER_CREATE: "user.create:all";
59
+ readonly USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction";
60
+ readonly USER_UPDATE: "user.update:all";
61
+ readonly USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction";
62
+ readonly CONFIG_UPDATE_ALL: "config.update:all";
63
+ readonly USER_DATA_SEEDING: "user.data-seeding";
64
+ };
65
+ export declare const SearchScopes: z.ZodUnion<[z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">]>;
66
+ declare const LiteralScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"register">, z.ZodLiteral<"demo">, z.ZodLiteral<"config">]>, z.ZodUnion<[z.ZodLiteral<"webhook">, z.ZodLiteral<"nationalId">, z.ZodLiteral<"notification-api">, z.ZodLiteral<"recordsearch">]>, z.ZodLiteral<"record.unassign-others">, z.ZodUnion<[z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.declare-birth:my-jurisdiction">, z.ZodLiteral<"record.declare-death">, z.ZodLiteral<"record.declare-death:my-jurisdiction">, z.ZodLiteral<"record.declare-marriage">, z.ZodLiteral<"record.declare-marriage:my-jurisdiction">, z.ZodLiteral<"record.declaration-submit-incomplete">, z.ZodLiteral<"record.declaration-submit-for-review">]>, z.ZodUnion<[z.ZodLiteral<"record.declaration-submit-for-approval">, z.ZodLiteral<"record.declaration-submit-for-updates">, z.ZodLiteral<"record.declaration-edit">, z.ZodLiteral<"record.review-duplicates">, z.ZodLiteral<"record.declaration-archive">, z.ZodLiteral<"record.declaration-reinstate">]>, z.ZodLiteral<"record.register">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodUnion<[z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>, z.ZodUnion<[z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">]>, z.ZodLiteral<"record.read">, z.ZodLiteral<"profile.electronic-signature">, z.ZodUnion<[z.ZodLiteral<"performance.read">, z.ZodLiteral<"performance.read-dashboards">, z.ZodLiteral<"performance.vital-statistics-export">]>, z.ZodUnion<[z.ZodLiteral<"organisation.read-locations:all">, z.ZodLiteral<"organisation.read-locations:my-office">, z.ZodLiteral<"organisation.read-locations:my-jurisdiction">]>, z.ZodUnion<[z.ZodLiteral<"user.read:all">, z.ZodLiteral<"user.read:my-office">, z.ZodLiteral<"user.read:my-jurisdiction">, z.ZodLiteral<"user.read:only-my-audit">, z.ZodLiteral<"user.create:all">, z.ZodLiteral<"user.create:my-jurisdiction">, z.ZodLiteral<"user.update:all">, z.ZodLiteral<"user.update:my-jurisdiction">]>, z.ZodLiteral<"config.update:all">, z.ZodLiteral<"user.data-seeding">, z.ZodUnion<[z.ZodLiteral<"record.reindex">, z.ZodLiteral<"record.import">]>]>;
67
+ declare const SearchScope: z.ZodObject<{
68
+ type: z.ZodLiteral<"search">;
69
+ options: z.ZodObject<{
70
+ event: z.ZodArray<z.ZodString, "many">;
71
+ access: z.ZodArray<z.ZodEnum<["my-jurisdiction", "all"]>, "many">;
72
+ }, "strip", z.ZodTypeAny, {
73
+ event: string[];
74
+ access: ("my-jurisdiction" | "all")[];
75
+ }, {
76
+ event: string[];
77
+ access: ("my-jurisdiction" | "all")[];
143
78
  }>;
144
- options: z.ZodOptional<z.ZodObject<{
145
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
146
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
147
- administrativeArea: "administrativeArea";
148
- location: "location";
149
- all: "all";
150
- }>>;
151
- declaredIn: z.ZodOptional<z.ZodEnum<{
152
- administrativeArea: "administrativeArea";
153
- location: "location";
154
- all: "all";
155
- }>>;
156
- declaredBy: z.ZodOptional<z.ZodEnum<{
157
- user: "user";
158
- }>>;
159
- registeredIn: z.ZodOptional<z.ZodEnum<{
160
- administrativeArea: "administrativeArea";
161
- location: "location";
162
- all: "all";
163
- }>>;
164
- registeredBy: z.ZodOptional<z.ZodEnum<{
165
- user: "user";
166
- }>>;
167
- }, z.core.$strip>>;
168
- }, z.core.$strip>, z.ZodObject<{
169
- type: z.ZodLiteral<"record.custom-action">;
170
- options: z.ZodOptional<z.ZodObject<{
171
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
172
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
173
- administrativeArea: "administrativeArea";
174
- location: "location";
175
- all: "all";
176
- }>>;
177
- declaredIn: z.ZodOptional<z.ZodEnum<{
178
- administrativeArea: "administrativeArea";
179
- location: "location";
180
- all: "all";
181
- }>>;
182
- declaredBy: z.ZodOptional<z.ZodEnum<{
183
- user: "user";
184
- }>>;
185
- registeredIn: z.ZodOptional<z.ZodEnum<{
186
- administrativeArea: "administrativeArea";
187
- location: "location";
188
- all: "all";
189
- }>>;
190
- registeredBy: z.ZodOptional<z.ZodEnum<{
191
- user: "user";
192
- }>>;
193
- customActionTypes: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
194
- }, z.core.$strip>>;
195
- }, z.core.$strip>, z.ZodObject<{
196
- type: z.ZodLiteral<"record.print-certified-copies">;
197
- options: z.ZodOptional<z.ZodObject<{
198
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
199
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
200
- administrativeArea: "administrativeArea";
201
- location: "location";
202
- all: "all";
203
- }>>;
204
- declaredIn: z.ZodOptional<z.ZodEnum<{
205
- administrativeArea: "administrativeArea";
206
- location: "location";
207
- all: "all";
208
- }>>;
209
- declaredBy: z.ZodOptional<z.ZodEnum<{
210
- user: "user";
211
- }>>;
212
- registeredIn: z.ZodOptional<z.ZodEnum<{
213
- administrativeArea: "administrativeArea";
214
- location: "location";
215
- all: "all";
216
- }>>;
217
- registeredBy: z.ZodOptional<z.ZodEnum<{
218
- user: "user";
219
- }>>;
220
- templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
221
- }, z.core.$strip>>;
222
- }, z.core.$strip>], "type">;
223
- export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
224
- type: z.infer<typeof ScopesWithDeclaredOptions>;
225
- }>;
226
- export declare function scopeUsesFullOptions(scope: Scope): scope is Extract<Scope, {
227
- type: z.infer<typeof ScopesWithFullOptions>;
228
- }>;
229
- export declare function scopeUsesPrintCertifiedCopiesOptions(scope: Scope): scope is Extract<Scope, {
230
- type: 'record.print-certified-copies';
231
- }>;
232
- export declare function isCustomActionScope(scope: Scope): scope is Extract<Scope, {
233
- type: 'record.custom-action';
79
+ }, "strip", z.ZodTypeAny, {
80
+ type: "search";
81
+ options: {
82
+ event: string[];
83
+ access: ("my-jurisdiction" | "all")[];
84
+ };
85
+ }, {
86
+ type: "search";
87
+ options: {
88
+ event: string[];
89
+ access: ("my-jurisdiction" | "all")[];
90
+ };
234
91
  }>;
235
- export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
236
- type: z.ZodEnum<{
237
- "record.create": "record.create";
238
- "record.declare": "record.declare";
239
- "record.notify": "record.notify";
240
- }>;
241
- options: z.ZodOptional<z.ZodObject<{
242
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
243
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
244
- }, z.core.$strip>>;
245
- }, z.core.$strip>, z.ZodObject<{
246
- type: z.ZodEnum<{
247
- "record.edit": "record.edit";
248
- "record.reject": "record.reject";
249
- "record.archive": "record.archive";
250
- "record.review-duplicates": "record.review-duplicates";
251
- "record.register": "record.register";
252
- }>;
253
- options: z.ZodOptional<z.ZodObject<{
254
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
255
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
256
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
257
- declaredBy: z.ZodOptional<z.ZodString>;
258
- }, z.core.$strip>>;
259
- }, z.core.$strip>, z.ZodObject<{
260
- type: z.ZodEnum<{
261
- "record.search": "record.search";
262
- "record.read": "record.read";
263
- "record.request-correction": "record.request-correction";
264
- "record.correct": "record.correct";
265
- "record.unassign-others": "record.unassign-others";
92
+ declare const PrintCertifiedCopiesScope: z.ZodObject<{
93
+ type: z.ZodLiteral<"record.registered.print-certified-copies">;
94
+ options: z.ZodObject<{
95
+ event: z.ZodArray<z.ZodString, "many">;
96
+ templates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ event: string[];
99
+ templates?: string[] | undefined;
100
+ }, {
101
+ event: string[];
102
+ templates?: string[] | undefined;
266
103
  }>;
267
- options: z.ZodOptional<z.ZodObject<{
268
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
269
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
270
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
271
- declaredBy: z.ZodOptional<z.ZodString>;
272
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
273
- registeredBy: z.ZodOptional<z.ZodString>;
274
- }, z.core.$strip>>;
275
- }, z.core.$strip>, z.ZodObject<{
276
- type: z.ZodLiteral<"record.print-certified-copies">;
277
- options: z.ZodOptional<z.ZodObject<{
278
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
279
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
280
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
281
- declaredBy: z.ZodOptional<z.ZodString>;
282
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
283
- registeredBy: z.ZodOptional<z.ZodString>;
284
- templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
285
- }, z.core.$strip>>;
286
- }, z.core.$strip>], "type">;
287
- export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
288
- export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
289
- declare const SystemScopeType: z.ZodEnum<{
290
- "organisation.read-locations": "organisation.read-locations";
291
- "user.read": "user.read";
292
- "user.create": "user.create";
293
- "user.edit": "user.edit";
104
+ }, "strip", z.ZodTypeAny, {
105
+ type: "record.registered.print-certified-copies";
106
+ options: {
107
+ event: string[];
108
+ templates?: string[] | undefined;
109
+ };
110
+ }, {
111
+ type: "record.registered.print-certified-copies";
112
+ options: {
113
+ event: string[];
114
+ templates?: string[] | undefined;
115
+ };
294
116
  }>;
295
- export type SystemScopeType = z.infer<typeof SystemScopeType>;
296
- /** The primary scope schema which gathers all scope types together. All scopes are discriminated by type and options are determined according to the type. */
297
- export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
298
- type: z.ZodEnum<{
299
- bypassratelimit: "bypassratelimit";
300
- "record.reindex": "record.reindex";
301
- "user.data-seeding": "user.data-seeding";
302
- "integration.create": "integration.create";
303
- "record.import": "record.import";
304
- "config.update-all": "config.update-all";
305
- "attachment.upload": "attachment.upload";
306
- "profile.electronic-signature": "profile.electronic-signature";
307
- "user.read-only-my-audit": "user.read-only-my-audit";
308
- "performance.read": "performance.read";
309
- "performance.read-dashboards": "performance.read-dashboards";
310
- "performance.vital-statistics-export": "performance.vital-statistics-export";
311
- "record.confirm-registration": "record.confirm-registration";
312
- "record.reject-registration": "record.reject-registration";
117
+ export type SearchScope = z.infer<typeof SearchScope>;
118
+ export type PrintCertifiedCopiesScope = z.infer<typeof PrintCertifiedCopiesScope>;
119
+ export declare const RecordScopeType: z.ZodEnum<["record.create", "record.read", "record.declare", "record.notify", "record.declared.validate", "record.declared.reject", "record.declared.archive", "record.declared.review-duplicates", "record.register", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
120
+ export type RecordScopeType = z.infer<typeof RecordScopeType>;
121
+ export declare const RecordScope: z.ZodObject<{
122
+ type: z.ZodEnum<["record.create", "record.read", "record.declare", "record.notify", "record.declared.validate", "record.declared.reject", "record.declared.archive", "record.declared.review-duplicates", "record.register", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
123
+ options: z.ZodObject<{
124
+ event: z.ZodArray<z.ZodString, "many">;
125
+ }, "strip", z.ZodTypeAny, {
126
+ event: string[];
127
+ }, {
128
+ event: string[];
313
129
  }>;
314
- }, z.core.$strip>, z.ZodObject<{
315
- type: z.ZodEnum<{
316
- "record.create": "record.create";
317
- "record.declare": "record.declare";
318
- "record.notify": "record.notify";
130
+ }, "strip", z.ZodTypeAny, {
131
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
132
+ options: {
133
+ event: string[];
134
+ };
135
+ }, {
136
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
137
+ options: {
138
+ event: string[];
139
+ };
140
+ }>;
141
+ export type RecordScope = z.infer<typeof RecordScope>;
142
+ declare const ConfigurableRawScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
143
+ type: z.ZodLiteral<"search">;
144
+ options: z.ZodObject<{
145
+ event: z.ZodArray<z.ZodString, "many">;
146
+ access: z.ZodArray<z.ZodEnum<["my-jurisdiction", "all"]>, "many">;
147
+ }, "strip", z.ZodTypeAny, {
148
+ event: string[];
149
+ access: ("my-jurisdiction" | "all")[];
150
+ }, {
151
+ event: string[];
152
+ access: ("my-jurisdiction" | "all")[];
319
153
  }>;
320
- options: z.ZodOptional<z.ZodObject<{
321
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
322
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
323
- administrativeArea: "administrativeArea";
324
- location: "location";
325
- all: "all";
326
- }>>;
327
- }, z.core.$strip>>;
328
- }, z.core.$strip>, z.ZodObject<{
329
- type: z.ZodEnum<{
330
- "record.edit": "record.edit";
331
- "record.reject": "record.reject";
332
- "record.archive": "record.archive";
333
- "record.review-duplicates": "record.review-duplicates";
334
- "record.register": "record.register";
154
+ }, "strip", z.ZodTypeAny, {
155
+ type: "search";
156
+ options: {
157
+ event: string[];
158
+ access: ("my-jurisdiction" | "all")[];
159
+ };
160
+ }, {
161
+ type: "search";
162
+ options: {
163
+ event: string[];
164
+ access: ("my-jurisdiction" | "all")[];
165
+ };
166
+ }>, z.ZodObject<{
167
+ type: z.ZodLiteral<"record.registered.print-certified-copies">;
168
+ options: z.ZodObject<{
169
+ event: z.ZodArray<z.ZodString, "many">;
170
+ templates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ event: string[];
173
+ templates?: string[] | undefined;
174
+ }, {
175
+ event: string[];
176
+ templates?: string[] | undefined;
335
177
  }>;
336
- options: z.ZodOptional<z.ZodObject<{
337
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
338
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
339
- administrativeArea: "administrativeArea";
340
- location: "location";
341
- all: "all";
342
- }>>;
343
- declaredIn: z.ZodOptional<z.ZodEnum<{
344
- administrativeArea: "administrativeArea";
345
- location: "location";
346
- all: "all";
347
- }>>;
348
- declaredBy: z.ZodOptional<z.ZodEnum<{
349
- user: "user";
350
- }>>;
351
- }, z.core.$strip>>;
352
- }, z.core.$strip>, z.ZodObject<{
353
- type: z.ZodEnum<{
354
- "record.search": "record.search";
355
- "record.read": "record.read";
356
- "record.request-correction": "record.request-correction";
357
- "record.correct": "record.correct";
358
- "record.unassign-others": "record.unassign-others";
178
+ }, "strip", z.ZodTypeAny, {
179
+ type: "record.registered.print-certified-copies";
180
+ options: {
181
+ event: string[];
182
+ templates?: string[] | undefined;
183
+ };
184
+ }, {
185
+ type: "record.registered.print-certified-copies";
186
+ options: {
187
+ event: string[];
188
+ templates?: string[] | undefined;
189
+ };
190
+ }>, z.ZodObject<{
191
+ type: z.ZodLiteral<"user.create">;
192
+ options: z.ZodObject<{
193
+ role: z.ZodArray<z.ZodString, "many">;
194
+ }, "strip", z.ZodTypeAny, {
195
+ role: string[];
196
+ }, {
197
+ role: string[];
359
198
  }>;
360
- options: z.ZodOptional<z.ZodObject<{
361
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
362
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
363
- administrativeArea: "administrativeArea";
364
- location: "location";
365
- all: "all";
366
- }>>;
367
- declaredIn: z.ZodOptional<z.ZodEnum<{
368
- administrativeArea: "administrativeArea";
369
- location: "location";
370
- all: "all";
371
- }>>;
372
- declaredBy: z.ZodOptional<z.ZodEnum<{
373
- user: "user";
374
- }>>;
375
- registeredIn: z.ZodOptional<z.ZodEnum<{
376
- administrativeArea: "administrativeArea";
377
- location: "location";
378
- all: "all";
379
- }>>;
380
- registeredBy: z.ZodOptional<z.ZodEnum<{
381
- user: "user";
382
- }>>;
383
- }, z.core.$strip>>;
384
- }, z.core.$strip>, z.ZodObject<{
385
- type: z.ZodLiteral<"record.custom-action">;
386
- options: z.ZodOptional<z.ZodObject<{
387
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
388
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
389
- administrativeArea: "administrativeArea";
390
- location: "location";
391
- all: "all";
392
- }>>;
393
- declaredIn: z.ZodOptional<z.ZodEnum<{
394
- administrativeArea: "administrativeArea";
395
- location: "location";
396
- all: "all";
397
- }>>;
398
- declaredBy: z.ZodOptional<z.ZodEnum<{
399
- user: "user";
400
- }>>;
401
- registeredIn: z.ZodOptional<z.ZodEnum<{
402
- administrativeArea: "administrativeArea";
403
- location: "location";
404
- all: "all";
405
- }>>;
406
- registeredBy: z.ZodOptional<z.ZodEnum<{
407
- user: "user";
408
- }>>;
409
- customActionTypes: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
410
- }, z.core.$strip>>;
411
- }, z.core.$strip>, z.ZodObject<{
412
- type: z.ZodLiteral<"record.print-certified-copies">;
413
- options: z.ZodOptional<z.ZodObject<{
414
- event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
415
- placeOfEvent: z.ZodOptional<z.ZodEnum<{
416
- administrativeArea: "administrativeArea";
417
- location: "location";
418
- all: "all";
419
- }>>;
420
- declaredIn: z.ZodOptional<z.ZodEnum<{
421
- administrativeArea: "administrativeArea";
422
- location: "location";
423
- all: "all";
424
- }>>;
425
- declaredBy: z.ZodOptional<z.ZodEnum<{
426
- user: "user";
427
- }>>;
428
- registeredIn: z.ZodOptional<z.ZodEnum<{
429
- administrativeArea: "administrativeArea";
430
- location: "location";
431
- all: "all";
432
- }>>;
433
- registeredBy: z.ZodOptional<z.ZodEnum<{
434
- user: "user";
435
- }>>;
436
- templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
437
- }, z.core.$strip>>;
438
- }, z.core.$strip>, z.ZodObject<{
439
- type: z.ZodEnum<{
440
- "organisation.read-locations": "organisation.read-locations";
441
- "user.read": "user.read";
442
- "user.create": "user.create";
443
- "user.edit": "user.edit";
199
+ }, "strip", z.ZodTypeAny, {
200
+ type: "user.create";
201
+ options: {
202
+ role: string[];
203
+ };
204
+ }, {
205
+ type: "user.create";
206
+ options: {
207
+ role: string[];
208
+ };
209
+ }>, z.ZodObject<{
210
+ type: z.ZodLiteral<"user.edit">;
211
+ options: z.ZodObject<{
212
+ role: z.ZodArray<z.ZodString, "many">;
213
+ }, "strip", z.ZodTypeAny, {
214
+ role: string[];
215
+ }, {
216
+ role: string[];
444
217
  }>;
445
- options: z.ZodOptional<z.ZodObject<{
446
- accessLevel: z.ZodOptional<z.ZodEnum<{
447
- administrativeArea: "administrativeArea";
448
- location: "location";
449
- all: "all";
450
- }>>;
451
- }, z.core.$strip>>;
452
- }, z.core.$strip>, z.ZodObject<{
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: "user.edit";
220
+ options: {
221
+ role: string[];
222
+ };
223
+ }, {
224
+ type: "user.edit";
225
+ options: {
226
+ role: string[];
227
+ };
228
+ }>, z.ZodObject<{
453
229
  type: z.ZodLiteral<"workqueue">;
454
230
  options: z.ZodObject<{
455
- ids: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodArray<z.ZodString>>;
456
- }, z.core.$strip>;
457
- }, z.core.$strip>, z.ZodObject<{
458
- type: z.ZodLiteral<"dashboard.view">;
231
+ id: z.ZodArray<z.ZodString, "many">;
232
+ }, "strip", z.ZodTypeAny, {
233
+ id: string[];
234
+ }, {
235
+ id: string[];
236
+ }>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ type: "workqueue";
239
+ options: {
240
+ id: string[];
241
+ };
242
+ }, {
243
+ type: "workqueue";
244
+ options: {
245
+ id: string[];
246
+ };
247
+ }>, z.ZodObject<{
248
+ type: z.ZodEnum<["record.create", "record.read", "record.declare", "record.notify", "record.declared.validate", "record.declared.reject", "record.declared.archive", "record.declared.review-duplicates", "record.register", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
459
249
  options: z.ZodObject<{
460
- ids: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodArray<z.ZodString>>;
461
- }, z.core.$strip>;
462
- }, z.core.$strip>], "type">;
463
- export type Scope = z.infer<typeof Scope>;
464
- export declare const ScopeType: z.ZodEnum<{
465
- "record.search": "record.search";
466
- "record.create": "record.create";
467
- "record.read": "record.read";
468
- "record.declare": "record.declare";
469
- "record.notify": "record.notify";
470
- "record.edit": "record.edit";
471
- "record.reject": "record.reject";
472
- "record.archive": "record.archive";
473
- "record.review-duplicates": "record.review-duplicates";
474
- "record.register": "record.register";
475
- "record.print-certified-copies": "record.print-certified-copies";
476
- "record.request-correction": "record.request-correction";
477
- "record.correct": "record.correct";
478
- "record.unassign-others": "record.unassign-others";
479
- "record.custom-action": "record.custom-action";
480
- bypassratelimit: "bypassratelimit";
481
- "record.reindex": "record.reindex";
482
- "user.data-seeding": "user.data-seeding";
483
- "integration.create": "integration.create";
484
- "record.import": "record.import";
485
- "config.update-all": "config.update-all";
486
- "attachment.upload": "attachment.upload";
487
- "profile.electronic-signature": "profile.electronic-signature";
488
- "user.read-only-my-audit": "user.read-only-my-audit";
489
- "performance.read": "performance.read";
490
- "performance.read-dashboards": "performance.read-dashboards";
491
- "performance.vital-statistics-export": "performance.vital-statistics-export";
492
- "record.confirm-registration": "record.confirm-registration";
493
- "record.reject-registration": "record.reject-registration";
494
- "organisation.read-locations": "organisation.read-locations";
495
- "user.read": "user.read";
496
- "user.create": "user.create";
497
- "user.edit": "user.edit";
498
- workqueue: "workqueue";
499
- "dashboard.view": "dashboard.view";
500
- }>;
501
- export type ScopeType = z.infer<typeof ScopeType>;
502
- /**
503
- * Branded encoded scope string, in query string format.
504
- *
505
- */
506
- export declare const EncodedScope: z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">;
507
- export type EncodedScope = z.infer<typeof EncodedScope>;
508
- /**
509
- * Encodes a scope object into an EncodedScope branded query string.
510
- *
511
- *
512
- * @param scope - The scope object to encode.
513
- * @returns The encoded scope as a branded string (`EncodedScope`).
514
- */
515
- export declare const encodeScope: (scope: Scope) => EncodedScope;
250
+ event: z.ZodArray<z.ZodString, "many">;
251
+ }, "strip", z.ZodTypeAny, {
252
+ event: string[];
253
+ }, {
254
+ event: string[];
255
+ }>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
258
+ options: {
259
+ event: string[];
260
+ };
261
+ }, {
262
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
263
+ options: {
264
+ event: string[];
265
+ };
266
+ }>]>;
267
+ type ConfigurableRawScopes = z.infer<typeof ConfigurableRawScopes>;
268
+ export type ConfigurableScopeType = ConfigurableRawScopes['type'];
269
+ type FlattenedSearchScope = {
270
+ type: 'search';
271
+ options: Record<string, SearchScopeAccessLevels>;
272
+ };
273
+ export type ConfigurableScopes = Exclude<ConfigurableRawScopes, {
274
+ type: 'search';
275
+ }> | FlattenedSearchScope;
276
+ export declare function findScope<T extends ConfigurableScopeType>(scopes: string[], scopeType: T): Extract<{
277
+ type: "record.registered.print-certified-copies";
278
+ options: {
279
+ event: string[];
280
+ templates?: string[] | undefined;
281
+ };
282
+ }, {
283
+ type: T;
284
+ }> | Extract<{
285
+ type: "user.create";
286
+ options: {
287
+ role: string[];
288
+ };
289
+ }, {
290
+ type: T;
291
+ }> | Extract<{
292
+ type: "user.edit";
293
+ options: {
294
+ role: string[];
295
+ };
296
+ }, {
297
+ type: T;
298
+ }> | Extract<{
299
+ type: "workqueue";
300
+ options: {
301
+ id: string[];
302
+ };
303
+ }, {
304
+ type: T;
305
+ }> | Extract<{
306
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
307
+ options: {
308
+ event: string[];
309
+ };
310
+ }, {
311
+ type: T;
312
+ }> | Extract<FlattenedSearchScope, {
313
+ type: T;
314
+ }> | undefined;
516
315
  /**
517
- * Converts a scope object into an encoded query string representation.
518
- *
519
- * @TODO scope param could be defined as EncodedScope instead of string.
520
- *
521
- * @param scope - The scope object to encode.
522
- * @returns The encoded scope as a branded string (`EncodedScope`).
316
+ * Parses a configurable scope string into a ConfigurableRawScopes object.
317
+ * @param {string} scope - The scope string to parse
318
+ * @returns {ConfigurableRawScopes | undefined} The parsed scope object if valid, undefined otherwise
319
+ * @example
320
+ * parseScope("user.create[role=field-agent|registration-agent]")
321
+ * // Returns: { type: "user.create", options: { role: ["field-agent", "registration-agent"] } }
523
322
  */
524
- export declare const decodeScope: (query: EncodedScope) => {
525
- type: "record.create" | "record.declare" | "record.notify";
526
- options?: {
527
- event?: string[] | undefined;
528
- placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
529
- } | undefined;
530
- } | {
531
- type: "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register";
532
- options?: {
533
- event?: string[] | undefined;
534
- placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
535
- declaredIn?: "administrativeArea" | "location" | "all" | undefined;
536
- declaredBy?: "user" | undefined;
537
- } | undefined;
538
- } | {
539
- type: "record.search" | "record.read" | "record.request-correction" | "record.correct" | "record.unassign-others";
540
- options?: {
541
- event?: string[] | undefined;
542
- placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
543
- declaredIn?: "administrativeArea" | "location" | "all" | undefined;
544
- declaredBy?: "user" | undefined;
545
- registeredIn?: "administrativeArea" | "location" | "all" | undefined;
546
- registeredBy?: "user" | undefined;
547
- } | undefined;
548
- } | {
549
- type: "record.custom-action";
550
- options?: {
551
- event?: string[] | undefined;
552
- placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
553
- declaredIn?: "administrativeArea" | "location" | "all" | undefined;
554
- declaredBy?: "user" | undefined;
555
- registeredIn?: "administrativeArea" | "location" | "all" | undefined;
556
- registeredBy?: "user" | undefined;
557
- customActionTypes?: string[] | undefined;
558
- } | undefined;
559
- } | {
560
- type: "record.print-certified-copies";
561
- options?: {
562
- event?: string[] | undefined;
563
- placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
564
- declaredIn?: "administrativeArea" | "location" | "all" | undefined;
565
- declaredBy?: "user" | undefined;
566
- registeredIn?: "administrativeArea" | "location" | "all" | undefined;
567
- registeredBy?: "user" | undefined;
323
+ export declare function parseConfigurableScope(scope: string): {
324
+ type: "record.registered.print-certified-copies";
325
+ options: {
326
+ event: string[];
568
327
  templates?: string[] | undefined;
569
- } | undefined;
328
+ };
570
329
  } | {
571
- type: "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration";
330
+ type: "search";
331
+ options: {
332
+ event: string[];
333
+ access: ("my-jurisdiction" | "all")[];
334
+ };
572
335
  } | {
573
- type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
574
- options?: {
575
- accessLevel?: "administrativeArea" | "location" | "all" | undefined;
576
- } | undefined;
336
+ type: "user.create";
337
+ options: {
338
+ role: string[];
339
+ };
340
+ } | {
341
+ type: "user.edit";
342
+ options: {
343
+ role: string[];
344
+ };
577
345
  } | {
578
346
  type: "workqueue";
579
347
  options: {
580
- ids: string[];
348
+ id: string[];
581
349
  };
582
350
  } | {
583
- type: "dashboard.view";
351
+ type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
584
352
  options: {
585
- ids: string[];
353
+ event: string[];
586
354
  };
587
355
  } | undefined;
356
+ export declare function parseLiteralScope(scope: string): {
357
+ type: "bypassratelimit" | "register" | "demo" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.import" | "record.reindex" | "record.declare-birth" | "record.declare-birth:my-jurisdiction" | "record.declare-death" | "record.declare-death:my-jurisdiction" | "record.declare-marriage" | "record.declare-marriage:my-jurisdiction" | "record.declaration-submit-incomplete" | "record.declaration-submit-for-review" | "record.unassign-others" | "record.declaration-submit-for-approval" | "record.declaration-submit-for-updates" | "record.declaration-edit" | "record.review-duplicates" | "record.declaration-archive" | "record.declaration-reinstate" | "record.register" | "record.registration-print&issue-certified-copies" | "record.registration-request-correction" | "record.registration-correct" | "record.confirm-registration" | "record.reject-registration" | "search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage" | "record.read" | "profile.electronic-signature" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "organisation.read-locations:all" | "organisation.read-locations:my-office" | "organisation.read-locations:my-jurisdiction" | "user.read:all" | "user.read:my-office" | "user.read:my-jurisdiction" | "user.read:only-my-audit" | "user.create:all" | "user.create:my-jurisdiction" | "user.update:all" | "user.update:my-jurisdiction" | "config.update:all" | "user.data-seeding";
358
+ } | undefined;
588
359
  /**
589
- * Function to get the value of a scope option (aka. scope attribute)
590
- *
591
- * @param scope - The scope to get the value of the option from.
592
- * @param option - The option to get the value of.
593
- * @returns The value of the scope option. Will return the default value if the option is not set.
594
- */
595
- export declare function getScopeOptionValue<T extends ScopeOptionKey>(scope: Scope, option: T): AllScopeOptions[T] | undefined;
596
- export declare function getAcceptedScopesByType({ acceptedScopes, scopes }: {
597
- acceptedScopes: ScopeType[];
598
- scopes: EncodedScope[];
599
- }): Scope[];
600
- /**
601
- * Checks if the provided scopes or token contain any of the accepted scopes.
602
- *
603
- * Overloads:
604
- * - `hasAnyScope(token, scopes)` → extracts scopes from a token
605
- * - `hasAnyScope(scopes, scopes)` → checks directly from a scope array
606
- */
607
- /**
608
- * Checks if the provided token contains any of the accepted scopes.
609
- *
610
- * @param {string} token - The authentication JWT token.
611
- * @param {ScopeType[]} scopes - An array of scope types to check for.
612
- * @returns {boolean} True if the token contains at least one of the accepted scopes, false otherwise.
613
- */
614
- export declare function hasAnyScope(token: string, scopes: ScopeType[]): boolean;
615
- /**
616
- * Checks if the provided array of scopes contains any of the accepted scopes.
617
- *
618
- * @param {EncodedScope[]} userScopes - Array of scopes to check.
619
- * @param {ScopeType[]} scopes - An array of scope types to check for.
620
- * @returns {boolean} True if the scope list contains at least one of the accepted scopes.
621
- */
622
- export declare function hasAnyScope(userScopes: EncodedScope[], scopes: ScopeType[]): boolean;
623
- /**
624
- * Checks whether a scope exists either inside a JWT token or
625
- * within a provided list of scopes.
626
- *
627
- * Overloads:
628
- * - `hasScope(token, scope)` → extracts scopes from a token
629
- * - `hasScope(scopes, scope)` → checks directly from a scope array
630
- */
631
- /**
632
- * Checks if the provided token contains the given scope.
633
- *
634
- * @param token - The authentication JWT token.
635
- * @param scope - The scope type to check for.
636
- * @returns True if the token contains the specified scope.
637
- */
638
- export declare function hasScope(token: string, scope: ScopeType): boolean;
639
- /**
640
- * Checks if the provided list of scopes contains the given scope.
641
- *
642
- * @param scopes - Array of scopes to check.
643
- * @param scope - The scope type to check for.
644
- * @returns True if the scope list contains the specified scope.
645
- */
646
- export declare function hasScope(scopes: EncodedScope[], scope: ScopeType): boolean;
647
- /**
648
- * Checks if the given event type is allowed by the accepted scopes. If no specific event types are defined, it returns true.
649
- *
650
- * @param {Scope[]} userScopes - The scopes of the user.
651
- * @param {string} eventType - The event type to check for permission.
652
- * @returns {boolean} Returns true if the event type is allowed by the scope.
653
- */
654
- export declare function canUserCreateEvent(userScopes: EncodedScope[], eventType: string): boolean;
655
- /**
656
- * Helper for defining scopes for user roles. Should be used in country config.
657
- *
658
- * @param scopes Array of scopes in object format.
659
- * @returns Array of scopes in string format, encoded for use in JWT tokens.
360
+ * Stringifies a ConfigurableScopes object into a scope string.
361
+ * @param {ConfigurableScopes} scope - The scope object to stringify
362
+ * @returns {string} The stringified scope in format "type[key1=value1|value2,key2=value3|value4]"
363
+ * @example
364
+ * stringifyScope({
365
+ * type: "record.notify",
366
+ * options: { event: ["birth", "tennis-club-membership"] }
367
+ * })
368
+ * // Returns: "record.notify[event=birth|tennis-club-membership]"
660
369
  */
661
- export declare function defineScopes(scopes: Scope[]): (string & z.core.$brand<"EncodedScope">)[];
370
+ export declare function stringifyScope(scope: z.infer<typeof ConfigurableRawScopes>): string;
662
371
  /**
663
- * Helper for defining user roles. Should be used in country config.
372
+ * Extracts authorized event identifiers (e.g. birth, death) from the provided configurable scopes.
664
373
  *
665
- * @param roles Array of roles in object format.
374
+ * @param scopes - Array of configurable scopes with options
375
+ * @returns Array of authorized event identifiers
666
376
  */
667
- export declare function defineRoles(roles: Role[]): {
668
- id: string;
669
- scopes: (string & z.core.$brand<"EncodedScope">)[];
670
- }[];
377
+ export declare function getAuthorizedEventsFromScopes(scopes: ConfigurableScopes[]): string[];
378
+ export declare const scopes: Scope[];
379
+ export type ParsedScopes = NonNullable<ReturnType<typeof parseConfigurableScope>>;
380
+ export type RawScopes = z.infer<typeof LiteralScopes> | (string & {});
381
+ export type Scope = RawScopes;
382
+ export declare const ActionScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.declare-birth:my-jurisdiction">, z.ZodLiteral<"record.declare-death">, z.ZodLiteral<"record.declare-death:my-jurisdiction">, z.ZodLiteral<"record.declare-marriage">, z.ZodLiteral<"record.declare-marriage:my-jurisdiction">, z.ZodLiteral<"record.declaration-submit-incomplete">, z.ZodLiteral<"record.declaration-submit-for-review">]>, z.ZodUnion<[z.ZodLiteral<"record.declaration-submit-for-approval">, z.ZodLiteral<"record.declaration-submit-for-updates">, z.ZodLiteral<"record.declaration-edit">, z.ZodLiteral<"record.review-duplicates">, z.ZodLiteral<"record.declaration-archive">, z.ZodLiteral<"record.declaration-reinstate">]>, z.ZodLiteral<"record.register">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodUnion<[z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>]>;
383
+ export type ActionScopes = z.infer<typeof ActionScopes>;
671
384
  export {};
672
385
  //# sourceMappingURL=scopes.d.ts.map