@opencrvs/toolkit 2.2.0-rc.3af310b → 2.2.0-rc.5bf5dfc

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 (82) hide show
  1. package/build.sh +7 -2
  2. package/dist/application-config/index.js +9 -9
  3. package/dist/authentication/index.d.ts +2 -1
  4. package/dist/authentication/index.js +20 -12
  5. package/dist/cli.js +633 -333
  6. package/dist/commons/api/router.d.ts +249 -249
  7. package/dist/commons/application-config/index.d.ts +2 -2
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/index.d.ts +1 -0
  10. package/dist/commons/conditionals/validate.d.ts +6 -1
  11. package/dist/commons/events/ActionConfig.d.ts +2 -2
  12. package/dist/commons/events/ActionDocument.d.ts +1 -0
  13. package/dist/commons/events/ActionInput.d.ts +4 -4
  14. package/dist/commons/events/ActionStatus.d.ts +2 -2
  15. package/dist/commons/events/ActionType.d.ts +2 -0
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
  17. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  18. package/dist/commons/events/Draft.d.ts +34 -1
  19. package/dist/commons/events/EventConfig.d.ts +1 -10
  20. package/dist/commons/events/EventIndex.d.ts +2 -2
  21. package/dist/commons/events/FieldConfig.d.ts +1 -1
  22. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  23. package/dist/commons/events/Flag.d.ts +1 -1
  24. package/dist/commons/events/PlainDate.d.ts +1 -0
  25. package/dist/commons/events/eventConfigValidation.d.ts +1 -1
  26. package/dist/commons/events/field.d.ts +5 -0
  27. package/dist/commons/events/index.d.ts +3 -0
  28. package/dist/commons/events/locations.d.ts +1 -1
  29. package/dist/commons/events/scopes.d.ts +2 -1
  30. package/dist/commons/events/test.utils.d.ts +5 -6
  31. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  32. package/dist/commons/events/utils.d.ts +26 -5
  33. package/dist/commons/users/Role.d.ts +23 -0
  34. package/dist/commons/users/User.d.ts +263 -0
  35. package/dist/commons/users/authentication.d.ts +67 -0
  36. package/dist/commons/users/index.d.ts +5 -0
  37. package/dist/commons/users/roleValidations.d.ts +15 -0
  38. package/dist/commons/users/scopes.d.ts +1402 -0
  39. package/dist/commons/users/userReferences.d.ts +176 -0
  40. package/dist/conditionals/index.js +5 -5
  41. package/dist/environment/custom-types.d.ts +1 -0
  42. package/dist/environment/custom-types.d.ts.map +1 -1
  43. package/dist/environment/derived-variables.d.ts +6 -4
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/derived-variables.js +6 -4
  46. package/dist/environment/questions.d.ts +42 -9
  47. package/dist/environment/questions.d.ts.map +1 -1
  48. package/dist/environment/questions.js +70 -47
  49. package/dist/environment/registry.d.ts +15 -0
  50. package/dist/environment/registry.d.ts.map +1 -0
  51. package/dist/environment/registry.js +112 -0
  52. package/dist/environment/setup-environment.d.ts.map +1 -1
  53. package/dist/environment/setup-environment.js +85 -29
  54. package/dist/events/index.js +214 -152
  55. package/dist/migrations/add-notify-config.d.ts +40 -0
  56. package/dist/migrations/add-notify-config.d.ts.map +1 -0
  57. package/dist/migrations/add-notify-config.js +249 -0
  58. package/dist/migrations/index.d.ts.map +1 -1
  59. package/dist/migrations/index.js +345 -143
  60. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
  61. package/dist/migrations/move-declaration-to-declare-action.js +27 -144
  62. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
  63. package/dist/migrations/read-declaration-through-helper.js +3 -61
  64. package/dist/migrations/utils.d.ts +61 -0
  65. package/dist/migrations/utils.d.ts.map +1 -0
  66. package/dist/migrations/utils.js +218 -0
  67. package/dist/notification/index.js +282 -90
  68. package/dist/roles/index.d.ts +2 -0
  69. package/dist/roles/index.d.ts.map +1 -0
  70. package/dist/roles/index.js +719 -0
  71. package/dist/scopes/index.d.ts +54 -61
  72. package/dist/scopes/index.js +15 -11
  73. package/dist/templates/charts-values/opencrvs-services/values.yaml +3 -4
  74. package/opencrvs-toolkit-2.2.0-rc.5bf5dfc.tgz +0 -0
  75. package/package.json +5 -3
  76. package/tsconfig.build.tsbuildinfo +1 -1
  77. package/tsconfig.json +3 -5
  78. package/dist/commons/events/notificationFormFallback.d.ts +0 -10
  79. package/dist/environment/dockerhub.d.ts +0 -15
  80. package/dist/environment/dockerhub.d.ts.map +0 -1
  81. package/dist/environment/dockerhub.js +0 -104
  82. package/opencrvs-toolkit-2.2.0-rc.3af310b.tgz +0 -0
