@opencrvs/toolkit 1.9.12-rc.eae3bc3 → 1.9.12-rc.efbd898

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 (84) hide show
  1. package/build.sh +8 -0
  2. package/dist/application-config/index.js +2045 -41
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +2422 -0
  6. package/dist/commons/api/router.d.ts +337 -118
  7. package/dist/commons/application-config/index.d.ts +13 -16
  8. package/dist/commons/conditionals/conditionals.d.ts +8 -8
  9. package/dist/commons/events/ActionDocument.d.ts +196 -196
  10. package/dist/commons/events/ActionInput.d.ts +113 -113
  11. package/dist/commons/events/ActionType.d.ts +3 -3
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  13. package/dist/commons/events/AuditLog.d.ts +345 -163
  14. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +461 -190
  16. package/dist/commons/events/Draft.d.ts +9 -9
  17. package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
  18. package/dist/commons/events/EventDocument.d.ts +80 -80
  19. package/dist/commons/events/EventIndex.d.ts +35 -27
  20. package/dist/commons/events/EventInput.d.ts +1 -1
  21. package/dist/commons/events/EventMetadata.d.ts +19 -19
  22. package/dist/commons/events/FieldConfig.d.ts +285 -69
  23. package/dist/commons/events/FieldType.d.ts +2 -1
  24. package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
  25. package/dist/commons/events/FieldValue.d.ts +54 -26
  26. package/dist/commons/events/PlainDate.d.ts +1 -1
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +7 -7
  28. package/dist/commons/events/WorkqueueConfig.d.ts +443 -199
  29. package/dist/commons/events/defineConfig.d.ts +0 -4
  30. package/dist/commons/events/locations.d.ts +4 -4
  31. package/dist/commons/events/scopes.d.ts +3 -2
  32. package/dist/commons/events/state/index.d.ts +2 -2
  33. package/dist/commons/events/state/utils.d.ts +1 -1
  34. package/dist/commons/events/test.utils.d.ts +2 -2
  35. package/dist/commons/events/utils.d.ts +3 -175
  36. package/dist/commons/notification/UserNotifications.d.ts +6 -1
  37. package/dist/conditionals/index.js +74 -359
  38. package/dist/events/index.js +1194 -1261
  39. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  40. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  41. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  42. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  43. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  44. package/dist/migrations/v2.0/convert-config-files-to-ts.js +753 -0
  45. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  46. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  47. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  48. package/dist/migrations/v2.0/index.d.ts +7 -0
  49. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  50. package/dist/migrations/v2.0/index.js +2361 -0
  51. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  52. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  53. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  54. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  55. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  56. package/dist/migrations/v2.0/migrate-scopes.js +281 -0
  57. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  58. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  59. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  60. package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
  61. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
  62. package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
  63. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  64. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  65. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  66. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  67. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  68. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  69. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  70. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  71. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  72. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  73. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  74. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  75. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  76. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  77. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  78. package/dist/notification/index.js +1002 -1133
  79. package/dist/scopes/index.d.ts +389 -152
  80. package/dist/scopes/index.js +128 -322
  81. package/opencrvs-toolkit-1.9.12-rc.efbd898.tgz +0 -0
  82. package/package.json +11 -7
  83. package/tsconfig.tsbuildinfo +1 -1
  84. package/opencrvs-toolkit-1.9.12-rc.eae3bc3.tgz +0 -0
@@ -1,78 +1,9 @@
1
1
  import * as z from 'zod/v4';
