@opencrvs/toolkit 2.0.0-rc.3edb4f4 → 2.0.0-rc.3f6203c

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 (105) 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 +305 -129
  4. package/dist/cli.js +1961 -350
  5. package/dist/commons/api/router.d.ts +3470 -328
  6. package/dist/commons/application-config/index.d.ts +17 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionDocument.d.ts +6 -0
  10. package/dist/commons/events/ActionInput.d.ts +114 -0
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  12. package/dist/commons/events/AuditLog.d.ts +2 -0
  13. package/dist/commons/events/Draft.d.ts +4 -2
  14. package/dist/commons/events/EventDocument.d.ts +3 -0
  15. package/dist/commons/events/EventIndex.d.ts +0 -3
  16. package/dist/commons/events/EventMetadata.d.ts +0 -7
  17. package/dist/commons/events/FieldConfig.d.ts +387 -50
  18. package/dist/commons/events/FieldValue.d.ts +6 -0
  19. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  20. package/dist/commons/events/field.d.ts +53 -1
  21. package/dist/commons/events/index.d.ts +2 -0
  22. package/dist/commons/events/locations.d.ts +38 -1
  23. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  24. package/dist/commons/events/scopes.d.ts +24 -1
  25. package/dist/commons/events/state/flags.d.ts +16 -0
  26. package/dist/commons/events/state/index.d.ts +0 -4
  27. package/dist/commons/events/state/utils.d.ts +12 -289
  28. package/dist/commons/events/utils.d.ts +13 -2
  29. package/dist/commons/notification/UserNotifications.d.ts +15 -0
  30. package/dist/conditionals/index.js +92 -9
  31. package/dist/events/index.js +1085 -261
  32. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  33. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  34. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  35. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  36. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  37. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  38. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  39. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  40. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  41. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  42. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  44. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/create-events-index.js +1 -2
  46. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  47. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  48. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  49. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  50. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  51. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  52. package/dist/migrations/v2.0/index.d.ts +10 -4
  53. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  54. package/dist/migrations/v2.0/index.js +1929 -347
  55. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  56. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  57. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  58. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  59. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  60. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  61. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  62. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  63. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  64. package/dist/migrations/v2.0/migrate-scopes.js +55 -32
  65. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  66. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  67. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  68. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  69. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  70. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  71. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  72. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  73. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  74. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  75. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  76. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  77. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  78. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  79. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  80. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  81. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  82. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  83. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  84. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  85. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  86. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  87. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  88. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  89. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  90. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  91. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  92. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  93. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  94. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  95. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  96. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  97. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  98. package/dist/migrations/v2.0/update-package-json.js +105 -0
  99. package/dist/notification/index.js +847 -160
  100. package/dist/scopes/index.d.ts +91 -16
  101. package/dist/scopes/index.js +55 -12
  102. package/opencrvs-toolkit-2.0.0-rc.3f6203c.tgz +0 -0
  103. package/package.json +6 -2
  104. package/tsconfig.tsbuildinfo +1 -1
  105. package/opencrvs-toolkit-2.0.0-rc.3edb4f4.tgz +0 -0
@@ -110,6 +110,10 @@ var scopeByEvent = z2.preprocess(
110
110
  (val) => val === void 0 ? void 0 : [val].flat(),
111
111
  z2.array(z2.string()).optional()
112
112
  ).describe("Event type, e.g. birth, death");
