@opencrvs/toolkit 2.0.0-rc.f281551 → 2.0.0-rc.f38dc6b

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 (98) hide show
  1. package/create-countryconfig/index.js +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +259 -96
  4. package/dist/cli.js +1952 -347
  5. package/dist/commons/api/router.d.ts +3345 -272
  6. package/dist/commons/application-config/index.d.ts +16 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +12 -6
  8. package/dist/commons/conditionals/validate.d.ts +1 -0
  9. package/dist/commons/events/ActionInput.d.ts +108 -0
  10. package/dist/commons/events/Draft.d.ts +4 -2
  11. package/dist/commons/events/EventIndex.d.ts +0 -3
  12. package/dist/commons/events/EventMetadata.d.ts +0 -7
  13. package/dist/commons/events/FieldConfig.d.ts +10 -0
  14. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  15. package/dist/commons/events/index.d.ts +2 -0
  16. package/dist/commons/events/locations.d.ts +38 -1
  17. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  18. package/dist/commons/events/scopes.d.ts +24 -1
  19. package/dist/commons/events/state/flags.d.ts +2 -0
  20. package/dist/commons/events/state/index.d.ts +0 -4
  21. package/dist/commons/events/state/utils.d.ts +0 -2
  22. package/dist/commons/events/utils.d.ts +1 -1
  23. package/dist/conditionals/index.js +44 -8
  24. package/dist/events/index.js +806 -154
  25. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  26. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  27. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  28. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  29. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  30. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  31. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  32. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  33. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  35. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  36. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  37. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  38. package/dist/migrations/v2.0/create-events-index.js +1 -2
  39. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  40. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  41. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  42. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  43. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  44. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  45. package/dist/migrations/v2.0/index.d.ts +10 -4
  46. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  47. package/dist/migrations/v2.0/index.js +1920 -344
  48. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  49. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  50. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  51. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  52. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  53. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  54. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  55. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  56. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  57. package/dist/migrations/v2.0/migrate-scopes.js +55 -32
  58. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  59. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  60. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  61. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  62. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  63. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  64. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  65. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  66. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  67. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  68. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  69. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  70. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  71. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  72. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  73. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  74. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  75. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  76. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  77. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  78. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  79. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  80. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  81. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  82. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  83. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  84. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  85. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  86. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  87. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  88. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  89. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  90. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  91. package/dist/migrations/v2.0/update-package-json.js +105 -0
  92. package/dist/notification/index.js +689 -124
  93. package/dist/scopes/index.d.ts +87 -10
  94. package/dist/scopes/index.js +46 -9
  95. package/opencrvs-toolkit-2.0.0-rc.f38dc6b.tgz +0 -0
  96. package/package.json +6 -2
  97. package/tsconfig.tsbuildinfo +1 -1
  98. package/opencrvs-toolkit-2.0.0-rc.f281551.tgz +0 -0