2
- export declare const SCOPES: {
3
- readonly BYPASSRATELIMIT: "bypassratelimit";
4
- readonly REGISTER: "register";
5
- readonly DEMO: "demo";
6
- readonly CONFIG: "config";
7
- readonly WEBHOOK: "webhook";
8
- readonly NATIONALID: "nationalId";
9
- readonly NOTIFICATION_API: "notification-api";
10
- readonly RECORDSEARCH: "recordsearch";
11
- readonly RECORD_IMPORT: "record.import";
12
- readonly RECORD_EXPORT: "record.export";
13
- readonly RECORD_REINDEX: "record.reindex";
14
- readonly INTEGRATION_CREATE: "integration.create";
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
- readonly ATTACHMENT_UPLOAD: "attachment.upload";
65
- };
66
- /**
67
- * @deprecated - will be removed in v2.1.
68
- */
69
- export declare function parseLiteralScope(scope: string): {
70
- type: "bypassratelimit" | "register" | "demo" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.import" | "record.reindex" | "integration.create" | "record.registration-print&issue-certified-copies" | "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" | "attachment.upload";
71
- } | undefined;
2
+ import { Role } from './roles';
72
3
  export declare const JurisdictionFilter: z.ZodEnum<{
73
- all: "all";
74
4
  administrativeArea: "administrativeArea";
75
5
  location: "location";
6
+ all: "all";
76
7
  }>;
77
8
  export type JurisdictionFilter = z.infer<typeof JurisdictionFilter>;
78
9
  export declare const UserFilter: z.ZodEnum<{
@@ -86,48 +17,54 @@ export type UserFilter = z.infer<typeof UserFilter>;
86
17
  * @see scopeOptionsPlaceEvent @see scopeOptionsDeclared @see scopeOptionsFull
87
18
  */
88
19
  export declare const RecordScopeTypeV2: z.ZodEnum<{
20
+ "record.search": "record.search";
89
21
  "record.create": "record.create";
90
22
  "record.read": "record.read";
91
23
  "record.declare": "record.declare";
92
24
  "record.notify": "record.notify";
93
- "record.register": "record.register";
94
- "record.unassign-others": "record.unassign-others";
95
- "record.review-duplicates": "record.review-duplicates";
96
- "record.search": "record.search";
97
25
  "record.edit": "record.edit";
98
26
  "record.reject": "record.reject";
99
27
  "record.archive": "record.archive";
28
+ "record.review-duplicates": "record.review-duplicates";
29
+ "record.register": "record.register";
100
30
  "record.print-certified-copies": "record.print-certified-copies";
101
31
  "record.request-correction": "record.request-correction";
102
32
  "record.correct": "record.correct";
33
+ "record.unassign-others": "record.unassign-others";
103
34
  "record.custom-action": "record.custom-action";
104
35
  }>;
105
36
  export type RecordScopeTypeV2 = z.infer<typeof RecordScopeTypeV2>;
106
- declare const ScopeOptionsFull: z.ZodObject<{
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
+ }>>;
107
44
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
108
45
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
109
- all: "all";
110
46
  administrativeArea: "administrativeArea";
111
47
  location: "location";
48
+ all: "all";
112
49
  }>>;
113
50
  declaredIn: z.ZodOptional<z.ZodEnum<{
114
- all: "all";
115
51
  administrativeArea: "administrativeArea";
116
52
  location: "location";
53
+ all: "all";
117
54
  }>>;
118
55
  declaredBy: z.ZodOptional<z.ZodEnum<{
119
56
  user: "user";
120
57
  }>>;
121
58
  registeredIn: z.ZodOptional<z.ZodEnum<{
122
- all: "all";
123
59
  administrativeArea: "administrativeArea";
124
60
  location: "location";
61
+ all: "all";
125
62
  }>>;
126
63
  registeredBy: z.ZodOptional<z.ZodEnum<{
127
64
  user: "user";
128
65
  }>>;
129
66
  }, z.core.$strip>;