113
+ var userRole = z2.preprocess(
114
+ (val) => val === void 0 ? void 0 : [val].flat(),
115
+ z2.array(z2.string()).optional()
116
+ ).describe("User role, e.g. admin, field agent");
113
117
  var scopeOptionsPlaceEvent = z2.object({
114
118
  event: scopeByEvent,
115
119
  placeOfEvent: JurisdictionFilter.optional()
@@ -133,6 +137,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
133
137
  var AccessLevelOptions = z2.object({
134
138
  accessLevel: JurisdictionFilter.optional()
135
139
  });
140
+ var AllUserScopeOptions = AccessLevelOptions.extend({
141
+ role: userRole.optional()
142
+ });
136
143
  var WorkqueueOrDashboardOptions = z2.object({
137
144
  ids: z2.preprocess(
138
145
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -142,6 +149,7 @@ var WorkqueueOrDashboardOptions = z2.object({
142
149
  var AllScopeOptions = z2.object({
143
150
  ...AllRecordScopeOptions.shape,
144
151
  ...AccessLevelOptions.shape,
152
+ ...AllUserScopeOptions.shape,
145
153
  ...WorkqueueOrDashboardOptions.shape
146
154
  });
147
155
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -214,6 +222,30 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
214
222
  ]).describe(
215
223
  "Scopes used to check user's permission to perform actions on a record."
216
224
  );
225
+ var SystemScopeType = z2.enum([
226
+ "organisation.read-locations",
227
+ "user.read",
228
+ "user.create",
229
+ "user.edit",
230
+ "user.search"
231
+ ]);
232
+ var UserScopeType = SystemScopeType.extract([
233
+ "user.read",
234
+ "user.create",
235
+ "user.edit",
236
+ "user.search"
237
+ ]);
238
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
239
+ var UserScopeV2 = z2.discriminatedUnion("type", [
240
+ z2.object({
241
+ type: ScopesWithRoleOption,
242
+ options: AllUserScopeOptions.optional()
243
+ }),
244
+ z2.object({
245
+ type: UserScopeType.extract(["user.read", "user.search"]),
246
+ options: AccessLevelOptions.optional()
247
+ })
248
+ ]);
217
249
  var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
218
250
  z2.object({
219
251
  type: ScopesWithPlaceEventOptions,
@@ -234,16 +266,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
234
266
  }).optional()
235
267
  })
236
268
  ]).describe("Resolved scope with location/user IDs instead of filters.");
237
- var SystemScopeType = z2.enum([
238
- "organisation.read-locations",
239
- "user.read",
240
- "user.create",
241
- "user.edit"
242
- ]);
243
269
  var Scope = z2.discriminatedUnion("type", [
244
270
  z2.object({ type: PlainScopeType }),
245
271
  ...RecordScopeV2.options,
246
- z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
272
+ ...UserScopeV2.options,
273
+ z2.object({
274
+ type: z2.literal("organisation.read-locations"),
275
+ options: AccessLevelOptions.optional()
276
+ }),
247
277
  z2.object({
248
278
  type: z2.literal("workqueue"),
249
279
  options: WorkqueueOrDashboardOptions
@@ -263,7 +293,9 @@ var ScopeType = z2.enum([
263
293
  var EncodedScope = z2.string().brand("EncodedScope");
264
294
  var DEFAULT_SCOPE_OPTIONS = {
265
295
  placeOfEvent: JurisdictionFilter.enum.all,
266
- accessLevel: JurisdictionFilter.enum.all
296
+ accessLevel: JurisdictionFilter.enum.all,
297
+ registeredIn: JurisdictionFilter.enum.all,
298
+ declaredIn: JurisdictionFilter.enum.all
267
299
  };
268
300
 
269
301
  // ../commons/src/authentication.ts
@@ -520,6 +552,7 @@ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
520
552
  "user.password_changed",
521
553
  "user.password_reset",
522
554
  "user.password_reset_by_admin",
555
+ "user.resend_invite",
523
556
  "user.username_reminder",
524
557
  "user.username_reminder_by_admin"
525
558
  ]),
@@ -621,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
621
654
  ShowConditional,
622
655
  // Action can be shown to the user in the list but as disabled
623
656
  EnableConditional
624
- ]);
657
+ ]).meta({
658
+ id: "ActionConditional",
659
+ 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."
660
+ });
625
661
  var DisplayOnReviewConditional = z7.object({
626
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
627
663
  conditional: Conditional
@@ -636,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
636
672
  // Field output can be shown / hidden on the review page
637
673
  DisplayOnReviewConditional
638
674
  ]).meta({
639
- description: "Field conditional configuration",
640
- id: "FieldConditional"
675
+ id: "FieldConditional",
676
+ 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."
641
677
  });
642
678
 
643
679
  // ../commons/src/events/FieldType.ts
@@ -881,6 +917,7 @@ var DateRangeFieldValue = z12.object({
881
917
  var EmailValue = z12.email();
882
918
  var CheckboxFieldValue = z12.boolean();
883
919
  var NumberFieldValue = z12.number();
920
+ var SignatureFieldValue = FileFieldValue;
884
921
  var ButtonFieldValue = z12.number();
885
922
  var VerificationStatusValue = z12.enum([
886
923
  "verified",
@@ -949,28 +986,20 @@ function schemaPriority(schema) {
949
986
  return idx === -1 ? 9999 : idx;
950
987
  }
951
988
  function safeUnion(schemas) {
989
+ const sortedSchemas = [...schemas].sort(
990
+ (a, b) => schemaPriority(a) - schemaPriority(b)
991
+ );
952
992
  return z12.any().superRefine((val, ctx) => {
953
- const successful = schemas.filter((s) => s.safeParse(val).success);
954
- if (successful.length === 1) {
955
- return;
956
- }
957
- if (successful.length === 0) {
958
- ctx.addIssue({
959
- code: "invalid_type",
960
- expected: "custom",
961
- message: "Value does not match any schema"
962
- });
963
- return;
964
- }
965
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
966
- const best = successful[0];
967
- if (!best.safeParse(val).success) {
968
- ctx.addIssue({
969
- expected: "custom",
970
- code: "invalid_type",
971
- message: "Value did not match the best schema"
972
- });
993
+ for (const schema of sortedSchemas) {
994
+ if (schema.safeParse(val).success) {
995
+ return;
996
+ }
973
997
  }
998
+ ctx.addIssue({
999
+ code: "invalid_type",
1000
+ expected: "custom",
1001
+ message: "Value does not match any schema"
1002
+ });
974
1003
  }).meta({
975
1004
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
976
1005
  });
@@ -1187,8 +1216,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1187
1216
  var ApprovedCorrectionAction = ActionBase.extend(
1188
1217
  z14.object({
1189
1218
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1190
- requestId: z14.string()
1219
+ requestId: z14.string(),
1191
1220
  // TODO move into 'content' property
1221
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1192
1222
  }).shape
1193
1223
  );
1194
1224
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1280,6 +1310,9 @@ var FlagConfig = z15.object({
1280
1310
  "Indicates if this flag expects an action to be performed to be cleared."
1281
1311
  ),
1282
1312
  label: TranslationConfig.describe("Human readable label of the flag.")
1313
+ }).meta({
1314
+ id: "FlagConfig",
1315
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1283
1316
  });
1284
1317
  var ActionFlagConfig = z15.object({
1285
1318
  id: Flag,
@@ -1287,6 +1320,9 @@ var ActionFlagConfig = z15.object({
1287
1320
  conditional: Conditional.optional().describe(
1288
1321
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1289
1322
  )
1323
+ }).meta({
1324
+ id: "ActionFlagConfig",
1325
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1290
1326
  });
1291
1327
 
1292
1328
  // ../commons/src/events/EventMetadata.ts
@@ -1308,8 +1344,7 @@ var ActionCreationMetadata = z16.object({
1308
1344
  ),
1309
1345
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1310
1346
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1311
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1312
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1347
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1313
1348
  });
1314
1349
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1315
1350
  registrationNumber: z16.string().describe(
@@ -1337,9 +1372,6 @@ var EventMetadata = z16.object({
1337
1372
  createdAtLocation: UUID.nullish().describe(
1338
1373
  "Location of the user who created the event."
1339
1374
  ),
1340
- createdBySignature: DocumentPath.nullish().describe(
1341
- "Signature of the user who created the event."
1342
- ),
1343
1375
  updatedAtLocation: UUID.nullish().describe(
1344
1376
  "Location of the user who last changed the status."
1345
1377
  ),
@@ -1632,14 +1664,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1632
1664
  }
1633
1665
  }).describe("Unique identifier for the field");
1634
1666
  var FieldReference = import_v43.default.object({
1635
- $$field: FieldId,
1667
+ $$field: FieldId.describe("Id of the field to reference"),
1636
1668
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1637
1669
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1670
+ ),
1671
+ $$code: import_v43.default.string().optional().describe(
1672
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1673
+ )
1674
+ }).describe(
1675
+ "Reference to a field value, with an optional client-side computation applied."
1676
+ );
1677
+ var ComputedDefaultValue = import_v43.default.object({
1678
+ $$code: import_v43.default.string().describe(
1679
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1638
1680
  )
1639
- }).describe("Reference to a field by its ID");
1681
+ }).describe("A context-only computation used as a field default value.");
1640
1682
  var ValidationConfig = import_v43.default.object({
1641
- validator: Conditional,
1642
- message: TranslationConfig
1683
+ validator: Conditional.describe(
1684
+ "Conditional expression that must hold for the field value to be considered valid."
1685
+ ),
1686
+ message: TranslationConfig.describe(
1687
+ "Error message displayed when the validator does not hold."
1688
+ )
1689
+ }).meta({
1690
+ id: "ValidationConfig",
1691
+ 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."
1643
1692
  });
1644
1693
  var requiredSchema = import_v43.default.union([
1645
1694
  import_v43.default.boolean(),
@@ -1670,7 +1719,7 @@ var BaseField = import_v43.default.object({
1670
1719
  "Indicates whether the field can be modified during record correction."
1671
1720
  ),
1672
1721
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1673
- "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1722
+ "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used. A FieldReference with $$code computes the value via a custom client-side function."
1674
1723
  ),
1675
1724
  analytics: import_v43.default.boolean().default(false).optional().describe(
1676
1725
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1678,30 +1727,39 @@ var BaseField = import_v43.default.object({
1678
1727
  }).describe("Common properties shared across all field types.");
1679
1728
  var Divider = BaseField.extend({
1680
1729
  type: import_v43.default.literal(FieldType.DIVIDER)
1730
+ }).meta({
1731
+ description: "A horizontal line divider",
1732
+ id: "Divider"
1681
1733
  });
1682
1734
  var TextField = BaseField.extend({
1683
1735
  type: import_v43.default.literal(FieldType.TEXT),
1684
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1736
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1685
1737
  configuration: import_v43.default.object({
1686
1738
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1687
1739
  type: import_v43.default.enum(["text", "password"]).optional(),
1688
1740
  prefix: TranslationConfig.optional(),
1689
1741
  postfix: TranslationConfig.optional()
1690
1742
  }).default({ type: "text" }).optional()
1691
- }).describe("Text input");
1743
+ }).meta({
1744
+ description: "A text input field",
1745
+ id: "TextField"
1746
+ });
1692
1747
  var NumberField = BaseField.extend({
1693
1748
  type: import_v43.default.literal(FieldType.NUMBER),
1694
- defaultValue: NumberFieldValue.optional(),
1749
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1695
1750
  configuration: import_v43.default.object({
1696
1751
  min: import_v43.default.number().optional().describe("Minimum value"),
1697
1752
  max: import_v43.default.number().optional().describe("Maximum value"),
1698
1753
  prefix: TranslationConfig.optional(),
1699
1754
  postfix: TranslationConfig.optional()
1700
1755
  }).optional()
1701
- }).describe("Number input");
1756
+ }).meta({
1757
+ description: "A number input field",
1758
+ id: "NumberField"
1759
+ });
1702
1760
  var TextAreaField = BaseField.extend({
1703
1761
  type: import_v43.default.literal(FieldType.TEXTAREA),
1704
- defaultValue: NonEmptyTextValue.optional(),
1762
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1705
1763
  configuration: import_v43.default.object({
1706
1764
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1707
1765
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1709,7 +1767,10 @@ var TextAreaField = BaseField.extend({
1709
1767
  prefix: TranslationConfig.optional(),
1710
1768
  postfix: TranslationConfig.optional()
1711
1769
  }).default({ rows: 4 }).optional()
1712
- }).describe("Multiline text input");
1770
+ }).meta({
1771
+ description: "A multiline text input",
1772
+ id: "TextAreaField"
1773
+ });
1713
1774
  var ImageMimeType = import_v43.default.enum([
1714
1775
  "image/png",
1715
1776
  "image/jpg",
@@ -1732,58 +1793,76 @@ var SignatureField = BaseField.extend({
1732
1793
  signaturePromptLabel: TranslationConfig.describe(
1733
1794
  "Title of the signature modal"
1734
1795
  ),
1735
- defaultValue: FieldValue.optional(),
1796
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1736
1797
  configuration: import_v43.default.object({
1737
1798
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1738
1799
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1739
1800
  }).default({
1740
1801
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1741
1802
  })
1742
- }).describe("Signature input field");
1803
+ }).meta({
1804
+ description: "A signature input field",
1805
+ id: "SignatureField"
1806
+ });
1743
1807
  var EmailField = BaseField.extend({
1744
1808
  type: import_v43.default.literal(FieldType.EMAIL),
1745
1809
  configuration: import_v43.default.object({
1746
1810
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1747
1811
  }).default({ maxLength: 255 }).optional(),
1748
- defaultValue: NonEmptyTextValue.optional()
1812
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1813
+ }).meta({
1814
+ description: "An email input field",
1815
+ id: "EmailField"
1749
1816
  });
1750
1817
  var DateField = BaseField.extend({
1751
1818
  type: import_v43.default.literal(FieldType.DATE),
1752
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1819
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1753
1820
  configuration: import_v43.default.object({
1754
1821
  notice: TranslationConfig.describe(
1755
1822
  "Text to display above the date input"
1756
1823
  ).optional()
1757
1824
  }).optional()
1758
- }).describe("A single date input (yyyy-MM-dd)");
1825
+ }).meta({
1826
+ description: "A date input (yyyy-MM-dd)",
1827
+ id: "DateField"
1828
+ });
1759
1829
  var AgeField = BaseField.extend({
1760
1830
  type: import_v43.default.literal(FieldType.AGE),
1761
- defaultValue: NumberFieldValue.optional(),
1831
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1762
1832
  configuration: import_v43.default.object({
1763
1833
  asOfDate: FieldReference,
1764
1834
  prefix: TranslationConfig.optional(),
1765
1835
  postfix: TranslationConfig.optional()
1766
1836
  })
1767
- }).describe("An age input field which uses the current date as the asOfDate");
1837
+ }).meta({
1838
+ description: "An age input field which uses the current date as the asOfDate",
1839
+ id: "AgeField"
1840
+ });
1768
1841
  var TimeField = BaseField.extend({
1769
1842
  type: import_v43.default.literal(FieldType.TIME),
1770
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1843
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1771
1844
  configuration: import_v43.default.object({
1772
1845
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1773
1846
  notice: TranslationConfig.describe(
1774
1847
  "Text to display above the time input"
1775
1848
  ).optional()
1776
1849
  }).optional()
1777
- }).describe("A single date input (HH-mm)");
1850
+ }).meta({
1851
+ description: "A single time input (HH-mm)",
1852
+ id: "TimeField"
1853
+ });
1778
1854
  var DateRangeField = BaseField.extend({
1779
1855
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1780
- defaultValue: DateRangeFieldValue.optional(),
1856
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1781
1857
  configuration: import_v43.default.object({
1782
1858
  notice: TranslationConfig.describe(
1783
1859
  "Text to display above the date input"
1784
1860
  ).optional()
1785
1861
  }).optional()
1786
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1862
+ }).meta({
1863
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1864
+ id: "DateRangeField"
1865
+ });
1787
1866
  var HtmlFontVariant = import_v43.default.enum([
1788
1867
  "reg12",
1789
1868
  "reg14",
@@ -1827,21 +1906,33 @@ var ImageViewField = BaseField.extend({
1827
1906
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1828
1907
  defaultValue: NonEmptyTextValue.optional(),
1829
1908
  configuration: ImageConfiguration
1830
- }).describe("A read-only image component for form pages");
1909
+ }).meta({
1910
+ description: "A read-only image component for form pages",
1911
+ id: "ImageViewField"
1912
+ });
1831
1913
  var Paragraph = BaseField.extend({
1832
1914
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1833
1915
  configuration: ParagraphConfiguration
1834
- }).describe("A read-only HTML <p> paragraph");
1916
+ }).meta({
1917
+ description: "A read-only HTML <p> paragraph",
1918
+ id: "Paragraph"
1919
+ });
1835
1920
  var Heading = BaseField.extend({
1836
1921
  type: import_v43.default.literal(FieldType.HEADING),
1837
1922
  configuration: HeadingConfiguration
1838
- }).describe("A read-only heading component for form pages");
1923
+ }).meta({
1924
+ description: "A read-only heading component for form pages",
1925
+ id: "Heading"
1926
+ });
1839
1927
  var PageHeader = BaseField.extend({
1840
1928
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1841
- }).describe("A read-only header component for form pages");
1929
+ }).meta({
1930
+ description: "A read-only header component for form pages",
1931
+ id: "PageHeader"
1932
+ });
1842
1933
  var File = BaseField.extend({
1843
1934
  type: import_v43.default.literal(FieldType.FILE),
1844
- defaultValue: FileFieldValue.optional(),
1935
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1845
1936
  configuration: import_v43.default.object({
1846
1937
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1847
1938
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1857,7 +1948,10 @@ var File = BaseField.extend({
1857
1948
  }).default({
1858
1949
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1859
1950
  })
1860
- }).describe("File upload");
1951
+ }).meta({
1952
+ description: "A file upload field",
1953
+ id: "File"
1954
+ });
1861
1955
  var SelectOption = import_v43.default.object({
1862
1956
  value: import_v43.default.string().describe("The value of the option"),
1863
1957
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1865,7 +1959,7 @@ var SelectOption = import_v43.default.object({
1865
1959
  });
1866
1960
  var NumberWithUnitField = BaseField.extend({
1867
1961
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1868
- defaultValue: NumberWithUnitFieldValue.optional(),
1962
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1869
1963
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1870
1964
  configuration: import_v43.default.object({
1871
1965
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1874,17 +1968,23 @@ var NumberWithUnitField = BaseField.extend({
1874
1968
  "Placeholder for the number field"
1875
1969
  )
1876
1970
  }).optional()
1877
- }).describe("Number with unit input");
1971
+ }).meta({
1972
+ description: "A number with unit input field",
1973
+ id: "NumberWithUnitField"
1974
+ });
1878
1975
  var RadioGroup = BaseField.extend({
1879
1976
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1880
- defaultValue: TextValue.optional(),
1977
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1881
1978
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1882
1979
  configuration: import_v43.default.object({
1883
1980
  styles: import_v43.default.object({
1884
1981
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1885
1982
  }).optional()
1886
1983
  }).optional()
1887
- }).describe("Grouped radio options");
1984
+ }).meta({
1985
+ description: "A grouped radio button field",
1986
+ id: "RadioGroup"
1987
+ });
1888
1988
  var BulletList = BaseField.extend({
1889
1989
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1890
1990
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1893,10 +1993,13 @@ var BulletList = BaseField.extend({
1893
1993
  fontVariant: HtmlFontVariant.optional()
1894
1994
  }).optional()
1895
1995
  }).default({})