@@ -1,5 +1,4 @@
1
1
  import * as z from 'zod/v4';
2
- import { Role } from './roles';
3
2
  export declare const JurisdictionFilter: z.ZodEnum<{
4
3
  administrativeArea: "administrativeArea";
5
4
  all: "all";
@@ -40,7 +39,7 @@ export declare const RecordScopeTypeV2: z.ZodEnum<{
40
39
  }>;
41
40
  export type RecordScopeTypeV2 = z.infer<typeof RecordScopeTypeV2>;
42
41
  declare const AllScopeOptions: z.ZodObject<{
43
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
42
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
44
43
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
45
44
  administrativeArea: "administrativeArea";
46
45
  all: "all";
@@ -77,7 +76,7 @@ declare const AllScopeOptions: z.ZodObject<{
77
76
  NOTIFIED: "NOTIFIED";
78
77
  REGISTERED: "REGISTERED";
79
78
  REVOKED: "REVOKED";
80
- }>>>>;
79
+ }>>>, unknown>;
81
80
  registeredIn: z.ZodOptional<z.ZodEnum<{
82
81
  administrativeArea: "administrativeArea";
83
82
  all: "all";
@@ -111,8 +110,8 @@ declare const AllScopeOptions: z.ZodObject<{
111
110
  all: "all";
112
111
  location: "location";
113
112
  }>>;
114
- role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>>;
115
- ids: z.ZodPreprocess<z.ZodArray<z.ZodString>>;
113
+ role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>>;
114
+ ids: z.ZodPreprocess<z.ZodArray<z.ZodString>, unknown>;
116
115
  }, z.core.$strip>;
117
116
  type AllScopeOptions = z.infer<typeof AllScopeOptions>;
118
117
  export declare const ScopeOptionKey: z.ZodEnum<{
@@ -167,7 +166,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
167
166
  "record.notify": "record.notify";
168
167
  }>;
169
168
  options: z.ZodOptional<z.ZodObject<{
170
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
169
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
171
170
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
172
171
  administrativeArea: "administrativeArea";
173
172
  all: "all";
@@ -191,7 +190,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
191
190
  "record.unarchive": "record.unarchive";
192
191
  }>;
193
192
  options: z.ZodOptional<z.ZodObject<{
194
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
193
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
195
194
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
196
195
  administrativeArea: "administrativeArea";
197
196
  all: "all";
@@ -228,7 +227,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
228
227
  NOTIFIED: "NOTIFIED";
229
228
  REGISTERED: "REGISTERED";
230
229
  REVOKED: "REVOKED";
231
- }>>>>;
230
+ }>>>, unknown>;
232
231
  }, z.core.$strip>>;
233
232
  }, z.core.$strip>, z.ZodObject<{
234
233
  type: z.ZodEnum<{
@@ -242,7 +241,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
241
  "record.unassign-others": "record.unassign-others";
243
242
  }>;
244
243
  options: z.ZodOptional<z.ZodObject<{
245
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
244
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
246
245
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
247
246
  administrativeArea: "administrativeArea";
248
247
  all: "all";
@@ -279,7 +278,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
279
278
  NOTIFIED: "NOTIFIED";
280
279
  REGISTERED: "REGISTERED";
281
280
  REVOKED: "REVOKED";
282
- }>>>>;
281
+ }>>>, unknown>;
283
282
  registeredIn: z.ZodOptional<z.ZodEnum<{
284
283
  administrativeArea: "administrativeArea";
285
284
  all: "all";
@@ -312,7 +311,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
312
311
  }, z.core.$strip>, z.ZodObject<{
313
312
  type: z.ZodLiteral<"record.custom-action">;
314
313
  options: z.ZodOptional<z.ZodObject<{
315
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
314
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
316
315
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
317
316
  administrativeArea: "administrativeArea";
318
317
  all: "all";
@@ -349,7 +348,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
349
348
  NOTIFIED: "NOTIFIED";
350
349
  REGISTERED: "REGISTERED";
351
350
  REVOKED: "REVOKED";
352
- }>>>>;
351
+ }>>>, unknown>;
353
352
  registeredIn: z.ZodOptional<z.ZodEnum<{
354
353
  administrativeArea: "administrativeArea";
355
354
  all: "all";
@@ -378,12 +377,12 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
378
377
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
379
378
  }>]>, z.ZodString]>>>;
