@opencrvs/toolkit 1.9.12-rc.c1f8f26 → 1.9.12-rc.ce018e5

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 (79) hide show
  1. package/build.sh +4 -0
  2. package/dist/application-config/index.js +2045 -41
  3. package/dist/cli.js +2362 -4
  4. package/dist/commons/api/router.d.ts +106 -75
  5. package/dist/commons/application-config/index.d.ts +13 -16
  6. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  7. package/dist/commons/events/ActionDocument.d.ts +198 -198
  8. package/dist/commons/events/ActionInput.d.ts +113 -113
  9. package/dist/commons/events/ActionType.d.ts +3 -3
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +16 -10
  11. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +443 -172
  13. package/dist/commons/events/Draft.d.ts +15 -15
  14. package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
  15. package/dist/commons/events/EventConfig.d.ts +1 -1
  16. package/dist/commons/events/EventDocument.d.ts +81 -81
  17. package/dist/commons/events/EventIndex.d.ts +35 -27
  18. package/dist/commons/events/EventInput.d.ts +1 -1
  19. package/dist/commons/events/EventMetadata.d.ts +24 -24
  20. package/dist/commons/events/FieldConfig.d.ts +155 -44
  21. package/dist/commons/events/FieldType.d.ts +2 -1
  22. package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
  23. package/dist/commons/events/FieldValue.d.ts +54 -26
  24. package/dist/commons/events/PlainDate.d.ts +1 -1
  25. package/dist/commons/events/WorkqueueColumnConfig.d.ts +16 -16
  26. package/dist/commons/events/WorkqueueConfig.d.ts +438 -194
  27. package/dist/commons/events/defineConfig.d.ts +0 -4
  28. package/dist/commons/events/locations.d.ts +4 -4
  29. package/dist/commons/events/state/index.d.ts +2 -2
  30. package/dist/commons/events/state/utils.d.ts +3 -3
  31. package/dist/commons/events/utils.d.ts +5 -177
  32. package/dist/conditionals/index.js +13 -5
  33. package/dist/events/index.js +142 -33
  34. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  35. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  36. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  37. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  38. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  39. package/dist/migrations/v2.0/convert-config-files-to-ts.js +753 -0
  40. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  41. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  42. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  43. package/dist/migrations/v2.0/index.d.ts +7 -0
  44. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  45. package/dist/migrations/v2.0/index.js +2361 -0
  46. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  47. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  48. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  49. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  50. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  51. package/dist/migrations/v2.0/migrate-scopes.js +281 -0
  52. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  53. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  54. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  55. package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
  56. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
  57. package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
  58. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  59. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  60. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  61. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  62. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  63. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  64. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  65. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  66. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  67. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  68. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  69. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  70. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  71. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  72. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  73. package/dist/notification/index.js +73 -23
  74. package/dist/scopes/index.d.ts +31 -10
  75. package/dist/scopes/index.js +17 -5
  76. package/opencrvs-toolkit-1.9.12-rc.ce018e5.tgz +0 -0
  77. package/package.json +8 -7
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/opencrvs-toolkit-1.9.12-rc.c1f8f26.tgz +0 -0
@@ -133,16 +133,16 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
133
133
  var AccessLevelOptions = z2.object({
134
134
  accessLevel: JurisdictionFilter.optional()
135
135
  });
