@opencrvs/toolkit 1.9.2-rc.c3822a1 → 1.9.2-rc.f6dcfa6

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 (56) hide show
  1. package/dist/commons/api/router.d.ts +1620 -26666
  2. package/dist/commons/conditionals/conditionals.d.ts +1 -10
  3. package/dist/commons/conditionals/validate.d.ts +4 -11
  4. package/dist/commons/events/ActionConfig.d.ts +1525 -21293
  5. package/dist/commons/events/ActionDocument.d.ts +1849 -764
  6. package/dist/commons/events/ActionInput.d.ts +1066 -264
  7. package/dist/commons/events/ActionType.d.ts +8 -85
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -211
  9. package/dist/commons/events/CompositeFieldValue.d.ts +176 -25
  10. package/dist/commons/events/Conditional.d.ts +38 -26
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +4169 -919
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
  15. package/dist/commons/events/Draft.d.ts +105 -70
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2096 -17110
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1326 -311
  20. package/dist/commons/events/EventIndex.d.ts +967 -191
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +345 -102
  23. package/dist/commons/events/FieldConfig.d.ts +11775 -4088
  24. package/dist/commons/events/FieldType.d.ts +2 -6
  25. package/dist/commons/events/FieldTypeMapping.d.ts +810 -164
  26. package/dist/commons/events/FieldValue.d.ts +354 -80
  27. package/dist/commons/events/FormConfig.d.ts +697 -12636
  28. package/dist/commons/events/PageConfig.d.ts +314 -8441
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  31. package/dist/commons/events/WorkqueueColumnConfig.d.ts +36 -70
  32. package/dist/commons/events/WorkqueueConfig.d.ts +7080 -1597
  33. package/dist/commons/events/deduplication.d.ts +3 -3
  34. package/dist/commons/events/defineConfig.d.ts +155 -24703
  35. package/dist/commons/events/index.d.ts +0 -1
  36. package/dist/commons/events/locations.d.ts +19 -15
  37. package/dist/commons/events/scopes.d.ts +0 -1
  38. package/dist/commons/events/state/availableActions.d.ts +1 -2
  39. package/dist/commons/events/state/flags.d.ts +3 -21
  40. package/dist/commons/events/state/index.d.ts +19 -17
  41. package/dist/commons/events/state/utils.d.ts +112 -127
  42. package/dist/commons/events/test.utils.d.ts +5 -11
  43. package/dist/commons/events/transactions.d.ts +1 -1
  44. package/dist/commons/events/utils.d.ts +359 -49444
  45. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  46. package/dist/conditionals/index.d.ts.map +1 -1
  47. package/dist/conditionals/index.js +5 -38
  48. package/dist/events/deduplication.d.ts +3 -3
  49. package/dist/events/index.js +1360 -1502
  50. package/dist/notification/index.d.ts.map +1 -1
  51. package/dist/notification/index.js +1279 -1276
  52. package/dist/scopes/index.d.ts +136 -106
  53. package/dist/scopes/index.d.ts.map +1 -1
  54. package/dist/scopes/index.js +93 -116
  55. package/package.json +5 -5
  56. package/dist/commons/events/Flag.d.ts +0 -43