380
379
  }, z.core.$strip>>;
381
- customActionTypes: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
380
+ customActionTypes: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
382
381
  }, z.core.$strip>>;
383
382
  }, z.core.$strip>, z.ZodObject<{
384
383
  type: z.ZodLiteral<"record.print-certified-copies">;
385
384
  options: z.ZodOptional<z.ZodObject<{
386
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
385
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
387
386
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
388
387
  administrativeArea: "administrativeArea";
389
388
  all: "all";
@@ -420,7 +419,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
420
419
  NOTIFIED: "NOTIFIED";
421
420
  REGISTERED: "REGISTERED";
422
421
  REVOKED: "REVOKED";
423
- }>>>>;
422
+ }>>>, unknown>;
424
423
  registeredIn: z.ZodOptional<z.ZodEnum<{
425
424
  administrativeArea: "administrativeArea";
426
425
  all: "all";
@@ -449,7 +448,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
449
448
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
450
449
  }>]>, z.ZodString]>>>;
451
450
  }, z.core.$strip>>;
452
- templates: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
451
+ templates: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
453
452
  }, z.core.$strip>>;
454
453
  }, z.core.$strip>, z.ZodObject<{
455
454
  type: z.ZodEnum<{
@@ -457,7 +456,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
457
456
  "record.action.reject": "record.action.reject";
458
457
  }>;
459
458
  options: z.ZodOptional<z.ZodObject<{
460
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
459
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
461
460
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
462
461
  administrativeArea: "administrativeArea";
463
462
  all: "all";
@@ -494,7 +493,7 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
494
493
  NOTIFIED: "NOTIFIED";
495
494
  REGISTERED: "REGISTERED";
496
495
  REVOKED: "REVOKED";
497
- }>>>>;
496
+ }>>>, unknown>;
498
497
  registeredIn: z.ZodOptional<z.ZodEnum<{
499
498
  administrativeArea: "administrativeArea";
500
499
  all: "all";
@@ -556,7 +555,7 @@ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
556
555
  all: "all";
557
556
  location: "location";
558
557
  }>>;
559
- role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>>;
558
+ role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>>;
560
559
  }, z.core.$strip>>;
561
560
  }, z.core.$strip>, z.ZodObject<{
562
561
  type: z.ZodEnum<{
@@ -594,7 +593,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
594
593
  "record.notify": "record.notify";
595
594
  }>;
596
595
  options: z.ZodOptional<z.ZodObject<{
597
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
596
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
598
597
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
599
598
  createdBy: z.ZodOptional<z.ZodString>;
600
599
  createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -608,7 +607,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
608
607
  "record.unarchive": "record.unarchive";
609
608
  }>;
610
609
  options: z.ZodOptional<z.ZodObject<{
611
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
610
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
612
611
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
613
612
  createdBy: z.ZodOptional<z.ZodString>;
614
613
  createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -629,7 +628,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
629
628
  "record.unassign-others": "record.unassign-others";
630
629
  }>;
631
630
  options: z.ZodOptional<z.ZodObject<{
632
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
631
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
633
632
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
634
633
  createdBy: z.ZodOptional<z.ZodString>;
635
634
  createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -663,7 +662,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
663
662
  }, z.core.$strip>, z.ZodObject<{
664
663
  type: z.ZodLiteral<"record.print-certified-copies">;
665
664
  options: z.ZodOptional<z.ZodObject<{
666
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
665
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
667
666
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
668
667
  createdBy: z.ZodOptional<z.ZodString>;
669
668
  createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -723,7 +722,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
723
722
  "record.notify": "record.notify";
724
723
  }>;
725
724
  options: z.ZodOptional<z.ZodObject<{
726
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
725
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
727
726
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
728
727
  administrativeArea: "administrativeArea";
729
728
  all: "all";
@@ -747,7 +746,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
747
746
  "record.unarchive": "record.unarchive";
748
747
  }>;
749
748
  options: z.ZodOptional<z.ZodObject<{
750
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
749
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
751
750
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
752
751
  administrativeArea: "administrativeArea";
753
752
  all: "all";
@@ -784,7 +783,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
784
783
  NOTIFIED: "NOTIFIED";
785
784
  REGISTERED: "REGISTERED";
786
785
  REVOKED: "REVOKED";
787
- }>>>>;
786
+ }>>>, unknown>;
788
787
  }, z.core.$strip>>;