136
- var WorkqueueOptions = z2.object({
136
+ var WorkqueueOrDashboardOptions = z2.object({
137
137
  ids: z2.preprocess(
138
138
  (val) => val === void 0 ? void 0 : [val].flat(),
139
139
  z2.array(z2.string())
140
- ).describe("Must contain a list of workqueue ids.")
140
+ ).describe("Must contain a list of workqueue or dashboard ids.")
141
141
  });
142
142
  var AllScopeOptions = z2.object({
143
143
  ...AllRecordScopeOptions.shape,
144
144
  ...AccessLevelOptions.shape,
145
- ...WorkqueueOptions.shape
145
+ ...WorkqueueOrDashboardOptions.shape
146
146
  });
147
147
  var ScopeOptionKey = AllScopeOptions.keyof();
148
148
  var ResolvedScopeOptionsPlaceEvent = z2.object({
@@ -244,13 +244,21 @@ var Scope = z2.discriminatedUnion("type", [
244
244
  z2.object({ type: PlainScopeType }),
245
245
  ...RecordScopeV2.options,
246
246
  z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
247
- z2.object({ type: z2.literal("workqueue"), options: WorkqueueOptions })
247
+ z2.object({
248
+ type: z2.literal("workqueue"),
249
+ options: WorkqueueOrDashboardOptions
250
+ }),
251
+ z2.object({
252
+ type: z2.literal("dashboard.view"),
253
+ options: WorkqueueOrDashboardOptions
254
+ })
248
255
  ]);
249
256
  var ScopeType = z2.enum([
250
257
  ...SystemScopeType.options,
251
258
  ...RecordScopeTypeV2.options,
252
259
  ...PlainScopeType.options,
253
- "workqueue"
260
+ "workqueue",
261
+ "dashboard.view"
254
262
  ]);
255
263
  var EncodedScope = z2.string().brand("EncodedScope");
256
264
  var DEFAULT_SCOPE_OPTIONS = {
@@ -673,6 +681,7 @@ var FieldType = {
673
681
  SIGNATURE: "SIGNATURE",
674
682
  DATA: "DATA",
675
683
  BUTTON: "BUTTON",
684
+ AUTOCOMPLETE: "AUTOCOMPLETE",
676
685
  SEARCH: "SEARCH",
677
686
  ALPHA_PRINT_BUTTON: "ALPHA_PRINT_BUTTON",
678
687
  HTTP: "HTTP",
@@ -850,6 +859,11 @@ var AgeValue = z12.object({
850
859
  asOfDateRef: z12.string()
851
860
  });
852
861
  var AgeUpdateValue = AgeValue.optional().nullable();
862
+ var AutocompleteValue = z12.object({
863
+ label: z12.string(),
864
+ value: z12.string()
865
+ });
866
+ var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
853
867
  var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
854
868
  var DatetimeValue = z12.iso.datetime();
855
869
  var SelectDateRangeValue = z12.enum([
@@ -896,7 +910,9 @@ var LeafFieldValues = z12.union([
896
910
  IdReaderFieldValue,
897
911
  NumberWithUnitFieldValue,
898
912
  NumberWithUnitFieldUpdateValue,
899
- CustomFieldValue
913
+ CustomFieldValue,
914
+ AutocompleteValue,
915
+ AutocompleteUpdateValue
900
916
  ]);
901
917
  var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
902
918
  var DataFieldValue = z12.object({
@@ -978,7 +994,8 @@ var FieldUpdateValue = safeUnion([
978
994
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
979
995
  QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
980
996
  CustomFieldValue.describe("CustomFieldValue"),
981
- HiddenFieldValue.describe("HiddenFieldValue")
997
+ HiddenFieldValue.describe("HiddenFieldValue"),
998
+ AutocompleteUpdateValue.describe("AutocompleteUpdateValue")
982
999
  ]);
983
1000
 
984
1001
  // ../commons/src/events/serializers/user/serializer.ts
@@ -1475,8 +1492,8 @@ var QueryExpression = import_v4.z.object({
1475
1492
  "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1476
1493
  "legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
1477
1494
  "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1478
- createdAtLocation: import_v4.z.optional(Within),
1479
- updatedAtLocation: import_v4.z.optional(Within),
1495
+ createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1496
+ updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1480
1497
  assignedTo: import_v4.z.optional(Exact),
1481
1498
  createdByUserType: import_v4.z.optional(ExactUserType),
1482
1499
  updatedByUserRole: import_v4.z.optional(Exact),
@@ -1813,17 +1830,14 @@ var ImageViewField = BaseField.extend({
1813
1830
  }).describe("A read-only image component for form pages");
1814
1831
  var Paragraph = BaseField.extend({
1815
1832
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1816
- defaultValue: NonEmptyTextValue.optional(),
1817
1833
  configuration: ParagraphConfiguration
1818
1834
  }).describe("A read-only HTML <p> paragraph");
1819
1835
  var Heading = BaseField.extend({
1820
1836
  type: import_v43.default.literal(FieldType.HEADING),
1821
- defaultValue: NonEmptyTextValue.optional(),
1822
1837
  configuration: HeadingConfiguration
1823
1838
  }).describe("A read-only heading component for form pages");
1824
1839
  var PageHeader = BaseField.extend({
1825
- type: import_v43.default.literal(FieldType.PAGE_HEADER),
1826
- defaultValue: NonEmptyTextValue.optional()
1840
+ type: import_v43.default.literal(FieldType.PAGE_HEADER)
1827
1841
  }).describe("A read-only header component for form pages");
1828
1842
  var File = BaseField.extend({
1829
1843
  type: import_v43.default.literal(FieldType.FILE),
@@ -1873,7 +1887,6 @@ var RadioGroup = BaseField.extend({
1873
1887
  }).describe("Grouped radio options");
1874
1888
  var BulletList = BaseField.extend({
1875
1889
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1876
- defaultValue: TextValue.optional(),
1877
1890
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
1878
1891
  configuration: import_v43.default.object({
1879
1892
  styles: import_v43.default.object({
@@ -2055,16 +2068,32 @@ var DataField = BaseField.extend({
2055
2068
  data: import_v43.default.array(DataEntry)
2056
2069
  })
2057
2070
  }).describe("Data field for displaying read-only data");
2071
+ var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2072
+ var ButtonType = import_v43.default.enum([
2073
+ "primary",
2074
+ "secondary",
2075
+ "tertiary",
2076
+ "positive",
2077
+ "negative",
2078
+ "secondaryNegative",
2079
+ "icon",
2080
+ "iconPrimary"
2081
+ ]);
2082
+ var TextColor = import_v43.default.enum(["primary", "copy"]);
2083
+ var TextVariant = import_v43.default.enum(["bold14", "reg14"]);
2084
+ var ButtonConfiguration = import_v43.default.object({
2085
+ icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit."),
2086
+ loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2087
+ buttonSize: ButtonSize.optional().describe("Size of the button."),
2088
+ buttonType: ButtonType.optional().describe("Type of the button."),
2089
+ textColor: TextColor.optional().describe("Color of the text."),
2090
+ textVariant: TextVariant.optional().describe("Variant of the text."),
2091
+ text: TranslationConfig.describe("Text to display on the button")
2092
+ });
2058
2093
  var ButtonField = BaseField.extend({
2059
2094
  type: import_v43.default.literal(FieldType.BUTTON),
2060
2095
  defaultValue: ButtonFieldValue.optional(),
2061
- configuration: import_v43.default.object({
2062
- icon: import_v43.default.string().optional().describe(
2063
- "Icon for the button. You can find icons from OpenCRVS UI-Kit."
2064
- ),
2065
- loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2066
- text: TranslationConfig.describe("Text to display on the button")
2067
- })
2096
+ configuration: ButtonConfiguration
2068
2097
  }).describe("Generic button without any built-in functionality");
2069
2098
  var FieldGroup = BaseField.extend({
2070
2099
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
@@ -2096,6 +2125,19 @@ var HttpField = BaseField.extend({
2096
2125
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2097
2126
  })
2098
2127
  }).describe("HTTP request function triggered by a button click or other event");
2128
+ var AutocompleteField = BaseField.extend({
2129
+ type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2130
+ configuration: import_v43.default.object({
2131
+ url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2132
+ method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2133
+ defaultOptions: import_v43.default.array(
2134
+ import_v43.default.object({
2135
+ label: import_v43.default.string(),
2136
+ value: import_v43.default.string()
2137
+ })
2138
+ ).optional()
2139
+ })
2140
+ }).describe("Autocomplete input field");
2099
2141
  var SearchField = HttpField.extend({
2100
2142
  type: import_v43.default.literal(FieldType.SEARCH),
2101
2143
  configuration: SearchQuery.pick({
@@ -2181,8 +2223,11 @@ var CustomField = BaseField.extend({
2181
2223
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2182
2224
  configuration: import_v43.default.unknown().optional()
2183
2225
  });
2226
+ var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2184
2227
  var LoaderField = BaseField.extend({
2185
2228
  type: import_v43.default.literal(FieldType.LOADER),
2229
+ variant: FieldStyleVariant.default("default").optional(),
2230
+ hideLabel: import_v43.default.boolean().default(true).optional().describe("Loader field does not show a label by default"),
2186
2231
  configuration: import_v43.default.object({
2187
2232
  text: TranslationConfig.describe("Display text above the loading spinner")
2188
2233
  })
@@ -2239,6 +2284,7 @@ var FieldConfig = import_v43.default.discriminatedUnion("type", [
2239
2284
  ButtonField,
2240
2285
  AlphaPrintButton,
2241
2286
  HttpField,
2287
+ AutocompleteField,
2242
2288
  LinkButtonField,
2243
2289
  VerificationStatus,
2244
2290
  QrReaderField,
@@ -3875,8 +3921,12 @@ var SerializedQueryExpression = z35.object({
3875
3921
  "legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
3876
3922
  "legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
3877
3923
  "legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
3878
- createdAtLocation: z35.optional(SerializableWithin),
3879
- updatedAtLocation: z35.optional(SerializableWithin),
3924
+ createdAtLocation: z35.optional(
3925
+ z35.union([SerializableWithin, SerializableExact])
3926
+ ),
3927
+ updatedAtLocation: z35.optional(
3928
+ z35.union([SerializableWithin, SerializableExact])
3929
+ ),
3880
3930
  updatedByUserRole: z35.optional(SerializableExact),
3881
3931
  assignedTo: z35.optional(SerializableExact),
3882
3932
  createdBy: z35.optional(SerializableExact),
@@ -1,4 +1,5 @@
1
1
  import * as z from 'zod/v4';
2
+ import { Role } from './roles';
2
3
  export declare const JurisdictionFilter: z.ZodEnum<{
3
4
  administrativeArea: "administrativeArea";
4
5
  location: "location";
@@ -239,7 +240,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
239
240
  }>;
240
241
  options: z.ZodOptional<z.ZodObject<{
241
242
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
242
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
243
+ placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
243
244
  }, z.core.$strip>>;
244
245
  }, z.core.$strip>, z.ZodObject<{
245
246
  type: z.ZodEnum<{
@@ -251,8 +252,8 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
251
252
  }>;
252
253
  options: z.ZodOptional<z.ZodObject<{
253
254
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
254
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
255
- 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">>>;
256
257
  declaredBy: z.ZodOptional<z.ZodString>;
257
258
  }, z.core.$strip>>;
258
259
  }, z.core.$strip>, z.ZodObject<{
@@ -265,20 +266,20 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
265
266
  }>;
266
267
  options: z.ZodOptional<z.ZodObject<{
267
268
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
268
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
269
- 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">>>;
270
271
  declaredBy: z.ZodOptional<z.ZodString>;
271
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
272
+ registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
272
273
  registeredBy: z.ZodOptional<z.ZodString>;
273
274
  }, z.core.$strip>>;
274
275
  }, z.core.$strip>, z.ZodObject<{
275
276
  type: z.ZodLiteral<"record.print-certified-copies">;
276
277
  options: z.ZodOptional<z.ZodObject<{
277
278
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
278
- placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
279
- 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">>>;
280
281
  declaredBy: z.ZodOptional<z.ZodString>;
281
- registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
282
+ registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
282
283
  registeredBy: z.ZodOptional<z.ZodString>;
283
284
  templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
284
285
  }, z.core.$strip>>;
@@ -453,6 +454,11 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
453
454
  options: z.ZodObject<{
454
455
  ids: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodArray<z.ZodString>>;
455
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>;
456
462
  }, z.core.$strip>], "type">;
457
463
  export type Scope = z.infer<typeof Scope>;
458
464
  export declare const ScopeType: z.ZodEnum<{
@@ -490,13 +496,14 @@ export declare const ScopeType: z.ZodEnum<{
490
496
  "user.create": "user.create";
491
497
  "user.edit": "user.edit";
492
498
  workqueue: "workqueue";
499
+ "dashboard.view": "dashboard.view";
493
500
  }>;
494
501
  export type ScopeType = z.infer<typeof ScopeType>;
495
502
  /**
496
503
  * Branded encoded scope string, in query string format.
497
504
  *
498
505
  */
499
- export declare const EncodedScope: z.core.$ZodBranded<z.ZodString, "EncodedScope">;
506
+ export declare const EncodedScope: z.core.$ZodBranded<z.ZodString, "EncodedScope", "out">;
500
507
  export type EncodedScope = z.infer<typeof EncodedScope>;
501
508
  /**
502
509
  * Encodes a scope object into an EncodedScope branded query string.
@@ -572,6 +579,11 @@ export declare const decodeScope: (query: EncodedScope) => {
572
579
  options: {
573
580
  ids: string[];
574
581
  };
582
+ } | {
583
+ type: "dashboard.view";
584
+ options: {
585
+ ids: string[];
586
+ };
575
587
  } | undefined;
576
588
  /**
577
589
  * Function to get the value of a scope option (aka. scope attribute)
@@ -647,5 +659,14 @@ export declare function canUserCreateEvent(userScopes: EncodedScope[], eventType
647
659
  * @returns Array of scopes in string format, encoded for use in JWT tokens.
648
660
  */
649
661
  export declare function defineScopes(scopes: Scope[]): (string & z.core.$brand<"EncodedScope">)[];
662
+ /**
663
+ * Helper for defining user roles. Should be used in country config.
664
+ *
665
+ * @param roles Array of roles in object format.
666
+ */
667
+ export declare function defineRoles(roles: Role[]): {
668
+ id: string;
669
+ scopes: (string & z.core.$brand<"EncodedScope">)[];
670
+ }[];
650
671
  export {};
651
672
  //# sourceMappingURL=scopes.d.ts.map
@@ -44,6 +44,7 @@ __export(scopes_exports, {
44
44
  UserFilter: () => UserFilter,
45
45
  canUserCreateEvent: () => canUserCreateEvent,
46
46
  decodeScope: () => decodeScope,
47
+ defineRoles: () => defineRoles,
47
48
  defineScopes: () => defineScopes,
48
49
  encodeScope: () => encodeScope,
49
50
  getAcceptedScopesByType: () => getAcceptedScopesByType,
@@ -161,16 +162,16 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
161
162
  var AccessLevelOptions = z3.object({
162
163
  accessLevel: JurisdictionFilter.optional()
163
164
  });
164
- var WorkqueueOptions = z3.object({
165
+ var WorkqueueOrDashboardOptions = z3.object({
165
166
  ids: z3.preprocess(
166
167
  (val) => val === void 0 ? void 0 : [val].flat(),
167
168
  z3.array(z3.string())
168
- ).describe("Must contain a list of workqueue ids.")
169
+ ).describe("Must contain a list of workqueue or dashboard ids.")
169
170
  });
170
171
  var AllScopeOptions = z3.object({
171
172
  ...AllRecordScopeOptions.shape,
172
173
  ...AccessLevelOptions.shape,
173
- ...WorkqueueOptions.shape
174
+ ...WorkqueueOrDashboardOptions.shape
174
175
  });
175
176
  var ScopeOptionKey = AllScopeOptions.keyof();
176
177
  var ResolvedScopeOptionsPlaceEvent = z3.object({
@@ -284,13 +285,21 @@ var Scope2 = z3.discriminatedUnion("type", [
284
285
  z3.object({ type: PlainScopeType }),
285
286
  ...RecordScopeV2.options,
286
287
  z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
287
- z3.object({ type: z3.literal("workqueue"), options: WorkqueueOptions })
288
+ z3.object({
289
+ type: z3.literal("workqueue"),
290
+ options: WorkqueueOrDashboardOptions
291
+ }),
292
+ z3.object({
293
+ type: z3.literal("dashboard.view"),
294
+ options: WorkqueueOrDashboardOptions
295
+ })
288
296
  ]);
289
297
  var ScopeType2 = z3.enum([
290
298
  ...SystemScopeType.options,
291
299
  ...RecordScopeTypeV2.options,
292
300
  ...PlainScopeType.options,
293
- "workqueue"
301
+ "workqueue",
302
+ "dashboard.view"
294
303
  ]);
295
304
  var flattenScope = (scope) => ({
296
305
  type: scope.type,
@@ -372,6 +381,9 @@ function canUserCreateEvent(userScopes, eventType) {
372
381
  function defineScopes(scopes) {
373
382
  return scopes.map((scope) => Scope2.parse(scope)).map(encodeScope);
374
383
  }
384
+ function defineRoles(roles) {
385
+ return roles;
386
+ }
375
387
 
376
388
  // src/scopes/index.ts
377
389
  z4.globalRegistry.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.9.12-rc.c1f8f26",
3
+ "version": "1.9.12-rc.ce018e5",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@trpc/client": "11.4.3",
25
- "@trpc/server": "11.4.3",
25
+ "@trpc/server": "^11.8.0",
26
26
  "ajv": "^8.17.1",
27
27
  "ajv-formats": "^3.0.1",
28
28
  "date-fns": "^2.28.0",
@@ -31,16 +31,17 @@
31
31
  "object-hash": "^3.0.0",
32
32
  "qs": "6.14.0",
33
33
  "superjson": "1.9.0-0",
34
+ "ts-morph": "^27.0.2",
34
35
  "uuid": "^9.0.0",
35
- "zod": "^4.1.12",
36
- "zod-openapi": "^5.4.3"
36
+ "zod": "^4.2.1",
37
+ "zod-openapi": "^5.4.6"
37
38
  },
38
39
  "devDependencies": {
40
+ "@opencrvs/events": "^1.9.0",
41
+ "@types/object-hash": "^3.0.6",
39
42
  "@types/uuid": "^9.0.3",
40
43
  "esbuild": "^0.24.0",
41
- "typescript": "^5.6.3",
42
- "@opencrvs/events": "^1.9.0",
43
- "@types/object-hash": "^3.0.6"
44
+ "typescript": "^5.6.3"
44
45
  },
45
46
  "moduleNameMapper": {
46
47
  "@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",
@@ -1 +1 @@
1
- {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
1
+ {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}