1896
- }).describe("A list of bullet points");
1996
+ }).meta({
1997
+ description: "A list of bullet points",
1998
+ id: "BulletList"
1999
+ });
1897
2000
  var Select = BaseField.extend({
1898
2001
  type: import_v43.default.literal(FieldType.SELECT),
1899
- defaultValue: TextValue.optional(),
2002
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1900
2003
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1901
2004
  noOptionsMessage: TranslationConfig.optional().describe(
1902
2005
  `
@@ -1908,16 +2011,22 @@ var Select = BaseField.extend({
1908
2011
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1909
2012
  `
1910
2013
  )
1911
- }).describe("Select input");
2014
+ }).meta({
2015
+ description: "A select input field",
2016
+ id: "Select"
2017
+ });
1912
2018
  var SelectDateRangeOption = import_v43.default.object({
1913
2019
  value: SelectDateRangeValue.describe("The value of the option"),
1914
2020
  label: TranslationConfig.describe("The label of the option")
1915
2021
  });
1916
2022
  var SelectDateRangeField = BaseField.extend({
1917
2023
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1918
- defaultValue: SelectDateRangeValue.optional(),
2024
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1919
2025
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1920
- }).describe("Select input with date range options");
2026
+ }).meta({
2027
+ description: "A date range selection field",
2028
+ id: "SelectDateRangeField"
2029
+ });
1921
2030
  var NameConfig = import_v43.default.object({
1922
2031
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1923
2032
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1929,7 +2038,7 @@ var NameField = BaseField.extend({
1929
2038
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1930
2039
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1931
2040
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1932
- }).optional(),
2041
+ }).or(ComputedDefaultValue).optional(),
1933
2042
  configuration: import_v43.default.object({
1934
2043
  name: NameConfig.default({
1935
2044
  firstname: { required: true },
@@ -1948,26 +2057,41 @@ var NameField = BaseField.extend({
1948
2057
  surname: { required: true }
1949
2058
  }
1950
2059
  }).optional()
1951
- }).describe("Name input field");
2060
+ }).meta({
2061
+ description: "A field for entering a persons name",
2062
+ id: "NameField"
2063
+ });
1952
2064
  var PhoneField = BaseField.extend({
1953
- defaultValue: NonEmptyTextValue.optional(),
2065
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1954
2066
  type: import_v43.default.literal(FieldType.PHONE)
1955
- }).describe("Phone input field");
2067
+ }).meta({
2068
+ description: "A field for entering a phone number",
2069
+ id: "PhoneField"
2070
+ });
1956
2071
  var IdField = BaseField.extend({
1957
- defaultValue: NonEmptyTextValue.optional(),
2072
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1958
2073
  type: import_v43.default.literal(FieldType.ID)
1959
- }).describe("ID input field");
2074
+ }).meta({
2075
+ description: "A field for entering an ID",
2076
+ id: "IdField"
2077
+ });
1960
2078
  var Checkbox = BaseField.extend({
1961
2079
  type: import_v43.default.literal(FieldType.CHECKBOX),
1962
- defaultValue: CheckboxFieldValue.default(false)
1963
- }).describe("Boolean checkbox field");
2080
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
2081
+ }).meta({
2082
+ description: "A boolean checkbox field",
2083
+ id: "Checkbox"
2084
+ });
1964
2085
  var Country = BaseField.extend({
1965
2086
  type: import_v43.default.literal(FieldType.COUNTRY),
1966
- defaultValue: NonEmptyTextValue.optional(),
2087
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1967
2088
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1968
2089
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1969
2090
  )
1970
- }).describe("Country select field");
2091
+ }).meta({
2092
+ description: "A field for selecting a country",
2093
+ id: "Country"
2094
+ });
1971
2095
  var AllowedLocations = JurisdictionReference.optional().describe(
1972
2096
  "Limits which location options are selectable depending on user jurisdiction and location."
1973
2097
  );