130
- export type ScopeOptionsFull = z.infer<typeof ScopeOptionsFull>;
67
+ type AllScopeOptions = z.infer<typeof AllScopeOptions>;
131
68
  export declare const ScopeOptionKey: z.ZodEnum<{
132
69
  event: "event";
133
70
  placeOfEvent: "placeOfEvent";
@@ -135,6 +72,8 @@ export declare const ScopeOptionKey: z.ZodEnum<{
135
72
  declaredBy: "declaredBy";
136
73
  registeredIn: "registeredIn";
137
74
  registeredBy: "registeredBy";
75
+ accessLevel: "accessLevel";
76
+ ids: "ids";
138
77
  }>;
139
78
  export type ScopeOptionKey = z.infer<typeof ScopeOptionKey>;
140
79
  export declare const ScopesWithPlaceEventOptions: z.ZodEnum<{
@@ -143,18 +82,18 @@ export declare const ScopesWithPlaceEventOptions: z.ZodEnum<{
143
82
  "record.notify": "record.notify";
144
83
  }>;
145
84
  export declare const ScopesWithDeclaredOptions: z.ZodEnum<{
146
- "record.register": "record.register";
147
- "record.review-duplicates": "record.review-duplicates";
148
85
  "record.edit": "record.edit";
149
86
  "record.reject": "record.reject";
150
87
  "record.archive": "record.archive";
88
+ "record.review-duplicates": "record.review-duplicates";
89
+ "record.register": "record.register";
151
90
  }>;
152
91
  export declare const ScopesWithFullOptions: z.ZodEnum<{
153
- "record.read": "record.read";
154
- "record.unassign-others": "record.unassign-others";
155
92
  "record.search": "record.search";
93
+ "record.read": "record.read";
156
94
  "record.request-correction": "record.request-correction";
157
95
  "record.correct": "record.correct";
96
+ "record.unassign-others": "record.unassign-others";
158
97
  }>;
159
98
  export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
99
  type: z.ZodEnum<{
@@ -165,30 +104,30 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
104
  options: z.ZodOptional<z.ZodObject<{
166
105
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
167
106
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
168
- all: "all";
169
107
  administrativeArea: "administrativeArea";
170
108
  location: "location";
109
+ all: "all";
171
110
  }>>;
172
111
  }, z.core.$strip>>;
173
112
  }, z.core.$strip>, z.ZodObject<{
174
113
  type: z.ZodEnum<{
175
- "record.register": "record.register";
176
- "record.review-duplicates": "record.review-duplicates";
177
114
  "record.edit": "record.edit";
178
115
  "record.reject": "record.reject";
179
116
  "record.archive": "record.archive";
117
+ "record.review-duplicates": "record.review-duplicates";
118
+ "record.register": "record.register";
180
119
  }>;
181
120
  options: z.ZodOptional<z.ZodObject<{
182
121
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
183
122
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
184
- all: "all";
185
123
  administrativeArea: "administrativeArea";
186
124
  location: "location";
125
+ all: "all";
187
126
  }>>;
188
127
  declaredIn: z.ZodOptional<z.ZodEnum<{
189
- all: "all";
190
128
  administrativeArea: "administrativeArea";
191
129
  location: "location";
130
+ all: "all";
192
131
  }>>;
193
132
  declaredBy: z.ZodOptional<z.ZodEnum<{
194
133
  user: "user";
@@ -196,31 +135,31 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
196
135
  }, z.core.$strip>>;
197
136
  }, z.core.$strip>, z.ZodObject<{
198
137
  type: z.ZodEnum<{
199
- "record.read": "record.read";
200
- "record.unassign-others": "record.unassign-others";
201
138
  "record.search": "record.search";
139
+ "record.read": "record.read";
202
140
  "record.request-correction": "record.request-correction";
203
141
  "record.correct": "record.correct";
142
+ "record.unassign-others": "record.unassign-others";
204
143
  }>;
205
144
  options: z.ZodOptional<z.ZodObject<{
206
145
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
207
146
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
208
- all: "all";
209
147
  administrativeArea: "administrativeArea";
210
148
  location: "location";
149
+ all: "all";
211
150
  }>>;
212
151
  declaredIn: z.ZodOptional<z.ZodEnum<{
213
- all: "all";
214
152
  administrativeArea: "administrativeArea";
215
153
  location: "location";
154
+ all: "all";
216
155
  }>>;
217
156
  declaredBy: z.ZodOptional<z.ZodEnum<{
218
157
  user: "user";
219
158
  }>>;
220
159
  registeredIn: z.ZodOptional<z.ZodEnum<{
221
- all: "all";
222
160
  administrativeArea: "administrativeArea";
223
161
  location: "location";
162
+ all: "all";
224
163
  }>>;
225
164
  registeredBy: z.ZodOptional<z.ZodEnum<{
226
165
  user: "user";
@@ -231,22 +170,22 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
170
  options: z.ZodOptional<z.ZodObject<{
232
171
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
233
172
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
234
- all: "all";
235
173
  administrativeArea: "administrativeArea";
236
174
  location: "location";
175
+ all: "all";
237
176
  }>>;
238
177
  declaredIn: z.ZodOptional<z.ZodEnum<{
239
- all: "all";
240
178
  administrativeArea: "administrativeArea";
241
179
  location: "location";
180
+ all: "all";
242
181
  }>>;
243
182
  declaredBy: z.ZodOptional<z.ZodEnum<{
244
183
  user: "user";
245
184
  }>>;
246
185
  registeredIn: z.ZodOptional<z.ZodEnum<{
247
- all: "all";
248
186
  administrativeArea: "administrativeArea";
249
187
  location: "location";
188
+ all: "all";
250
189
  }>>;
251
190
  registeredBy: z.ZodOptional<z.ZodEnum<{
252
191
  user: "user";
@@ -258,22 +197,22 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
258
197
  options: z.ZodOptional<z.ZodObject<{
259
198
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
260
199
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
261
- all: "all";
262
200
  administrativeArea: "administrativeArea";
263
201
  location: "location";
202
+ all: "all";
264
203
  }>>;
265
204
  declaredIn: z.ZodOptional<z.ZodEnum<{
266
- all: "all";
267
205
  administrativeArea: "administrativeArea";
268
206
  location: "location";
207
+ all: "all";
269
208
  }>>;
270
209
  declaredBy: z.ZodOptional<z.ZodEnum<{
271
210
  user: "user";
272
211
  }>>;
273
212
  registeredIn: z.ZodOptional<z.ZodEnum<{
274
- all: "all";
275
213
  administrativeArea: "administrativeArea";
276
214
  location: "location";
215
+ all: "all";
277
216
  }>>;
278
217
  registeredBy: z.ZodOptional<z.ZodEnum<{
279
218
  user: "user";
@@ -281,16 +220,16 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
281
220
  templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
282
221
  }, z.core.$strip>>;
283
222
  }, z.core.$strip>], "type">;
284
- export declare function scopeUsesDeclaredOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
223
+ export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
285
224
  type: z.infer<typeof ScopesWithDeclaredOptions>;
286
225
  }>;
287
- export declare function scopeUsesFullOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
226
+ export declare function scopeUsesFullOptions(scope: Scope): scope is Extract<Scope, {
288
227
  type: z.infer<typeof ScopesWithFullOptions>;
289
228
  }>;
290
- export declare function scopeUsesPrintCertifiedCopiesOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
229
+ export declare function scopeUsesPrintCertifiedCopiesOptions(scope: Scope): scope is Extract<Scope, {
291
230
  type: 'record.print-certified-copies';
292
231
  }>;
293
- export declare function isCustomActionScope(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
232
+ export declare function isCustomActionScope(scope: Scope): scope is Extract<Scope, {
294
233
  type: 'record.custom-action';
295
234
  }>;
296
235
  export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -301,85 +240,319 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
301
240
  }>;
302
241
  options: z.ZodOptional<z.ZodObject<{
303
242
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
304
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
243
+ placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
305
244
  }, z.core.$strip>>;
306
245
  }, z.core.$strip>, z.ZodObject<{
307
246
  type: z.ZodEnum<{
308
- "record.register": "record.register";
309
- "record.review-duplicates": "record.review-duplicates";
310
247
  "record.edit": "record.edit";
311
248
  "record.reject": "record.reject";
312
249
  "record.archive": "record.archive";
250
+ "record.review-duplicates": "record.review-duplicates";
251
+ "record.register": "record.register";
313
252
  }>;
314
253
  options: z.ZodOptional<z.ZodObject<{
315
254
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
316
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
317
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
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">>>;
318
257
  declaredBy: z.ZodOptional<z.ZodString>;
319
258
  }, z.core.$strip>>;
320
259
  }, z.core.$strip>, z.ZodObject<{
321
260
  type: z.ZodEnum<{
322
- "record.read": "record.read";
323
- "record.unassign-others": "record.unassign-others";
324
261
  "record.search": "record.search";
262
+ "record.read": "record.read";
325
263
  "record.request-correction": "record.request-correction";
326
264
  "record.correct": "record.correct";
265
+ "record.unassign-others": "record.unassign-others";
327
266
  }>;
328
267
  options: z.ZodOptional<z.ZodObject<{
329
268
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
330
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
331
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
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">>>;
332
271
  declaredBy: z.ZodOptional<z.ZodString>;
333
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
272
+ registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
334
273
  registeredBy: z.ZodOptional<z.ZodString>;
335
274
  }, z.core.$strip>>;
336
275
  }, z.core.$strip>, z.ZodObject<{
337
276
  type: z.ZodLiteral<"record.print-certified-copies">;
338
277
  options: z.ZodOptional<z.ZodObject<{
339
278
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
340
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
341
- declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
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">>>;
342
281
  declaredBy: z.ZodOptional<z.ZodString>;
343
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
282
+ registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
344
283
  registeredBy: z.ZodOptional<z.ZodString>;
345
284
  templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
346
285
  }, z.core.$strip>>;
347
286
  }, z.core.$strip>], "type">;
