@opencrvs/toolkit 2.0.0-rc.9917c19 → 2.0.0-rc.99921a2

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 (121) hide show
  1. package/README.md +15 -0
  2. package/build.sh +5 -4
  3. package/create-countryconfig/index.js +50 -20
  4. package/create-countryconfig/package.json +12 -2
  5. package/dist/application-config/index.js +298 -123
  6. package/dist/cli.js +3219 -4778
  7. package/dist/commons/api/router.d.ts +3954 -211
  8. package/dist/commons/application-config/index.d.ts +1 -0
  9. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  10. package/dist/commons/conditionals/validate.d.ts +52 -2
  11. package/dist/commons/events/ActionConfig.d.ts +230 -2
  12. package/dist/commons/events/ActionDocument.d.ts +50 -0
  13. package/dist/commons/events/ActionInput.d.ts +140 -0
  14. package/dist/commons/events/ActionType.d.ts +6 -1
  15. package/dist/commons/events/AdvancedSearchConfig.d.ts +360 -0
  16. package/dist/commons/events/AuditLog.d.ts +2 -0
  17. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  18. package/dist/commons/events/Draft.d.ts +6 -2
  19. package/dist/commons/events/EventConfig.d.ts +2 -0
  20. package/dist/commons/events/EventDocument.d.ts +25 -0
  21. package/dist/commons/events/EventIndex.d.ts +25 -3
  22. package/dist/commons/events/EventMetadata.d.ts +26 -7
  23. package/dist/commons/events/FieldConfig.d.ts +393 -50
  24. package/dist/commons/events/FieldType.d.ts +1 -0
  25. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  26. package/dist/commons/events/FieldValue.d.ts +6 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +194 -152
  28. package/dist/commons/events/field.d.ts +53 -1
  29. package/dist/commons/events/index.d.ts +2 -0
  30. package/dist/commons/events/locations.d.ts +1 -0
  31. package/dist/commons/events/scopes.d.ts +1 -0
  32. package/dist/commons/events/state/flags.d.ts +16 -0
  33. package/dist/commons/events/state/index.d.ts +8 -4
  34. package/dist/commons/events/state/utils.d.ts +21 -289
  35. package/dist/commons/events/test.utils.d.ts +9 -1
  36. package/dist/commons/events/utils.d.ts +28 -3
  37. package/dist/conditionals/index.js +65 -5
  38. package/dist/environment/custom-types.d.ts +33 -0
  39. package/dist/environment/custom-types.d.ts.map +1 -0
  40. package/dist/environment/custom-types.js +12 -0
  41. package/dist/environment/derived-variables.d.ts +134 -0
  42. package/dist/environment/derived-variables.d.ts.map +1 -0
  43. package/dist/environment/derived-variables.js +169 -0
  44. package/dist/environment/editor-questions.d.ts +4 -0
  45. package/dist/environment/editor-questions.d.ts.map +1 -0
  46. package/dist/environment/editor-questions.js +67 -0
  47. package/dist/environment/git.d.ts +5 -0
  48. package/dist/environment/git.d.ts.map +1 -0
  49. package/dist/environment/git.js +38 -0
  50. package/dist/environment/github.d.ts +26 -0
  51. package/dist/environment/github.d.ts.map +1 -0
  52. package/dist/environment/github.js +247 -0
  53. package/dist/environment/index.d.ts +5 -0
  54. package/dist/environment/index.d.ts.map +1 -0
  55. package/dist/environment/index.js +71 -0
  56. package/dist/environment/logger.d.ts +15 -0
  57. package/dist/environment/logger.d.ts.map +1 -0
  58. package/dist/environment/logger.js +25 -0
  59. package/dist/environment/manage-users.d.ts +11 -0
  60. package/dist/environment/manage-users.d.ts.map +1 -0
  61. package/dist/environment/manage-users.js +497 -0
  62. package/dist/environment/questions-helper.d.ts +15 -0
  63. package/dist/environment/questions-helper.d.ts.map +1 -0
  64. package/dist/environment/questions-helper.js +70 -0
  65. package/dist/environment/questions.d.ts +199 -0
  66. package/dist/environment/questions.d.ts.map +1 -0
  67. package/dist/environment/questions.js +412 -0
  68. package/dist/environment/setup-environment.d.ts +2 -0
  69. package/dist/environment/setup-environment.d.ts.map +1 -0
  70. package/dist/environment/setup-environment.js +794 -0
  71. package/dist/environment/ssh-keygen.d.ts +5 -0
  72. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  73. package/dist/environment/ssh-keygen.js +21 -0
  74. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  75. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  76. package/dist/environment/swarm-to-k8s.js +173 -0
  77. package/dist/environment/templates.d.ts +27 -0
  78. package/dist/environment/templates.d.ts.map +1 -0
  79. package/dist/environment/templates.js +163 -0
  80. package/dist/environment/update-workflows.d.ts +2 -0
  81. package/dist/environment/update-workflows.d.ts.map +1 -0
  82. package/dist/environment/update-workflows.js +169 -0
  83. package/dist/environment/users.d.ts +2 -0
  84. package/dist/environment/users.d.ts.map +1 -0
  85. package/dist/environment/users.js +112 -0
  86. package/dist/environment/utils.d.ts +18 -0
  87. package/dist/environment/utils.d.ts.map +1 -0
  88. package/dist/environment/utils.js +100 -0
  89. package/dist/events/index.js +1272 -299
  90. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  91. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  92. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  93. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  94. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  95. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  96. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  97. package/dist/migrations/v2.0/index.js +88 -4963
  98. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  99. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  100. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  101. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  102. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  103. package/dist/migrations/v2.1/index.d.ts +6 -0
  104. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  105. package/dist/migrations/v2.1/index.js +218 -0
  106. package/dist/notification/index.js +1038 -163
  107. package/dist/scopes/index.d.ts +100 -8
  108. package/dist/scopes/index.js +22 -7
  109. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  110. package/dist/templates/charts-values/dependencies/values.yaml +83 -0
  111. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  112. package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
  113. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  114. package/dist/templates/charts-values/traefik/values.yaml +115 -0
  115. package/dist/templates/inventory/inventory.template.yml +100 -0
  116. package/dist/templates/inventory/production.example.yml +77 -0
  117. package/dist/templates/inventory/qa.example.yml +48 -0
  118. package/opencrvs-toolkit-2.0.0-rc.99921a2.tgz +0 -0
  119. package/package.json +20 -2
  120. package/tsconfig.tsbuildinfo +1 -1
  121. package/opencrvs-toolkit-2.0.0-rc.9917c19.tgz +0 -0