@@ -1976,28 +2100,33 @@ var AdministrativeAreas = import_v43.default.enum([
1976
2100
  "HEALTH_FACILITY",
1977
2101
  "CRVS_OFFICE"
1978
2102
  ]);
1979
- var AdministrativeAreaConfiguration = import_v43.default.object({
1980
- partOf: FieldReference.optional().describe("Parent location"),
1981
- type: AdministrativeAreas,
1982
- allowedLocations: AllowedLocations
1983
- }).describe("Administrative area options");
1984
2103
  var AdministrativeAreaField = BaseField.extend({
1985
2104
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1986
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1987
- configuration: AdministrativeAreaConfiguration
1988
- }).describe("Administrative area input field e.g. facility, office");
2105
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
2106
+ configuration: import_v43.default.object({
2107
+ partOf: FieldReference.optional().describe("Parent location"),
2108
+ type: AdministrativeAreas,
2109
+ allowedLocations: AllowedLocations
2110
+ }).describe("Administrative area options")
2111
+ }).meta({
2112
+ description: "Administrative area input field",
2113
+ id: "AdministrativeAreaField"
2114
+ });
1989
2115
  var LocationInput = BaseField.extend({
1990
2116
  type: import_v43.default.literal(FieldType.LOCATION),
1991
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2117
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1992
2118
  configuration: import_v43.default.object({
1993
2119
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1994
2120
  allowedLocations: AllowedLocations
1995
2121
  }).optional()
1996
- }).describe("Input field for a location");
2122
+ }).meta({
2123
+ description: "A field for selecting a location",
2124
+ id: "LocationInput"
2125
+ });
1997
2126
  var FileUploadWithOptions = BaseField.extend({
1998
2127
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1999
2128
  options: import_v43.default.array(SelectOption).describe("A list of options"),
2000
- defaultValue: FileFieldWithOptionValue.optional(),
2129
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
2001
2130
  configuration: import_v43.default.object({
2002
2131
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
2003
2132
  maxImageSize: import_v43.default.object({
@@ -2007,15 +2136,18 @@ var FileUploadWithOptions = BaseField.extend({
2007
2136
  }).default({
2008
2137
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2009
2138
  })
2139
+ }).meta({
2140
+ description: "A field for uploading files with file type options",
2141
+ id: "FileUploadWithOptions"
2010
2142
  });
2011
2143
  var Facility = BaseField.extend({
2012
2144
  type: import_v43.default.literal(FieldType.FACILITY),
2013
- defaultValue: NonEmptyTextValue.optional(),
2145
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2014
2146
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2015
2147
  }).describe("Input field for a facility");
2016
2148
  var Office = BaseField.extend({
2017
2149
  type: import_v43.default.literal(FieldType.OFFICE),
2018
- defaultValue: NonEmptyTextValue.optional(),
2150
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2019
2151
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
2020
2152
  }).describe("Input field for an office");
2021
2153
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -2051,8 +2183,11 @@ var Address = BaseField.extend({
2051
2183
  ).optional(),
2052
2184
  allowedLocations: AllowedLocations
2053
2185
  }).optional(),
2054
- defaultValue: DefaultAddressFieldValue.optional()
2055
- }).describe("Address input field \u2013 a combination of location and text fields");
2186
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
2187
+ }).meta({
2188
+ description: "Address input field \u2013 a combination of location and text fields",
2189
+ id: "Address"
2190
+ });
2056
2191
  var StaticDataEntry = import_v43.default.object({
2057
2192
  id: import_v43.default.string().describe("ID for the data entry."),
2058
2193
  label: TranslationConfig,
@@ -2067,7 +2202,10 @@ var DataField = BaseField.extend({
2067
2202
  subtitle: TranslationConfig.optional(),
2068
2203
  data: import_v43.default.array(DataEntry)
2069
2204
  })
2070
- }).describe("Data field for displaying read-only data");
2205
+ }).meta({
2206
+ description: "A field for displaying a table of read-only data",
2207
+ id: "DataField"
2208
+ });
2071
2209
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2072
2210
  var ButtonType = import_v43.default.enum([
2073
2211
  "primary",
@@ -2092,13 +2230,19 @@ var ButtonConfiguration = import_v43.default.object({
2092
2230
  });
2093
2231
  var ButtonField = BaseField.extend({
2094
2232
  type: import_v43.default.literal(FieldType.BUTTON),
2095
- defaultValue: ButtonFieldValue.optional(),
2233
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
2096
2234
  configuration: ButtonConfiguration
2097
- }).describe("Generic button without any built-in functionality");
2235
+ }).meta({
2236
+ description: "A generic button that can be used to trigger an action",
2237
+ id: "ButtonField"
2238
+ });
2098
2239
  var FieldGroup = BaseField.extend({
2099
2240
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2100
2241
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2101
2242
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2243
+ }).meta({
2244
+ description: "A group of fields that are displayed together",
2245
+ id: "FieldGroup"
2102
2246
  });