348
287
  export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
349
288
  export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
350
- export declare const encodeScope: (scope: RecordScopeV2) => string;
351
- export declare const decodeScope: (query: string) => {
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";
294
+ }>;
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";
313
+ }>;
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";
319
+ }>;
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";
335
+ }>;
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";
359
+ }>;
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";
444
+ }>;
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<{
453
+ type: z.ZodLiteral<"workqueue">;
454
+ 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">;
459
+ 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;
516
+ /**
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`).
523
+ */
524
+ export declare const decodeScope: (query: EncodedScope) => {
352
525
  type: "record.create" | "record.declare" | "record.notify";
353
526
  options?: {
354
527
  event?: string[] | undefined;
355
- placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
528
+ placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
356
529
  } | undefined;
357
530
  } | {
358
- type: "record.register" | "record.review-duplicates" | "record.edit" | "record.reject" | "record.archive";
531
+ type: "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register";
359
532
  options?: {
360
533
  event?: string[] | undefined;
361
- placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
362
- declaredIn?: "all" | "administrativeArea" | "location" | undefined;
534
+ placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
535
+ declaredIn?: "administrativeArea" | "location" | "all" | undefined;
363
536
  declaredBy?: "user" | undefined;
364
537
  } | undefined;
365
538
  } | {
366
- type: "record.read" | "record.unassign-others" | "record.search" | "record.request-correction" | "record.correct";
539
+ type: "record.search" | "record.read" | "record.request-correction" | "record.correct" | "record.unassign-others";
367
540
  options?: {
368
541
  event?: string[] | undefined;
369
- placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
370
- declaredIn?: "all" | "administrativeArea" | "location" | undefined;
542
+ placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
543
+ declaredIn?: "administrativeArea" | "location" | "all" | undefined;
371
544
  declaredBy?: "user" | undefined;
372
- registeredIn?: "all" | "administrativeArea" | "location" | undefined;
545
+ registeredIn?: "administrativeArea" | "location" | "all" | undefined;
373
546
  registeredBy?: "user" | undefined;
374
547
  } | undefined;
375
548
  } | {
376
549
  type: "record.custom-action";
377
550
  options?: {
378
551
  event?: string[] | undefined;
379
- placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
380
- declaredIn?: "all" | "administrativeArea" | "location" | undefined;
552
+ placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
553
+ declaredIn?: "administrativeArea" | "location" | "all" | undefined;
381
554
  declaredBy?: "user" | undefined;
382
- registeredIn?: "all" | "administrativeArea" | "location" | undefined;
555
+ registeredIn?: "administrativeArea" | "location" | "all" | undefined;
383
556
  registeredBy?: "user" | undefined;
384
557
  customActionTypes?: string[] | undefined;
385
558
  } | undefined;
@@ -387,13 +560,30 @@ export declare const decodeScope: (query: string) => {
387
560
  type: "record.print-certified-copies";
388
561
  options?: {
389
562
  event?: string[] | undefined;
390
- placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
391
- declaredIn?: "all" | "administrativeArea" | "location" | undefined;
563
+ placeOfEvent?: "administrativeArea" | "location" | "all" | undefined;
564
+ declaredIn?: "administrativeArea" | "location" | "all" | undefined;
392
565
  declaredBy?: "user" | undefined;
393
- registeredIn?: "all" | "administrativeArea" | "location" | undefined;
566
+ registeredIn?: "administrativeArea" | "location" | "all" | undefined;
394
567
  registeredBy?: "user" | undefined;
395
568
  templates?: string[] | undefined;
396
569
  } | undefined;
570
+ } | {
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";
572
+ } | {
573
+ type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
574
+ options?: {
575
+ accessLevel?: "administrativeArea" | "location" | "all" | undefined;
576
+ } | undefined;
577
+ } | {
578
+ type: "workqueue";
579
+ options: {
580
+ ids: string[];
581
+ };
582
+ } | {
583
+ type: "dashboard.view";
584
+ options: {
585
+ ids: string[];
586
+ };
397
587
  } | undefined;
398
588
  /**
399
589
  * Function to get the value of a scope option (aka. scope attribute)
@@ -402,34 +592,81 @@ export declare const decodeScope: (query: string) => {
402
592
  * @param option - The option to get the value of.
403
593
  * @returns The value of the scope option. Will return the default value if the option is not set.
404
594
  */
405
- export declare function getScopeOptionValue<T extends ScopeOptionKey>(scope: RecordScopeV2, option: T): ScopeOptionsFull[T] | undefined;
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[];
406
600
  /**
407
- * Converts a V1 scope string to a V2 compatible scope string. Used to migrate between 1.9 and 2.0 scopes.
408
- * @deprecated - This will be removed after migration to V2 scopes is complete. Do not use for new development.
601
+ * Checks if the provided scopes or token contain any of the accepted scopes.
409
602
  *
410
- * NOTE: We are casting intentionally broad with the input and output types to allow for flexibility during migration, without forcing loose types on the rest of the codebase.
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.
411
609
  *
412
- * @param v1Scope e.g. 'record.declared.reject[event=birth|death|tennis-club-membership]',
413
- * @returns corresponding V2 compatible scope string based on v1 input.
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.
414
613
  */
415
- export declare const v1ScopeToV2Scope: (v1Scope: string) => string;
416
- export declare function getAcceptedScopesByType({ acceptedScopes, scopes }: {
417
- acceptedScopes: RecordScopeTypeV2[];
418
- scopes: string[];
419
- }): RecordScopeV2[];
420
- export declare function canUserCreateEvent(acceptedScopes: RecordScopeV2[], eventType: string): boolean;
614
+ export declare function hasAnyScope(token: string, scopes: ScopeType[]): boolean;
421
615
  /**
422
- * Helper for defining scopes for user roles.
423
- * @param scopes Array of scopes in object format.
616
+ * Checks if the provided array of scopes contains any of the accepted scopes.
424
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.
425
659
  * @returns Array of scopes in string format, encoded for use in JWT tokens.
426
660
  */
427
- export declare function defineScopes(scopes: RecordScopeV2[]): string[];
661
+ export declare function defineScopes(scopes: Scope[]): (string & z.core.$brand<"EncodedScope">)[];
428
662
  /**
429
- * Helper for porting v1 scopes to v2. Intended to be used in the interim during migration, not for new development.
430
- * @param scopes v1 scopes
431
- * @returns array of v2 compatible scopes, filtering out the old ones not used anymore.
663
+ * Helper for defining user roles. Should be used in country config.
664
+ *
665
+ * @param roles Array of roles in object format.
432
666
  */
433
- export declare function migrateV1ScopesToV2(scopes: string[]): string[];
667
+ export declare function defineRoles(roles: Role[]): {
668
+ id: string;
669
+ scopes: (string & z.core.$brand<"EncodedScope">)[];
670
+ }[];
434
671
  export {};
435
672
  //# sourceMappingURL=scopes.d.ts.map