@@ -75,7 +75,10 @@ var ActionConditional = z.discriminatedUnion("type", [
75
75
  ShowConditional,
76
76
  // Action can be shown to the user in the list but as disabled
77
77
  EnableConditional
78
- ]);
78
+ ]).meta({
79
+ id: "ActionConditional",
80
+ 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."
81
+ });
79
82
  var DisplayOnReviewConditional = z.object({
80
83
  type: z.literal(ConditionalType.DISPLAY_ON_REVIEW),
81
84
  conditional: Conditional
@@ -90,8 +93,8 @@ var FieldConditional = z.discriminatedUnion("type", [
90
93
  // Field output can be shown / hidden on the review page
91
94
  DisplayOnReviewConditional
92
95
  ]).meta({
93
- description: "Field conditional configuration",
94
- id: "FieldConditional"
96
+ id: "FieldConditional",
97
+ 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."
95
98
  });
96
99
 
97
100
  // ../commons/src/events/TranslationConfig.ts
@@ -203,6 +206,11 @@ var FieldTypesToHideInReview = [
203
206
  FieldType.ALPHA_PRINT_BUTTON,
204
207
  FieldType.ALPHA_HIDDEN
205
208
  ];
209
+ var HiddenFieldTypes = [
210
+ FieldType.HTTP,
211
+ FieldType.QUERY_PARAM_READER,
212
+ FieldType.ALPHA_HIDDEN
213
+ ];
206
214
 
207
215
  // ../commons/src/events/FieldValue.ts
208
216
  var z7 = __toESM(require("zod/v4"));
@@ -321,7 +329,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
321
329
  // ../commons/src/events/FieldValue.ts
322
330
  var TextValue = z7.string();
323
331
  var HiddenFieldValue = z7.string();
324
- var NonEmptyTextValue = TextValue.min(1);
332
+ var NonEmptyTextValue = z7.string().trim().min(1);
325
333
  var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
326
334
  var AgeValue = z7.object({
327
335
  age: z7.number(),
@@ -350,6 +358,7 @@ var DateRangeFieldValue = z7.object({
350
358
  var EmailValue = z7.email();
351
359
  var CheckboxFieldValue = z7.boolean();
352
360
  var NumberFieldValue = z7.number();
361
+ var SignatureFieldValue = FileFieldValue;
353
362
  var ButtonFieldValue = z7.number();
354
363
  var VerificationStatusValue = z7.enum([
355
364
  "verified",
@@ -418,28 +427,20 @@ function schemaPriority(schema) {
418
427
  return idx === -1 ? 9999 : idx;
419
428
  }
420
429
  function safeUnion(schemas) {
430
+ const sortedSchemas = [...schemas].sort(
431
+ (a, b) => schemaPriority(a) - schemaPriority(b)
432
+ );
421
433
  return z7.any().superRefine((val, ctx) => {
422
- const successful = schemas.filter((s) => s.safeParse(val).success);
423
- if (successful.length === 1) {
424
- return;
425
- }
426
- if (successful.length === 0) {
427
- ctx.addIssue({
428
- code: "invalid_type",
429
- expected: "custom",
430
- message: "Value does not match any schema"
431
- });
432
- return;
433
- }
434
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
435
- const best = successful[0];
436
- if (!best.safeParse(val).success) {
437
- ctx.addIssue({
438
- expected: "custom",
439
- code: "invalid_type",
440
- message: "Value did not match the best schema"
441
- });
434
+ for (const schema of sortedSchemas) {
435
+ if (schema.safeParse(val).success) {
436
+ return;
437
+ }
442
438
  }
439
+ ctx.addIssue({
440
+ code: "invalid_type",
441
+ expected: "custom",
442
+ message: "Value does not match any schema"
443
+ });
443
444
  }).meta({
444
445
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
445
446
  });
@@ -519,6 +520,7 @@ var ActionType = {
519
520
  MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
520
521
  MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
521
522
  ARCHIVE: "ARCHIVE",
523
+ UNARCHIVE: "UNARCHIVE",
522
524
  // Record actions
523
525
  PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
524
526
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
@@ -538,6 +540,7 @@ var ConfirmableActions = [
538
540
  ActionType.REGISTER,
539
541
  ActionType.REJECT,
540
542
  ActionType.ARCHIVE,
543
+ ActionType.UNARCHIVE,
541
544
  ActionType.PRINT_CERTIFICATE,
542
545
  ActionType.REQUEST_CORRECTION,
543
546
  ActionType.APPROVE_CORRECTION,
@@ -556,6 +559,7 @@ var ActionTypes = z10.enum([
556
559
  "MARK_AS_DUPLICATE",
557
560
  "MARK_AS_NOT_DUPLICATE",
558
561
  "ARCHIVE",
562
+ "UNARCHIVE",
559
563
  "PRINT_CERTIFICATE",
560
564
  "REQUEST_CORRECTION",
561
565
  "REJECT_CORRECTION",
@@ -596,6 +600,7 @@ var WorkqueueActionType = ActionTypes.extract([
596
600
  ActionType.REJECT,
597
601
  ActionType.MARK_AS_DUPLICATE,
598
602
  ActionType.ARCHIVE,
603
+ ActionType.UNARCHIVE,
599
604
  ActionType.PRINT_CERTIFICATE,
600
605
  ActionType.REQUEST_CORRECTION
601
606
  ]);
@@ -625,6 +630,7 @@ var RecordScopeTypeV2 = z11.enum([
625
630
  "record.edit",
626
631
  "record.reject",
627
632
  "record.archive",
633
+ "record.unarchive",
628
634
  "record.review-duplicates",
629
635
  "record.register",
630
636
  "record.print-certified-copies",
@@ -664,11 +670,13 @@ var scopeOptionsPlaceEvent = z11.object({
664
670
  event: scopeByEvent,
665
671
  placeOfEvent: JurisdictionFilter.optional()
666
672
  }).describe("Options applicable to all record scopes.");
667
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
673
+ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
674
+ notifiedIn: JurisdictionFilter.optional(),
675
+ notifiedBy: UserFilter.optional(),
668
676
  declaredIn: JurisdictionFilter.optional(),
669
677
  declaredBy: UserFilter.optional()
670
678
  }).describe("Options applicable to actions that may take place after DECLARE");
671
- var AllRecordScopeOptions = scopeOptionsDeclared.extend({
679
+ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
672
680
  registeredIn: JurisdictionFilter.optional(),
673
681
  registeredBy: UserFilter.optional()
674
682
  }).describe(
@@ -706,6 +714,8 @@ var ResolvedScopeOptionsPlaceEvent = z11.object({
706
714
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
707
715
  );
708
716
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
717
+ notifiedIn: UUID.nullish(),
718
+ notifiedBy: z11.string().optional(),
709
719
  declaredIn: UUID.nullish(),
710
720
  declaredBy: z11.string().optional()
711
721
  }).describe(
@@ -726,6 +736,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
726
736
  "record.edit",
727
737
  "record.reject",
728
738
  "record.archive",
739
+ "record.unarchive",
729
740
  "record.review-duplicates",
730
741
  "record.register"
731
742
  ]);
@@ -751,7 +762,7 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
751
762
  }),
752
763
  z11.object({
753
764
  type: ScopesWithDeclaredOptions,
754
- options: scopeOptionsDeclared.optional()
765
+ options: scopeOptionsDeclaredOrNotified.optional()
755
766
  }),
756
767
  z11.object({
757
768
  type: ScopesWithFullOptions,
@@ -839,7 +850,10 @@ var ScopeType = z11.enum([
839
850
  var EncodedScope = z11.string().brand("EncodedScope");
840
851
  var DEFAULT_SCOPE_OPTIONS = {
841
852
  placeOfEvent: JurisdictionFilter.enum.all,
842
- accessLevel: JurisdictionFilter.enum.all
853
+ accessLevel: JurisdictionFilter.enum.all,
854
+ notifiedIn: JurisdictionFilter.enum.all,
855
+ declaredIn: JurisdictionFilter.enum.all,
856
+ registeredIn: JurisdictionFilter.enum.all
843
857
  };
844
858
 
845
859
  // ../commons/src/authentication.ts
@@ -957,6 +971,11 @@ var ArchiveAction = ActionBase.extend(
957
971
  content: ReasonContent
958
972
  }).shape
959
973
  );
974
+ var UnarchiveAction = ActionBase.extend(
975
+ z13.object({
976
+ type: z13.literal(ActionType.UNARCHIVE)
977
+ }).shape
978
+ );
960
979
  var CreatedAction = ActionBase.extend(
961
980
  z13.object({
962
981
  type: z13.literal(ActionType.CREATE)
@@ -992,8 +1011,9 @@ var RequestedCorrectionAction = ActionBase.extend(
992
1011
  var ApprovedCorrectionAction = ActionBase.extend(
993
1012
  z13.object({
994
1013
  type: z13.literal(ActionType.APPROVE_CORRECTION),
995
- requestId: z13.string()
1014
+ requestId: z13.string(),
996
1015
  // TODO move into 'content' property
1016
+ content: z13.object({ immediateCorrection: z13.boolean().optional() }).optional()
997
1017
  }).shape
998
1018
  );
999
1019
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1022,6 +1042,7 @@ var ActionDocument = z13.discriminatedUnion("type", [
1022
1042
  MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1023
1043
  MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1024
1044
  ArchiveAction.meta({ id: "ArchiveAction" }),
1045
+ UnarchiveAction.meta({ id: "UnarchiveAction" }),
1025
1046
  NotifiedAction.meta({ id: "NotifiedAction" }),
1026
1047
  RegisterAction.meta({ id: "RegisterAction" }),
1027
1048
  DeclareAction.meta({ id: "DeclareAction" }),
@@ -1085,6 +1106,9 @@ var FlagConfig = z14.object({
1085
1106
  "Indicates if this flag expects an action to be performed to be cleared."
1086
1107
  ),
1087
1108
  label: TranslationConfig.describe("Human readable label of the flag.")
1109
+ }).meta({
1110
+ id: "FlagConfig",
1111
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1088
1112
  });
1089
1113
  var ActionFlagConfig = z14.object({
1090
1114
  id: Flag,
@@ -1092,6 +1116,9 @@ var ActionFlagConfig = z14.object({
1092
1116
  conditional: Conditional.optional().describe(
1093
1117
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1094
1118
  )
1119
+ }).meta({
1120
+ id: "ActionFlagConfig",
1121
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1095
1122
  });
1096
1123
 
1097
1124
  // ../commons/src/events/EventMetadata.ts
@@ -1113,8 +1140,7 @@ var ActionCreationMetadata = z15.object({
1113
1140
  ),
1114
1141
  createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1115
1142
  acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
1116
- createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation."),
1117
- createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
1143
+ createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
1118
1144
  });
1119
1145
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1120
1146
  registrationNumber: z15.string().describe(
@@ -1122,6 +1148,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1122
1148
  )
1123
1149
  });
1124
1150
  var LegalStatuses = z15.object({
1151
+ [EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
1125
1152
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1126
1153
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1127
1154
  });
@@ -1142,9 +1169,6 @@ var EventMetadata = z15.object({
1142
1169
  createdAtLocation: UUID.nullish().describe(
1143
1170
  "Location of the user who created the event."
1144
1171
  ),
1145
- createdBySignature: DocumentPath.nullish().describe(
1146
- "Signature of the user who created the event."
1147
- ),
1148
1172
  updatedAtLocation: UUID.nullish().describe(
1149
1173
  "Location of the user who last changed the status."
1150
1174
  ),
@@ -1184,6 +1208,8 @@ var EventMetadataKeys = z15.enum(EventMetadataKeysArray);
1184
1208
  var EventMetadataDateFieldIdInput = z15.enum([
1185
1209
  "createdAt",
1186
1210
  "updatedAt",
1211
+ "legalStatuses.NOTIFIED.createdAt",
1212
+ "legalStatuses.NOTIFIED.acceptedAt",
1187
1213
  "legalStatuses.DECLARED.createdAt",
1188
1214
  "legalStatuses.DECLARED.acceptedAt",
1189
1215
  "legalStatuses.REGISTERED.createdAt",
@@ -1192,6 +1218,8 @@ var EventMetadataDateFieldIdInput = z15.enum([
1192
1218
  var EventMetadataDateFieldId = z15.enum([
1193
1219
  "event.createdAt",
1194
1220
  "event.updatedAt",
1221
+ "event.legalStatuses.NOTIFIED.createdAt",
1222
+ "event.legalStatuses.NOTIFIED.acceptedAt",
1195
1223
  "event.legalStatuses.DECLARED.createdAt",
1196
1224
  "event.legalStatuses.DECLARED.acceptedAt",
1197
1225
  "event.legalStatuses.REGISTERED.createdAt",
@@ -1254,7 +1282,8 @@ var Range = import_v4.z.object({
1254
1282
  });
1255
1283
  var ContainsFlags = import_v4.z.object({
1256
1284
  anyOf: import_v4.z.array(Flag).optional(),
1257
- noneOf: import_v4.z.array(Flag).optional()
1285
+ noneOf: import_v4.z.array(Flag).optional(),
1286
+ allOf: import_v4.z.array(Flag).optional()
1258
1287
  }).meta({
1259
1288
  id: "ContainsFlags"
1260
1289
  });
@@ -1408,14 +1437,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1408
1437
  }
1409
1438
  }).describe("Unique identifier for the field");
1410
1439
  var FieldReference = import_v43.default.object({
1411
- $$field: FieldId,
1440
+ $$field: FieldId.describe("Id of the field to reference"),
1412
1441
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1413
1442
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1443
+ ),
1444
+ $$code: import_v43.default.string().optional().describe(
1445
+ "Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
1414
1446
  )
1415
- }).describe("Reference to a field by its ID");
1447
+ }).describe(
1448
+ "Reference to a field value, with an optional client-side computation applied."
1449
+ );
1450
+ var ComputedDefaultValue = import_v43.default.object({
1451
+ $$code: import_v43.default.string().describe(
1452
+ "Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
1453
+ )
1454
+ }).describe("A context-only computation used as a field default value.");
1416
1455
  var ValidationConfig = import_v43.default.object({
1417
- validator: Conditional,
1418
- message: TranslationConfig
1456
+ validator: Conditional.describe(
1457
+ "Conditional expression that must hold for the field value to be considered valid."
1458
+ ),
1459
+ message: TranslationConfig.describe(
1460
+ "Error message displayed when the validator does not hold."
1461
+ )
1462
+ }).meta({
1463
+ id: "ValidationConfig",
1464
+ 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."
1419
1465
  });
1420
1466
  var requiredSchema = import_v43.default.union([
1421
1467
  import_v43.default.boolean(),
@@ -1446,7 +1492,7 @@ var BaseField = import_v43.default.object({
1446
1492
  "Indicates whether the field can be modified during record correction."
1447
1493
  ),
1448
1494
  value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
1449
- "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."
1495
+ "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."
1450
1496
  ),
1451
1497
  analytics: import_v43.default.boolean().default(false).optional().describe(
1452
1498
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
@@ -1454,30 +1500,40 @@ var BaseField = import_v43.default.object({
1454
1500
  }).describe("Common properties shared across all field types.");
1455
1501
  var Divider = BaseField.extend({
1456
1502
  type: import_v43.default.literal(FieldType.DIVIDER)
1503
+ }).meta({
1504
+ description: "A horizontal line divider",
1505
+ id: "Divider"
1457
1506
  });
1458
1507
  var TextField = BaseField.extend({
1459
1508
  type: import_v43.default.literal(FieldType.TEXT),
1460
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1509
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1461
1510
  configuration: import_v43.default.object({
1462
1511
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1463
1512
  type: import_v43.default.enum(["text", "password"]).optional(),
1464
1513
  prefix: TranslationConfig.optional(),
1465
1514
  postfix: TranslationConfig.optional()
1466
1515
  }).default({ type: "text" }).optional()
1467
- }).describe("Text input");
1516
+ }).meta({
1517
+ description: "A text input field",
1518
+ id: "TextField"
1519
+ });
1468
1520
  var NumberField = BaseField.extend({
1469
1521
  type: import_v43.default.literal(FieldType.NUMBER),
1470
- defaultValue: NumberFieldValue.optional(),
1522
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1471
1523
  configuration: import_v43.default.object({
1472
1524
  min: import_v43.default.number().optional().describe("Minimum value"),
1473
1525
  max: import_v43.default.number().optional().describe("Maximum value"),
1526
+ integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
1474
1527
  prefix: TranslationConfig.optional(),
1475
1528
  postfix: TranslationConfig.optional()
1476
1529
  }).optional()
1477
- }).describe("Number input");
1530
+ }).meta({
1531
+ description: "A number input field",
1532
+ id: "NumberField"
1533
+ });
1478
1534
  var TextAreaField = BaseField.extend({
1479
1535
  type: import_v43.default.literal(FieldType.TEXTAREA),
1480
- defaultValue: NonEmptyTextValue.optional(),
1536
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1481
1537
  configuration: import_v43.default.object({
1482
1538
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
1483
1539
  rows: import_v43.default.number().optional().describe("Number of visible text lines"),
@@ -1485,7 +1541,10 @@ var TextAreaField = BaseField.extend({
1485
1541
  prefix: TranslationConfig.optional(),
1486
1542
  postfix: TranslationConfig.optional()
1487
1543
  }).default({ rows: 4 }).optional()
1488
- }).describe("Multiline text input");
1544
+ }).meta({
1545
+ description: "A multiline text input",
1546
+ id: "TextAreaField"
1547
+ });
1489
1548
  var ImageMimeType = import_v43.default.enum([
1490
1549
  "image/png",
1491
1550
  "image/jpg",
@@ -1508,58 +1567,76 @@ var SignatureField = BaseField.extend({
1508
1567
  signaturePromptLabel: TranslationConfig.describe(
1509
1568
  "Title of the signature modal"
1510
1569
  ),
1511
- defaultValue: FieldValue.optional(),
1570
+ defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
1512
1571
  configuration: import_v43.default.object({
1513
1572
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1514
1573
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1515
1574
  }).default({
1516
1575
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1517
1576
  })
1518
- }).describe("Signature input field");
1577
+ }).meta({
1578
+ description: "A signature input field",
1579
+ id: "SignatureField"
1580
+ });
1519
1581
  var EmailField = BaseField.extend({
1520
1582
  type: import_v43.default.literal(FieldType.EMAIL),
1521
1583
  configuration: import_v43.default.object({
1522
1584
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
1523
1585
  }).default({ maxLength: 255 }).optional(),
1524
- defaultValue: NonEmptyTextValue.optional()
1586
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
1587
+ }).meta({
1588
+ description: "An email input field",
1589
+ id: "EmailField"
1525
1590
  });
1526
1591
  var DateField = BaseField.extend({
1527
1592
  type: import_v43.default.literal(FieldType.DATE),
1528
- defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
1593
+ defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
1529
1594
  configuration: import_v43.default.object({
1530
1595
  notice: TranslationConfig.describe(
1531
1596
  "Text to display above the date input"
1532
1597
  ).optional()
1533
1598
  }).optional()
1534
- }).describe("A single date input (yyyy-MM-dd)");
1599
+ }).meta({
1600
+ description: "A date input (yyyy-MM-dd)",
1601
+ id: "DateField"
1602
+ });
1535
1603
  var AgeField = BaseField.extend({
1536
1604
  type: import_v43.default.literal(FieldType.AGE),
1537
- defaultValue: NumberFieldValue.optional(),
1605
+ defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
1538
1606
  configuration: import_v43.default.object({
1539
1607
  asOfDate: FieldReference,
1540
1608
  prefix: TranslationConfig.optional(),
1541
1609
  postfix: TranslationConfig.optional()
1542
1610
  })
1543
- }).describe("An age input field which uses the current date as the asOfDate");
1611
+ }).meta({
1612
+ description: "An age input field which uses the current date as the asOfDate",
1613
+ id: "AgeField"
1614
+ });
1544
1615
  var TimeField = BaseField.extend({
1545
1616
  type: import_v43.default.literal(FieldType.TIME),
1546
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1617
+ defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
1547
1618
  configuration: import_v43.default.object({
1548
1619
  use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
1549
1620
  notice: TranslationConfig.describe(
1550
1621
  "Text to display above the time input"
1551
1622
  ).optional()
1552
1623
  }).optional()
1553
- }).describe("A single date input (HH-mm)");
1624
+ }).meta({
1625
+ description: "A single time input (HH-mm)",
1626
+ id: "TimeField"
1627
+ });
1554
1628
  var DateRangeField = BaseField.extend({
1555
1629
  type: import_v43.default.literal(FieldType.DATE_RANGE),
1556
- defaultValue: DateRangeFieldValue.optional(),
1630
+ defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
1557
1631
  configuration: import_v43.default.object({
1558
1632
  notice: TranslationConfig.describe(
1559
1633
  "Text to display above the date input"
1560
1634
  ).optional()
1561
1635
  }).optional()
1562
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1636
+ }).meta({
1637
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
1638
+ id: "DateRangeField"
1639
+ });
1563
1640
  var HtmlFontVariant = import_v43.default.enum([
1564
1641
  "reg12",
1565
1642
  "reg14",
@@ -1603,21 +1680,33 @@ var ImageViewField = BaseField.extend({
1603
1680
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
1604
1681
  defaultValue: NonEmptyTextValue.optional(),
1605
1682
  configuration: ImageConfiguration
1606
- }).describe("A read-only image component for form pages");
1683
+ }).meta({
1684
+ description: "A read-only image component for form pages",
1685
+ id: "ImageViewField"
1686
+ });
1607
1687
  var Paragraph = BaseField.extend({
1608
1688
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1609
1689
  configuration: ParagraphConfiguration
1610
- }).describe("A read-only HTML <p> paragraph");
1690
+ }).meta({
1691
+ description: "A read-only HTML <p> paragraph",
1692
+ id: "Paragraph"
1693
+ });
1611
1694
  var Heading = BaseField.extend({
1612
1695
  type: import_v43.default.literal(FieldType.HEADING),
1613
1696
  configuration: HeadingConfiguration
1614
- }).describe("A read-only heading component for form pages");
1697
+ }).meta({
1698
+ description: "A read-only heading component for form pages",
1699
+ id: "Heading"
1700
+ });
1615
1701
  var PageHeader = BaseField.extend({
1616
1702
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
1617
- }).describe("A read-only header component for form pages");
1703
+ }).meta({
1704
+ description: "A read-only header component for form pages",
1705
+ id: "PageHeader"
1706
+ });
1618
1707
  var File = BaseField.extend({
1619
1708
  type: import_v43.default.literal(FieldType.FILE),
1620
- defaultValue: FileFieldValue.optional(),
1709
+ defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
1621
1710
  configuration: import_v43.default.object({
1622
1711
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1623
1712
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -1633,7 +1722,10 @@ var File = BaseField.extend({
1633
1722
  }).default({
1634
1723
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1635
1724
  })
1636
- }).describe("File upload");
1725
+ }).meta({
1726
+ description: "A file upload field",
1727
+ id: "File"
1728
+ });
1637
1729
  var SelectOption = import_v43.default.object({
1638
1730
  value: import_v43.default.string().describe("The value of the option"),
1639
1731
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -1641,7 +1733,7 @@ var SelectOption = import_v43.default.object({
1641
1733
  });
1642
1734
  var NumberWithUnitField = BaseField.extend({
1643
1735
  type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
1644
- defaultValue: NumberWithUnitFieldValue.optional(),
1736
+ defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
1645
1737
  options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
1646
1738
  configuration: import_v43.default.object({
1647
1739
  min: import_v43.default.number().optional().describe("Minimum value of the number field"),
@@ -1650,17 +1742,23 @@ var NumberWithUnitField = BaseField.extend({
1650
1742
  "Placeholder for the number field"
1651
1743
  )
1652
1744
  }).optional()
1653
- }).describe("Number with unit input");
1745
+ }).meta({
1746
+ description: "A number with unit input field",
1747
+ id: "NumberWithUnitField"
1748
+ });
1654
1749
  var RadioGroup = BaseField.extend({
1655
1750
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
1656
- defaultValue: TextValue.optional(),
1751
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1657
1752
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1658
1753
  configuration: import_v43.default.object({
1659
1754
  styles: import_v43.default.object({
1660
1755
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
1661
1756
  }).optional()
1662
1757
  }).optional()
1663
- }).describe("Grouped radio options");
1758
+ }).meta({
1759
+ description: "A grouped radio button field",
1760
+ id: "RadioGroup"
1761
+ });
1664
1762
  var BulletList = BaseField.extend({
1665
1763
  type: import_v43.default.literal(FieldType.BULLET_LIST),
1666
1764
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -1669,10 +1767,13 @@ var BulletList = BaseField.extend({
1669
1767
  fontVariant: HtmlFontVariant.optional()
1670
1768
  }).optional()
1671
1769
  }).default({})
1672
- }).describe("A list of bullet points");
1770
+ }).meta({
1771
+ description: "A list of bullet points",
1772
+ id: "BulletList"
1773
+ });
1673
1774
  var Select = BaseField.extend({
1674
1775
  type: import_v43.default.literal(FieldType.SELECT),
1675
- defaultValue: TextValue.optional(),
1776
+ defaultValue: TextValue.or(ComputedDefaultValue).optional(),
1676
1777
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1677
1778
  noOptionsMessage: TranslationConfig.optional().describe(
1678
1779
  `
@@ -1684,16 +1785,22 @@ var Select = BaseField.extend({
1684
1785
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
1685
1786
  `
1686
1787
  )
1687
- }).describe("Select input");
1788
+ }).meta({
1789
+ description: "A select input field",
1790
+ id: "Select"
1791
+ });
1688
1792
  var SelectDateRangeOption = import_v43.default.object({
1689
1793
  value: SelectDateRangeValue.describe("The value of the option"),
1690
1794
  label: TranslationConfig.describe("The label of the option")
1691
1795
  });