2103
2247
  var AlphaPrintButton = BaseField.extend({
2104
2248
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2108,10 +2252,13 @@ var AlphaPrintButton = BaseField.extend({
2108
2252
  "Label for the print button"
2109
2253
  )
2110
2254
  })
2111
- }).describe("Print button field for printing certificates");
2255
+ }).meta({
2256
+ description: "An experimental print button field for printing certificates during the declaration process",
2257
+ id: "AlphaPrintButton"
2258
+ });
2112
2259
  var HttpField = BaseField.extend({
2113
2260
  type: import_v43.default.literal(FieldType.HTTP),
2114
- defaultValue: HttpFieldValue.optional(),
2261
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
2115
2262
  configuration: import_v43.default.object({
2116
2263
  trigger: FieldReference.optional().describe(
2117
2264
  "Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
@@ -2124,20 +2271,30 @@ var HttpField = BaseField.extend({
2124
2271
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2125
2272
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2126
2273
  })
2127
- }).describe("HTTP request function triggered by a button click or other event");
2274
+ }).meta({
2275
+ 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.",
2276
+ id: "HttpField"
2277
+ });
2128
2278
  var AutocompleteField = BaseField.extend({
2129
2279
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2130
2280
  configuration: import_v43.default.object({
2131
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2281
+ url: import_v43.default.string().describe(
2282
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2283
+ ).optional(),
2132
2284
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2133
2285
  defaultOptions: import_v43.default.array(
2134
2286
  import_v43.default.object({
2135
2287
  label: import_v43.default.string(),
2136
2288
  value: import_v43.default.string()
2137
2289
  })
2138
- ).optional()
2290
+ ).optional().describe(
2291
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2292
+ )
2139
2293
  })
2140
- }).describe("Autocomplete input field");
2294
+ }).meta({
2295
+ 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.",
2296
+ id: "AutocompleteField"
2297
+ });
2141
2298
  var SearchField = HttpField.extend({
2142
2299
  type: import_v43.default.literal(FieldType.SEARCH),
2143
2300
  configuration: SearchQuery.pick({
@@ -2170,6 +2327,9 @@ var SearchField = HttpField.extend({
2170
2327
  ok: TranslationConfig.optional()
2171
2328
  }).optional()
2172
2329
  })
2330
+ }).meta({
2331
+ description: "A search input field",
2332
+ id: "SearchField"
2173
2333
  });
2174
2334
  var LinkButtonField = BaseField.extend({
2175
2335
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2178,28 +2338,35 @@ var LinkButtonField = BaseField.extend({
2178
2338
  text: TranslationConfig.describe("Text to display on the button"),
2179
2339
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2180
2340
  })
2181
- }).describe("Button that opens a link");
2341
+ }).meta({
2342
+ description: "A button that opens a URL link",
2343
+ id: "LinkButtonField"
2344
+ });
2182
2345
  var VerificationStatus = BaseField.extend({
2183
2346
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2184
- defaultValue: VerificationStatusValue.optional(),
2347
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
2185
2348
  configuration: import_v43.default.object({
2186
2349
  status: TranslationConfig.describe("Text to display on the status pill."),
2187
2350
  description: TranslationConfig.describe(
2188
2351
  "Explaining text on the banner in form."
2189
2352
  )
2190
2353
  })
2354
+ }).meta({
2355
+ 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.",
2356
+ id: "VerificationStatus"
2191
2357
  });
2192
2358
  var QueryParamReaderField = BaseField.extend({
2193
2359
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2194
2360
  configuration: import_v43.default.object({
2195
2361
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2196
2362
  })
2197
- }).describe(
2198
- "A field that maps URL query params into form values and clears them afterward"
2199
- );
2363
+ }).meta({
2364
+ description: "A field that maps URL query params into form values and clears them afterward",
2365
+ id: "QueryParamReaderField"
2366
+ });
2200
2367
  var QrReaderField = BaseField.extend({
2201
2368
  type: import_v43.default.literal(FieldType.QR_READER),
2202
- defaultValue: QrReaderFieldValue.optional(),
2369
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
2203
2370
  configuration: import_v43.default.object({
2204
2371
  validator: import_v43.default.any().meta({
2205
2372
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -2207,21 +2374,27 @@ var QrReaderField = BaseField.extend({
2207
2374
  })
2208
2375
  }).optional()
2209
2376
  }).meta({
2210
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2377
+ description: "QR code reader field, including optional JSON Schema validator.",
2211
2378
  id: "QrReaderField"
2212
2379
  });
2213
2380
  var IdReaderField = BaseField.extend({
2214
2381
  type: import_v43.default.literal(FieldType.ID_READER),
2215
- defaultValue: IdReaderFieldValue.optional(),
2382
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
2216
2383
  methods: import_v43.default.array(
2217
2384
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2218
2385
  )
2386
+ }).meta({
2387
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2388
+ id: "IdReaderField"
2219
2389
  });
2220
2390
  var CustomField = BaseField.extend({
2221
2391
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2222
2392
  defaultValue: CustomFieldValue.optional(),
2223
2393
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2224
2394
  configuration: import_v43.default.unknown().optional()
2395
+ }).meta({
2396
+ description: "An expiremental custom field that is defined by a module source path",
2397
+ id: "CustomField"
2225
2398
  });
2226
2399
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2227
2400
  var LoaderField = BaseField.extend({
@@ -2231,22 +2404,25 @@ var LoaderField = BaseField.extend({
2231
2404
  configuration: import_v43.default.object({
2232
2405
  text: TranslationConfig.describe("Display text above the loading spinner")
2233
2406
  })
2234
- }).describe(
2235
- "A non-interactive field that indicates an in progress operation in form"
2236
- );
2407
+ }).meta({
2408
+ description: "A non-interactive field that indicates an in progress operation in form",
2409
+ id: "LoaderField"
2410
+ });
2237
2411
  var HiddenField = BaseField.extend({
2238
2412
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2239
2413
  required: import_v43.default.boolean().default(false).optional(),
2240
2414
  defaultValue: TextValue.optional()
2241
- }).describe(
2242
- "A non-interactive, hidden field that only hold a value in the form"
2243
- );
2415
+ }).meta({
2416
+ description: "A non-interactive, hidden field that only hold a value in the form",
2417
+ id: "HiddenField"
2418
+ });
2244
2419
  var UserRoleField = BaseField.extend({
2245
2420
  type: import_v43.default.literal(FieldType.USER_ROLE),
2246
2421
  defaultValue: TextValue.optional()
2247
- }).describe(
2248
- "A select dropdown that is automatically populated with available user roles"
2249
- );
2422
+ }).meta({
2423
+ description: "A select dropdown that is automatically populated with available user roles",
2424
+ id: "UserRoleField"
2425
+ });
2250
2426
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2251
2427
  FieldGroup,
2252
2428
  Address,
@@ -2345,16 +2521,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2345
2521
  type: z21.literal(PageTypes.enum.VERIFICATION),
2346
2522
  actions: VerificationActionConfig
2347
2523
  });
2348
- var PageConfig = z21.discriminatedUnion("type", [
2349
- FormPageConfig,
2350
- VerificationPageConfig
2351
- ]);
2524
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2525
+ id: "PageConfig",
2526
+ 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."
2527
+ });
2352
2528
 
2353
2529
  // ../commons/src/events/FormConfig.ts