@@ -213,6 +213,10 @@ __export(events_exports, {
213
213
  UUID: () => UUID,
214
214
  UnassignActionInput: () => UnassignActionInput,
215
215
  UserAuditRecordInput: () => UserAuditRecordInput,
216
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
217
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
218
+ V2_DEFAULT_MOCK_LOCATIONS: () => V2_DEFAULT_MOCK_LOCATIONS,
219
+ V2_DEFAULT_MOCK_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_LOCATIONS_MAP,
216
220
  ValidationConfig: () => ValidationConfig,
217
221
  VerificationActionConfig: () => VerificationActionConfig,
218
222
  VerificationPageConfig: () => VerificationPageConfig,
@@ -234,6 +238,7 @@ __export(events_exports, {
234
238
  ageToDate: () => ageToDate,
235
239
  aggregateActionAnnotations: () => aggregateActionAnnotations,
236
240
  aggregateActionDeclarations: () => aggregateActionDeclarations,
241
+ always: () => always,
237
242
  alwaysTrue: () => alwaysTrue,
238
243
  and: () => and,
239
244
  annotationActions: () => annotationActions,
@@ -243,6 +248,8 @@ __export(events_exports, {
243
248
  areConditionsMet: () => areConditionsMet,
244
249
  buildFormState: () => buildFormState,
245
250
  canAccessEventWithScope: () => canAccessEventWithScope,
251
+ canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
252
+ canAccessUserWithScope: () => canAccessUserWithScope,
246
253
  compositeFieldTypes: () => compositeFieldTypes,
247
254
  createEmptyDraft: () => createEmptyDraft,
248
255
  createFieldConditionals: () => createFieldConditionals,
@@ -300,12 +307,13 @@ __export(events_exports, {
300
307
  getActionConfig: () => getActionConfig,
301
308
  getActionReview: () => getActionReview,
302
309
  getActionReviewFields: () => getActionReviewFields,
310
+ getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
303
311
  getAllUniqueFields: () => getAllUniqueFields,
304
312
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
305
313
  getAssignedUserFromActions: () => getAssignedUserFromActions,
306
- getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
307
314
  getAssignmentStatus: () => getAssignmentStatus,
308
315
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
316
+ getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
309
317
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
310
318
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
311
319
  getCurrentEventState: () => getCurrentEventState,
@@ -315,7 +323,9 @@ __export(events_exports, {
315
323
  getDeclarationFields: () => getDeclarationFields,
316
324
  getDeclarationPages: () => getDeclarationPages,
317
325
  getEventConfigById: () => getEventConfigById,
326
+ getEventFlags: () => getEventFlags,
318
327
  getFilePathsFromEvent: () => getFilePathsFromEvent,
328
+ getLocationHierarchy: () => getLocationHierarchy,
319
329
  getMixedPath: () => getMixedPath,
320
330
  getPendingAction: () => getPendingAction,
321
331
  getPrintCertificatePages: () => getPrintCertificatePages,
@@ -376,6 +386,7 @@ __export(events_exports, {
376
386
  isPageVisible: () => isPageVisible,
377
387
  isParagraphFieldType: () => isParagraphFieldType,
378
388
  isPhoneFieldType: () => isPhoneFieldType,
389
+ isPotentialDuplicate: () => isPotentialDuplicate,
379
390
  isPrintButtonFieldType: () => isPrintButtonFieldType,
380
391
  isQrReaderFieldType: () => isQrReaderFieldType,
381
392
  isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
@@ -409,6 +420,7 @@ __export(events_exports, {
409
420
  plainDateToLocalDate: () => plainDateToLocalDate,
410
421
  precompileActionSchemas: () => precompileActionSchemas,
411
422
  resolveDateOfEvent: () => resolveDateOfEvent,
423
+ resolveEventCustomFlags: () => resolveEventCustomFlags,
412
424
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
413
425
  runFieldValidations: () => runFieldValidations,
414
426
  runStructuralValidations: () => runStructuralValidations,
@@ -489,6 +501,10 @@ var scopeByEvent = z2.preprocess(
489
501
  (val) => val === void 0 ? void 0 : [val].flat(),
490
502
  z2.array(z2.string()).optional()
491
503
  ).describe("Event type, e.g. birth, death");
504
+ var userRole = z2.preprocess(
505
+ (val) => val === void 0 ? void 0 : [val].flat(),
506
+ z2.array(z2.string()).optional()
507
+ ).describe("User role, e.g. admin, field agent");
492
508
  var scopeOptionsPlaceEvent = z2.object({
493
509
  event: scopeByEvent,
494
510
  placeOfEvent: JurisdictionFilter.optional()
@@ -512,6 +528,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
512
528
  var AccessLevelOptions = z2.object({
513
529
  accessLevel: JurisdictionFilter.optional()
514
530
  });
531
+ var AllUserScopeOptions = AccessLevelOptions.extend({
532
+ role: userRole.optional()
533
+ });
515
534
  var WorkqueueOrDashboardOptions = z2.object({
516
535
  ids: z2.preprocess(
517
536
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -521,6 +540,7 @@ var WorkqueueOrDashboardOptions = z2.object({
521
540
  var AllScopeOptions = z2.object({
522
541
  ...AllRecordScopeOptions.shape,
523
542
  ...AccessLevelOptions.shape,
543
+ ...AllUserScopeOptions.shape,
524
544
  ...WorkqueueOrDashboardOptions.shape
525
545
  });
526
546
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -593,6 +613,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
593
613
  ]).describe(
594
614
  "Scopes used to check user's permission to perform actions on a record."
595
615
  );
616
+ var SystemScopeType = z2.enum([
617
+ "organisation.read-locations",
618
+ "user.read",
619
+ "user.create",
620
+ "user.edit",
621
+ "user.search"
622
+ ]);
623
+ var UserScopeType = SystemScopeType.extract([
624
+ "user.read",
625
+ "user.create",
626
+ "user.edit",
627
+ "user.search"
628
+ ]);
629
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
630
+ var UserScopeV2 = z2.discriminatedUnion("type", [
631
+ z2.object({
632
+ type: ScopesWithRoleOption,
633
+ options: AllUserScopeOptions.optional()
634
+ }),
635
+ z2.object({
636
+ type: UserScopeType.extract(["user.read", "user.search"]),
637
+ options: AccessLevelOptions.optional()
638
+ })
639
+ ]);
640
+ function scopeUsesRoleOptions(scope) {
641
+ return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
642
+ }
596
643
  function scopeUsesDeclaredOptions(scope) {
597
644
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
598
645
  }
@@ -625,16 +672,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
625
672
  }).optional()
626
673
  })
627
674
  ]).describe("Resolved scope with location/user IDs instead of filters.");
628
- var SystemScopeType = z2.enum([
629
- "organisation.read-locations",
630
- "user.read",
631
- "user.create",
632
- "user.edit"
633
- ]);
634
675
  var Scope = z2.discriminatedUnion("type", [
635
676
  z2.object({ type: PlainScopeType }),
636
677
  ...RecordScopeV2.options,
637
- z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
678
+ ...UserScopeV2.options,
679
+ z2.object({
680
+ type: z2.literal("organisation.read-locations"),
681
+ options: AccessLevelOptions.optional()
682
+ }),
638
683
  z2.object({
639
684
  type: z2.literal("workqueue"),
640
685
  options: WorkqueueOrDashboardOptions
@@ -667,7 +712,9 @@ var decodeScope = (query) => {
667
712
  };
668
713
  var DEFAULT_SCOPE_OPTIONS = {
669
714
  placeOfEvent: JurisdictionFilter.enum.all,
670
- accessLevel: JurisdictionFilter.enum.all
715
+ accessLevel: JurisdictionFilter.enum.all,
716
+ registeredIn: JurisdictionFilter.enum.all,
717
+ declaredIn: JurisdictionFilter.enum.all
671
718
  };
672
719
  function getAcceptedScopesByType({
673
720
  acceptedScopes,
@@ -1040,7 +1087,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
1040
1087
  ShowConditional,
1041
1088
  // Action can be shown to the user in the list but as disabled
1042
1089
  EnableConditional
1043
- ]);
1090
+ ]).meta({
1091
+ id: "ActionConditional",
1092
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
1093
+ });
1044
1094
  var DisplayOnReviewConditional = z7.object({
1045
1095
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
1046
1096
  conditional: Conditional
@@ -1055,8 +1105,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
1055
1105
  // Field output can be shown / hidden on the review page
1056
1106
  DisplayOnReviewConditional
1057
1107
  ]).meta({
1058
- description: "Field conditional configuration",
1059
- id: "FieldConditional"
1108
+ id: "FieldConditional",
1109
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
1060
1110
  });
1061
1111
 
1062
1112
  // ../commons/src/events/FieldType.ts
@@ -1376,28 +1426,20 @@ function schemaPriority(schema) {
1376
1426
  return idx === -1 ? 9999 : idx;
1377
1427
  }
1378
1428
  function safeUnion(schemas) {
1429
+ const sortedSchemas = [...schemas].sort(
1430
+ (a, b) => schemaPriority(a) - schemaPriority(b)
1431
+ );
1379
1432
  return z12.any().superRefine((val, ctx) => {
1380
- const successful = schemas.filter((s) => s.safeParse(val).success);
1381
- if (successful.length === 1) {
1382
- return;
1383
- }
1384
- if (successful.length === 0) {
1385
- ctx.addIssue({
1386
- code: "invalid_type",
1387
- expected: "custom",
1388
- message: "Value does not match any schema"
1389
- });
1390
- return;
1391
- }
1392
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
1393
- const best = successful[0];
1394
- if (!best.safeParse(val).success) {
1395
- ctx.addIssue({
1396
- expected: "custom",
1397
- code: "invalid_type",
1398
- message: "Value did not match the best schema"
1399
- });
1433
+ for (const schema of sortedSchemas) {
1434
+ if (schema.safeParse(val).success) {
1435
+ return;
1436
+ }
1400
1437
  }
1438
+ ctx.addIssue({
1439
+ code: "invalid_type",
1440
+ expected: "custom",
1441
+ message: "Value does not match any schema"
1442
+ });
1401
1443
  }).meta({
1402
1444
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1403
1445
  });
@@ -1707,6 +1749,9 @@ var FlagConfig = z15.object({
1707
1749
  "Indicates if this flag expects an action to be performed to be cleared."
1708
1750
  ),
1709
1751
  label: TranslationConfig.describe("Human readable label of the flag.")
1752
+ }).meta({
1753
+ id: "FlagConfig",
1754
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1710
1755
  });
1711
1756
  var ActionFlagConfig = z15.object({
1712
1757
  id: Flag,
@@ -1714,6 +1759,9 @@ var ActionFlagConfig = z15.object({
1714
1759
  conditional: Conditional.optional().describe(
1715
1760
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1716
1761
  )
1762
+ }).meta({
1763
+ id: "ActionFlagConfig",
1764
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1717
1765
  });
1718
1766
 
1719
1767
  // ../commons/src/events/EventMetadata.ts
@@ -1735,8 +1783,7 @@ var ActionCreationMetadata = z16.object({
1735
1783
  ),
1736
1784
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1737
1785
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1738
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1739
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1786
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1740
1787
  });
1741
1788
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1742
1789
  registrationNumber: z16.string().describe(
@@ -1764,9 +1811,6 @@ var EventMetadata = z16.object({
1764
1811
  createdAtLocation: UUID.nullish().describe(
1765
1812
  "Location of the user who created the event."
1766
1813
  ),
1767
- createdBySignature: DocumentPath.nullish().describe(
1768
- "Signature of the user who created the event."
1769
- ),
1770
1814
  updatedAtLocation: UUID.nullish().describe(
1771
1815
  "Location of the user who last changed the status."
1772
1816
  ),
@@ -2141,14 +2185,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
2141
2185
  }
2142
2186
  }).describe("Unique identifier for the field");
2143
2187
  var FieldReference = import_v43.default.object({
2144
- $$field: FieldId,
2188
+ $$field: FieldId.describe("Id of the field to reference"),
2145
2189
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
2146
2190
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
2147
2191
  )
2148
2192
  }).describe("Reference to a field by its ID");
2149
2193
  var ValidationConfig = import_v43.default.object({
2150
- validator: Conditional,
2151
- message: TranslationConfig
2194
+ validator: Conditional.describe(
2195
+ "Conditional expression that must hold for the field value to be considered valid."
2196
+ ),
2197
+ message: TranslationConfig.describe(
2198
+ "Error message displayed when the validator does not hold."
2199
+ )
2200
+ }).meta({
2201
+ id: "ValidationConfig",
2202
+ description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
2152
2203
  });
2153
2204
  var requiredSchema = import_v43.default.union([
2154
2205
  import_v43.default.boolean(),
@@ -2187,6 +2238,9 @@ var BaseField = import_v43.default.object({
2187
2238
  }).describe("Common properties shared across all field types.");
2188
2239
  var Divider = BaseField.extend({
2189
2240
  type: import_v43.default.literal(FieldType.DIVIDER)
2241
+ }).meta({
2242
+ description: "A horizontal line divider",
2243
+ id: "Divider"
2190
2244
  });
2191
2245
  var TextField = BaseField.extend({
2192
2246
  type: import_v43.default.literal(FieldType.TEXT),
@@ -2197,7 +2251,10 @@ var TextField = BaseField.extend({
2197
2251
  prefix: TranslationConfig.optional(),
2198
2252
  postfix: TranslationConfig.optional()
2199
2253
  }).default({ type: "text" }).optional()
2200
- }).describe("Text input");
2254
+ }).meta({
2255
+ description: "A text input field",
2256
+ id: "TextField"
2257
+ });
2201
2258
  var NumberField = BaseField.extend({
2202
2259
  type: import_v43.default.literal(FieldType.NUMBER),
2203
2260
  defaultValue: NumberFieldValue.optional(),
@@ -2207,7 +2264,10 @@ var NumberField = BaseField.extend({
2207
2264
  prefix: TranslationConfig.optional(),
2208
2265
  postfix: TranslationConfig.optional()
2209
2266
  }).optional()
2210
- }).describe("Number input");
2267
+ }).meta({
2268
+ description: "A number input field",
2269
+ id: "NumberField"
2270
+ });
2211
2271
  var TextAreaField = BaseField.extend({
2212
2272
  type: import_v43.default.literal(FieldType.TEXTAREA),
2213
2273
  defaultValue: NonEmptyTextValue.optional(),
@@ -2218,7 +2278,10 @@ var TextAreaField = BaseField.extend({
2218
2278
  prefix: TranslationConfig.optional(),
2219
2279
  postfix: TranslationConfig.optional()
2220
2280
  }).default({ rows: 4 }).optional()
2221
- }).describe("Multiline text input");
2281
+ }).meta({
2282
+ description: "A multiline text input",
2283
+ id: "TextAreaField"
2284
+ });
2222
2285
  var ImageMimeType = import_v43.default.enum([
2223
2286
  "image/png",
2224
2287
  "image/jpg",
@@ -2248,13 +2311,19 @@ var SignatureField = BaseField.extend({
2248
2311
  }).default({
2249
2312
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2250
2313
  })
2251
- }).describe("Signature input field");
2314
+ }).meta({
2315
+ description: "A signature input field",
2316
+ id: "SignatureField"
2317
+ });
2252
2318
  var EmailField = BaseField.extend({
2253
2319
  type: import_v43.default.literal(FieldType.EMAIL),
2254
2320
  configuration: import_v43.default.object({
2255
2321
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
2256
2322
  }).default({ maxLength: 255 }).optional(),
2257
2323
  defaultValue: NonEmptyTextValue.optional()
2324
+ }).meta({
2325
+ description: "An email input field",
2326
+ id: "EmailField"
2258
2327
  });
2259
2328
  var DateField = BaseField.extend({
2260
2329
  type: import_v43.default.literal(FieldType.DATE),
@@ -2264,7 +2333,10 @@ var DateField = BaseField.extend({
2264
2333
  "Text to display above the date input"
2265
2334
  ).optional()
2266
2335
  }).optional()
2267
- }).describe("A single date input (yyyy-MM-dd)");
2336
+ }).meta({
2337
+ description: "A date input (yyyy-MM-dd)",
2338
+ id: "DateField"
2339
+ });
2268
2340
  var AgeField = BaseField.extend({
2269
2341
  type: import_v43.default.literal(FieldType.AGE),
2270
2342
  defaultValue: NumberFieldValue.optional(),
@@ -2273,7 +2345,10 @@ var AgeField = BaseField.extend({
2273
2345
  prefix: TranslationConfig.optional(),
2274
2346
  postfix: TranslationConfig.optional()
2275
2347
  })
2276
- }).describe("An age input field which uses the current date as the asOfDate");
2348
+ }).meta({
2349
+ description: "An age input field which uses the current date as the asOfDate",
2350
+ id: "AgeField"
2351
+ });
2277
2352
  var TimeField = BaseField.extend({
2278
2353
  type: import_v43.default.literal(FieldType.TIME),
2279
2354
  defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
@@ -2283,7 +2358,10 @@ var TimeField = BaseField.extend({
2283
2358
  "Text to display above the time input"
2284
2359
  ).optional()
2285
2360
  }).optional()
2286
- }).describe("A single date input (HH-mm)");
2361
+ }).meta({
2362
+ description: "A single time input (HH-mm)",
2363
+ id: "TimeField"
2364
+ });
2287
2365
  var DateRangeField = BaseField.extend({
2288
2366
  type: import_v43.default.literal(FieldType.DATE_RANGE),
2289
2367
  defaultValue: DateRangeFieldValue.optional(),
@@ -2292,7 +2370,10 @@ var DateRangeField = BaseField.extend({
2292
2370
  "Text to display above the date input"
2293
2371
  ).optional()
2294
2372
  }).optional()
2295
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
2373
+ }).meta({
2374
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
2375
+ id: "DateRangeField"
2376
+ });
2296
2377
  var HtmlFontVariant = import_v43.default.enum([
2297
2378
  "reg12",
2298
2379
  "reg14",
@@ -2336,18 +2417,30 @@ var ImageViewField = BaseField.extend({
2336
2417
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
2337
2418
  defaultValue: NonEmptyTextValue.optional(),
2338
2419
  configuration: ImageConfiguration
2339
- }).describe("A read-only image component for form pages");
2420
+ }).meta({
2421
+ description: "A read-only image component for form pages",
2422
+ id: "ImageViewField"
2423
+ });
2340
2424
  var Paragraph = BaseField.extend({
2341
2425
  type: import_v43.default.literal(FieldType.PARAGRAPH),
2342
2426
  configuration: ParagraphConfiguration
2343
- }).describe("A read-only HTML <p> paragraph");
2427
+ }).meta({
2428
+ description: "A read-only HTML <p> paragraph",
2429
+ id: "Paragraph"
2430
+ });
2344
2431
  var Heading = BaseField.extend({
2345
2432
  type: import_v43.default.literal(FieldType.HEADING),
2346
2433
  configuration: HeadingConfiguration
2347
- }).describe("A read-only heading component for form pages");
2434
+ }).meta({
2435
+ description: "A read-only heading component for form pages",
2436
+ id: "Heading"
2437
+ });
2348
2438
  var PageHeader = BaseField.extend({
2349
2439
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
2350
- }).describe("A read-only header component for form pages");
2440
+ }).meta({
2441
+ description: "A read-only header component for form pages",
2442
+ id: "PageHeader"
2443
+ });
2351
2444
  var File = BaseField.extend({
2352
2445
  type: import_v43.default.literal(FieldType.FILE),
2353
2446
  defaultValue: FileFieldValue.optional(),
@@ -2366,7 +2459,10 @@ var File = BaseField.extend({
2366
2459
  }).default({
2367
2460
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2368
2461
  })
2369
- }).describe("File upload");
2462
+ }).meta({
2463
+ description: "A file upload field",
2464
+ id: "File"
2465
+ });
2370
2466
  var SelectOption = import_v43.default.object({
2371
2467
  value: import_v43.default.string().describe("The value of the option"),
2372
2468
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -2383,7 +2479,10 @@ var NumberWithUnitField = BaseField.extend({
2383
2479
  "Placeholder for the number field"
2384
2480
  )
2385
2481
  }).optional()
2386
- }).describe("Number with unit input");
2482
+ }).meta({
2483
+ description: "A number with unit input field",
2484
+ id: "NumberWithUnitField"
2485
+ });
2387
2486
  var RadioGroup = BaseField.extend({
2388
2487
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
2389
2488
  defaultValue: TextValue.optional(),
@@ -2393,7 +2492,10 @@ var RadioGroup = BaseField.extend({
2393
2492
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
2394
2493
  }).optional()
2395
2494
  }).optional()