1692
1796
  var SelectDateRangeField = BaseField.extend({
1693
1797
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
1694
- defaultValue: SelectDateRangeValue.optional(),
1798
+ defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
1695
1799
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
1696
- }).describe("Select input with date range options");
1800
+ }).meta({
1801
+ description: "A date range selection field",
1802
+ id: "SelectDateRangeField"
1803
+ });
1697
1804
  var NameConfig = import_v43.default.object({
1698
1805
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1699
1806
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -1705,7 +1812,7 @@ var NameField = BaseField.extend({
1705
1812
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1706
1813
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1707
1814
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1708
- }).optional(),
1815
+ }).or(ComputedDefaultValue).optional(),
1709
1816
  configuration: import_v43.default.object({
1710
1817
  name: NameConfig.default({
1711
1818
  firstname: { required: true },
@@ -1724,26 +1831,41 @@ var NameField = BaseField.extend({
1724
1831
  surname: { required: true }
1725
1832
  }
1726
1833
  }).optional()
1727
- }).describe("Name input field");
1834
+ }).meta({
1835
+ description: "A field for entering a persons name",
1836
+ id: "NameField"
1837
+ });
1728
1838
  var PhoneField = BaseField.extend({
1729
- defaultValue: NonEmptyTextValue.optional(),
1839
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1730
1840
  type: import_v43.default.literal(FieldType.PHONE)
1731
- }).describe("Phone input field");
1841
+ }).meta({
1842
+ description: "A field for entering a phone number",
1843
+ id: "PhoneField"
1844
+ });
1732
1845
  var IdField = BaseField.extend({
1733
- defaultValue: NonEmptyTextValue.optional(),
1846
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1734
1847
  type: import_v43.default.literal(FieldType.ID)
1735
- }).describe("ID input field");
1848
+ }).meta({
1849
+ description: "A field for entering an ID",
1850
+ id: "IdField"
1851
+ });
1736
1852
  var Checkbox = BaseField.extend({
1737
1853
  type: import_v43.default.literal(FieldType.CHECKBOX),
1738
- defaultValue: CheckboxFieldValue.default(false)
1739
- }).describe("Boolean checkbox field");
1854
+ defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
1855
+ }).meta({
1856
+ description: "A boolean checkbox field",
1857
+ id: "Checkbox"
1858
+ });
1740
1859
  var Country = BaseField.extend({
1741
1860
  type: import_v43.default.literal(FieldType.COUNTRY),
1742
- defaultValue: NonEmptyTextValue.optional(),
1861
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1743
1862
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
1744
1863
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
1745
1864
  )
1746
- }).describe("Country select field");
1865
+ }).meta({
1866
+ description: "A field for selecting a country",
1867
+ id: "Country"
1868
+ });
1747
1869
  var AllowedLocations = JurisdictionReference.optional().describe(
1748
1870
  "Limits which location options are selectable depending on user jurisdiction and location."
1749
1871
  );
