@ecrvs/opencrvs-toolkit 1.8.1-rc.a7ee8fb

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 (76) hide show
  1. package/README.md +70 -0
  2. package/build.sh +56 -0
  3. package/dist/api/index.d.ts +11 -0
  4. package/dist/api/index.d.ts.map +1 -0
  5. package/dist/api/index.js +52 -0
  6. package/dist/commons/api/router.d.ts +14568 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +194 -0
  8. package/dist/commons/conditionals/index.d.ts +2 -0
  9. package/dist/commons/conditionals/validate.d.ts +129 -0
  10. package/dist/commons/events/ActionConfig.d.ts +2034 -0
  11. package/dist/commons/events/ActionDocument.d.ts +14400 -0
  12. package/dist/commons/events/ActionInput.d.ts +11157 -0
  13. package/dist/commons/events/ActionType.d.ts +52 -0
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +1175 -0
  15. package/dist/commons/events/CompositeFieldValue.d.ts +181 -0
  16. package/dist/commons/events/Conditional.d.ts +55 -0
  17. package/dist/commons/events/Constants.d.ts +3 -0
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +4494 -0
  19. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  20. package/dist/commons/events/DeduplicationConfig.d.ts +209 -0
  21. package/dist/commons/events/Draft.d.ts +814 -0
  22. package/dist/commons/events/EventConfig.d.ts +2237 -0
  23. package/dist/commons/events/EventConfigInput.d.ts +10 -0
  24. package/dist/commons/events/EventDocument.d.ts +8505 -0
  25. package/dist/commons/events/EventIndex.d.ts +3858 -0
  26. package/dist/commons/events/EventInput.d.ts +13 -0
  27. package/dist/commons/events/EventMetadata.d.ts +408 -0
  28. package/dist/commons/events/FieldConfig.d.ts +7125 -0
  29. package/dist/commons/events/FieldType.d.ts +46 -0
  30. package/dist/commons/events/FieldTypeMapping.d.ts +537 -0
  31. package/dist/commons/events/FieldValue.d.ts +250 -0
  32. package/dist/commons/events/FileUtils.d.ts +4 -0
  33. package/dist/commons/events/FormConfig.d.ts +725 -0
  34. package/dist/commons/events/PageConfig.d.ts +336 -0
  35. package/dist/commons/events/SummaryConfig.d.ts +170 -0
  36. package/dist/commons/events/TemplateConfig.d.ts +38 -0
  37. package/dist/commons/events/TranslationConfig.d.ts +15 -0
  38. package/dist/commons/events/User.d.ts +45 -0
  39. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  40. package/dist/commons/events/WorkqueueConfig.d.ts +8997 -0
  41. package/dist/commons/events/deduplication.d.ts +32 -0
  42. package/dist/commons/events/defineConfig.d.ts +309 -0
  43. package/dist/commons/events/event.d.ts +109 -0
  44. package/dist/commons/events/field.d.ts +151 -0
  45. package/dist/commons/events/index.d.ts +46 -0
  46. package/dist/commons/events/locations.d.ts +24 -0
  47. package/dist/commons/events/scopes.d.ts +55 -0
  48. package/dist/commons/events/serializer.d.ts +2 -0
  49. package/dist/commons/events/state/availableActions.d.ts +6 -0
  50. package/dist/commons/events/state/flags.d.ts +4 -0
  51. package/dist/commons/events/state/index.d.ts +146 -0
  52. package/dist/commons/events/state/utils.d.ts +1263 -0
  53. package/dist/commons/events/test.utils.d.ts +473 -0
  54. package/dist/commons/events/transactions.d.ts +2 -0
  55. package/dist/commons/events/utils.d.ts +501 -0
  56. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  57. package/dist/commons/notification/UserNotifications.d.ts +632 -0
  58. package/dist/commons/notification/index.d.ts +2 -0
  59. package/dist/conditionals/index.d.ts +2 -0
  60. package/dist/conditionals/index.d.ts.map +1 -0
  61. package/dist/conditionals/index.js +491 -0
  62. package/dist/events/deduplication.d.ts +32 -0
  63. package/dist/events/deduplication.d.ts.map +1 -0
  64. package/dist/events/deduplication.js +67 -0
  65. package/dist/events/index.d.ts +2 -0
  66. package/dist/events/index.d.ts.map +1 -0
  67. package/dist/events/index.js +8383 -0
  68. package/dist/notification/index.d.ts +2 -0
  69. package/dist/notification/index.d.ts.map +1 -0
  70. package/dist/notification/index.js +5928 -0
  71. package/dist/scopes/index.d.ts +335 -0
  72. package/dist/scopes/index.d.ts.map +1 -0
  73. package/dist/scopes/index.js +379 -0
  74. package/package.json +40 -0
  75. package/tsconfig.json +27 -0
  76. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,335 @@