789
788
  }, z.core.$strip>, z.ZodObject<{
790
789
  type: z.ZodEnum<{
@@ -798,7 +797,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
798
797
  "record.unassign-others": "record.unassign-others";
799
798
  }>;
800
799
  options: z.ZodOptional<z.ZodObject<{
801
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
800
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
802
801
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
803
802
  administrativeArea: "administrativeArea";
804
803
  all: "all";
@@ -835,7 +834,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
835
834
  NOTIFIED: "NOTIFIED";
836
835
  REGISTERED: "REGISTERED";
837
836
  REVOKED: "REVOKED";
838
- }>>>>;
837
+ }>>>, unknown>;
839
838
  registeredIn: z.ZodOptional<z.ZodEnum<{
840
839
  administrativeArea: "administrativeArea";
841
840
  all: "all";
@@ -868,7 +867,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
868
867
  }, z.core.$strip>, z.ZodObject<{
869
868
  type: z.ZodLiteral<"record.custom-action">;
870
869
  options: z.ZodOptional<z.ZodObject<{
871
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
870
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
872
871
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
873
872
  administrativeArea: "administrativeArea";
874
873
  all: "all";
@@ -905,7 +904,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
905
904
  NOTIFIED: "NOTIFIED";
906
905
  REGISTERED: "REGISTERED";
907
906
  REVOKED: "REVOKED";
908
- }>>>>;
907
+ }>>>, unknown>;
909
908
  registeredIn: z.ZodOptional<z.ZodEnum<{
910
909
  administrativeArea: "administrativeArea";
911
910
  all: "all";
@@ -934,12 +933,12 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
934
933
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
935
934
  }>]>, z.ZodString]>>>;
936
935
  }, z.core.$strip>>;
937
- customActionTypes: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
936
+ customActionTypes: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
938
937
  }, z.core.$strip>>;
939
938
  }, z.core.$strip>, z.ZodObject<{
940
939
  type: z.ZodLiteral<"record.print-certified-copies">;
941
940
  options: z.ZodOptional<z.ZodObject<{
942
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
941
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
943
942
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
944
943
  administrativeArea: "administrativeArea";
945
944
  all: "all";
@@ -976,7 +975,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
976
975
  NOTIFIED: "NOTIFIED";
977
976
  REGISTERED: "REGISTERED";
978
977
  REVOKED: "REVOKED";
979
- }>>>>;
978
+ }>>>, unknown>;
980
979
  registeredIn: z.ZodOptional<z.ZodEnum<{
981
980
  administrativeArea: "administrativeArea";
982
981
  all: "all";
@@ -1005,7 +1004,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
1005
1004
  readonly EDIT_IN_PROGRESS: 'edit-in-progress';
1006
1005
  }>]>, z.ZodString]>>>;
1007
1006
  }, z.core.$strip>>;
1008
- templates: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1007
+ templates: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
1009
1008
  }, z.core.$strip>>;
1010
1009
  }, z.core.$strip>, z.ZodObject<{
1011
1010
  type: z.ZodEnum<{
@@ -1013,7 +1012,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
1013
1012
  "record.action.reject": "record.action.reject";
1014
1013
  }>;
1015
1014
  options: z.ZodOptional<z.ZodObject<{
1016
- event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
1015
+ event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>;
1017
1016
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
1018
1017
  administrativeArea: "administrativeArea";
1019
1018
  all: "all";
@@ -1050,7 +1049,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
1050
1049
  NOTIFIED: "NOTIFIED";
1051
1050
  REGISTERED: "REGISTERED";
1052
1051
  REVOKED: "REVOKED";
1053
- }>>>>;
1052
+ }>>>, unknown>;
1054
1053
  registeredIn: z.ZodOptional<z.ZodEnum<{
1055
1054
  administrativeArea: "administrativeArea";
1056
1055
  all: "all";
@@ -1091,7 +1090,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
1091
1090
  all: "all";
1092
1091
  location: "location";
1093
1092
  }>>;