@@ -1752,28 +1874,33 @@ var AdministrativeAreas = import_v43.default.enum([
1752
1874
  "HEALTH_FACILITY",
1753
1875
  "CRVS_OFFICE"
1754
1876
  ]);
1755
- var AdministrativeAreaConfiguration = import_v43.default.object({
1756
- partOf: FieldReference.optional().describe("Parent location"),
1757
- type: AdministrativeAreas,
1758
- allowedLocations: AllowedLocations
1759
- }).describe("Administrative area options");
1760
1877
  var AdministrativeAreaField = BaseField.extend({
1761
1878
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
1762
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1763
- configuration: AdministrativeAreaConfiguration
1764
- }).describe("Administrative area input field e.g. facility, office");
1879
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1880
+ configuration: import_v43.default.object({
1881
+ partOf: FieldReference.optional().describe("Parent location"),
1882
+ type: AdministrativeAreas,
1883
+ allowedLocations: AllowedLocations
1884
+ }).describe("Administrative area options")
1885
+ }).meta({
1886
+ description: "Administrative area input field",
1887
+ id: "AdministrativeAreaField"
1888
+ });
1765
1889
  var LocationInput = BaseField.extend({
1766
1890
  type: import_v43.default.literal(FieldType.LOCATION),
1767
- defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
1891
+ defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
1768
1892
  configuration: import_v43.default.object({
1769
1893
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
1770
1894
  allowedLocations: AllowedLocations
1771
1895
  }).optional()
1772
- }).describe("Input field for a location");
1896
+ }).meta({
1897
+ description: "A field for selecting a location",
1898
+ id: "LocationInput"
1899
+ });
1773
1900
  var FileUploadWithOptions = BaseField.extend({
1774
1901
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
1775
1902
  options: import_v43.default.array(SelectOption).describe("A list of options"),
1776
- defaultValue: FileFieldWithOptionValue.optional(),
1903
+ defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
1777
1904
  configuration: import_v43.default.object({
1778
1905
  maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1779
1906
  maxImageSize: import_v43.default.object({
@@ -1783,15 +1910,18 @@ var FileUploadWithOptions = BaseField.extend({
1783
1910
  }).default({
1784
1911
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1785
1912
  })
1913
+ }).meta({
1914
+ description: "A field for uploading files with file type options",
1915
+ id: "FileUploadWithOptions"
1786
1916
  });
1787
1917
  var Facility = BaseField.extend({
1788
1918
  type: import_v43.default.literal(FieldType.FACILITY),
1789
- defaultValue: NonEmptyTextValue.optional(),
1919
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1790
1920
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1791
1921
  }).describe("Input field for a facility");
1792
1922
  var Office = BaseField.extend({
1793
1923
  type: import_v43.default.literal(FieldType.OFFICE),
1794
- defaultValue: NonEmptyTextValue.optional(),
1924
+ defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
1795
1925
  configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
1796
1926
  }).describe("Input field for an office");
1797
1927
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
@@ -1827,8 +1957,11 @@ var Address = BaseField.extend({
1827
1957
  ).optional(),
1828
1958
  allowedLocations: AllowedLocations
1829
1959
  }).optional(),
1830
- defaultValue: DefaultAddressFieldValue.optional()
1831
- }).describe("Address input field \u2013 a combination of location and text fields");
1960
+ defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
1961
+ }).meta({
1962
+ description: "Address input field \u2013 a combination of location and text fields",
1963
+ id: "Address"
1964
+ });
1832
1965
  var StaticDataEntry = import_v43.default.object({
1833
1966
  id: import_v43.default.string().describe("ID for the data entry."),
1834
1967
  label: TranslationConfig,
@@ -1843,7 +1976,10 @@ var DataField = BaseField.extend({
1843
1976
  subtitle: TranslationConfig.optional(),
1844
1977
  data: import_v43.default.array(DataEntry)
1845
1978
  })
1846
- }).describe("Data field for displaying read-only data");
1979
+ }).meta({
1980
+ description: "A field for displaying a table of read-only data",
1981
+ id: "DataField"
1982
+ });
1847
1983
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
1848
1984
  var ButtonType = import_v43.default.enum([
1849
1985
  "primary",
@@ -1868,13 +2004,19 @@ var ButtonConfiguration = import_v43.default.object({
1868
2004
  });
1869
2005
  var ButtonField = BaseField.extend({
1870
2006
  type: import_v43.default.literal(FieldType.BUTTON),
1871
- defaultValue: ButtonFieldValue.optional(),
2007
+ defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
1872
2008
  configuration: ButtonConfiguration
1873
- }).describe("Generic button without any built-in functionality");
2009
+ }).meta({
2010
+ description: "A generic button that can be used to trigger an action",
2011
+ id: "ButtonField"
2012
+ });
1874
2013
  var FieldGroup = BaseField.extend({
1875
2014
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
1876
2015
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
1877
2016
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2017
+ }).meta({
2018
+ description: "A group of fields that are displayed together",
2019
+ id: "FieldGroup"
1878
2020
  });