@@ -1,4 +1,4 @@
1
- import * as z from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { SearchScopeAccessLevels } from './events';
3
3
  export declare const SCOPES: {
4
4
  readonly BYPASSRATELIMIT: "bypassratelimit";
@@ -62,114 +62,158 @@ export declare const SCOPES: {
62
62
  readonly CONFIG_UPDATE_ALL: "config.update:all";
63
63
  readonly USER_DATA_SEEDING: "user.data-seeding";
64
64
  };
65
- export declare const SearchScopes: z.ZodUnion<readonly [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<readonly [z.ZodUnion<readonly [z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"register">, z.ZodLiteral<"demo">, z.ZodLiteral<"config">]>, z.ZodUnion<readonly [z.ZodLiteral<"webhook">, z.ZodLiteral<"nationalId">, z.ZodLiteral<"notification-api">, z.ZodLiteral<"recordsearch">]>, z.ZodLiteral<"record.unassign-others">, z.ZodUnion<readonly [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<readonly [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<readonly [z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>, z.ZodUnion<readonly [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<readonly [z.ZodLiteral<"performance.read">, z.ZodLiteral<"performance.read-dashboards">, z.ZodLiteral<"performance.vital-statistics-export">]>, z.ZodUnion<readonly [z.ZodLiteral<"organisation.read-locations:all">, z.ZodLiteral<"organisation.read-locations:my-office">, z.ZodLiteral<"organisation.read-locations:my-jurisdiction">]>, z.ZodUnion<readonly [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<readonly [z.ZodLiteral<"record.reindex">, z.ZodLiteral<"record.import">]>]>;
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
67
  declare const SearchScope: z.ZodObject<{
68
68
  type: z.ZodLiteral<"search">;
69
69
  options: z.ZodObject<{
70
- event: z.ZodArray<z.ZodString>;
71
- access: z.ZodArray<z.ZodEnum<{
72
- "my-jurisdiction": "my-jurisdiction";
73
- all: "all";
74
- }>>;
75
- }, z.core.$strip>;
76
- }, z.core.$strip>;
77
- export type SearchScope = z.infer<typeof SearchScope>;
78
- export declare const RecordScopeType: z.ZodEnum<{
79
- "record.unassign-others": "record.unassign-others";
80
- "record.register": "record.register";
81
- "record.read": "record.read";
82
- "record.create": "record.create";
83
- "record.declare": "record.declare";
84
- "record.notify": "record.notify";
85
- "record.declared.validate": "record.declared.validate";
86
- "record.declared.reject": "record.declared.reject";
87
- "record.declared.archive": "record.declared.archive";
88
- "record.declared.review-duplicates": "record.declared.review-duplicates";
89
- "record.registered.print-certified-copies": "record.registered.print-certified-copies";
90
- "record.registered.request-correction": "record.registered.request-correction";
91
- "record.registered.correct": "record.registered.correct";
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")[];
78
+ }>;
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
+ };
92
91
  }>;
92
+ export type SearchScope = z.infer<typeof SearchScope>;
93
+ 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"]>;
93
94
  export type RecordScopeType = z.infer<typeof RecordScopeType>;
94
95
  export declare const RecordScope: z.ZodObject<{
95
- type: z.ZodEnum<{
96
- "record.unassign-others": "record.unassign-others";
97
- "record.register": "record.register";
98
- "record.read": "record.read";
99
- "record.create": "record.create";
100
- "record.declare": "record.declare";
101
- "record.notify": "record.notify";
102
- "record.declared.validate": "record.declared.validate";
103
- "record.declared.reject": "record.declared.reject";
104
- "record.declared.archive": "record.declared.archive";
105
- "record.declared.review-duplicates": "record.declared.review-duplicates";
106
- "record.registered.print-certified-copies": "record.registered.print-certified-copies";
107
- "record.registered.request-correction": "record.registered.request-correction";
108
- "record.registered.correct": "record.registered.correct";
109
- }>;
96
+ 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"]>;
110
97
  options: z.ZodObject<{
111
- event: z.ZodArray<z.ZodString>;
112
- }, z.core.$strip>;
113
- }, z.core.$strip>;
98
+ event: z.ZodArray<z.ZodString, "many">;
99
+ }, "strip", z.ZodTypeAny, {
100
+ event: string[];
101
+ }, {
102
+ event: string[];
103
+ }>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ 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";
106
+ options: {
107
+ event: string[];
108
+ };
109
+ }, {
110
+ 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";
111
+ options: {
112
+ event: string[];
113
+ };
114
+ }>;
114
115
  export type RecordScope = z.infer<typeof RecordScope>;
115
- export declare const CustomActionScope: z.ZodObject<{
116
- type: z.ZodLiteral<"record.custom-action">;
117
- options: z.ZodObject<{
118
- event: z.ZodArray<z.ZodString>;
119
- customActionType: z.ZodArray<z.ZodString>;
120
- }, z.core.$strip>;
121
- }, z.core.$strip>;
122
- export type CustomActionScope = z.infer<typeof CustomActionScope>;
123
- declare const ConfigurableRawScopes: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ declare const ConfigurableRawScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
124
117
  type: z.ZodLiteral<"search">;
125
118
  options: z.ZodObject<{
126
- event: z.ZodArray<z.ZodString>;
127
- access: z.ZodArray<z.ZodEnum<{
128
- "my-jurisdiction": "my-jurisdiction";
129
- all: "all";
130
- }>>;
131
- }, z.core.$strip>;
132
- }, z.core.$strip>, z.ZodObject<{
119
+ event: z.ZodArray<z.ZodString, "many">;
120
+ access: z.ZodArray<z.ZodEnum<["my-jurisdiction", "all"]>, "many">;
121
+ }, "strip", z.ZodTypeAny, {
122
+ event: string[];
123
+ access: ("my-jurisdiction" | "all")[];
124
+ }, {
125
+ event: string[];
126
+ access: ("my-jurisdiction" | "all")[];
127
+ }>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ type: "search";
130
+ options: {
131
+ event: string[];
132
+ access: ("my-jurisdiction" | "all")[];
133
+ };
134
+ }, {
135
+ type: "search";
136
+ options: {
137
+ event: string[];
138
+ access: ("my-jurisdiction" | "all")[];
139
+ };
140
+ }>, z.ZodObject<{
133
141
  type: z.ZodLiteral<"user.create">;
134
142
  options: z.ZodObject<{
135
- role: z.ZodArray<z.ZodString>;
136
- }, z.core.$strip>;
137
- }, z.core.$strip>, z.ZodObject<{
143
+ role: z.ZodArray<z.ZodString, "many">;
144
+ }, "strip", z.ZodTypeAny, {
145
+ role: string[];
146
+ }, {
147
+ role: string[];
148
+ }>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ type: "user.create";
151
+ options: {
152
+ role: string[];
153
+ };
154
+ }, {
155
+ type: "user.create";
156
+ options: {
157
+ role: string[];
158
+ };
159
+ }>, z.ZodObject<{
138
160
  type: z.ZodLiteral<"user.edit">;
139
161
  options: z.ZodObject<{
140
- role: z.ZodArray<z.ZodString>;
141
- }, z.core.$strip>;
142
- }, z.core.$strip>, z.ZodObject<{
162
+ role: z.ZodArray<z.ZodString, "many">;
163
+ }, "strip", z.ZodTypeAny, {
164
+ role: string[];
165
+ }, {
166
+ role: string[];
167
+ }>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ type: "user.edit";
170
+ options: {
171
+ role: string[];
172
+ };
173
+ }, {
174
+ type: "user.edit";
175
+ options: {
176
+ role: string[];
177
+ };
178
+ }>, z.ZodObject<{
143
179
  type: z.ZodLiteral<"workqueue">;
144
180
  options: z.ZodObject<{
145
- id: z.ZodArray<z.ZodString>;
146
- }, z.core.$strip>;
147
- }, z.core.$strip>, z.ZodObject<{
148
- type: z.ZodEnum<{
149
- "record.unassign-others": "record.unassign-others";
150
- "record.register": "record.register";
151
- "record.read": "record.read";
152
- "record.create": "record.create";
153
- "record.declare": "record.declare";
154
- "record.notify": "record.notify";
155
- "record.declared.validate": "record.declared.validate";
156
- "record.declared.reject": "record.declared.reject";
157
- "record.declared.archive": "record.declared.archive";
158
- "record.declared.review-duplicates": "record.declared.review-duplicates";
159
- "record.registered.print-certified-copies": "record.registered.print-certified-copies";
160
- "record.registered.request-correction": "record.registered.request-correction";
161
- "record.registered.correct": "record.registered.correct";
181
+ id: z.ZodArray<z.ZodString, "many">;
182
+ }, "strip", z.ZodTypeAny, {
183
+ id: string[];
184
+ }, {
185
+ id: string[];
162
186
  }>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ type: "workqueue";
189
+ options: {
190
+ id: string[];
191
+ };
192
+ }, {
193
+ type: "workqueue";
194
+ options: {
195
+ id: string[];
196
+ };
197
+ }>, z.ZodObject<{
198
+ 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"]>;
163
199
  options: z.ZodObject<{
164
- event: z.ZodArray<z.ZodString>;
165
- }, z.core.$strip>;
166
- }, z.core.$strip>, z.ZodObject<{
167
- type: z.ZodLiteral<"record.custom-action">;
168
- options: z.ZodObject<{
169
- event: z.ZodArray<z.ZodString>;
170
- customActionType: z.ZodArray<z.ZodString>;
171
- }, z.core.$strip>;
172
- }, z.core.$strip>], "type">;
200
+ event: z.ZodArray<z.ZodString, "many">;
201
+ }, "strip", z.ZodTypeAny, {
202
+ event: string[];
203
+ }, {
204
+ event: string[];
205
+ }>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ 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";
208
+ options: {
209
+ event: string[];
210
+ };
211
+ }, {
212
+ 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";
213
+ options: {
214
+ event: string[];
215
+ };
216
+ }>]>;
173
217
  type ConfigurableRawScopes = z.infer<typeof ConfigurableRawScopes>;