1094
- role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>>;
1093
+ role: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>, unknown>>;
1095
1094
  }, z.core.$strip>>;
1096
1095
  }, z.core.$strip>, z.ZodObject<{
1097
1096
  type: z.ZodEnum<{
@@ -1117,12 +1116,12 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
1117
1116
  }, z.core.$strip>, z.ZodObject<{
1118
1117
  type: z.ZodLiteral<"workqueue">;
1119
1118
  options: z.ZodObject<{
1120
- ids: z.ZodPreprocess<z.ZodArray<z.ZodString>>;
1119
+ ids: z.ZodPreprocess<z.ZodArray<z.ZodString>, unknown>;
1121
1120
  }, z.core.$strip>;
1122
1121
  }, z.core.$strip>, z.ZodObject<{
1123
1122
  type: z.ZodLiteral<"dashboard.view">;
1124
1123
  options: z.ZodObject<{
1125
- ids: z.ZodPreprocess<z.ZodArray<z.ZodString>>;
1124
+ ids: z.ZodPreprocess<z.ZodArray<z.ZodString>, unknown>;
1126
1125
  }, z.core.$strip>;
1127
1126
  }, z.core.$strip>], "type">;
1128
1127
  export type Scope = z.infer<typeof Scope>;
@@ -1191,6 +1190,17 @@ export declare const encodeScope: (scope: Scope) => EncodedScope;
1191
1190
  * @returns The decoded scope object.
1192
1191
  */
1193
1192
  export declare const decodeScope: (encodedScope: EncodedScope) => {
1193
+ type: "user.create" | "user.edit";
1194
+ options?: {
1195
+ accessLevel?: "administrativeArea" | "all" | "location" | undefined;
1196
+ role?: string[] | undefined;
1197
+ } | undefined;
1198
+ } | {
1199
+ type: "user.read" | "user.search";
1200
+ options?: {
1201
+ accessLevel?: "administrativeArea" | "all" | "location" | undefined;
1202
+ } | undefined;
1203
+ } | {
1194
1204
  type: "record.create" | "record.declare" | "record.notify";
1195
1205
  options?: {
1196
1206
  event?: string[] | undefined;
@@ -1293,17 +1303,6 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
1293
1303
  allOf?: string[] | undefined;
1294
1304
  } | undefined;
1295
1305
  } | undefined;