1879
2021
  var AlphaPrintButton = BaseField.extend({
1880
2022
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -1884,10 +2026,13 @@ var AlphaPrintButton = BaseField.extend({
1884
2026
  "Label for the print button"
1885
2027
  )
1886
2028
  })
1887
- }).describe("Print button field for printing certificates");
2029
+ }).meta({
2030
+ description: "An experimental print button field for printing certificates during the declaration process",
2031
+ id: "AlphaPrintButton"
2032
+ });
1888
2033
  var HttpField = BaseField.extend({
1889
2034
  type: import_v43.default.literal(FieldType.HTTP),
1890
- defaultValue: HttpFieldValue.optional(),
2035
+ defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
1891
2036
  configuration: import_v43.default.object({
1892
2037
  trigger: FieldReference.optional().describe(
1893
2038
  "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."
@@ -1900,20 +2045,30 @@ var HttpField = BaseField.extend({
1900
2045
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
1901
2046
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
1902
2047
  })
1903
- }).describe("HTTP request function triggered by a button click or other event");
2048
+ }).meta({
2049
+ 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.",
2050
+ id: "HttpField"
2051
+ });
1904
2052
  var AutocompleteField = BaseField.extend({
1905
2053
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
1906
2054
  configuration: import_v43.default.object({
1907
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2055
+ url: import_v43.default.string().describe(
2056
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2057
+ ).optional(),
1908
2058
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
1909
2059
  defaultOptions: import_v43.default.array(
1910
2060
  import_v43.default.object({
1911
2061
  label: import_v43.default.string(),
1912
2062
  value: import_v43.default.string()
1913
2063
  })
1914
- ).optional()
2064
+ ).optional().describe(
2065
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2066
+ )
1915
2067
  })
1916
- }).describe("Autocomplete input field");
2068
+ }).meta({
2069
+ 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.",
2070
+ id: "AutocompleteField"
2071
+ });
1917
2072
  var SearchField = HttpField.extend({
1918
2073
  type: import_v43.default.literal(FieldType.SEARCH),
1919
2074
  configuration: SearchQuery.pick({
@@ -1946,6 +2101,9 @@ var SearchField = HttpField.extend({
1946
2101
  ok: TranslationConfig.optional()
1947
2102
  }).optional()
1948
2103
  })
2104
+ }).meta({
2105
+ description: "A search input field",
2106
+ id: "SearchField"
1949
2107
  });