2354
2530
  var DeclarationFormConfig = z22.object({
2355
2531
  label: TranslationConfig.describe("Human readable description of the form"),
2356
2532
  pages: z22.array(FormPageConfig)
2357
- }).describe("Configuration of the declaration form.");
2533
+ }).meta({
2534
+ id: "DeclarationFormConfig",
2535
+ description: "Configuration of the declaration form."
2536
+ });
2358
2537
  var ActionFormConfig = z22.object({
2359
2538
  label: TranslationConfig.describe("Human readable description of the form"),
2360
2539
  pages: z22.array(PageConfig)
@@ -2454,6 +2633,9 @@ var DeduplicationConfig = z23.object({
2454
2633
  id: z23.string(),
2455
2634
  label: TranslationConfig,
2456
2635
  query: Clause
2636
+ }).meta({
2637
+ id: "DeduplicationConfig",
2638
+ 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."
2457
2639
  });
2458
2640
 
2459
2641
  // ../commons/src/events/ActionConfig.ts
@@ -2571,17 +2753,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
2571
2753
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2572
2754
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2573
2755
  */
2574
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2575
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2576
- RejectConfig.meta({ id: "RejectActionConfig" }),
2577
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2756
+ ReadActionConfig.meta({
2757
+ id: "ReadActionConfig",
2758
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
2759
+ }),
2760
+ DeclareConfig.meta({
2761
+ id: "DeclareActionConfig",
2762
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
2763
+ }),
2764
+ RejectConfig.meta({
2765
+ id: "RejectActionConfig",
2766
+ description: "Configuration for rejecting a record before registration."
2767
+ }),
2768
+ RegisterConfig.meta({
2769
+ id: "RegisterActionConfig",
2770
+ description: "Configuration for registering a record."
2771
+ }),
2578
2772
  PrintCertificateActionConfig.meta({
2579
- id: "PrintCertificateActionConfig"
2773
+ id: "PrintCertificateActionConfig",
2774
+ description: "Configuration for printing a certificate of a registered record."
2775
+ }),
2776
+ RequestCorrectionConfig.meta({
2777
+ id: "RequestCorrectionActionConfig",
2778
+ description: "Configuration for requesting a correction on a registered record."
2779
+ }),
2780
+ EditActionConfig.meta({
2781
+ id: "EditActionConfig",
2782
+ description: "Configuration for editing a record before registration."
2783
+ }),
2784
+ ArchiveConfig.meta({
2785
+ id: "ArchiveActionConfig",
2786
+ description: "Configuration for archiving a record."
2580
2787
  }),
2581
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2582
- EditActionConfig.meta({ id: "EditActionConfig" }),
2583
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2584
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2788
+ CustomActionConfig.meta({
2789
+ id: "CustomActionConfig",
2790
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
2791
+ })
2585
2792
  ]).describe(
2586
2793
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2587
2794
  ).meta({ id: "ActionConfig" });
@@ -2657,7 +2864,10 @@ var Field = BaseField2.extend({
2657
2864
  }).describe("Custom field defined for the summary view.");
2658
2865
  var SummaryConfig = z27.object({
2659
2866
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2660
- }).describe("Configuration of the event summary section.");
2867
+ }).meta({
2868
+ id: "SummaryConfig",
2869
+ 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."
2870
+ });
2661
2871
 
2662
2872
  // ../commons/src/events/AdvancedSearchConfig.ts
2663
2873
  var z28 = __toESM(require("zod/v4"));
@@ -2728,6 +2938,9 @@ var BaseField3 = z28.object({
2728
2938
  ),
2729
2939
  validations: z28.array(ValidationConfig).optional().describe(
2730
2940
  `Option for overriding the field validations specifically for advanced search form.`
2941
+ ),
2942
+ allowedLocations: JurisdictionReference.optional().describe(
2943
+ `Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
2731
2944
  )
2732
2945
  });
2733
2946
  var SearchQueryParams = z28.object({
@@ -2781,6 +2994,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
2781
2994
  var AdvancedSearchConfig = z28.object({
2782
2995
  title: TranslationConfig.describe("Advanced search tab title"),
2783
2996
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2997
+ }).meta({
2998
+ id: "AdvancedSearchConfig",
2999
+ 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()`)."
2784
3000
  });
2785
3001
 
2786
3002
  // ../commons/src/events/utils.ts
@@ -2831,7 +3047,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
2831
3047
  }
2832
3048
  return current;
2833
3049
  }
3050
+ function todayISO() {
3051
+ return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
3052
+ }
3053
+ var compiledFunctionCache = /* @__PURE__ */ new Map();
3054
+ function compileClientFunction(code) {
3055
+ let fn = compiledFunctionCache.get(code);
3056
+ if (!fn) {
3057
+ fn = new Function(`return (${code})`)();
3058
+ compiledFunctionCache.set(code, fn);
3059
+ }
3060
+ return fn;
3061
+ }
2834
3062
  (0, import_ajv_formats.default)(ajv);
3063
+ function buildClientFunctionContext(input) {
3064
+ return {
3065
+ $form: input.form,
3066
+ $now: todayISO(),
3067
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3068
+ $online: isOnline(),
3069
+ $user: input.validatorContext?.user,
3070
+ $event: input.validatorContext?.event,
3071
+ $leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
3072
+ user: input.systemVariables?.user,
3073
+ $window: input.systemVariables?.$window,
3074
+ locations: input.locations,
3075
+ adminLevelIds: input.adminLevelIds
3076
+ };
3077
+ }
3078
+ function runClientFunction(code, data, context) {
3079
+ return compileClientFunction(code)(data, context);
3080
+ }
2835
3081
  ajv.addKeyword({
2836
3082
  keyword: "daysFromDate",
2837
3083
  type: "string",
@@ -2876,12 +3122,35 @@ ajv.addKeyword({
2876
3122
  $data: true,
2877
3123
  errors: true,
2878
3124
  // @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
2879
- validate(schema, data, _2, dataContext) {
3125
+ validate(_schema, data, _2, dataContext) {
2880
3126
  const locationIdInput = data;
2881
3127
  const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
2882
3128
  return locations.some((location) => location.id === locationIdInput);
2883
3129
  }
2884
3130
  });
3131
+ ajv.addKeyword({
3132
+ keyword: "customClientValidator",
3133
+ schemaType: "object",
3134
+ errors: true,
3135
+ // @ts-expect-error -- AJV's public types don't expose `rootData`. All
3136
+ // `validate()` callers build root data via `buildClientFunctionContext`,
3137
+ // so the cast holds.
3138
+ validate(schema, data, _2, dataContext) {
3139
+ return Boolean(
3140
+ runClientFunction(
3141
+ schema.code,
3142
+ data,
3143
+ dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
3144
+ )
3145
+ );
3146
+ }
3147
+ });
3148
+ function isOnline() {
3149
+ if (typeof window !== "undefined" && typeof navigator !== "undefined") {
3150
+ return navigator.onLine;
3151
+ }
3152
+ return true;
3153
+ }
2885
3154
 
2886
3155
  // ../commons/src/utils.ts
2887
3156
  var z32 = __toESM(require("zod/v4"));
@@ -3500,7 +3769,54 @@ function createFieldConditionals(fieldId) {
3500
3769
  }
3501
3770
  },
3502
3771
  required: [fieldId]
3503
- })
3772
+ }),
3773
+ /**
3774
+ * Custom client-side validator. The provided function is serialised and executed
3775
+ * just-in-time on the client only. External references (e.g. lodash) are not
3776
+ * available inside the function body — all logic must be self-contained.
3777
+ *
3778
+ * @example
3779
+ * field('nid').customClientValidator((value) => {
3780
+ * // LUHN check — all logic must be inline
3781
+ * const digits = String(value).split('').map(Number)
3782
+ * // ...
3783
+ * return isValid
3784
+ * })
3785
+ */
3786
+ customClientValidator(validationFn) {
3787
+ const code = validationFn.toString();
3788
+ return defineFormConditional({
3789
+ type: "object",
3790
+ properties: wrapToPath(
3791
+ { [fieldId]: { customClientValidator: { code } } },
3792
+ this.$$subfield
3793
+ ),
3794
+ required: [fieldId]
3795
+ });
3796
+ },
3797
+ /**
3798
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
3799
+ * that can be used as the `value` property or a DATA component entry.
3800
+ * The function receives the referenced field's value as the first argument and
3801
+ * the full form context as the second; its return value replaces the field reference.
3802
+ * The function is serialised and executed just-in-time on the client only.
3803
+ * External references (e.g. lodash) are not available inside the function body.
3804
+ *
3805
+ * For computing a default value without referencing a specific field, use
3806
+ * `evaluate(fn)` in the `defaultValue` property instead.
3807
+ *
3808
+ * @example
3809
+ * field('a').customClientEvaluation((aValue, ctx) =>
3810
+ * Number(aValue) + Number(ctx.$form.b)
3811
+ * )
3812
+ */
3813
+ customClientEvaluation(computationFn) {
3814
+ return {
3815
+ $$code: computationFn.toString(),
3816
+ $$field: fieldId,
3817
+ $$subfield: this.$$subfield
3818
+ };
3819
+ }
3504
3820
  };