1296
- } | {
1297
- type: "user.create" | "user.edit";
1298
- options?: {
1299
- accessLevel?: "administrativeArea" | "all" | "location" | undefined;
1300
- role?: string[] | undefined;
1301
- } | undefined;
1302
- } | {
1303
- type: "user.read" | "user.search";
1304
- options?: {
1305
- accessLevel?: "administrativeArea" | "all" | "location" | undefined;
1306
- } | undefined;
1307
1306
  } | {
1308
1307
  type: "attachment.upload" | "bypassratelimit" | "config.update-all" | "integration.audit.read" | "integration.create" | "location.edit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.import" | "record.reindex" | "user.data-seeding" | "user.read-only-my-audit";
1309
1308
  } | {
@@ -1382,13 +1381,16 @@ export declare function hasScope(token: string, scope: ScopeType): boolean;
1382
1381
  */
1383
1382
  export declare function hasScope(scopes: EncodedScope[], scope: ScopeType): boolean;
1384
1383
  /**
1385
- * Checks if the given event type is allowed by the accepted scopes. If no specific event types are defined, it returns true.
1384
+ * Checks if the user has the scope to perform an action on an event of a certain type.
1386
1385
  *
1387
1386
  * @param {Scope[]} userScopes - The scopes of the user.
1388
1387
  * @param {string} eventType - The event type to check for permission.
1389
- * @returns {boolean} Returns true if the event type is allowed by the scope.
1388
+ * @param {ScopeType[]} acceptedScopes - The scopes to check for permission.
1389
+ * @returns {boolean} Returns true if the user has the scope to perform an action on an event of a certain type.
1390
1390
  */
1391
+ export declare function hasScopeForEventType(userScopes: EncodedScope[], eventType: string, acceptedScope: ScopeType): boolean;
1391
1392
  export declare function canUserCreateEvent(userScopes: EncodedScope[], eventType: string): boolean;
1393
+ export declare function canUserNotifyEvent(userScopes: EncodedScope[], eventType: string): boolean;
1392
1394
  /**
1393
1395
  * Helper for defining scopes for user roles. Should be used in country config.
1394
1396
  *
@@ -1396,14 +1398,5 @@ export declare function canUserCreateEvent(userScopes: EncodedScope[], eventType
1396
1398
  * @returns Array of scopes in string format, encoded for use in JWT tokens.
1397
1399
  */
1398
1400
  export declare function defineScopes(scopes: Scope[]): (string & z.$brand<"EncodedScope">)[];
1399
- /**
1400
- * Helper for defining user roles. Should be used in country config.
1401
- *
1402
- * @param roles Array of roles in object format.
1403
- */
1404
- export declare function defineRoles(roles: Role[]): {
1405
- id: string;
1406
- scopes: (string & z.$brand<"EncodedScope">)[];
1407
- }[];
1408
1401
  export {};
1409
1402
  //# sourceMappingURL=scopes.d.ts.map
@@ -45,14 +45,15 @@ __export(scopes_exports, {
45
45
  UserFilter: () => UserFilter,
46
46
  UserScopeV2: () => UserScopeV2,
47
47
  canUserCreateEvent: () => canUserCreateEvent,
48
+ canUserNotifyEvent: () => canUserNotifyEvent,
48
49
  decodeScope: () => decodeScope,
49
- defineRoles: () => defineRoles,
50
50
  defineScopes: () => defineScopes,
51
51
  encodeScope: () => encodeScope,
52
52
  getAcceptedScopesByType: () => getAcceptedScopesByType,
53
53
  getScopeOptionValue: () => getScopeOptionValue,
54
54
  hasAnyScope: () => hasAnyScope,
55
55
  hasScope: () => hasScope,
56
+ hasScopeForEventType: () => hasScopeForEventType,
56
57
  isCustomActionScope: () => isCustomActionScope,
57
58
  scopeUsesDeclaredOptions: () => scopeUsesDeclaredOptions,
58
59
  scopeUsesFullOptions: () => scopeUsesFullOptions,
@@ -62,7 +63,7 @@ __export(scopes_exports, {
62
63
  module.exports = __toCommonJS(scopes_exports);
63
64
  var z9 = __toESM(require("zod/v4"));
64
65
 
65
- // ../commons/src/scopes.ts
66
+ // ../commons/src/users/scopes.ts
66
67
  var z8 = __toESM(require("zod/v4"));
67
68
  var qs = __toESM(require("qs"));
68
69
 
@@ -71,7 +72,7 @@ var import_uuid = require("uuid");
71
72
  var z = __toESM(require("zod/v4"));
72
73
  var UUID = z.uuid().brand("UUID");
73
74
 
74
- // ../commons/src/authentication.ts
75
+ // ../commons/src/users/authentication.ts
75
76
  var import_jwt_decode = __toESM(require("jwt-decode"));
76
77
  var z2 = __toESM(require("zod/v4"));
77
78
  var TokenUserType = z2.enum(["user", "system"]);
@@ -221,7 +222,7 @@ var ActionStatus = {
221
222
  };
222
223
 
223
224
  // ../commons/src/events/Flag.ts
224
- var z6 = __toESM(require("zod/v4"));
225
+ var z6 = __toESM(require("zod"));
225
226
 
226
227
  // ../commons/src/events/TranslationConfig.ts
227
228
  var z4 = __toESM(require("zod/v4"));
@@ -317,7 +318,7 @@ var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).inclu
317
318
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
318
319
  InherentFlags
319
320
  ).join(", ")}`
320
- }).refine((val) => !ActionFlag.safeParse(val).success, {
321
+ }).refine((val) => !ActionFlag.validate(val), {
321
322
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
322
323
  }).describe("Custom flag identifier defined by the country config.");
323
324
  var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
@@ -360,7 +361,7 @@ var EventStatus = z7.enum([
360
361
  "ARCHIVED"
361
362
  ]);
362
363
 
363
- // ../commons/src/scopes.ts
364
+ // ../commons/src/users/scopes.ts
364
365
  var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
365
366
  "Filters based on user jurisdiction relative to their office location in hierarchy."
366
367
  );
@@ -714,9 +715,9 @@ function hasScope(tokenOrScopes, scope) {
714
715
  }
715
716
  return hasAnyScope(tokenOrScopes, [scope]);
716
717
  }
717
- function canUserCreateEvent(userScopes, eventType) {
718
+ function hasScopeForEventType(userScopes, eventType, acceptedScope) {
718
719
  const scopes = getAcceptedScopesByType({
719
- acceptedScopes: ["record.create"],
720
+ acceptedScopes: [acceptedScope],
720
721
  scopes: userScopes
721
722
  });
722
723
  return scopes.some((scope) => {
@@ -726,12 +727,15 @@ function canUserCreateEvent(userScopes, eventType) {
726
727
  return scope.options?.event?.includes(eventType);
727
728
  });
728
729
  }
730
+ function canUserCreateEvent(userScopes, eventType) {
731
+ return hasScopeForEventType(userScopes, eventType, "record.create");
732
+ }
733
+ function canUserNotifyEvent(userScopes, eventType) {
734
+ return hasScopeForEventType(userScopes, eventType, "record.notify");
735
+ }
729
736
  function defineScopes(scopes) {
730
737
  return scopes.map((scope) => Scope2.parse(scope)).map(encodeScope);
731
738
  }
732
- function defineRoles(roles) {
733
- return roles;
734
- }
735
739
 
736
740
  // src/scopes/index.ts
737
741
  z9.globalRegistry.clear();
@@ -27,7 +27,7 @@ hpa:
27
27
  enabled: false
28
28
 
29
29
  env:
30
- MINIO_BUCKET: ocrvs
30
+ S3_BUCKET: ocrvs
31
31
  OPENCRVS_ENVIRONMENT: {{opencrvs_environment}}
32
32
 
33
33
  otel:
@@ -39,8 +39,7 @@ elasticsearch:
39
39
  auth_mode: auto
40
40
  host: elasticsearch.opencrvs-deps-{{env}}.svc.cluster.local
41
41
 
42
- minio:
43
- auth_mode: use_secret
42
+ s3:
44
43
  host: minio-0.minio.opencrvs-deps-{{env}}.svc.cluster.local
45
44
 
46
45
  redis:
@@ -54,7 +53,7 @@ postgres:
54
53
  platform:
55
54
  imagePullSecrets:
56
55
  # Default value for credentials created while yarn environment:init
57
- - name: dockerhub-credentials
56
+ - name: registry-credentials
58
57
 
59
58
  auth:
60
59
  env:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.2.0-rc.3af310b",
3
+ "version": "2.2.0-rc.5bf5dfc",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "./events": "./dist/events/index.js",
14
14
  "./telemetry": "./dist/telemetry/index.js",
15
15
  "./scopes": "./dist/scopes/index.js",
16
+ "./roles": "./dist/roles/index.js",
16
17
  "./authentication": "./dist/authentication/index.js",
17
18
  "./events/deduplication": "./dist/events/deduplication.js",
18
19
  "./conditionals": "./dist/conditionals/index.js",
@@ -22,6 +23,7 @@
22
23
  "build": "./build.sh",
23
24
  "build:all": "pnpm -w exec lerna run build --include-dependencies --scope @opencrvs/toolkit",
24
25
  "test": "vitest run",
26
+ "test:watch": "vitest",
25
27
  "test:compilation": "tsc --noEmit"
26
28
  },
27
29
  "repository": {
@@ -52,7 +54,7 @@
52
54
  "superjson": "1.9.0-0",
53
55
  "ts-morph": "^27.0.2",
54
56
  "uuid": "^9.0.0",
55
- "zod": "^4.4.3",
57
+ "zod": "^4.6.5",
56
58
  "zod-openapi": "^5.4.6"
57
59
  },
58
60
  "devDependencies": {
@@ -69,6 +71,6 @@
69
71
  },
70
72
  "moduleNameMapper": {
71
73
  "@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",
72
- "@opencrvs/commons/scopes": "@opencrvs/commons/build/dist/common/scopes.js"
74
+ "@opencrvs/commons/scopes": "@opencrvs/commons/build/dist/common/users/scopes.js"
73
75
  }
74
76
  }