1950
2108
  var LinkButtonField = BaseField.extend({
1951
2109
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -1954,28 +2112,35 @@ var LinkButtonField = BaseField.extend({
1954
2112
  text: TranslationConfig.describe("Text to display on the button"),
1955
2113
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1956
2114
  })
1957
- }).describe("Button that opens a link");
2115
+ }).meta({
2116
+ description: "A button that opens a URL link",
2117
+ id: "LinkButtonField"
2118
+ });
1958
2119
  var VerificationStatus = BaseField.extend({
1959
2120
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
1960
- defaultValue: VerificationStatusValue.optional(),
2121
+ defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
1961
2122
  configuration: import_v43.default.object({
1962
2123
  status: TranslationConfig.describe("Text to display on the status pill."),
1963
2124
  description: TranslationConfig.describe(
1964
2125
  "Explaining text on the banner in form."
1965
2126
  )
1966
2127
  })
2128
+ }).meta({
2129
+ 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.",
2130
+ id: "VerificationStatus"
1967
2131
  });
1968
2132
  var QueryParamReaderField = BaseField.extend({
1969
2133
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
1970
2134
  configuration: import_v43.default.object({
1971
2135
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
1972
2136
  })
1973
- }).describe(
1974
- "A field that maps URL query params into form values and clears them afterward"
1975
- );
2137
+ }).meta({
2138
+ description: "A field that maps URL query params into form values and clears them afterward",
2139
+ id: "QueryParamReaderField"
2140
+ });
1976
2141
  var QrReaderField = BaseField.extend({
1977
2142
  type: import_v43.default.literal(FieldType.QR_READER),
1978
- defaultValue: QrReaderFieldValue.optional(),
2143
+ defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
1979
2144
  configuration: import_v43.default.object({
1980
2145
  validator: import_v43.default.any().meta({
1981
2146
  description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
@@ -1983,21 +2148,27 @@ var QrReaderField = BaseField.extend({
1983
2148
  })
1984
2149
  }).optional()
1985
2150
  }).meta({
1986
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2151
+ description: "QR code reader field, including optional JSON Schema validator.",
1987
2152
  id: "QrReaderField"
1988
2153
  });
1989
2154
  var IdReaderField = BaseField.extend({
1990
2155
  type: import_v43.default.literal(FieldType.ID_READER),
1991
- defaultValue: IdReaderFieldValue.optional(),
2156
+ defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
1992
2157
  methods: import_v43.default.array(
1993
2158
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1994
2159
  )
2160
+ }).meta({
2161
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2162
+ id: "IdReaderField"
1995
2163
  });
1996
2164
  var CustomField = BaseField.extend({
1997
2165
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
1998
2166
  defaultValue: CustomFieldValue.optional(),
1999
2167
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2000
2168
  configuration: import_v43.default.unknown().optional()
2169
+ }).meta({
2170
+ description: "An expiremental custom field that is defined by a module source path",
2171
+ id: "CustomField"
2001
2172
  });
2002
2173
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2003
2174
  var LoaderField = BaseField.extend({
@@ -2007,22 +2178,25 @@ var LoaderField = BaseField.extend({
2007
2178
  configuration: import_v43.default.object({
2008
2179
  text: TranslationConfig.describe("Display text above the loading spinner")
2009
2180
  })
2010
- }).describe(
2011
- "A non-interactive field that indicates an in progress operation in form"
2012
- );
2181
+ }).meta({
2182
+ description: "A non-interactive field that indicates an in progress operation in form",
2183
+ id: "LoaderField"
2184
+ });
2013
2185
  var HiddenField = BaseField.extend({
2014
2186
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2015
2187
  required: import_v43.default.boolean().default(false).optional(),
2016
2188
  defaultValue: TextValue.optional()
2017
- }).describe(
2018
- "A non-interactive, hidden field that only hold a value in the form"
2019
- );
2189
+ }).meta({
2190
+ description: "A non-interactive, hidden field that only hold a value in the form",
2191
+ id: "HiddenField"
2192
+ });
2020
2193
  var UserRoleField = BaseField.extend({
2021
2194
  type: import_v43.default.literal(FieldType.USER_ROLE),
2022
2195
  defaultValue: TextValue.optional()
2023
- }).describe(
2024
- "A select dropdown that is automatically populated with available user roles"
2025
- );
2196
+ }).meta({
2197
+ description: "A select dropdown that is automatically populated with available user roles",
2198
+ id: "UserRoleField"
2199
+ });
2026
2200
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2027
2201
  FieldGroup,
2028
2202
  Address,
@@ -2140,6 +2314,7 @@ var ClientConfig = z20.object({
2140
2314
  COUNTRY: z20.string(),
2141
2315
  LANGUAGES: z20.array(z20.string()),
2142
2316
  SENTRY: z20.string().optional(),
2317
+ LOGIN_URL: z20.string().optional(),
2143
2318
  REGISTER_BACKGROUND: BackgroundConfig,
2144
2319
  DASHBOARDS: z20.array(
2145
2320
  z20.object({