3505
3821
  }
3506
3822
 
@@ -3648,7 +3964,7 @@ var _EventConfigBase = z33.object({
3648
3964
  ),
3649
3965
  label: TranslationConfig.describe("Human-readable label for the event type."),
3650
3966
  actions: z33.array(ActionConfig).describe(
3651
- "Configuration of system-defined actions associated with the event."
3967
+ "Configuration of core and custom actions associated with the event."
3652
3968
  ),
3653
3969
  actionOrder: z33.array(z33.string()).optional().describe(
3654
3970
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3660,7 +3976,7 @@ var _EventConfigBase = z33.object({
3660
3976
  "Configuration of fields available in the advanced search feature."
3661
3977
  ),
3662
3978
  flags: z33.array(FlagConfig).optional().default([]).describe(
3663
- "Configuration of flags associated with the actions of this event type."
3979
+ "Configuration of custom flags associated with the actions of this event type."
3664
3980
  ),
3665
3981
  analytics: z33.boolean().optional().default(true).describe(
3666
3982
  "Indicates whether the records of this event type are included in analytics"
@@ -3673,8 +3989,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
3673
3989
  validateActionFlags(event2, ctx);
3674
3990
  validateActionOrder(event2, ctx);
3675
3991
  }).meta({
3676
- id: "EventConfig"
3677
- }).describe("Configuration defining an event type.");
3992
+ id: "EventConfig",
3993
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
3994
+ });
3678
3995
 
3679
3996
  // ../commons/src/events/EventConfigInput.ts