2396
- }).describe("Grouped radio options");
2495
+ }).meta({
2496
+ description: "A grouped radio button field",
2497
+ id: "RadioGroup"
2498
+ });
2397
2499
  var BulletList = BaseField.extend({
2398
2500
  type: import_v43.default.literal(FieldType.BULLET_LIST),
2399
2501
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -2402,7 +2504,10 @@ var BulletList = BaseField.extend({
2402
2504
  fontVariant: HtmlFontVariant.optional()
2403
2505
  }).optional()
2404
2506
  }).default({})
2405
- }).describe("A list of bullet points");
2507
+ }).meta({
2508
+ description: "A list of bullet points",
2509
+ id: "BulletList"
2510
+ });
2406
2511
  var Select = BaseField.extend({
2407
2512
  type: import_v43.default.literal(FieldType.SELECT),
2408
2513
  defaultValue: TextValue.optional(),
@@ -2417,7 +2522,10 @@ var Select = BaseField.extend({
2417
2522
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
2418
2523
  `
2419
2524
  )
2420
- }).describe("Select input");
2525
+ }).meta({
2526
+ description: "A select input field",
2527
+ id: "Select"
2528
+ });
2421
2529
  var SelectDateRangeOption = import_v43.default.object({
2422
2530
  value: SelectDateRangeValue.describe("The value of the option"),
2423
2531
  label: TranslationConfig.describe("The label of the option")
@@ -2426,7 +2534,10 @@ var SelectDateRangeField = BaseField.extend({
2426
2534
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
2427
2535
  defaultValue: SelectDateRangeValue.optional(),
2428
2536
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
2429
- }).describe("Select input with date range options");
2537
+ }).meta({
2538
+ description: "A date range selection field",
2539
+ id: "SelectDateRangeField"
2540
+ });
2430
2541
  var NameConfig = import_v43.default.object({
2431
2542
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2432
2543
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -2457,26 +2568,41 @@ var NameField = BaseField.extend({
2457
2568
  surname: { required: true }
2458
2569
  }
2459
2570
  }).optional()
2460
- }).describe("Name input field");
2571
+ }).meta({
2572
+ description: "A field for entering a persons name",
2573
+ id: "NameField"
2574
+ });
2461
2575
  var PhoneField = BaseField.extend({
2462
2576
  defaultValue: NonEmptyTextValue.optional(),
2463
2577
  type: import_v43.default.literal(FieldType.PHONE)
2464
- }).describe("Phone input field");
2578
+ }).meta({
2579
+ description: "A field for entering a phone number",
2580
+ id: "PhoneField"
2581
+ });
2465
2582
  var IdField = BaseField.extend({
2466
2583
  defaultValue: NonEmptyTextValue.optional(),
2467
2584
  type: import_v43.default.literal(FieldType.ID)
2468
- }).describe("ID input field");
2585
+ }).meta({
2586
+ description: "A field for entering an ID",
2587
+ id: "IdField"
2588
+ });
2469
2589
  var Checkbox = BaseField.extend({
2470
2590
  type: import_v43.default.literal(FieldType.CHECKBOX),
2471
2591
  defaultValue: CheckboxFieldValue.default(false)
2472
- }).describe("Boolean checkbox field");
2592
+ }).meta({
2593
+ description: "A boolean checkbox field",
2594
+ id: "Checkbox"
2595
+ });
2473
2596
  var Country = BaseField.extend({
2474
2597
  type: import_v43.default.literal(FieldType.COUNTRY),
2475
2598
  defaultValue: NonEmptyTextValue.optional(),
2476
2599
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
2477
2600
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
2478
2601
  )
2479
- }).describe("Country select field");
2602
+ }).meta({
2603
+ description: "A field for selecting a country",
2604
+ id: "Country"
2605
+ });
2480
2606
  var AllowedLocations = JurisdictionReference.optional().describe(
2481
2607
  "Limits which location options are selectable depending on user jurisdiction and location."
2482
2608
  );
@@ -2485,16 +2611,18 @@ var AdministrativeAreas = import_v43.default.enum([
2485
2611
  "HEALTH_FACILITY",
2486
2612
  "CRVS_OFFICE"
2487
2613
  ]);
2488
- var AdministrativeAreaConfiguration = import_v43.default.object({
2489
- partOf: FieldReference.optional().describe("Parent location"),
2490
- type: AdministrativeAreas,
2491
- allowedLocations: AllowedLocations
2492
- }).describe("Administrative area options");
2493
2614
  var AdministrativeAreaField = BaseField.extend({
2494
2615
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2495
2616
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2496
- configuration: AdministrativeAreaConfiguration
2497
- }).describe("Administrative area input field e.g. facility, office");
2617
+ configuration: import_v43.default.object({
2618
+ partOf: FieldReference.optional().describe("Parent location"),
2619
+ type: AdministrativeAreas,
2620
+ allowedLocations: AllowedLocations
2621
+ }).describe("Administrative area options")
2622
+ }).meta({
2623
+ description: "Administrative area input field",
2624
+ id: "AdministrativeAreaField"
2625
+ });
2498
2626
  var LocationInput = BaseField.extend({
2499
2627
  type: import_v43.default.literal(FieldType.LOCATION),
2500
2628
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
@@ -2502,7 +2630,10 @@ var LocationInput = BaseField.extend({
2502
2630
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2503
2631
  allowedLocations: AllowedLocations
2504
2632
  }).optional()
2505
- }).describe("Input field for a location");
2633
+ }).meta({
2634
+ description: "A field for selecting a location",
2635
+ id: "LocationInput"
2636
+ });
2506
2637
  var FileUploadWithOptions = BaseField.extend({
2507
2638
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2508
2639
  options: import_v43.default.array(SelectOption).describe("A list of options"),
@@ -2516,6 +2647,9 @@ var FileUploadWithOptions = BaseField.extend({
2516
2647
  }).default({
2517
2648
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2518
2649
  })
2650
+ }).meta({
2651
+ description: "A field for uploading files with file type options",
2652
+ id: "FileUploadWithOptions"
2519
2653
  });
2520
2654
  var Facility = BaseField.extend({
2521
2655
  type: import_v43.default.literal(FieldType.FACILITY),
@@ -2561,7 +2695,10 @@ var Address = BaseField.extend({
2561
2695
  allowedLocations: AllowedLocations
2562
2696
  }).optional(),
2563
2697
  defaultValue: DefaultAddressFieldValue.optional()
2564
- }).describe("Address input field \u2013 a combination of location and text fields");
2698
+ }).meta({
2699
+ description: "Address input field \u2013 a combination of location and text fields",
2700
+ id: "Address"
2701
+ });
2565
2702
  var StaticDataEntry = import_v43.default.object({
2566
2703
  id: import_v43.default.string().describe("ID for the data entry."),
2567
2704
  label: TranslationConfig,
@@ -2576,7 +2713,10 @@ var DataField = BaseField.extend({
2576
2713
  subtitle: TranslationConfig.optional(),
2577
2714
  data: import_v43.default.array(DataEntry)
2578
2715
  })
2579
- }).describe("Data field for displaying read-only data");
2716
+ }).meta({
2717
+ description: "A field for displaying a table of read-only data",
2718
+ id: "DataField"
2719
+ });
2580
2720
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2581
2721
  var ButtonType = import_v43.default.enum([
2582
2722
  "primary",
@@ -2603,11 +2743,17 @@ var ButtonField = BaseField.extend({
2603
2743
  type: import_v43.default.literal(FieldType.BUTTON),
2604
2744
  defaultValue: ButtonFieldValue.optional(),
2605
2745
  configuration: ButtonConfiguration
2606
- }).describe("Generic button without any built-in functionality");
2746
+ }).meta({
2747
+ description: "A generic button that can be used to trigger an action",
2748
+ id: "ButtonField"
2749
+ });
2607
2750
  var FieldGroup = BaseField.extend({
2608
2751
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2609
2752
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2610
2753
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2754
+ }).meta({
2755
+ description: "A group of fields that are displayed together",
2756
+ id: "FieldGroup"
2611
2757
  });
2612
2758
  var AlphaPrintButton = BaseField.extend({
2613
2759
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2617,7 +2763,10 @@ var AlphaPrintButton = BaseField.extend({
2617
2763
  "Label for the print button"
2618
2764
  )
2619
2765
  })
2620
- }).describe("Print button field for printing certificates");
2766
+ }).meta({
2767
+ description: "An experimental print button field for printing certificates during the declaration process",
2768
+ id: "AlphaPrintButton"
2769
+ });
2621
2770
  var HttpField = BaseField.extend({
2622
2771
  type: import_v43.default.literal(FieldType.HTTP),
2623
2772
  defaultValue: HttpFieldValue.optional(),
@@ -2633,20 +2782,30 @@ var HttpField = BaseField.extend({
2633
2782
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2634
2783
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2635
2784
  })
2636
- }).describe("HTTP request function triggered by a button click or other event");
2785
+ }).meta({
2786
+ description: "Makes a background HTTP request to an external service and stores the response so other fields can use it. Has no visible UI \u2014 pair with LOADER to show request status.",
2787
+ id: "HttpField"
2788
+ });
2637
2789
  var AutocompleteField = BaseField.extend({
2638
2790
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2639
2791
  configuration: import_v43.default.object({
2640
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2792
+ url: import_v43.default.string().describe(
2793
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2794
+ ).optional(),
2641
2795
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2642
2796
  defaultOptions: import_v43.default.array(
2643
2797
  import_v43.default.object({
2644
2798
  label: import_v43.default.string(),
2645
2799
  value: import_v43.default.string()
2646
2800
  })
2647
- ).optional()
2801
+ ).optional().describe(
2802
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2803
+ )
2648
2804
  })
2649
- }).describe("Autocomplete input field");
2805
+ }).meta({
2806
+ description: "Generic autocomplete component designed for use with large dictionary-based datasets. The component supports dynamic retrieval of options from configurable data sources and is intended for datasets that may contain tens or hundreds of thousands of records.",
2807
+ id: "AutocompleteField"
2808
+ });
2650
2809
  var SearchField = HttpField.extend({
2651
2810
  type: import_v43.default.literal(FieldType.SEARCH),
2652
2811
  configuration: SearchQuery.pick({
@@ -2679,6 +2838,9 @@ var SearchField = HttpField.extend({
2679
2838
  ok: TranslationConfig.optional()
2680
2839
  }).optional()
2681
2840
  })
2841
+ }).meta({
2842
+ description: "A search input field",
2843
+ id: "SearchField"
2682
2844
  });
2683
2845
  var LinkButtonField = BaseField.extend({
2684
2846
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2687,7 +2849,10 @@ var LinkButtonField = BaseField.extend({
2687
2849
  text: TranslationConfig.describe("Text to display on the button"),
2688
2850
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2689
2851
  })
2690
- }).describe("Button that opens a link");
2852
+ }).meta({
2853
+ description: "A button that opens a URL link",
2854
+ id: "LinkButtonField"
2855
+ });
2691
2856
  var VerificationStatus = BaseField.extend({
2692
2857
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2693
2858
  defaultValue: VerificationStatusValue.optional(),
@@ -2697,15 +2862,19 @@ var VerificationStatus = BaseField.extend({
2697
2862
  "Explaining text on the banner in form."
2698
2863
  )
2699
2864
  })
2865
+ }).meta({
2866
+ description: "Displays a verification state (e.g. ID verified / pending). Often paired with ID_READER \u2014 it can read its value off an ID_READER rather than holding its own.",
2867
+ id: "VerificationStatus"
2700
2868
  });
2701
2869
  var QueryParamReaderField = BaseField.extend({
2702
2870
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2703
2871
  configuration: import_v43.default.object({
2704
2872
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2705
2873
  })
2706
- }).describe(
2707
- "A field that maps URL query params into form values and clears them afterward"
2708
- );
2874
+ }).meta({
2875
+ description: "A field that maps URL query params into form values and clears them afterward",
2876
+ id: "QueryParamReaderField"
2877
+ });
2709
2878
  var QrReaderField = BaseField.extend({
2710
2879
  type: import_v43.default.literal(FieldType.QR_READER),
2711
2880
  defaultValue: QrReaderFieldValue.optional(),
@@ -2716,7 +2885,7 @@ var QrReaderField = BaseField.extend({
2716
2885
  })
2717
2886
  }).optional()
2718
2887
  }).meta({
2719
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2888
+ description: "QR code reader field, including optional JSON Schema validator.",
2720
2889
  id: "QrReaderField"
2721
2890
  });
2722
2891
  var IdReaderField = BaseField.extend({
@@ -2725,12 +2894,18 @@ var IdReaderField = BaseField.extend({
2725
2894
  methods: import_v43.default.array(
2726
2895
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2727
2896
  )
2897
+ }).meta({
2898
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2899
+ id: "IdReaderField"
2728
2900
  });
2729
2901
  var CustomField = BaseField.extend({
2730
2902
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2731
2903
  defaultValue: CustomFieldValue.optional(),
2732
2904
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2733
2905
  configuration: import_v43.default.unknown().optional()
2906
+ }).meta({
2907
+ description: "An expiremental custom field that is defined by a module source path",
2908
+ id: "CustomField"
2734
2909
  });
2735
2910
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2736
2911
  var LoaderField = BaseField.extend({
@@ -2740,22 +2915,25 @@ var LoaderField = BaseField.extend({
2740
2915
  configuration: import_v43.default.object({
2741
2916
  text: TranslationConfig.describe("Display text above the loading spinner")
2742
2917
  })
2743
- }).describe(
2744
- "A non-interactive field that indicates an in progress operation in form"
2745
- );
2918
+ }).meta({
2919
+ description: "A non-interactive field that indicates an in progress operation in form",
2920
+ id: "LoaderField"
2921
+ });
2746
2922
  var HiddenField = BaseField.extend({
2747
2923
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2748
2924
  required: import_v43.default.boolean().default(false).optional(),
2749
2925
  defaultValue: TextValue.optional()
2750
- }).describe(
2751
- "A non-interactive, hidden field that only hold a value in the form"
2752
- );
2926
+ }).meta({
2927
+ description: "A non-interactive, hidden field that only hold a value in the form",
2928
+ id: "HiddenField"
2929
+ });
2753
2930
  var UserRoleField = BaseField.extend({
2754
2931
  type: import_v43.default.literal(FieldType.USER_ROLE),
2755
2932
  defaultValue: TextValue.optional()
2756
- }).describe(
2757
- "A select dropdown that is automatically populated with available user roles"
2758
- );
2933
+ }).meta({
2934
+ description: "A select dropdown that is automatically populated with available user roles",
2935
+ id: "UserRoleField"
2936
+ });
2759
2937
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2760
2938
  FieldGroup,
2761
2939
  Address,
@@ -2854,16 +3032,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2854
3032
  type: z21.literal(PageTypes.enum.VERIFICATION),
2855
3033
  actions: VerificationActionConfig
2856
3034
  });
2857
- var PageConfig = z21.discriminatedUnion("type", [
2858
- FormPageConfig,
2859
- VerificationPageConfig
2860
- ]);
3035
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
3036
+ id: "PageConfig",
3037
+ description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
3038
+ });
2861
3039
 
2862
3040
  // ../commons/src/events/FormConfig.ts
2863
3041
  var DeclarationFormConfig = z22.object({
2864
3042
  label: TranslationConfig.describe("Human readable description of the form"),
2865
3043
  pages: z22.array(FormPageConfig)
2866
- }).describe("Configuration of the declaration form.");
3044
+ }).meta({
3045
+ id: "DeclarationFormConfig",
3046
+ description: "Configuration of the declaration form."
3047
+ });
2867
3048
  var ActionFormConfig = z22.object({
2868
3049
  label: TranslationConfig.describe("Human readable description of the form"),
2869
3050
  pages: z22.array(PageConfig)
@@ -2963,6 +3144,9 @@ var DeduplicationConfig = z23.object({
2963
3144
  id: z23.string(),
2964
3145
  label: TranslationConfig,
2965
3146
  query: Clause
3147
+ }).meta({
3148
+ id: "DeduplicationConfig",
3149
+ description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
2966
3150
  });
2967
3151
 
2968
3152
  // ../commons/src/events/ActionConfig.ts
@@ -3080,17 +3264,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
3080
3264
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
3081
3265
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
3082
3266
  */
3083
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
3084
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
3085
- RejectConfig.meta({ id: "RejectActionConfig" }),
3086
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
3267
+ ReadActionConfig.meta({
3268
+ id: "ReadActionConfig",
3269
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3270
+ }),
3271
+ DeclareConfig.meta({
3272
+ id: "DeclareActionConfig",
3273
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3274
+ }),
3275
+ RejectConfig.meta({
3276
+ id: "RejectActionConfig",
3277
+ description: "Configuration for rejecting a record before registration."
3278
+ }),
3279
+ RegisterConfig.meta({
3280
+ id: "RegisterActionConfig",
3281
+ description: "Configuration for registering a record."
3282
+ }),
3087
3283
  PrintCertificateActionConfig.meta({
3088
- id: "PrintCertificateActionConfig"
3284
+ id: "PrintCertificateActionConfig",
3285
+ description: "Configuration for printing a certificate of a registered record."
3286
+ }),
3287
+ RequestCorrectionConfig.meta({
3288
+ id: "RequestCorrectionActionConfig",
3289
+ description: "Configuration for requesting a correction on a registered record."
3290
+ }),
3291
+ EditActionConfig.meta({
3292
+ id: "EditActionConfig",
3293
+ description: "Configuration for editing a record before registration."
3089
3294
  }),
3090
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
3091
- EditActionConfig.meta({ id: "EditActionConfig" }),
3092
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
3093
- CustomActionConfig.meta({ id: "CustomActionConfig" })
3295
+ ArchiveConfig.meta({
3296
+ id: "ArchiveActionConfig",
3297
+ description: "Configuration for archiving a record."
3298
+ }),
3299
+ CustomActionConfig.meta({
3300
+ id: "CustomActionConfig",
3301
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
3302
+ })
3094
3303
  ]).describe(
3095
3304
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
3096
3305
  ).meta({ id: "ActionConfig" });
@@ -3166,7 +3375,10 @@ var Field = BaseField2.extend({
3166
3375
  }).describe("Custom field defined for the summary view.");
3167
3376
  var SummaryConfig = z27.object({
3168
3377
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3169
- }).describe("Configuration of the event summary section.");
3378
+ }).meta({
3379
+ id: "SummaryConfig",
3380
+ description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
3381
+ });
3170
3382
 
3171
3383
  // ../commons/src/events/AdvancedSearchConfig.ts
3172
3384
  var z28 = __toESM(require("zod/v4"));
@@ -3290,6 +3502,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
3290
3502
  var AdvancedSearchConfig = z28.object({
3291
3503
  title: TranslationConfig.describe("Advanced search tab title"),
3292
3504
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3505
+ }).meta({
3506
+ id: "AdvancedSearchConfig",
3507
+ description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
3293
3508
  });
3294
3509
 
3295
3510
  // ../commons/src/events/utils.ts
@@ -3766,6 +3981,9 @@ function precompileActionSchemas(eventConfigurations) {
3766
3981
  function isAgeValue(value) {
3767
3982
  return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
3768
3983
  }
3984
+ function mergeWithBaseFormState(values, context) {
3985
+ return { ...context.baseFormState, ...values };
3986
+ }
3769
3987
  function validate(schema, data) {
3770
3988
  const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
3771
3989
  if ("$form" in data) {
@@ -3804,7 +4022,7 @@ function isOnline() {
3804
4022
  }
3805
4023
  function isConditionMet(conditional, values, context, eventIndex) {
3806
4024
  return validate(conditional, {
3807
- $form: values,
4025
+ $form: mergeWithBaseFormState(values, context),
3808
4026
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3809
4027
  $online: isOnline(),
3810
4028
  $user: context.user,
@@ -3833,7 +4051,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
3833
4051
  return true;
3834
4052
  }
3835
4053
  const validConditionals = getConditionalActionsForField(field3, {
3836
- $form: form,
4054
+ $form: mergeWithBaseFormState(form, context),
3837
4055
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3838
4056
  $online: isOnline(),
3839
4057
  $user: context.user,
@@ -4025,7 +4243,7 @@ function runFieldValidations({
4025
4243
  return [];
4026
4244
  }
4027
4245
  const conditionalParameters = {
4028
- $form: form,
4246
+ $form: mergeWithBaseFormState(form, context),
4029
4247
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
4030
4248
  /**
4031
4249
  * In real use cases, there can be hundreds of thousands of locations.
@@ -4269,17 +4487,16 @@ function isPageVisible(page, formValues, context) {
4269
4487
  }
4270
4488
  return isConditionMet(page.conditional, formValues, context);
4271
4489
  }
4272
- function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false, declarationContext) {
4490
+ function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
4273
4491
  const base = (0, import_lodash.cloneDeep)(formValues);
4274
4492
  function fn(prevVisibilityContext) {
4275
- const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
4276
4493
  const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
4277
4494
  const fieldConfig = fields.filter((f) => f.id === fieldId);
4278
4495
  if (!fieldConfig.length) {
4279
4496
  return false;
4280
4497
  }
4281
4498
  const isHidden = fieldConfig.every(
4282
- (f) => !isFieldVisible(f, visibilityForm, validatorContext)
4499
+ (f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
4283
4500
  );
4284
4501
  if (!isHidden) {
4285
4502
  return false;
@@ -4297,7 +4514,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
4297
4514
  const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4298
4515
  const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4299
4516
  const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
4300
- return hiddenFields.some((f) => f.id === fieldId);
4517
+ return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
4301
4518
  });
4302
4519
  return omitHiddenFields(
4303
4520
  visibleFields,
@@ -4344,13 +4561,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
4344
4561
  }
4345
4562
  function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
4346
4563
  const annotationFields = getActionAnnotationFields(actionConfig);
4347
- return omitHiddenFields(
4348
- annotationFields,
4349
- annotation,
4350
- context,
4351
- false,
4352
- declaration
4353
- );
4564
+ return omitHiddenFields(annotationFields, annotation, {
4565
+ ...context,
4566
+ baseFormState: declaration
4567
+ });
4354
4568
  }
4355
4569
  function deepMerge(currentDocument, actionDocument) {
4356
4570
  const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
@@ -4644,6 +4858,9 @@ function not(condition) {
4644
4858
  function never2() {
4645
4859
  return not(alwaysTrue());
4646
4860
  }
4861
+ function always() {
4862
+ return defineConditional(alwaysTrue());
4863
+ }
4647
4864
  function jsonFieldPath(field3) {
4648
4865
  return [field3.$$field, ...field3.$$subfield].join("/");
4649
4866
  }
@@ -5339,7 +5556,7 @@ var _EventConfigBase = z33.object({
5339
5556
  ),
5340
5557
  label: TranslationConfig.describe("Human-readable label for the event type."),
5341
5558
  actions: z33.array(ActionConfig).describe(
5342
- "Configuration of system-defined actions associated with the event."
5559
+ "Configuration of core and custom actions associated with the event."
5343
5560
  ),
5344
5561
  actionOrder: z33.array(z33.string()).optional().describe(
5345
5562
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -5351,7 +5568,7 @@ var _EventConfigBase = z33.object({
5351
5568
  "Configuration of fields available in the advanced search feature."
5352
5569
  ),
5353
5570
  flags: z33.array(FlagConfig).optional().default([]).describe(
5354
- "Configuration of flags associated with the actions of this event type."
5571
+ "Configuration of custom flags associated with the actions of this event type."
5355
5572
  ),
5356
5573
  analytics: z33.boolean().optional().default(true).describe(
5357
5574
  "Indicates whether the records of this event type are included in analytics"
@@ -5364,8 +5581,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
5364
5581
  validateActionFlags(event2, ctx);
5365
5582
  validateActionOrder(event2, ctx);
5366
5583
  }).meta({
5367
- id: "EventConfig"
5368
- }).describe("Configuration defining an event type.");
5584
+ id: "EventConfig",
5585
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
5586
+ });
5369
5587
 
5370
5588
  // ../commons/src/events/EventConfigInput.ts
5371
5589
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -5588,6 +5806,9 @@ var WorkqueueColumnValue = z34.object({
5588
5806
  var WorkqueueColumn = z34.object({
5589
5807
  label: TranslationConfig,
5590
5808
  value: WorkqueueColumnValue
5809
+ }).meta({
5810
+ id: "WorkqueueColumn",
5811
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
5591
5812
  });
5592
5813
  function defineWorkqueuesColumns(workqueueColumns) {
5593
5814
  return workqueueColumns.map(
@@ -5790,18 +6011,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5790
6011
  query: true,
5791
6012
  columns: true
5792
6013
  });
5793
- var WorkqueueConfigInput = z37.object({
5794
- slug: z37.string().describe("Determines the url of the workqueue."),
5795
- name: TranslationConfig.describe(
5796
- "Title of the workflow (both in navigation and on the page)"
5797
- ),
5798
- query: CountryConfigQueryInputType,
5799
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
5800
- "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
5801
- ),
5802
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
5803
- icon: AvailableIcons,
5804
- emptyMessage: TranslationConfig.optional()
6014
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
6015
+ query: CountryConfigQueryInputType
6016
+ }).meta({
6017
+ id: "WorkqueueConfig",
6018
+ description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
5805
6019
  });
5806
6020
  function defineWorkqueue(workqueueInput) {
5807
6021
  const queryInput = workqueueInput.query;
@@ -5862,6 +6076,11 @@ var BaseActionInput = z38.object({
5862
6076
  originalActionId: UUID.optional(),
5863
6077
  // should not be part of base action.
5864
6078
  keepAssignment: z38.boolean().optional(),
6079
+ keepAssignmentIfAccepted: z38.boolean().optional(),
6080
+ keepAssignmentIfRejected: z38.boolean().optional(),
6081
+ waitFor: z38.boolean().default(true).describe(
6082
+ "Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
6083
+ ),
5865
6084
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5866
6085
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
5867
6086
  createdAtLocation: UUID.nullish().describe(
@@ -6041,7 +6260,7 @@ var Draft = z39.object({
6041
6260
  }).describe(
6042
6261
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
6043
6262
  );
6044
- var DraftInput = BaseActionInput.extend({
6263
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
6045
6264
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
6046
6265
  status: z39.enum([
6047
6266
  ActionStatus.Requested,
@@ -6115,7 +6334,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
6115
6334
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
6116
6335
  acceptedAt: acceptAction.createdAt,
6117
6336
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
6118
- createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
6119
6337
  registrationNumber
6120
6338
  };
6121
6339
  }
@@ -6329,17 +6547,6 @@ function getAssignedUserFromActions(actions) {
6329
6547
  return user2;
6330
6548
  }, null);
6331
6549
  }
6332
- function getAssignedUserSignatureFromActions(actions) {
6333
- return actions.reduce((signature, action) => {
6334
- if (action.type === ActionType.ASSIGN) {
6335
- return action.createdBySignature || null;
6336
- }
6337
- if (action.type === ActionType.UNASSIGN) {
6338
- return null;
6339
- }
6340
- return signature;
6341
- }, null);
6342
- }
6343
6550
  function deepDropNulls(obj) {
6344
6551
  if (Array.isArray(obj)) {
6345
6552
  return obj.map(deepDropNulls);
@@ -6435,10 +6642,8 @@ function getCurrentEventState(event2, config) {
6435
6642
  createdBy: creationAction.createdBy,
6436
6643
  createdByUserType: creationAction.createdByUserType,
6437
6644
  createdAtLocation: creationAction.createdAtLocation,
6438
- createdBySignature: creationAction.createdBySignature,
6439
6645
  updatedAt: acceptedActionMetadata.createdAt,
6440
6646
  assignedTo: getAssignedUserFromActions(acceptedActions),
6441
- assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
6442
6647
  updatedBy: requestActionMetadata.createdBy,
6443
6648
  updatedAtLocation: requestActionMetadata.createdAtLocation,
6444
6649
  declaration,
@@ -9697,7 +9902,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
9697
9902
  createdBy: overrides.createdBy ?? generateUuid(rng),
9698
9903
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
9699
9904
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
9700
- createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
9701
9905
  updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
9702
9906
  assignedTo: overrides.assignedTo ?? null,
9703
9907
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -9930,11 +10134,77 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
9930
10134
  }
9931
10135
  return true;
9932
10136
  }
10137
+ function canAccessUserWithScope({
10138
+ userToAccess,
10139
+ scope,
10140
+ user: user2
10141
+ }) {
10142
+ const opts = scope.options;
10143
+ const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
10144
+ if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
10145
+ return false;
10146
+ }
10147
+ const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
10148
+ (id) => user2.administrativeAreaId === id
10149
+ ) || user2.administrativeAreaId === null;
10150
+ if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
10151
+ return false;
10152
+ }
10153
+ if (scopeUsesRoleOptions(scope)) {
10154
+ const { options } = scope;
10155
+ if (options?.role && !options.role.includes(userToAccess.role)) {
10156
+ return false;
10157
+ }
10158
+ }
10159
+ return true;
10160
+ }
10161
+ function canAccessOtherUserWithScopes({
10162
+ scopes,
10163
+ userToAccess,
10164
+ user: user2
10165
+ }) {
10166
+ return scopes.some(
10167
+ (scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
10168
+ );
10169
+ }
9933
10170
  function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
9934
10171
  return scopes.some(
9935
10172
  (scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
9936
10173
  );
9937
10174
  }
10175
+ function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
10176
+ const collectedLocations = [];
10177
+ const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
10178
+ let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
10179
+ while (current) {
10180
+ collectedLocations.push(current);
10181
+ if (!current.parentId) {
10182
+ break;
10183
+ }
10184
+ const parentId = current.parentId;
10185
+ current = administrativeAreas.get(parentId);
10186
+ }
10187
+ return collectedLocations;
10188
+ }
10189
+ function getLocationHierarchy(selectedId, context) {
10190
+ const { administrativeAreas, locations } = context;
10191
+ const loc = locations.get(selectedId);
10192
+ if (loc) {
10193
+ if (loc.administrativeAreaId) {
10194
+ const hierarchy2 = getAdministrativeAreaHierarchy(
10195
+ loc.administrativeAreaId,
10196
+ administrativeAreas
10197
+ );
10198
+ return [...hierarchy2.reverse().map((area) => area.id), loc.id];
10199
+ }
10200
+ return [loc.id];
10201
+ }
10202
+ const hierarchy = getAdministrativeAreaHierarchy(
10203
+ selectedId,
10204
+ administrativeAreas
10205
+ );
10206
+ return hierarchy.reverse().map((area) => area.id);
10207
+ }
9938
10208
 
9939
10209
  // ../commons/src/events/scopes.ts
9940
10210
  var ACTION_SCOPE_MAP = {
@@ -10009,6 +10279,25 @@ function isActionInScope({
10009
10279
  );
10010
10280
  return canAccess;
10011
10281
  }
10282
+ function getAvailableRolesForUserUpdatePayload({
10283
+ allRoles,
10284
+ userLocation,
10285
+ acceptedScopes,
10286
+ userRequesting
10287
+ }) {
10288
+ const availableRoles = allRoles.filter((role) => {
10289
+ const canAccess = canAccessOtherUserWithScopes({
10290
+ userToAccess: {
10291
+ ...userLocation,
10292
+ role
10293
+ },
10294
+ user: userRequesting,
10295
+ scopes: acceptedScopes
10296
+ });
10297
+ return canAccess;
10298
+ });
10299
+ return availableRoles;
10300
+ }
10012
10301
 
10013
10302
  // ../commons/src/events/serializers/user/deserializer.ts
10014
10303
  function userDeserializer(serializedUserField, user2) {
@@ -10211,3 +10500,366 @@ function getFilePathsFromEvent(event2) {
10211
10500
  });
10212
10501
  return (0, import_lodash7.uniq)(filepaths);
10213
10502
  }
10503
+
10504
+ // ../commons/src/events/mocks.test.utils.ts
10505
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
10506
+ {
10507
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10508
+ name: "Central",
10509
+ parentId: null,
10510
+ validUntil: null,
10511
+ externalId: "ydyJb1RAy4U1"
10512
+ },
10513
+ {
10514
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10515
+ name: "Sulaka",
10516
+ parentId: null,
10517
+ validUntil: null,
10518
+ externalId: "pQ8nGxWmZ2Q3"
10519
+ },
10520
+ {
10521
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10522
+ name: "Pualula",
10523
+ parentId: null,
10524
+ validUntil: null,
10525
+ externalId: "Aq91DweLmT8k"
10526
+ },
10527
+ {
10528
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10529
+ name: "Chuminga",
10530
+ parentId: null,
10531
+ validUntil: null,
10532
+ externalId: "Rw0fYNh2Xk9a"
10533
+ },
10534
+ {
10535
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10536
+ name: "Ibombo",
10537
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10538
+ validUntil: null,
10539
+ externalId: "k7DsP4vbN1Qe"
10540
+ },
10541
+ {
10542
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
10543
+ name: "Isango",
10544
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10545
+ validUntil: null,
10546
+ externalId: "Gm3Z9eQpHw4L"
10547
+ },
10548
+ {
10549
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
10550
+ name: "Isamba",
10551
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10552
+ validUntil: null,
10553
+ externalId: "sT0xVu1KqJ7r"
10554
+ },
10555
+ {
10556
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
10557
+ name: "Itambo",
10558
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10559
+ validUntil: null,
10560
+ externalId: "Nq6Bv2HpL9Te"
10561
+ },
10562
+ {
10563
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
10564
+ name: "Ezhi",
10565
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10566
+ validUntil: null,
10567
+ externalId: "xK8cQ0ZRy5Wd"
10568
+ },
10569
+ {
10570
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10571
+ name: "Ilanga",
10572
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10573
+ validUntil: null,
10574
+ externalId: "Cq4Jm1XvN8Ls"
10575
+ },
10576
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
10577
+ {
10578
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
10579
+ name: "Klow",
10580
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10581
+ validUntil: null,
10582
+ externalId: "IkYcYBUcyY2"
10583
+ },
10584
+ {
10585
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
10586
+ name: "Mbondo",
10587
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10588
+ validUntil: null,
10589
+ externalId: "Qhvv5hvo3mY"
10590
+ },
10591
+ {
10592
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
10593
+ name: "Ndara",
10594
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10595
+ validUntil: null,
10596
+ externalId: "crXh068O9TR"
10597
+ },
10598
+ {
10599
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
10600
+ name: "Olani",
10601
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10602
+ validUntil: null,
10603
+ externalId: "r00It8Tvvp7"
10604
+ },
10605
+ {
10606
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
10607
+ name: "Pemba",
10608
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10609
+ validUntil: null,
10610
+ externalId: "ZnUWsbONIaH"
10611
+ },
10612
+ {
10613
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
10614
+ name: "Quanza",
10615
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10616
+ validUntil: null,
10617
+ externalId: "fDZycvQTa7l"
10618
+ },
10619
+ {
10620
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
10621
+ name: "Rivka",
10622
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10623
+ validUntil: null,
10624
+ externalId: "KqswxCGTELa"
10625
+ },
10626
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
10627
+ {
10628
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
10629
+ name: "Mbula",
10630
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10631
+ validUntil: null,
10632
+ externalId: "osEbKjRc9Kg"
10633
+ },
10634
+ {
10635
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
10636
+ name: "Ndoki",
10637
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10638
+ validUntil: null,
10639
+ externalId: "aq4daBUAGr3"
10640
+ },
10641
+ {
10642
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
10643
+ name: "Tsanga",
10644
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10645
+ validUntil: null,
10646
+ externalId: "cqis6Y8trbJ"
10647
+ },
10648
+ {
10649
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
10650
+ name: "Waziri",
10651
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10652
+ validUntil: null,
10653
+ externalId: "LMijHPyyx6d"
10654
+ },
10655
+ {
10656
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
10657
+ name: "Zimbi",
10658
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10659
+ validUntil: null,
10660
+ externalId: "pcQYbPuKGZ7"
10661
+ },
10662
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
10663
+ {
10664
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
10665
+ name: "Felani",
10666
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10667
+ validUntil: null,
10668
+ externalId: "gSqpoCGdMXp"
10669
+ },
10670
+ {
10671
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
10672
+ name: "Goroma",
10673
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10674
+ validUntil: null,
10675
+ externalId: "KvAAIaNqVrp"
10676
+ },
10677
+ {
10678
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
10679
+ name: "Halifu",
10680
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10681
+ validUntil: null,
10682
+ externalId: "qe4UnEVt1hv"
10683
+ },
10684
+ {
10685
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
10686
+ name: "Jabari",
10687
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10688
+ validUntil: null,
10689
+ externalId: "yHH9Nz4rLOt"
10690
+ },
10691
+ {
10692
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
10693
+ name: "Kifani",
10694
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10695
+ validUntil: null,
10696
+ externalId: "eSWmXIGeu1I"
10697
+ },
10698
+ {
10699
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
10700
+ name: "Lumela",
10701
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10702
+ validUntil: null,
10703
+ externalId: "bh0b3aI1uP3"
10704
+ }
10705
+ ];
10706
+ var V2_DEFAULT_MOCK_LOCATIONS = [
10707
+ {
10708
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
10709
+ name: "Central Provincial Office",
10710
+ locationType: "CRVS_OFFICE",
10711
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10712
+ validUntil: null,
10713
+ externalId: "Xr3Df8WpK6Ys"
10714
+ },
10715
+ {
10716
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
10717
+ name: "Central Health Post",
10718
+ locationType: "HEALTH_FACILITY",
10719
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10720
+ validUntil: null
10721
+ },
10722
+ {
10723
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
10724
+ name: "Ibombo District Office",
10725
+ locationType: "CRVS_OFFICE",
10726
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10727
+ validUntil: null,
10728
+ externalId: "Sm4Nw7GrD2Vy"
10729
+ },
10730
+ {
10731
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
10732
+ name: "Isamba District Office",
10733
+ locationType: "CRVS_OFFICE",
10734
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10735
+ validUntil: null,
10736
+ externalId: "Vg1Bq5XeH9Lt"
10737
+ },
10738
+ {
10739
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
10740
+ name: "Isango District Office",
10741
+ locationType: "CRVS_OFFICE",
10742
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
10743
+ validUntil: null,
10744
+ externalId: "Je7Lm2XqN9Vz"
10745
+ },
10746
+ {
10747
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
10748
+ name: "Sulaka Provincial Office",
10749
+ locationType: "CRVS_OFFICE",
10750
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10751
+ validUntil: null,
10752
+ externalId: "Ht2Wp9KcX5Qv"
10753
+ },
10754
+ {
10755
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
10756
+ name: "Ilanga District Office",
10757
+ locationType: "CRVS_OFFICE",
10758
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10759
+ validUntil: null,
10760
+ externalId: "Yp6Ds1WqN3Xz"
10761
+ },
10762
+ {
10763
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
10764
+ name: "Chamakubi Health Post",
10765
+ locationType: "HEALTH_FACILITY",
10766
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10767
+ validUntil: null,
10768
+ externalId: "M1nFr8LbC2Qy"
10769
+ },
10770
+ {
10771
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
10772
+ name: "Ibombo Rural Health Centre",
10773
+ locationType: "HEALTH_FACILITY",
10774
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10775
+ validUntil: null,
10776
+ externalId: "bT7pV6YrW0Xc"
10777
+ },
10778
+ {
10779
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
10780
+ name: "Chikobo Rural Health Centre",
10781
+ locationType: "HEALTH_FACILITY",
10782
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10783
+ validUntil: null,
10784
+ externalId: "zE4qPn2SgJ5d"
10785
+ },
10786
+ {
10787
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
10788
+ name: "Chilochabalenje Health Post",
10789
+ locationType: "HEALTH_FACILITY",
10790
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10791
+ validUntil: null,
10792
+ externalId: "H8vDs1MqR4Uf"
10793
+ },
10794
+ {
10795
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
10796
+ name: "Chipeso Rural Health Centre",
10797
+ locationType: "HEALTH_FACILITY",
10798
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10799
+ validUntil: null,
10800
+ externalId: "Qw3uZ9KfX6Lm"
10801
+ },
10802
+ {
10803
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
10804
+ name: "Chisamba Rural Health Centre",
10805
+ locationType: "HEALTH_FACILITY",
10806
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10807
+ validUntil: null,
10808
+ externalId: "Yr0pCg8LdM2s"
10809
+ },
10810
+ {
10811
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
10812
+ name: "Chitanda Rural Health Centre",
10813
+ locationType: "HEALTH_FACILITY",
10814
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10815
+ validUntil: null,
10816
+ externalId: "tS9gJ4PwB1Qx"
10817
+ },
10818
+ {
10819
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
10820
+ name: "Golden Valley Rural Health Centre",
10821
+ locationType: "HEALTH_FACILITY",
10822
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10823
+ validUntil: null,
10824
+ externalId: "Ld7Qm3XsA8Vr"
10825
+ },
10826
+ {
10827
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
10828
+ name: "Ipongo Rural Health Centre",
10829
+ locationType: "HEALTH_FACILITY",
10830
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10831
+ validUntil: null,
10832
+ externalId: "kF2sW9DmH0Bt"
10833
+ },
10834
+ {
10835
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
10836
+ name: "Itumbwe Health Post",
10837
+ locationType: "HEALTH_FACILITY",
10838
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10839
+ validUntil: null,
10840
+ externalId: "Ue5Xb3VaC7Pq"
10841
+ },
10842
+ {
10843
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
10844
+ name: "Kabangalala Rural Health Centre",
10845
+ locationType: "HEALTH_FACILITY",
10846
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10847
+ validUntil: null,
10848
+ externalId: "Pz8Kc1TqH6Jn"
10849
+ },
10850
+ // Village offices
10851
+ {
10852
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
10853
+ name: "Klow Village Office",
10854
+ locationType: "CRVS_OFFICE",
10855
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
10856
+ validUntil: null,
10857
+ externalId: "PmAyxAJkxiJ"
10858
+ }
10859
+ ];
10860
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
10861
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
10862
+ );
10863
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
10864
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
10865
+ );