174
218
  export type ConfigurableScopeType = ConfigurableRawScopes['type'];
175
219
  type FlattenedSearchScope = {
@@ -207,14 +251,6 @@ export declare function findScope<T extends ConfigurableScopeType>(scopes: strin
207
251
  };
208
252
  }, {
209
253
  type: T;
210
- }> | Extract<{
211
- type: "record.custom-action";
212
- options: {
213
- event: string[];
214
- customActionType: string[];
215
- };
216
- }, {
217
- type: T;
218
254
  }> | Extract<FlattenedSearchScope, {
219
255
  type: T;
220
256
  }> | undefined;
@@ -252,12 +288,6 @@ export declare function parseConfigurableScope(scope: string): {
252
288
  options: {
253
289
  event: string[];
254
290
  };
255
- } | {
256
- type: "record.custom-action";
257
- options: {
258
- event: string[];
259
- customActionType: string[];
260
- };
261
291
  } | undefined;
262
292
  export declare function parseLiteralScope(scope: string): {
263
293
  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";
@@ -285,7 +315,7 @@ export declare const scopes: Scope[];
285
315
  export type ParsedScopes = NonNullable<ReturnType<typeof parseConfigurableScope>>;
286
316
  export type RawScopes = z.infer<typeof LiteralScopes> | (string & {});
287
317
  export type Scope = RawScopes;
288
- export declare const ActionScopes: z.ZodUnion<readonly [z.ZodUnion<readonly [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<readonly [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<readonly [z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>]>;
318
+ 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">]>]>;
289
319
  export type ActionScopes = z.infer<typeof ActionScopes>;
290
320
  export {};
291
321
  //# sourceMappingURL=scopes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scopes/index.ts"],"names":[],"mappings":"AAaA,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scopes/index.ts"],"names":[],"mappings":"AAUA,cAAc,0BAA0B,CAAA"}
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,21 +15,12 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/scopes/index.ts
31
21
  var scopes_exports = {};
32
22
  __export(scopes_exports, {
33
23
  ActionScopes: () => ActionScopes,
34
- CustomActionScope: () => CustomActionScope,
35
24
  RecordScope: () => RecordScope,
36
25
  RecordScopeType: () => RecordScopeType,
37
26
  SCOPES: () => SCOPES,
@@ -44,10 +33,9 @@ __export(scopes_exports, {
44
33
  stringifyScope: () => stringifyScope
45
34
  });
46
35
  module.exports = __toCommonJS(scopes_exports);
47
- var z2 = __toESM(require("zod/v4"));
48
36
 
49
37
  // ../commons/src/scopes.ts
50
- var z = __toESM(require("zod/v4"));
38
+ var import_zod = require("zod");
51
39
  var SCOPES = {
52
40
  // TODO v1.8 legacy scopes
53
41
  BYPASSRATELIMIT: "bypassratelimit",
@@ -126,91 +114,91 @@ var SCOPES = {
126
114
  // data seeding
127
115
  USER_DATA_SEEDING: "user.data-seeding"
128
116
  };
129
- var LegacyScopes = z.union([
130
- z.literal(SCOPES.BYPASSRATELIMIT),
131
- z.literal(SCOPES.REGISTER),
132
- z.literal(SCOPES.DEMO),
133
- z.literal(SCOPES.CONFIG)
117
+ var LegacyScopes = import_zod.z.union([
118
+ import_zod.z.literal(SCOPES.BYPASSRATELIMIT),
119
+ import_zod.z.literal(SCOPES.REGISTER),
120
+ import_zod.z.literal(SCOPES.DEMO),
121
+ import_zod.z.literal(SCOPES.CONFIG)
134
122
  ]);
135
- var IntegrationScopes = z.union([
136
- z.literal(SCOPES.WEBHOOK),
137
- z.literal(SCOPES.NATIONALID),
138
- z.literal(SCOPES.NOTIFICATION_API),
139
- z.literal(SCOPES.RECORDSEARCH)
123
+ var IntegrationScopes = import_zod.z.union([
124
+ import_zod.z.literal(SCOPES.WEBHOOK),
125
+ import_zod.z.literal(SCOPES.NATIONALID),
126
+ import_zod.z.literal(SCOPES.NOTIFICATION_API),
127
+ import_zod.z.literal(SCOPES.RECORDSEARCH)
140
128
  ]);
141
- var InternalOperationsScopes = z.union([
142
- z.literal(SCOPES.RECORD_REINDEX),
143
- z.literal(SCOPES.RECORD_IMPORT)
129
+ var InternalOperationsScopes = import_zod.z.union([
130
+ import_zod.z.literal(SCOPES.RECORD_REINDEX),
131
+ import_zod.z.literal(SCOPES.RECORD_IMPORT)
144
132
  ]);
145
- var DeclareScopes = z.union([
146
- z.literal(SCOPES.RECORD_DECLARE_BIRTH),
147
- z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
148
- z.literal(SCOPES.RECORD_DECLARE_DEATH),
149
- z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
150
- z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
151
- z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
152
- z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
153
- z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
133
+ var DeclareScopes = import_zod.z.union([
134
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
135
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
136
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH),
137
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
138
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
139
+ import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
140
+ import_zod.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
141
+ import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
154
142
  ]);
155
- var UnassignScope = z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
156
- var ValidateScopes = z.union([
157
- z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
158
- z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
159
- z.literal(SCOPES.RECORD_DECLARATION_EDIT),
160
- z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
161
- z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
162
- z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
143
+ var UnassignScope = import_zod.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
144
+ var ValidateScopes = import_zod.z.union([
145
+ import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
146
+ import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
147
+ import_zod.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
148
+ import_zod.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
149
+ import_zod.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
150
+ import_zod.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
163
151
  ]);
164
- var RegisterScope = z.literal(SCOPES.RECORD_REGISTER);
165
- var CorrectionScopes = z.union([
166
- z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
167
- z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
168
- z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
169
- z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
152
+ var RegisterScope = import_zod.z.literal(SCOPES.RECORD_REGISTER);
153
+ var CorrectionScopes = import_zod.z.union([
154
+ import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
155
+ import_zod.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
156
+ import_zod.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
157
+ import_zod.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
170
158
  ]);
171
- var SearchScopes = z.union([
172
- z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
173
- z.literal(SCOPES.SEARCH_BIRTH),
174
- z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
175
- z.literal(SCOPES.SEARCH_DEATH),
176
- z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
177
- z.literal(SCOPES.SEARCH_MARRIAGE)
159
+ var SearchScopes = import_zod.z.union([
160
+ import_zod.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
161
+ import_zod.z.literal(SCOPES.SEARCH_BIRTH),
162
+ import_zod.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
163
+ import_zod.z.literal(SCOPES.SEARCH_DEATH),
164
+ import_zod.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
165
+ import_zod.z.literal(SCOPES.SEARCH_MARRIAGE)
178
166
  ]);
179
- var AuditScopes = z.literal(SCOPES.RECORD_READ);
180
- var PerformanceScopes = z.union([
181
- z.literal(SCOPES.PERFORMANCE_READ),
182
- z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
183
- z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
167
+ var AuditScopes = import_zod.z.literal(SCOPES.RECORD_READ);
168
+ var PerformanceScopes = import_zod.z.union([
169
+ import_zod.z.literal(SCOPES.PERFORMANCE_READ),
170
+ import_zod.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
171
+ import_zod.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
184
172
  ]);
185
- var OrganisationScopes = z.union([
186
- z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
187
- z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
188
- z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
173
+ var OrganisationScopes = import_zod.z.union([
174
+ import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
175
+ import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
176
+ import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
189
177
  ]);
190
- var UserScopes = z.union([
191
- z.literal(SCOPES.USER_READ),
192
- z.literal(SCOPES.USER_READ_MY_OFFICE),
193
- z.literal(SCOPES.USER_READ_MY_JURISDICTION),
194
- z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
195
- z.literal(SCOPES.USER_CREATE),
196
- z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
197
- z.literal(SCOPES.USER_UPDATE),
198
- z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
178
+ var UserScopes = import_zod.z.union([
179
+ import_zod.z.literal(SCOPES.USER_READ),
180
+ import_zod.z.literal(SCOPES.USER_READ_MY_OFFICE),
181
+ import_zod.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
182
+ import_zod.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
183
+ import_zod.z.literal(SCOPES.USER_CREATE),
184
+ import_zod.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
185
+ import_zod.z.literal(SCOPES.USER_UPDATE),
186
+ import_zod.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
199
187
  ]);
200
- var ConfigScope = z.literal(SCOPES.CONFIG_UPDATE_ALL);
201
- var DataSeedingScope = z.literal(SCOPES.USER_DATA_SEEDING);
202
- var LiteralScopes = z.union([
188
+ var ConfigScope = import_zod.z.literal(SCOPES.CONFIG_UPDATE_ALL);
189
+ var DataSeedingScope = import_zod.z.literal(SCOPES.USER_DATA_SEEDING);
190
+ var LiteralScopes = import_zod.z.union([
203
191
  LegacyScopes,
204
192
  IntegrationScopes,
205
193
  UnassignScope,
206
194
  DeclareScopes,
207
195
  ValidateScopes,
208
196
  RegisterScope,
209
- z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
197
+ import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
210
198
  CorrectionScopes,
211
199
  SearchScopes,
212
200
  AuditScopes,
213
- z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
201
+ import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
214
202
  PerformanceScopes,
215
203
  OrganisationScopes,
216
204
  UserScopes,
@@ -219,33 +207,33 @@ var LiteralScopes = z.union([
219
207
  InternalOperationsScopes
220
208
  ]);
221
209
  var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
222
- var rawConfigurableScope = z.string().regex(rawConfigurableScopeRegex);
223
- var CreateUserScope = z.object({
224
- type: z.literal("user.create"),
225
- options: z.object({
226
- role: z.array(z.string())
210
+ var rawConfigurableScope = import_zod.z.string().regex(rawConfigurableScopeRegex);
211
+ var CreateUserScope = import_zod.z.object({
212
+ type: import_zod.z.literal("user.create"),
213
+ options: import_zod.z.object({
214
+ role: import_zod.z.array(import_zod.z.string())
227
215
  })
228
216
  });
229
- var EditUserScope = z.object({
230
- type: z.literal("user.edit"),
231
- options: z.object({
232
- role: z.array(z.string())
217
+ var EditUserScope = import_zod.z.object({
218
+ type: import_zod.z.literal("user.edit"),
219
+ options: import_zod.z.object({
220
+ role: import_zod.z.array(import_zod.z.string())
233
221
  })
234
222
  });
235
- var WorkqueueScope = z.object({
236
- type: z.literal("workqueue"),
237
- options: z.object({
238
- id: z.array(z.string())
223
+ var WorkqueueScope = import_zod.z.object({
224
+ type: import_zod.z.literal("workqueue"),
225
+ options: import_zod.z.object({
226
+ id: import_zod.z.array(import_zod.z.string())
239
227
  })
240
228
  });
241
- var SearchScope = z.object({
242
- type: z.literal("search"),
243
- options: z.object({
244
- event: z.array(z.string()).length(1),
245
- access: z.array(z.enum(["my-jurisdiction", "all"])).length(1)
229
+ var SearchScope = import_zod.z.object({
230
+ type: import_zod.z.literal("search"),
231
+ options: import_zod.z.object({
232
+ event: import_zod.z.array(import_zod.z.string()).length(1),
233
+ access: import_zod.z.array(import_zod.z.enum(["my-jurisdiction", "all"])).length(1)
246
234
  })
247
235
  });
248
- var RecordScopeType = z.enum([
236
+ var RecordScopeType = import_zod.z.enum([
249
237
  "record.create",
250
238
  "record.read",
251
239
  "record.declare",
@@ -260,28 +248,20 @@ var RecordScopeType = z.enum([
260
248
  "record.registered.correct",
261
249
  "record.unassign-others"
262
250
  ]);
263
- var RecordScope = z.object({
251
+ var RecordScope = import_zod.z.object({
264
252
  type: RecordScopeType,
265
- options: z.object({
266
- event: z.array(z.string()).describe("Event type, e.g. birth, death")
253
+ options: import_zod.z.object({
254
+ event: import_zod.z.array(import_zod.z.string()).describe("Event type, e.g. birth, death")
267
255
  })
268
256
  }).describe(
269
257
  "Scopes used to check user's permission to perform actions on a record."
270
258
  );
271
- var CustomActionScope = z.object({
272
- type: z.literal("record.custom-action"),
273
- options: z.object({
274
- event: z.array(z.string()).describe("Allowed event type, e.g. birth, death"),
275
- customActionType: z.array(z.string()).describe("Allowed custom action types")
276
- })
277
- });
278
- var ConfigurableRawScopes = z.discriminatedUnion("type", [
259
+ var ConfigurableRawScopes = import_zod.z.discriminatedUnion("type", [
279
260
  SearchScope,
280
261
  CreateUserScope,
281
262
  EditUserScope,
282
263
  WorkqueueScope,
283
- RecordScope,
284
- CustomActionScope
264
+ RecordScope
285
265
  ]);
286
266
  function flattenAndMergeScopes(scopes2) {
287
267
  if (scopes2.length === 0) return null;
@@ -351,13 +331,10 @@ function getAuthorizedEventsFromScopes(scopes2) {
351
331
  }).filter((event) => event !== void 0).filter((event, index, self) => self.indexOf(event) === index);
352
332
  }
353
333
  var scopes = Object.values(SCOPES);
354
- var ActionScopes = z.union([
334
+ var ActionScopes = import_zod.z.union([
355
335
  DeclareScopes,
356
336
  ValidateScopes,
357
337
  RegisterScope,
358
- z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
338
+ import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
359
339
  CorrectionScopes
360
340
  ]);
361
-
362
- // src/scopes/index.ts
363
- z2.globalRegistry.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.2-rc.c3822a1",
3
+ "version": "1.9.2-rc.f6dcfa6",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {
@@ -17,14 +17,14 @@
17
17
  "build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@trpc/client": "11.4.3",
21
- "@trpc/server": "11.4.3",
20
+ "uuid": "^9.0.0",
22
21
  "ajv": "^8.17.1",
23
22
  "ajv-formats": "^3.0.1",
24
23
  "object-hash": "^3.0.0",
25
24
  "superjson": "1.9.0-0",
26
- "uuid": "^9.0.0",
27
- "zod-openapi": "^5.4.3"
25
+ "@trpc/client": "11.4.3",
26
+ "@trpc/server": "11.4.3",
27
+ "zod-openapi": "^4.2.4"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/uuid": "^9.0.3",