3680
3997
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -3896,6 +4213,9 @@ var WorkqueueColumnValue = z34.object({
3896
4213
  var WorkqueueColumn = z34.object({
3897
4214
  label: TranslationConfig,
3898
4215
  value: WorkqueueColumnValue
4216
+ }).meta({
4217
+ id: "WorkqueueColumn",
4218
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
3899
4219
  });
3900
4220
  function defineWorkqueuesColumns(workqueueColumns) {
3901
4221
  return workqueueColumns.map(
@@ -4098,18 +4418,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4098
4418
  query: true,
4099
4419
  columns: true
4100
4420
  });
4101
- var WorkqueueConfigInput = z37.object({
4102
- slug: z37.string().describe("Determines the url of the workqueue."),
4103
- name: TranslationConfig.describe(
4104
- "Title of the workflow (both in navigation and on the page)"
4105
- ),
4106
- query: CountryConfigQueryInputType,
4107
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4108
- "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."
4109
- ),
4110
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4111
- icon: AvailableIcons,
4112
- emptyMessage: TranslationConfig.optional()
4421
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4422
+ query: CountryConfigQueryInputType
4423
+ }).meta({
4424
+ id: "WorkqueueConfig",
4425
+ 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."
4113
4426
  });
4114
4427
  var WorkqueueCountInput = z37.array(
4115
4428
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4149,6 +4462,11 @@ var BaseActionInput = z38.object({
4149
4462
  originalActionId: UUID.optional(),
4150
4463
  // should not be part of base action.
4151
4464
  keepAssignment: z38.boolean().optional(),
4465
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4466
+ keepAssignmentIfRejected: z38.boolean().optional(),
4467
+ waitFor: z38.boolean().default(true).describe(
4468
+ "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."
4469
+ ),
4152
4470
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4153
4471
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4154
4472
  createdAtLocation: UUID.nullish().describe(
@@ -4266,7 +4584,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4266
4584
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4267
4585
  z38.object({
4268
4586
  requestId: z38.string(),
4269
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4587
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4588
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4270
4589
  }).shape
4271
4590
  );
4272
4591
  var ReadActionInput = BaseActionInput.extend(
@@ -4328,7 +4647,7 @@ var Draft = z39.object({
4328
4647
  }).describe(
4329
4648
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4330
4649
  );
4331
- var DraftInput = BaseActionInput.extend({
4650
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
4332
4651
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4333
4652
  status: z39.enum([
4334
4653
  ActionStatus.Requested,
@@ -6926,6 +7245,369 @@ var ACTION_FILTERS = {
6926
7245
  // ../commons/src/events/FileUtils.ts
6927
7246
  var import_lodash7 = require("lodash");
6928
7247
 
7248
+ // ../commons/src/events/mocks.test.utils.ts
7249
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
7250
+ {
7251
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7252
+ name: "Central",
7253
+ parentId: null,
7254
+ validUntil: null,
7255
+ externalId: "ydyJb1RAy4U1"
7256
+ },
7257
+ {
7258
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7259
+ name: "Sulaka",
7260
+ parentId: null,
7261
+ validUntil: null,
7262
+ externalId: "pQ8nGxWmZ2Q3"
7263
+ },
7264
+ {
7265
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
7266
+ name: "Pualula",
7267
+ parentId: null,
7268
+ validUntil: null,
7269
+ externalId: "Aq91DweLmT8k"
7270
+ },
7271
+ {
7272
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
7273
+ name: "Chuminga",
7274
+ parentId: null,
7275
+ validUntil: null,
7276
+ externalId: "Rw0fYNh2Xk9a"
7277
+ },
7278
+ {
7279
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7280
+ name: "Ibombo",
7281
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7282
+ validUntil: null,
7283
+ externalId: "k7DsP4vbN1Qe"
7284
+ },
7285
+ {
7286
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
7287
+ name: "Isango",
7288
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7289
+ validUntil: null,
7290
+ externalId: "Gm3Z9eQpHw4L"
7291
+ },
7292
+ {
7293
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
7294
+ name: "Isamba",
7295
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7296
+ validUntil: null,
7297
+ externalId: "sT0xVu1KqJ7r"
7298
+ },
7299
+ {
7300
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
7301
+ name: "Itambo",
7302
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7303
+ validUntil: null,
7304
+ externalId: "Nq6Bv2HpL9Te"
7305
+ },
7306
+ {
7307
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
7308
+ name: "Ezhi",
7309
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7310
+ validUntil: null,
7311
+ externalId: "xK8cQ0ZRy5Wd"
7312
+ },
7313
+ {
7314
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7315
+ name: "Ilanga",
7316
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7317
+ validUntil: null,
7318
+ externalId: "Cq4Jm1XvN8Ls"
7319
+ },
7320
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
7321
+ {
7322
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7323
+ name: "Klow",
7324
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7325
+ validUntil: null,
7326
+ externalId: "IkYcYBUcyY2"
7327
+ },
7328
+ {
7329
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
7330
+ name: "Mbondo",
7331
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7332
+ validUntil: null,
7333
+ externalId: "Qhvv5hvo3mY"
7334
+ },
7335
+ {
7336
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
7337
+ name: "Ndara",
7338
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7339
+ validUntil: null,
7340
+ externalId: "crXh068O9TR"
7341
+ },
7342
+ {
7343
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
7344
+ name: "Olani",
7345
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7346
+ validUntil: null,
7347
+ externalId: "r00It8Tvvp7"
7348
+ },
7349
+ {
7350
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
7351
+ name: "Pemba",
7352
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7353
+ validUntil: null,
7354
+ externalId: "ZnUWsbONIaH"
7355
+ },
7356
+ {
7357
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
7358
+ name: "Quanza",
7359
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7360
+ validUntil: null,
7361
+ externalId: "fDZycvQTa7l"
7362
+ },
7363
+ {
7364
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
7365
+ name: "Rivka",
7366
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7367
+ validUntil: null,
7368
+ externalId: "KqswxCGTELa"
7369
+ },
7370
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
7371
+ {
7372
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
7373
+ name: "Mbula",
7374
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7375
+ validUntil: null,
7376
+ externalId: "osEbKjRc9Kg"
7377
+ },
7378
+ {
7379
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
7380
+ name: "Ndoki",
7381
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7382
+ validUntil: null,
7383
+ externalId: "aq4daBUAGr3"
7384
+ },
7385
+ {
7386
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
7387
+ name: "Tsanga",
7388
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7389
+ validUntil: null,
7390
+ externalId: "cqis6Y8trbJ"
7391
+ },
7392
+ {
7393
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
7394
+ name: "Waziri",
7395
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7396
+ validUntil: null,
7397
+ externalId: "LMijHPyyx6d"
7398
+ },
7399
+ {
7400
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
7401
+ name: "Zimbi",
7402
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7403
+ validUntil: null,
7404
+ externalId: "pcQYbPuKGZ7"
7405
+ },
7406
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
7407
+ {
7408
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
7409
+ name: "Felani",
7410
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7411
+ validUntil: null,
7412
+ externalId: "gSqpoCGdMXp"
7413
+ },
7414
+ {
7415
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
7416
+ name: "Goroma",
7417
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7418
+ validUntil: null,
7419
+ externalId: "KvAAIaNqVrp"
7420
+ },
7421
+ {
7422
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
7423
+ name: "Halifu",
7424
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7425
+ validUntil: null,
7426
+ externalId: "qe4UnEVt1hv"
7427
+ },
7428
+ {
7429
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
7430
+ name: "Jabari",
7431
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7432
+ validUntil: null,
7433
+ externalId: "yHH9Nz4rLOt"
7434
+ },
7435
+ {
7436
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
7437
+ name: "Kifani",
7438
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7439
+ validUntil: null,
7440
+ externalId: "eSWmXIGeu1I"
7441
+ },
7442
+ {
7443
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
7444
+ name: "Lumela",
7445
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
7446
+ validUntil: null,
7447
+ externalId: "bh0b3aI1uP3"
7448
+ }
7449
+ ];
7450
+ var V2_DEFAULT_MOCK_LOCATIONS = [
7451
+ {
7452
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
7453
+ name: "Central Provincial Office",
7454
+ locationType: "CRVS_OFFICE",
7455
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7456
+ validUntil: null,
7457
+ externalId: "Xr3Df8WpK6Ys"
7458
+ },
7459
+ {
7460
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
7461
+ name: "Central Health Post",
7462
+ locationType: "HEALTH_FACILITY",
7463
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
7464
+ validUntil: null
7465
+ },
7466
+ {
7467
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
7468
+ name: "Ibombo District Office",
7469
+ locationType: "CRVS_OFFICE",
7470
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7471
+ validUntil: null,
7472
+ externalId: "Sm4Nw7GrD2Vy"
7473
+ },
7474
+ {
7475
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
7476
+ name: "Isamba District Office",
7477
+ locationType: "CRVS_OFFICE",
7478
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
7479
+ validUntil: null,
7480
+ externalId: "Vg1Bq5XeH9Lt"
7481
+ },
7482
+ {
7483
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
7484
+ name: "Isango District Office",
7485
+ locationType: "CRVS_OFFICE",
7486
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
7487
+ validUntil: null,
7488
+ externalId: "Je7Lm2XqN9Vz"
7489
+ },
7490
+ {
7491
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
7492
+ name: "Sulaka Provincial Office",
7493
+ locationType: "CRVS_OFFICE",
7494
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
7495
+ validUntil: null,
7496
+ externalId: "Ht2Wp9KcX5Qv"
7497
+ },
7498
+ {
7499
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
7500
+ name: "Ilanga District Office",
7501
+ locationType: "CRVS_OFFICE",
7502
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
7503
+ validUntil: null,
7504
+ externalId: "Yp6Ds1WqN3Xz"
7505
+ },
7506
+ {
7507
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
7508
+ name: "Chamakubi Health Post",
7509
+ locationType: "HEALTH_FACILITY",
7510
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7511
+ validUntil: null,
7512
+ externalId: "M1nFr8LbC2Qy"
7513
+ },
7514
+ {
7515
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
7516
+ name: "Ibombo Rural Health Centre",
7517
+ locationType: "HEALTH_FACILITY",
7518
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7519
+ validUntil: null,
7520
+ externalId: "bT7pV6YrW0Xc"
7521
+ },
7522
+ {
7523
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
7524
+ name: "Chikobo Rural Health Centre",
7525
+ locationType: "HEALTH_FACILITY",
7526
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7527
+ validUntil: null,
7528
+ externalId: "zE4qPn2SgJ5d"
7529
+ },
7530
+ {
7531
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
7532
+ name: "Chilochabalenje Health Post",
7533
+ locationType: "HEALTH_FACILITY",
7534
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7535
+ validUntil: null,
7536
+ externalId: "H8vDs1MqR4Uf"
7537
+ },
7538
+ {
7539
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
7540
+ name: "Chipeso Rural Health Centre",
7541
+ locationType: "HEALTH_FACILITY",
7542
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7543
+ validUntil: null,
7544
+ externalId: "Qw3uZ9KfX6Lm"
7545
+ },
7546
+ {
7547
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
7548
+ name: "Chisamba Rural Health Centre",
7549
+ locationType: "HEALTH_FACILITY",
7550
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7551
+ validUntil: null,
7552
+ externalId: "Yr0pCg8LdM2s"
7553
+ },
7554
+ {
7555
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
7556
+ name: "Chitanda Rural Health Centre",
7557
+ locationType: "HEALTH_FACILITY",
7558
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7559
+ validUntil: null,
7560
+ externalId: "tS9gJ4PwB1Qx"
7561
+ },
7562
+ {
7563
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
7564
+ name: "Golden Valley Rural Health Centre",
7565
+ locationType: "HEALTH_FACILITY",
7566
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7567
+ validUntil: null,
7568
+ externalId: "Ld7Qm3XsA8Vr"
7569
+ },
7570
+ {
7571
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
7572
+ name: "Ipongo Rural Health Centre",
7573
+ locationType: "HEALTH_FACILITY",
7574
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7575
+ validUntil: null,
7576
+ externalId: "kF2sW9DmH0Bt"
7577
+ },
7578
+ {
7579
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
7580
+ name: "Itumbwe Health Post",
7581
+ locationType: "HEALTH_FACILITY",
7582
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7583
+ validUntil: null,
7584
+ externalId: "Ue5Xb3VaC7Pq"
7585
+ },
7586
+ {
7587
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
7588
+ name: "Kabangalala Rural Health Centre",
7589
+ locationType: "HEALTH_FACILITY",
7590
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
7591
+ validUntil: null,
7592
+ externalId: "Pz8Kc1TqH6Jn"
7593
+ },
7594
+ // Village offices
7595
+ {
7596
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
7597
+ name: "Klow Village Office",
7598
+ locationType: "CRVS_OFFICE",
7599
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
7600
+ validUntil: null,
7601
+ externalId: "PmAyxAJkxiJ"
7602
+ }
7603
+ ];
7604
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
7605
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
7606
+ );
7607
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
7608
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
7609
+ );
7610
+
6929
7611
  // ../commons/src/notification/UserNotifications.ts
6930
7612
  var z44 = __toESM(require("zod/v4"));
6931
7613
  var TriggerEvent = {
@@ -6934,6 +7616,7 @@ var TriggerEvent = {
6934
7616
  USERNAME_REMINDER: "username-reminder",
6935
7617
  RESET_PASSWORD: "reset-password",
6936
7618
  RESET_PASSWORD_BY_ADMIN: "reset-password-by-admin",
7619
+ RESEND_INVITE: "resend-invite",
6937
7620
  TWO_FA: "2fa",
6938
7621
  ALL_USER_NOTIFICATION: "all-user-notification",
6939
7622
  CHANGE_PHONE_NUMBER: "change-phone-number",
@@ -6971,6 +7654,10 @@ var TriggerPayload = {
6971
7654
  role: z44.string()
6972
7655
  })
6973
7656
  }),
7657
+ [TriggerEvent.RESEND_INVITE]: BasePayload.extend({
7658
+ username: z44.string(),
7659
+ temporaryPassword: z44.string()
7660
+ }),
6974
7661
  [TriggerEvent.TWO_FA]: BasePayload.extend({
6975
7662
  code: z44.string()
6976
7663
  }),