1
+ import { z } from 'zod';
2
+ import { SearchScopeAccessLevels } from './events';
3
+ export declare const SCOPES: {
4
+ readonly NATLSYSADMIN: "natlsysadmin";
5
+ readonly BYPASSRATELIMIT: "bypassratelimit";
6
+ readonly DECLARE: "declare";
7
+ readonly REGISTER: "register";
8
+ readonly VALIDATE: "validate";
9
+ readonly DEMO: "demo";
10
+ readonly CERTIFY: "certify";
11
+ readonly PERFORMANCE: "performance";
12
+ readonly SYSADMIN: "sysadmin";
13
+ readonly TEAMS: "teams";
14
+ readonly CONFIG: "config";
15
+ readonly WEBHOOK: "webhook";
16
+ readonly NATIONALID: "nationalId";
17
+ readonly NOTIFICATION_API: "notification-api";
18
+ readonly RECORDSEARCH: "recordsearch";
19
+ readonly RECORD_IMPORT: "record.import";
20
+ readonly RECORD_EXPORT: "record.export";
21
+ readonly RECORD_REINDEX: "record.reindex";
22
+ readonly RECORD_DECLARE_BIRTH: "record.declare-birth";
23
+ readonly RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction";
24
+ readonly RECORD_DECLARE_DEATH: "record.declare-death";
25
+ readonly RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction";
26
+ readonly RECORD_DECLARE_MARRIAGE: "record.declare-marriage";
27
+ readonly RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction";
28
+ readonly RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete";
29
+ readonly RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review";
30
+ readonly RECORD_UNASSIGN_OTHERS: "record.unassign-others";
31
+ readonly RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval";
32
+ readonly RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates";
33
+ readonly RECORD_DECLARATION_EDIT: "record.declaration-edit";
34
+ readonly RECORD_REVIEW_DUPLICATES: "record.review-duplicates";
35
+ readonly RECORD_DECLARATION_ARCHIVE: "record.declaration-archive";
36
+ readonly RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate";
37
+ readonly RECORD_REGISTER: "record.register";
38
+ readonly RECORD_EXPORT_RECORDS: "record.export-records";
39
+ readonly RECORD_DECLARATION_PRINT: "record.declaration-print";
40
+ readonly RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS: "record.declaration-print-supporting-documents";
41
+ readonly RECORD_REGISTRATION_PRINT: "record.registration-print";
42
+ /**
43
+ * This scope is used to **print and **issue certified copies of a record
44
+ * after it has been registered. Previously Registrars had this permission.
45
+ */
46
+ readonly RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies";
47
+ readonly RECORD_PRINT_CERTIFIED_COPIES: "record.registration-print-certified-copies";
48
+ readonly RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES: "record.registration-verify-certified-copies";
49
+ readonly RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction";
50
+ readonly RECORD_REGISTRATION_CORRECT: "record.registration-correct";
51
+ readonly RECORD_CONFIRM_REGISTRATION: "record.confirm-registration";
52
+ readonly RECORD_REJECT_REGISTRATION: "record.reject-registration";
53
+ readonly SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction";
54
+ readonly SEARCH_BIRTH: "search.birth";
55
+ readonly SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction";
56
+ readonly SEARCH_DEATH: "search.death";
57
+ readonly SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction";
58
+ readonly SEARCH_MARRIAGE: "search.marriage";
59
+ readonly RECORD_READ: "record.read";
60
+ readonly PROFILE_UPDATE: "profile.update";
61
+ readonly PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature";
62
+ readonly PERFORMANCE_READ: "performance.read";
63
+ readonly PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards";
64
+ readonly PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export";
65
+ readonly ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all";
66
+ readonly ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office";
67
+ readonly ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction";
68
+ readonly USER_READ: "user.read:all";
69
+ readonly USER_READ_MY_OFFICE: "user.read:my-office";
70
+ readonly USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction";
71
+ readonly USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit";
72
+ readonly USER_CREATE: "user.create:all";
73
+ readonly USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction";
74
+ readonly USER_UPDATE: "user.update:all";
75
+ readonly USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction";
76
+ readonly CONFIG_UPDATE_ALL: "config.update:all";
77
+ readonly USER_DATA_SEEDING: "user.data-seeding";
78
+ };
79
+ 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">]>;
80
+ declare const LiteralScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"natlsysadmin">, z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"declare">, z.ZodLiteral<"register">, z.ZodLiteral<"validate">, z.ZodLiteral<"demo">, z.ZodLiteral<"certify">, z.ZodLiteral<"performance">, z.ZodLiteral<"sysadmin">, z.ZodLiteral<"teams">, 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.ZodUnion<[z.ZodLiteral<"record.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-verify-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.ZodUnion<[z.ZodLiteral<"profile.update">, 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">]>]>;
81
+ declare const SearchScope: z.ZodObject<{
82
+ type: z.ZodLiteral<"search">;
83
+ options: z.ZodObject<{
84
+ event: z.ZodArray<z.ZodString, "many">;
85
+ access: z.ZodArray<z.ZodEnum<["my-jurisdiction", "all"]>, "many">;
86
+ }, "strip", z.ZodTypeAny, {
87
+ event: string[];
88
+ access: ("my-jurisdiction" | "all")[];
89
+ }, {
90
+ event: string[];
91
+ access: ("my-jurisdiction" | "all")[];
92
+ }>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ type: "search";
95
+ options: {
96
+ event: string[];
97
+ access: ("my-jurisdiction" | "all")[];
98
+ };
99
+ }, {
100
+ type: "search";
101
+ options: {
102
+ event: string[];
103
+ access: ("my-jurisdiction" | "all")[];
104
+ };
105
+ }>;
106
+ export type SearchScope = z.infer<typeof SearchScope>;
107
+ 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.print-certified-copies", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
108
+ export type RecordScopeType = z.infer<typeof RecordScopeType>;
109
+ export declare const RecordScope: z.ZodObject<{
110
+ 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.print-certified-copies", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
111
+ options: z.ZodObject<{
112
+ event: z.ZodArray<z.ZodString, "many">;
113
+ }, "strip", z.ZodTypeAny, {
114
+ event: string[];
115
+ }, {
116
+ event: string[];
117
+ }>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ 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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
120
+ options: {
121
+ event: string[];
122
+ };
123
+ }, {
124
+ 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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
125
+ options: {
126
+ event: string[];
127
+ };
128
+ }>;
129
+ export type RecordScope = z.infer<typeof RecordScope>;
130
+ declare const ConfigurableRawScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
131
+ type: z.ZodLiteral<"search">;
132
+ options: z.ZodObject<{
133
+ event: z.ZodArray<z.ZodString, "many">;
134
+ access: z.ZodArray<z.ZodEnum<["my-jurisdiction", "all"]>, "many">;
135
+ }, "strip", z.ZodTypeAny, {
136
+ event: string[];
137
+ access: ("my-jurisdiction" | "all")[];
138
+ }, {
139
+ event: string[];
140
+ access: ("my-jurisdiction" | "all")[];
141
+ }>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ type: "search";
144
+ options: {
145
+ event: string[];
146
+ access: ("my-jurisdiction" | "all")[];
147
+ };
148
+ }, {
149
+ type: "search";
150
+ options: {
151
+ event: string[];
152
+ access: ("my-jurisdiction" | "all")[];
153
+ };
154
+ }>, z.ZodObject<{
155
+ type: z.ZodLiteral<"user.create">;
156
+ options: z.ZodObject<{
157
+ role: z.ZodArray<z.ZodString, "many">;
158
+ }, "strip", z.ZodTypeAny, {
159
+ role: string[];
160
+ }, {
161
+ role: string[];
162
+ }>;
163
+ }, "strip", z.ZodTypeAny, {
164
+ type: "user.create";
165
+ options: {
166
+ role: string[];
167
+ };
168
+ }, {
169
+ type: "user.create";
170
+ options: {
171
+ role: string[];
172
+ };
173
+ }>, z.ZodObject<{
174
+ type: z.ZodLiteral<"user.edit">;
175
+ options: z.ZodObject<{
176
+ role: z.ZodArray<z.ZodString, "many">;
177
+ }, "strip", z.ZodTypeAny, {
178
+ role: string[];
179
+ }, {
180
+ role: string[];
181
+ }>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ type: "user.edit";
184
+ options: {
185
+ role: string[];
186
+ };
187
+ }, {
188
+ type: "user.edit";
189
+ options: {
190
+ role: string[];
191
+ };
192
+ }>, z.ZodObject<{
193
+ type: z.ZodLiteral<"workqueue">;
194
+ options: z.ZodObject<{
195
+ id: z.ZodArray<z.ZodString, "many">;
196
+ }, "strip", z.ZodTypeAny, {
197
+ id: string[];
198
+ }, {
199
+ id: string[];
200
+ }>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ type: "workqueue";
203
+ options: {
204
+ id: string[];
205
+ };
206
+ }, {
207
+ type: "workqueue";
208
+ options: {
209
+ id: string[];
210
+ };
211
+ }>, z.ZodObject<{
212
+ 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.print-certified-copies", "record.registered.request-correction", "record.registered.correct", "record.unassign-others"]>;
213
+ options: z.ZodObject<{
214
+ event: z.ZodArray<z.ZodString, "many">;
215
+ }, "strip", z.ZodTypeAny, {
216
+ event: string[];
217
+ }, {
218
+ event: string[];
219
+ }>;
220
+ }, "strip", z.ZodTypeAny, {
221
+ 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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
222
+ options: {
223
+ event: string[];
224
+ };
225
+ }, {
226
+ 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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
227
+ options: {
228
+ event: string[];
229
+ };
230
+ }>]>;
231
+ type ConfigurableRawScopes = z.infer<typeof ConfigurableRawScopes>;
232
+ export type ConfigurableScopeType = ConfigurableRawScopes['type'];
233
+ type FlattenedSearchScope = {
234
+ type: 'search';
235
+ options: Record<string, SearchScopeAccessLevels>;
236
+ };
237
+ export type ConfigurableScopes = Exclude<ConfigurableRawScopes, {
238
+ type: 'search';
239
+ }> | FlattenedSearchScope;
240
+ export declare function findScope<T extends ConfigurableScopeType>(scopes: string[], scopeType: T): Extract<{
241
+ type: "user.create";
242
+ options: {
243
+ role: string[];
244
+ };
245
+ }, {
246
+ type: T;
247
+ }> | Extract<{
248
+ type: "user.edit";
249
+ options: {
250
+ role: string[];
251
+ };
252
+ }, {
253
+ type: T;
254
+ }> | Extract<{
255
+ type: "workqueue";
256
+ options: {
257
+ id: string[];
258
+ };
259
+ }, {
260
+ type: T;
261
+ }> | Extract<{
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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
263
+ options: {
264
+ event: string[];
265
+ };
266
+ }, {
267
+ type: T;
268
+ }> | Extract<FlattenedSearchScope, {
269
+ type: T;
270
+ }> | undefined;
271
+ /**
272
+ * Parses a configurable scope string into a ConfigurableRawScopes object.
273
+ * @param {string} scope - The scope string to parse
274
+ * @returns {ConfigurableRawScopes | undefined} The parsed scope object if valid, undefined otherwise
275
+ * @example
276
+ * parseScope("user.create[role=field-agent|registration-agent]")
277
+ * // Returns: { type: "user.create", options: { role: ["field-agent", "registration-agent"] } }
278
+ */
279
+ export declare function parseConfigurableScope(scope: string): {
280
+ type: "search";
281
+ options: {
282
+ event: string[];
283
+ access: ("my-jurisdiction" | "all")[];
284
+ };
285
+ } | {
286
+ type: "user.create";
287
+ options: {
288
+ role: string[];
289
+ };
290
+ } | {
291
+ type: "user.edit";
292
+ options: {
293
+ role: string[];
294
+ };
295
+ } | {
296
+ type: "workqueue";
297
+ options: {
298
+ id: string[];
299
+ };
300
+ } | {
301
+ 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.print-certified-copies" | "record.registered.request-correction" | "record.registered.correct";
302
+ options: {
303
+ event: string[];
304
+ };
305
+ } | undefined;
306
+ export declare function parseLiteralScope(scope: string): {
307
+ type: "natlsysadmin" | "bypassratelimit" | "declare" | "register" | "validate" | "demo" | "certify" | "performance" | "sysadmin" | "teams" | "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.export-records" | "record.declaration-print" | "record.declaration-print-supporting-documents" | "record.registration-print" | "record.registration-print&issue-certified-copies" | "record.registration-print-certified-copies" | "record.registration-verify-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.update" | "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";
308
+ } | undefined;
309
+ /**
310
+ * Stringifies a ConfigurableScopes object into a scope string.
311
+ * @param {ConfigurableScopes} scope - The scope object to stringify
312
+ * @returns {string} The stringified scope in format "type[key1=value1|value2,key2=value3|value4]"
313
+ * @example
314
+ * stringifyScope({
315
+ * type: "record.notify",
316
+ * options: { event: ["birth", "tennis-club-membership"] }
317
+ * })
318
+ * // Returns: "record.notify[event=birth|tennis-club-membership]"
319
+ */
320
+ export declare function stringifyScope(scope: z.infer<typeof ConfigurableRawScopes>): string;
321
+ /**
322
+ * Extracts authorized event identifiers (e.g. birth, death) from the provided configurable scopes.
323
+ *
324
+ * @param scopes - Array of configurable scopes with options
325
+ * @returns Array of authorized event identifiers
326
+ */
327
+ export declare function getAuthorizedEventsFromScopes(scopes: ConfigurableScopes[]): string[];
328
+ export declare const scopes: Scope[];
329
+ export type ParsedScopes = NonNullable<ReturnType<typeof parseConfigurableScope>>;
330
+ export type RawScopes = z.infer<typeof LiteralScopes> | (string & {});
331
+ export type Scope = RawScopes;
332
+ 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.ZodUnion<[z.ZodLiteral<"record.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-verify-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">]>]>;
333
+ export type ActionScopes = z.infer<typeof ActionScopes>;
334
+ export {};
335
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scopes/index.ts"],"names":[],"mappings":"AAUA,cAAc,0BAA0B,CAAA"}