@opencrvs/toolkit 2.0.0-rc.cfdbeba → 2.0.0-rc.d0ccb3c

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 (53) 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 +223 -88
  4. package/dist/cli.js +507 -171
  5. package/dist/commons/api/router.d.ts +3331 -266
  6. package/dist/commons/conditionals/conditionals.d.ts +9 -3
  7. package/dist/commons/conditionals/validate.d.ts +1 -0
  8. package/dist/commons/events/ActionInput.d.ts +108 -0
  9. package/dist/commons/events/Draft.d.ts +4 -2
  10. package/dist/commons/events/EventIndex.d.ts +0 -3
  11. package/dist/commons/events/EventMetadata.d.ts +0 -7
  12. package/dist/commons/events/FieldConfig.d.ts +5 -0
  13. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  14. package/dist/commons/events/index.d.ts +1 -0
  15. package/dist/commons/events/locations.d.ts +21 -0
  16. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  17. package/dist/commons/events/scopes.d.ts +24 -1
  18. package/dist/commons/events/state/flags.d.ts +15 -0
  19. package/dist/commons/events/state/index.d.ts +0 -4
  20. package/dist/commons/events/state/utils.d.ts +0 -2
  21. package/dist/commons/events/utils.d.ts +1 -1
  22. package/dist/conditionals/index.js +12 -4
  23. package/dist/events/index.js +788 -175
  24. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  25. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  26. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  27. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  28. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  29. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  30. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  32. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  33. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  34. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  35. package/dist/migrations/v2.0/index.d.ts +5 -3
  36. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/index.js +505 -169
  38. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  39. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  40. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  41. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  42. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  43. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  44. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  45. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  46. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  47. package/dist/notification/index.js +657 -120
  48. package/dist/scopes/index.d.ts +6 -1
  49. package/dist/scopes/index.js +8 -4
  50. package/opencrvs-toolkit-2.0.0-rc.d0ccb3c.tgz +0 -0
  51. package/package.json +6 -2
  52. package/tsconfig.tsbuildinfo +1 -1
  53. package/opencrvs-toolkit-2.0.0-rc.cfdbeba.tgz +0 -0
@@ -213,6 +213,10 @@ __export(events_exports, {
213
213
  UUID: () => UUID,
214
214
  UnassignActionInput: () => UnassignActionInput,
215
215
  UserAuditRecordInput: () => UserAuditRecordInput,
216
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
217
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
218
+ V2_DEFAULT_MOCK_LOCATIONS: () => V2_DEFAULT_MOCK_LOCATIONS,
219
+ V2_DEFAULT_MOCK_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_LOCATIONS_MAP,
216
220
  ValidationConfig: () => ValidationConfig,
217
221
  VerificationActionConfig: () => VerificationActionConfig,
218
222
  VerificationPageConfig: () => VerificationPageConfig,
@@ -234,6 +238,7 @@ __export(events_exports, {
234
238
  ageToDate: () => ageToDate,
235
239
  aggregateActionAnnotations: () => aggregateActionAnnotations,
236
240
  aggregateActionDeclarations: () => aggregateActionDeclarations,
241
+ always: () => always,
237
242
  alwaysTrue: () => alwaysTrue,
238
243
  and: () => and,
239
244
  annotationActions: () => annotationActions,
@@ -302,12 +307,13 @@ __export(events_exports, {
302
307
  getActionConfig: () => getActionConfig,
303
308
  getActionReview: () => getActionReview,
304
309
  getActionReviewFields: () => getActionReviewFields,
310
+ getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
305
311
  getAllUniqueFields: () => getAllUniqueFields,
306
312
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
307
313
  getAssignedUserFromActions: () => getAssignedUserFromActions,
308
- getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
309
314
  getAssignmentStatus: () => getAssignmentStatus,
310
315
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
316
+ getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
311
317
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
312
318
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
313
319
  getCurrentEventState: () => getCurrentEventState,
@@ -318,6 +324,7 @@ __export(events_exports, {
318
324
  getDeclarationPages: () => getDeclarationPages,
319
325
  getEventConfigById: () => getEventConfigById,
320
326
  getFilePathsFromEvent: () => getFilePathsFromEvent,
327
+ getLocationHierarchy: () => getLocationHierarchy,
321
328
  getMixedPath: () => getMixedPath,
322
329
  getPendingAction: () => getPendingAction,
323
330
  getPrintCertificatePages: () => getPrintCertificatePages,
@@ -607,12 +614,14 @@ var SystemScopeType = z2.enum([
607
614
  "organisation.read-locations",
608
615
  "user.read",
609
616
  "user.create",
610
- "user.edit"
617
+ "user.edit",
618
+ "user.search"
611
619
  ]);
612
620
  var UserScopeType = SystemScopeType.extract([
613
621
  "user.read",
614
622
  "user.create",
615
- "user.edit"
623
+ "user.edit",
624
+ "user.search"
616
625
  ]);
617
626
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
618
627
  var UserScopeV2 = z2.discriminatedUnion("type", [
@@ -621,7 +630,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
621
630
  options: AllUserScopeOptions.optional()
622
631
  }),
623
632
  z2.object({
624
- type: UserScopeType.extract(["user.read"]),
633
+ type: UserScopeType.extract(["user.read", "user.search"]),
625
634
  options: AccessLevelOptions.optional()
626
635
  })
627
636
  ]);
@@ -700,7 +709,9 @@ var decodeScope = (query) => {
700
709
  };
701
710
  var DEFAULT_SCOPE_OPTIONS = {
702
711
  placeOfEvent: JurisdictionFilter.enum.all,
703
- accessLevel: JurisdictionFilter.enum.all
712
+ accessLevel: JurisdictionFilter.enum.all,
713
+ registeredIn: JurisdictionFilter.enum.all,
714
+ declaredIn: JurisdictionFilter.enum.all
704
715
  };
705
716
  function getAcceptedScopesByType({
706
717
  acceptedScopes,
@@ -1073,7 +1084,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
1073
1084
  ShowConditional,
1074
1085
  // Action can be shown to the user in the list but as disabled
1075
1086
  EnableConditional
1076
- ]);
1087
+ ]).meta({
1088
+ id: "ActionConditional",
1089
+ 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."
1090
+ });
1077
1091
  var DisplayOnReviewConditional = z7.object({
1078
1092
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
1079
1093
  conditional: Conditional
@@ -1088,8 +1102,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
1088
1102
  // Field output can be shown / hidden on the review page
1089
1103
  DisplayOnReviewConditional
1090
1104
  ]).meta({
1091
- description: "Field conditional configuration",
1092
- id: "FieldConditional"
1105
+ id: "FieldConditional",
1106
+ 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."
1093
1107
  });
1094
1108
 
1095
1109
  // ../commons/src/events/FieldType.ts
@@ -1409,28 +1423,20 @@ function schemaPriority(schema) {
1409
1423
  return idx === -1 ? 9999 : idx;
1410
1424
  }
1411
1425
  function safeUnion(schemas) {
1426
+ const sortedSchemas = [...schemas].sort(
1427
+ (a, b) => schemaPriority(a) - schemaPriority(b)
1428
+ );
1412
1429
  return z12.any().superRefine((val, ctx) => {
1413
- const successful = schemas.filter((s) => s.safeParse(val).success);
1414
- if (successful.length === 1) {
1415
- return;
1416
- }
1417
- if (successful.length === 0) {
1418
- ctx.addIssue({
1419
- code: "invalid_type",
1420
- expected: "custom",
1421
- message: "Value does not match any schema"
1422
- });
1423
- return;
1424
- }
1425
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
1426
- const best = successful[0];
1427
- if (!best.safeParse(val).success) {
1428
- ctx.addIssue({
1429
- expected: "custom",
1430
- code: "invalid_type",
1431
- message: "Value did not match the best schema"
1432
- });
1430
+ for (const schema of sortedSchemas) {
1431
+ if (schema.safeParse(val).success) {
1432
+ return;
1433
+ }
1433
1434
  }
1435
+ ctx.addIssue({
1436
+ code: "invalid_type",
1437
+ expected: "custom",
1438
+ message: "Value does not match any schema"
1439
+ });
1434
1440
  }).meta({
1435
1441
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1436
1442
  });
@@ -1740,6 +1746,9 @@ var FlagConfig = z15.object({
1740
1746
  "Indicates if this flag expects an action to be performed to be cleared."
1741
1747
  ),
1742
1748
  label: TranslationConfig.describe("Human readable label of the flag.")
1749
+ }).meta({
1750
+ id: "FlagConfig",
1751
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
1743
1752
  });
1744
1753
  var ActionFlagConfig = z15.object({
1745
1754
  id: Flag,
@@ -1747,6 +1756,9 @@ var ActionFlagConfig = z15.object({
1747
1756
  conditional: Conditional.optional().describe(
1748
1757
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1749
1758
  )
1759
+ }).meta({
1760
+ id: "ActionFlagConfig",
1761
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
1750
1762
  });
1751
1763
 
1752
1764
  // ../commons/src/events/EventMetadata.ts
@@ -1768,8 +1780,7 @@ var ActionCreationMetadata = z16.object({
1768
1780
  ),
1769
1781
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1770
1782
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1771
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1772
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1783
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1773
1784
  });
1774
1785
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1775
1786
  registrationNumber: z16.string().describe(
@@ -1797,9 +1808,6 @@ var EventMetadata = z16.object({
1797
1808
  createdAtLocation: UUID.nullish().describe(
1798
1809
  "Location of the user who created the event."
1799
1810
  ),
1800
- createdBySignature: DocumentPath.nullish().describe(
1801
- "Signature of the user who created the event."
1802
- ),
1803
1811
  updatedAtLocation: UUID.nullish().describe(
1804
1812
  "Location of the user who last changed the status."
1805
1813
  ),
@@ -2174,14 +2182,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
2174
2182
  }
2175
2183
  }).describe("Unique identifier for the field");
2176
2184
  var FieldReference = import_v43.default.object({
2177
- $$field: FieldId,
2185
+ $$field: FieldId.describe("Id of the field to reference"),
2178
2186
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
2179
2187
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
2180
2188
  )
2181
2189
  }).describe("Reference to a field by its ID");
2182
2190
  var ValidationConfig = import_v43.default.object({
2183
- validator: Conditional,
2184
- message: TranslationConfig
2191
+ validator: Conditional.describe(
2192
+ "Conditional expression that must hold for the field value to be considered valid."
2193
+ ),
2194
+ message: TranslationConfig.describe(
2195
+ "Error message displayed when the validator does not hold."
2196
+ )
2197
+ }).meta({
2198
+ id: "ValidationConfig",
2199
+ 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."
2185
2200
  });
2186
2201
  var requiredSchema = import_v43.default.union([
2187
2202
  import_v43.default.boolean(),
@@ -2220,6 +2235,9 @@ var BaseField = import_v43.default.object({
2220
2235
  }).describe("Common properties shared across all field types.");
2221
2236
  var Divider = BaseField.extend({
2222
2237
  type: import_v43.default.literal(FieldType.DIVIDER)
2238
+ }).meta({
2239
+ description: "A horizontal line divider",
2240
+ id: "Divider"
2223
2241
  });
2224
2242
  var TextField = BaseField.extend({
2225
2243
  type: import_v43.default.literal(FieldType.TEXT),
@@ -2230,7 +2248,10 @@ var TextField = BaseField.extend({
2230
2248
  prefix: TranslationConfig.optional(),
2231
2249
  postfix: TranslationConfig.optional()
2232
2250
  }).default({ type: "text" }).optional()
2233
- }).describe("Text input");
2251
+ }).meta({
2252
+ description: "A text input field",
2253
+ id: "TextField"
2254
+ });
2234
2255
  var NumberField = BaseField.extend({
2235
2256
  type: import_v43.default.literal(FieldType.NUMBER),
2236
2257
  defaultValue: NumberFieldValue.optional(),
@@ -2240,7 +2261,10 @@ var NumberField = BaseField.extend({
2240
2261
  prefix: TranslationConfig.optional(),
2241
2262
  postfix: TranslationConfig.optional()
2242
2263
  }).optional()
2243
- }).describe("Number input");
2264
+ }).meta({
2265
+ description: "A number input field",
2266
+ id: "NumberField"
2267
+ });
2244
2268
  var TextAreaField = BaseField.extend({
2245
2269
  type: import_v43.default.literal(FieldType.TEXTAREA),
2246
2270
  defaultValue: NonEmptyTextValue.optional(),
@@ -2251,7 +2275,10 @@ var TextAreaField = BaseField.extend({
2251
2275
  prefix: TranslationConfig.optional(),
2252
2276
  postfix: TranslationConfig.optional()
2253
2277
  }).default({ rows: 4 }).optional()
2254
- }).describe("Multiline text input");
2278
+ }).meta({
2279
+ description: "A multiline text input",
2280
+ id: "TextAreaField"
2281
+ });
2255
2282
  var ImageMimeType = import_v43.default.enum([
2256
2283
  "image/png",
2257
2284
  "image/jpg",
@@ -2281,13 +2308,19 @@ var SignatureField = BaseField.extend({
2281
2308
  }).default({
2282
2309
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2283
2310
  })
2284
- }).describe("Signature input field");
2311
+ }).meta({
2312
+ description: "A signature input field",
2313
+ id: "SignatureField"
2314
+ });
2285
2315
  var EmailField = BaseField.extend({
2286
2316
  type: import_v43.default.literal(FieldType.EMAIL),
2287
2317
  configuration: import_v43.default.object({
2288
2318
  maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
2289
2319
  }).default({ maxLength: 255 }).optional(),
2290
2320
  defaultValue: NonEmptyTextValue.optional()
2321
+ }).meta({
2322
+ description: "An email input field",
2323
+ id: "EmailField"
2291
2324
  });
2292
2325
  var DateField = BaseField.extend({
2293
2326
  type: import_v43.default.literal(FieldType.DATE),
@@ -2297,7 +2330,10 @@ var DateField = BaseField.extend({
2297
2330
  "Text to display above the date input"
2298
2331
  ).optional()
2299
2332
  }).optional()
2300
- }).describe("A single date input (yyyy-MM-dd)");
2333
+ }).meta({
2334
+ description: "A date input (yyyy-MM-dd)",
2335
+ id: "DateField"
2336
+ });
2301
2337
  var AgeField = BaseField.extend({
2302
2338
  type: import_v43.default.literal(FieldType.AGE),
2303
2339
  defaultValue: NumberFieldValue.optional(),
@@ -2306,7 +2342,10 @@ var AgeField = BaseField.extend({
2306
2342
  prefix: TranslationConfig.optional(),
2307
2343
  postfix: TranslationConfig.optional()
2308
2344
  })
2309
- }).describe("An age input field which uses the current date as the asOfDate");
2345
+ }).meta({
2346
+ description: "An age input field which uses the current date as the asOfDate",
2347
+ id: "AgeField"
2348
+ });
2310
2349
  var TimeField = BaseField.extend({
2311
2350
  type: import_v43.default.literal(FieldType.TIME),
2312
2351
  defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
@@ -2316,7 +2355,10 @@ var TimeField = BaseField.extend({
2316
2355
  "Text to display above the time input"
2317
2356
  ).optional()
2318
2357
  }).optional()
2319
- }).describe("A single date input (HH-mm)");
2358
+ }).meta({
2359
+ description: "A single time input (HH-mm)",
2360
+ id: "TimeField"
2361
+ });
2320
2362
  var DateRangeField = BaseField.extend({
2321
2363
  type: import_v43.default.literal(FieldType.DATE_RANGE),
2322
2364
  defaultValue: DateRangeFieldValue.optional(),
@@ -2325,7 +2367,10 @@ var DateRangeField = BaseField.extend({
2325
2367
  "Text to display above the date input"
2326
2368
  ).optional()
2327
2369
  }).optional()
2328
- }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
2370
+ }).meta({
2371
+ description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
2372
+ id: "DateRangeField"
2373
+ });
2329
2374
  var HtmlFontVariant = import_v43.default.enum([
2330
2375
  "reg12",
2331
2376
  "reg14",
@@ -2369,18 +2414,30 @@ var ImageViewField = BaseField.extend({
2369
2414
  type: import_v43.default.literal(FieldType.IMAGE_VIEW),
2370
2415
  defaultValue: NonEmptyTextValue.optional(),
2371
2416
  configuration: ImageConfiguration
2372
- }).describe("A read-only image component for form pages");
2417
+ }).meta({
2418
+ description: "A read-only image component for form pages",
2419
+ id: "ImageViewField"
2420
+ });
2373
2421
  var Paragraph = BaseField.extend({
2374
2422
  type: import_v43.default.literal(FieldType.PARAGRAPH),
2375
2423
  configuration: ParagraphConfiguration
2376
- }).describe("A read-only HTML <p> paragraph");
2424
+ }).meta({
2425
+ description: "A read-only HTML <p> paragraph",
2426
+ id: "Paragraph"
2427
+ });
2377
2428
  var Heading = BaseField.extend({
2378
2429
  type: import_v43.default.literal(FieldType.HEADING),
2379
2430
  configuration: HeadingConfiguration
2380
- }).describe("A read-only heading component for form pages");
2431
+ }).meta({
2432
+ description: "A read-only heading component for form pages",
2433
+ id: "Heading"
2434
+ });
2381
2435
  var PageHeader = BaseField.extend({
2382
2436
  type: import_v43.default.literal(FieldType.PAGE_HEADER)
2383
- }).describe("A read-only header component for form pages");
2437
+ }).meta({
2438
+ description: "A read-only header component for form pages",
2439
+ id: "PageHeader"
2440
+ });
2384
2441
  var File = BaseField.extend({
2385
2442
  type: import_v43.default.literal(FieldType.FILE),
2386
2443
  defaultValue: FileFieldValue.optional(),
@@ -2399,7 +2456,10 @@ var File = BaseField.extend({
2399
2456
  }).default({
2400
2457
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2401
2458
  })
2402
- }).describe("File upload");
2459
+ }).meta({
2460
+ description: "A file upload field",
2461
+ id: "File"
2462
+ });
2403
2463
  var SelectOption = import_v43.default.object({
2404
2464
  value: import_v43.default.string().describe("The value of the option"),
2405
2465
  label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
@@ -2416,7 +2476,10 @@ var NumberWithUnitField = BaseField.extend({
2416
2476
  "Placeholder for the number field"
2417
2477
  )
2418
2478
  }).optional()
2419
- }).describe("Number with unit input");
2479
+ }).meta({
2480
+ description: "A number with unit input field",
2481
+ id: "NumberWithUnitField"
2482
+ });
2420
2483
  var RadioGroup = BaseField.extend({
2421
2484
  type: import_v43.default.literal(FieldType.RADIO_GROUP),
2422
2485
  defaultValue: TextValue.optional(),
@@ -2426,7 +2489,10 @@ var RadioGroup = BaseField.extend({
2426
2489
  size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
2427
2490
  }).optional()
2428
2491
  }).optional()
2429
- }).describe("Grouped radio options");
2492
+ }).meta({
2493
+ description: "A grouped radio button field",
2494
+ id: "RadioGroup"
2495
+ });
2430
2496
  var BulletList = BaseField.extend({
2431
2497
  type: import_v43.default.literal(FieldType.BULLET_LIST),
2432
2498
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
@@ -2435,7 +2501,10 @@ var BulletList = BaseField.extend({
2435
2501
  fontVariant: HtmlFontVariant.optional()
2436
2502
  }).optional()
2437
2503
  }).default({})
2438
- }).describe("A list of bullet points");
2504
+ }).meta({
2505
+ description: "A list of bullet points",
2506
+ id: "BulletList"
2507
+ });
2439
2508
  var Select = BaseField.extend({
2440
2509
  type: import_v43.default.literal(FieldType.SELECT),
2441
2510
  defaultValue: TextValue.optional(),
@@ -2450,7 +2519,10 @@ var Select = BaseField.extend({
2450
2519
  { ..., defaultMessage: "'{input}' is not listed among the health facilities." }
2451
2520
  `
2452
2521
  )
2453
- }).describe("Select input");
2522
+ }).meta({
2523
+ description: "A select input field",
2524
+ id: "Select"
2525
+ });
2454
2526
  var SelectDateRangeOption = import_v43.default.object({
2455
2527
  value: SelectDateRangeValue.describe("The value of the option"),
2456
2528
  label: TranslationConfig.describe("The label of the option")
@@ -2459,7 +2531,10 @@ var SelectDateRangeField = BaseField.extend({
2459
2531
  type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
2460
2532
  defaultValue: SelectDateRangeValue.optional(),
2461
2533
  options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
2462
- }).describe("Select input with date range options");
2534
+ }).meta({
2535
+ description: "A date range selection field",
2536
+ id: "SelectDateRangeField"
2537
+ });
2463
2538
  var NameConfig = import_v43.default.object({
2464
2539
  firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
2465
2540
  middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
@@ -2490,26 +2565,41 @@ var NameField = BaseField.extend({
2490
2565
  surname: { required: true }
2491
2566
  }
2492
2567
  }).optional()
2493
- }).describe("Name input field");
2568
+ }).meta({
2569
+ description: "A field for entering a persons name",
2570
+ id: "NameField"
2571
+ });
2494
2572
  var PhoneField = BaseField.extend({
2495
2573
  defaultValue: NonEmptyTextValue.optional(),
2496
2574
  type: import_v43.default.literal(FieldType.PHONE)
2497
- }).describe("Phone input field");
2575
+ }).meta({
2576
+ description: "A field for entering a phone number",
2577
+ id: "PhoneField"
2578
+ });
2498
2579
  var IdField = BaseField.extend({
2499
2580
  defaultValue: NonEmptyTextValue.optional(),
2500
2581
  type: import_v43.default.literal(FieldType.ID)
2501
- }).describe("ID input field");
2582
+ }).meta({
2583
+ description: "A field for entering an ID",
2584
+ id: "IdField"
2585
+ });
2502
2586
  var Checkbox = BaseField.extend({
2503
2587
  type: import_v43.default.literal(FieldType.CHECKBOX),
2504
2588
  defaultValue: CheckboxFieldValue.default(false)
2505
- }).describe("Boolean checkbox field");
2589
+ }).meta({
2590
+ description: "A boolean checkbox field",
2591
+ id: "Checkbox"
2592
+ });
2506
2593
  var Country = BaseField.extend({
2507
2594
  type: import_v43.default.literal(FieldType.COUNTRY),
2508
2595
  defaultValue: NonEmptyTextValue.optional(),
2509
2596
  optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
2510
2597
  "Conditionals for specific countries. Countries not listed are always shown and enabled."
2511
2598
  )
2512
- }).describe("Country select field");
2599
+ }).meta({
2600
+ description: "A field for selecting a country",
2601
+ id: "Country"
2602
+ });
2513
2603
  var AllowedLocations = JurisdictionReference.optional().describe(
2514
2604
  "Limits which location options are selectable depending on user jurisdiction and location."
2515
2605
  );
@@ -2518,16 +2608,18 @@ var AdministrativeAreas = import_v43.default.enum([
2518
2608
  "HEALTH_FACILITY",
2519
2609
  "CRVS_OFFICE"
2520
2610
  ]);
2521
- var AdministrativeAreaConfiguration = import_v43.default.object({
2522
- partOf: FieldReference.optional().describe("Parent location"),
2523
- type: AdministrativeAreas,
2524
- allowedLocations: AllowedLocations
2525
- }).describe("Administrative area options");
2526
2611
  var AdministrativeAreaField = BaseField.extend({
2527
2612
  type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
2528
2613
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
2529
- configuration: AdministrativeAreaConfiguration
2530
- }).describe("Administrative area input field e.g. facility, office");
2614
+ configuration: import_v43.default.object({
2615
+ partOf: FieldReference.optional().describe("Parent location"),
2616
+ type: AdministrativeAreas,
2617
+ allowedLocations: AllowedLocations
2618
+ }).describe("Administrative area options")
2619
+ }).meta({
2620
+ description: "Administrative area input field",
2621
+ id: "AdministrativeAreaField"
2622
+ });
2531
2623
  var LocationInput = BaseField.extend({
2532
2624
  type: import_v43.default.literal(FieldType.LOCATION),
2533
2625
  defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
@@ -2535,7 +2627,10 @@ var LocationInput = BaseField.extend({
2535
2627
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2536
2628
  allowedLocations: AllowedLocations
2537
2629
  }).optional()
2538
- }).describe("Input field for a location");
2630
+ }).meta({
2631
+ description: "A field for selecting a location",
2632
+ id: "LocationInput"
2633
+ });
2539
2634
  var FileUploadWithOptions = BaseField.extend({
2540
2635
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
2541
2636
  options: import_v43.default.array(SelectOption).describe("A list of options"),
@@ -2549,6 +2644,9 @@ var FileUploadWithOptions = BaseField.extend({
2549
2644
  }).default({
2550
2645
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
2551
2646
  })
2647
+ }).meta({
2648
+ description: "A field for uploading files with file type options",
2649
+ id: "FileUploadWithOptions"
2552
2650
  });
2553
2651
  var Facility = BaseField.extend({
2554
2652
  type: import_v43.default.literal(FieldType.FACILITY),
@@ -2594,7 +2692,10 @@ var Address = BaseField.extend({
2594
2692
  allowedLocations: AllowedLocations
2595
2693
  }).optional(),
2596
2694
  defaultValue: DefaultAddressFieldValue.optional()
2597
- }).describe("Address input field \u2013 a combination of location and text fields");
2695
+ }).meta({
2696
+ description: "Address input field \u2013 a combination of location and text fields",
2697
+ id: "Address"
2698
+ });
2598
2699
  var StaticDataEntry = import_v43.default.object({
2599
2700
  id: import_v43.default.string().describe("ID for the data entry."),
2600
2701
  label: TranslationConfig,
@@ -2609,7 +2710,10 @@ var DataField = BaseField.extend({
2609
2710
  subtitle: TranslationConfig.optional(),
2610
2711
  data: import_v43.default.array(DataEntry)
2611
2712
  })
2612
- }).describe("Data field for displaying read-only data");
2713
+ }).meta({
2714
+ description: "A field for displaying a table of read-only data",
2715
+ id: "DataField"
2716
+ });
2613
2717
  var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2614
2718
  var ButtonType = import_v43.default.enum([
2615
2719
  "primary",
@@ -2636,11 +2740,17 @@ var ButtonField = BaseField.extend({
2636
2740
  type: import_v43.default.literal(FieldType.BUTTON),
2637
2741
  defaultValue: ButtonFieldValue.optional(),
2638
2742
  configuration: ButtonConfiguration
2639
- }).describe("Generic button without any built-in functionality");
2743
+ }).meta({
2744
+ description: "A generic button that can be used to trigger an action",
2745
+ id: "ButtonField"
2746
+ });
2640
2747
  var FieldGroup = BaseField.extend({
2641
2748
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2642
2749
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2643
2750
  fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2751
+ }).meta({
2752
+ description: "A group of fields that are displayed together",
2753
+ id: "FieldGroup"
2644
2754
  });
2645
2755
  var AlphaPrintButton = BaseField.extend({
2646
2756
  type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
@@ -2650,7 +2760,10 @@ var AlphaPrintButton = BaseField.extend({
2650
2760
  "Label for the print button"
2651
2761
  )
2652
2762
  })
2653
- }).describe("Print button field for printing certificates");
2763
+ }).meta({
2764
+ description: "An experimental print button field for printing certificates during the declaration process",
2765
+ id: "AlphaPrintButton"
2766
+ });
2654
2767
  var HttpField = BaseField.extend({
2655
2768
  type: import_v43.default.literal(FieldType.HTTP),
2656
2769
  defaultValue: HttpFieldValue.optional(),
@@ -2666,20 +2779,30 @@ var HttpField = BaseField.extend({
2666
2779
  params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
2667
2780
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2668
2781
  })
2669
- }).describe("HTTP request function triggered by a button click or other event");
2782
+ }).meta({
2783
+ 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.",
2784
+ id: "HttpField"
2785
+ });
2670
2786
  var AutocompleteField = BaseField.extend({
2671
2787
  type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2672
2788
  configuration: import_v43.default.object({
2673
- url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2789
+ url: import_v43.default.string().describe(
2790
+ "URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
2791
+ ).optional(),
2674
2792
  method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2675
2793
  defaultOptions: import_v43.default.array(
2676
2794
  import_v43.default.object({
2677
2795
  label: import_v43.default.string(),
2678
2796
  value: import_v43.default.string()
2679
2797
  })
2680
- ).optional()
2798
+ ).optional().describe(
2799
+ "Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
2800
+ )
2681
2801
  })
2682
- }).describe("Autocomplete input field");
2802
+ }).meta({
2803
+ 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.",
2804
+ id: "AutocompleteField"
2805
+ });
2683
2806
  var SearchField = HttpField.extend({
2684
2807
  type: import_v43.default.literal(FieldType.SEARCH),
2685
2808
  configuration: SearchQuery.pick({
@@ -2712,6 +2835,9 @@ var SearchField = HttpField.extend({
2712
2835
  ok: TranslationConfig.optional()
2713
2836
  }).optional()
2714
2837
  })
2838
+ }).meta({
2839
+ description: "A search input field",
2840
+ id: "SearchField"
2715
2841
  });
2716
2842
  var LinkButtonField = BaseField.extend({
2717
2843
  type: import_v43.default.literal(FieldType.LINK_BUTTON),
@@ -2720,7 +2846,10 @@ var LinkButtonField = BaseField.extend({
2720
2846
  text: TranslationConfig.describe("Text to display on the button"),
2721
2847
  icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
2722
2848
  })
2723
- }).describe("Button that opens a link");
2849
+ }).meta({
2850
+ description: "A button that opens a URL link",
2851
+ id: "LinkButtonField"
2852
+ });
2724
2853
  var VerificationStatus = BaseField.extend({
2725
2854
  type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
2726
2855
  defaultValue: VerificationStatusValue.optional(),
@@ -2730,15 +2859,19 @@ var VerificationStatus = BaseField.extend({
2730
2859
  "Explaining text on the banner in form."
2731
2860
  )
2732
2861
  })
2862
+ }).meta({
2863
+ 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.",
2864
+ id: "VerificationStatus"
2733
2865
  });
2734
2866
  var QueryParamReaderField = BaseField.extend({
2735
2867
  type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
2736
2868
  configuration: import_v43.default.object({
2737
2869
  pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
2738
2870
  })
2739
- }).describe(
2740
- "A field that maps URL query params into form values and clears them afterward"
2741
- );
2871
+ }).meta({
2872
+ description: "A field that maps URL query params into form values and clears them afterward",
2873
+ id: "QueryParamReaderField"
2874
+ });
2742
2875
  var QrReaderField = BaseField.extend({
2743
2876
  type: import_v43.default.literal(FieldType.QR_READER),
2744
2877
  defaultValue: QrReaderFieldValue.optional(),
@@ -2749,7 +2882,7 @@ var QrReaderField = BaseField.extend({
2749
2882
  })
2750
2883
  }).optional()
2751
2884
  }).meta({
2752
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2885
+ description: "QR code reader field, including optional JSON Schema validator.",
2753
2886
  id: "QrReaderField"
2754
2887
  });
2755
2888
  var IdReaderField = BaseField.extend({
@@ -2758,12 +2891,18 @@ var IdReaderField = BaseField.extend({
2758
2891
  methods: import_v43.default.array(
2759
2892
  import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2760
2893
  )
2894
+ }).meta({
2895
+ description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
2896
+ id: "IdReaderField"
2761
2897
  });
2762
2898
  var CustomField = BaseField.extend({
2763
2899
  type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
2764
2900
  defaultValue: CustomFieldValue.optional(),
2765
2901
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2766
2902
  configuration: import_v43.default.unknown().optional()
2903
+ }).meta({
2904
+ description: "An expiremental custom field that is defined by a module source path",
2905
+ id: "CustomField"
2767
2906
  });
2768
2907
  var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2769
2908
  var LoaderField = BaseField.extend({
@@ -2773,22 +2912,25 @@ var LoaderField = BaseField.extend({
2773
2912
  configuration: import_v43.default.object({
2774
2913
  text: TranslationConfig.describe("Display text above the loading spinner")
2775
2914
  })
2776
- }).describe(
2777
- "A non-interactive field that indicates an in progress operation in form"
2778
- );
2915
+ }).meta({
2916
+ description: "A non-interactive field that indicates an in progress operation in form",
2917
+ id: "LoaderField"
2918
+ });
2779
2919
  var HiddenField = BaseField.extend({
2780
2920
  type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
2781
2921
  required: import_v43.default.boolean().default(false).optional(),
2782
2922
  defaultValue: TextValue.optional()
2783
- }).describe(
2784
- "A non-interactive, hidden field that only hold a value in the form"
2785
- );
2923
+ }).meta({
2924
+ description: "A non-interactive, hidden field that only hold a value in the form",
2925
+ id: "HiddenField"
2926
+ });
2786
2927
  var UserRoleField = BaseField.extend({
2787
2928
  type: import_v43.default.literal(FieldType.USER_ROLE),
2788
2929
  defaultValue: TextValue.optional()
2789
- }).describe(
2790
- "A select dropdown that is automatically populated with available user roles"
2791
- );
2930
+ }).meta({
2931
+ description: "A select dropdown that is automatically populated with available user roles",
2932
+ id: "UserRoleField"
2933
+ });
2792
2934
  var FieldConfig = import_v43.default.discriminatedUnion("type", [
2793
2935
  FieldGroup,
2794
2936
  Address,
@@ -2887,16 +3029,19 @@ var VerificationPageConfig = FormPageConfig.extend({
2887
3029
  type: z21.literal(PageTypes.enum.VERIFICATION),
2888
3030
  actions: VerificationActionConfig
2889
3031
  });
2890
- var PageConfig = z21.discriminatedUnion("type", [
2891
- FormPageConfig,
2892
- VerificationPageConfig
2893
- ]);
3032
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
3033
+ id: "PageConfig",
3034
+ 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."
3035
+ });
2894
3036
 
2895
3037
  // ../commons/src/events/FormConfig.ts
2896
3038
  var DeclarationFormConfig = z22.object({
2897
3039
  label: TranslationConfig.describe("Human readable description of the form"),
2898
3040
  pages: z22.array(FormPageConfig)
2899
- }).describe("Configuration of the declaration form.");
3041
+ }).meta({
3042
+ id: "DeclarationFormConfig",
3043
+ description: "Configuration of the declaration form."
3044
+ });
2900
3045
  var ActionFormConfig = z22.object({
2901
3046
  label: TranslationConfig.describe("Human readable description of the form"),
2902
3047
  pages: z22.array(PageConfig)
@@ -2996,6 +3141,9 @@ var DeduplicationConfig = z23.object({
2996
3141
  id: z23.string(),
2997
3142
  label: TranslationConfig,
2998
3143
  query: Clause
3144
+ }).meta({
3145
+ id: "DeduplicationConfig",
3146
+ 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."
2999
3147
  });
3000
3148
 
3001
3149
  // ../commons/src/events/ActionConfig.ts
@@ -3113,17 +3261,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
3113
3261
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
3114
3262
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
3115
3263
  */
3116
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
3117
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
3118
- RejectConfig.meta({ id: "RejectActionConfig" }),
3119
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
3264
+ ReadActionConfig.meta({
3265
+ id: "ReadActionConfig",
3266
+ description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
3267
+ }),
3268
+ DeclareConfig.meta({
3269
+ id: "DeclareActionConfig",
3270
+ description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
3271
+ }),
3272
+ RejectConfig.meta({
3273
+ id: "RejectActionConfig",
3274
+ description: "Configuration for rejecting a record before registration."
3275
+ }),
3276
+ RegisterConfig.meta({
3277
+ id: "RegisterActionConfig",
3278
+ description: "Configuration for registering a record."
3279
+ }),
3120
3280
  PrintCertificateActionConfig.meta({
3121
- id: "PrintCertificateActionConfig"
3281
+ id: "PrintCertificateActionConfig",
3282
+ description: "Configuration for printing a certificate of a registered record."
3283
+ }),
3284
+ RequestCorrectionConfig.meta({
3285
+ id: "RequestCorrectionActionConfig",
3286
+ description: "Configuration for requesting a correction on a registered record."
3287
+ }),
3288
+ EditActionConfig.meta({
3289
+ id: "EditActionConfig",
3290
+ description: "Configuration for editing a record before registration."
3122
3291
  }),
3123
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
3124
- EditActionConfig.meta({ id: "EditActionConfig" }),
3125
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
3126
- CustomActionConfig.meta({ id: "CustomActionConfig" })
3292
+ ArchiveConfig.meta({
3293
+ id: "ArchiveActionConfig",
3294
+ description: "Configuration for archiving a record."
3295
+ }),
3296
+ CustomActionConfig.meta({
3297
+ id: "CustomActionConfig",
3298
+ description: "Configuration for a country-defined custom action. An event may include any number of these."
3299
+ })
3127
3300
  ]).describe(
3128
3301
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
3129
3302
  ).meta({ id: "ActionConfig" });
@@ -3199,7 +3372,10 @@ var Field = BaseField2.extend({
3199
3372
  }).describe("Custom field defined for the summary view.");
3200
3373
  var SummaryConfig = z27.object({
3201
3374
  fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
3202
- }).describe("Configuration of the event summary section.");
3375
+ }).meta({
3376
+ id: "SummaryConfig",
3377
+ 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."
3378
+ });
3203
3379
 
3204
3380
  // ../commons/src/events/AdvancedSearchConfig.ts
3205
3381
  var z28 = __toESM(require("zod/v4"));
@@ -3323,6 +3499,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
3323
3499
  var AdvancedSearchConfig = z28.object({
3324
3500
  title: TranslationConfig.describe("Advanced search tab title"),
3325
3501
  fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
3502
+ }).meta({
3503
+ id: "AdvancedSearchConfig",
3504
+ 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()`)."
3326
3505
  });
3327
3506
 
3328
3507
  // ../commons/src/events/utils.ts
@@ -3799,6 +3978,9 @@ function precompileActionSchemas(eventConfigurations) {
3799
3978
  function isAgeValue(value) {
3800
3979
  return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
3801
3980
  }
3981
+ function mergeWithBaseFormState(values, context) {
3982
+ return { ...context.baseFormState, ...values };
3983
+ }
3802
3984
  function validate(schema, data) {
3803
3985
  const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
3804
3986
  if ("$form" in data) {
@@ -3837,7 +4019,7 @@ function isOnline() {
3837
4019
  }
3838
4020
  function isConditionMet(conditional, values, context, eventIndex) {
3839
4021
  return validate(conditional, {
3840
- $form: values,
4022
+ $form: mergeWithBaseFormState(values, context),
3841
4023
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3842
4024
  $online: isOnline(),
3843
4025
  $user: context.user,
@@ -3866,7 +4048,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
3866
4048
  return true;
3867
4049
  }
3868
4050
  const validConditionals = getConditionalActionsForField(field3, {
3869
- $form: form,
4051
+ $form: mergeWithBaseFormState(form, context),
3870
4052
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
3871
4053
  $online: isOnline(),
3872
4054
  $user: context.user,
@@ -4058,7 +4240,7 @@ function runFieldValidations({
4058
4240
  return [];
4059
4241
  }
4060
4242
  const conditionalParameters = {
4061
- $form: form,
4243
+ $form: mergeWithBaseFormState(form, context),
4062
4244
  $now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
4063
4245
  /**
4064
4246
  * In real use cases, there can be hundreds of thousands of locations.
@@ -4302,17 +4484,16 @@ function isPageVisible(page, formValues, context) {
4302
4484
  }
4303
4485
  return isConditionMet(page.conditional, formValues, context);
4304
4486
  }
4305
- function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false, declarationContext) {
4487
+ function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
4306
4488
  const base = (0, import_lodash.cloneDeep)(formValues);
4307
4489
  function fn(prevVisibilityContext) {
4308
- const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
4309
4490
  const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
4310
4491
  const fieldConfig = fields.filter((f) => f.id === fieldId);
4311
4492
  if (!fieldConfig.length) {
4312
4493
  return false;
4313
4494
  }
4314
4495
  const isHidden = fieldConfig.every(
4315
- (f) => !isFieldVisible(f, visibilityForm, validatorContext)
4496
+ (f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
4316
4497
  );
4317
4498
  if (!isHidden) {
4318
4499
  return false;
@@ -4330,7 +4511,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
4330
4511
  const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4331
4512
  const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
4332
4513
  const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
4333
- return hiddenFields.some((f) => f.id === fieldId);
4514
+ return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
4334
4515
  });
4335
4516
  return omitHiddenFields(
4336
4517
  visibleFields,
@@ -4377,13 +4558,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
4377
4558
  }
4378
4559
  function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
4379
4560
  const annotationFields = getActionAnnotationFields(actionConfig);
4380
- return omitHiddenFields(
4381
- annotationFields,
4382
- annotation,
4383
- context,
4384
- false,
4385
- declaration
4386
- );
4561
+ return omitHiddenFields(annotationFields, annotation, {
4562
+ ...context,
4563
+ baseFormState: declaration
4564
+ });
4387
4565
  }
4388
4566
  function deepMerge(currentDocument, actionDocument) {
4389
4567
  const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
@@ -4677,6 +4855,9 @@ function not(condition) {
4677
4855
  function never2() {
4678
4856
  return not(alwaysTrue());
4679
4857
  }
4858
+ function always() {
4859
+ return defineConditional(alwaysTrue());
4860
+ }
4680
4861
  function jsonFieldPath(field3) {
4681
4862
  return [field3.$$field, ...field3.$$subfield].join("/");
4682
4863
  }
@@ -5372,7 +5553,7 @@ var _EventConfigBase = z33.object({
5372
5553
  ),
5373
5554
  label: TranslationConfig.describe("Human-readable label for the event type."),
5374
5555
  actions: z33.array(ActionConfig).describe(
5375
- "Configuration of system-defined actions associated with the event."
5556
+ "Configuration of core and custom actions associated with the event."
5376
5557
  ),
5377
5558
  actionOrder: z33.array(z33.string()).optional().describe(
5378
5559
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -5384,7 +5565,7 @@ var _EventConfigBase = z33.object({
5384
5565
  "Configuration of fields available in the advanced search feature."
5385
5566
  ),
5386
5567
  flags: z33.array(FlagConfig).optional().default([]).describe(
5387
- "Configuration of flags associated with the actions of this event type."
5568
+ "Configuration of custom flags associated with the actions of this event type."
5388
5569
  ),
5389
5570
  analytics: z33.boolean().optional().default(true).describe(
5390
5571
  "Indicates whether the records of this event type are included in analytics"
@@ -5397,8 +5578,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
5397
5578
  validateActionFlags(event2, ctx);
5398
5579
  validateActionOrder(event2, ctx);
5399
5580
  }).meta({
5400
- id: "EventConfig"
5401
- }).describe("Configuration defining an event type.");
5581
+ id: "EventConfig",
5582
+ description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
5583
+ });
5402
5584
 
5403
5585
  // ../commons/src/events/EventConfigInput.ts
5404
5586
  var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
@@ -5621,6 +5803,9 @@ var WorkqueueColumnValue = z34.object({
5621
5803
  var WorkqueueColumn = z34.object({
5622
5804
  label: TranslationConfig,
5623
5805
  value: WorkqueueColumnValue
5806
+ }).meta({
5807
+ id: "WorkqueueColumn",
5808
+ description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
5624
5809
  });
5625
5810
  function defineWorkqueuesColumns(workqueueColumns) {
5626
5811
  return workqueueColumns.map(
@@ -5823,18 +6008,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5823
6008
  query: true,
5824
6009
  columns: true
5825
6010
  });
5826
- var WorkqueueConfigInput = z37.object({
5827
- slug: z37.string().describe("Determines the url of the workqueue."),
5828
- name: TranslationConfig.describe(
5829
- "Title of the workflow (both in navigation and on the page)"
5830
- ),
5831
- query: CountryConfigQueryInputType,
5832
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
5833
- "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."
5834
- ),
5835
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
5836
- icon: AvailableIcons,
5837
- emptyMessage: TranslationConfig.optional()
6011
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
6012
+ query: CountryConfigQueryInputType
6013
+ }).meta({
6014
+ id: "WorkqueueConfig",
6015
+ 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."
5838
6016
  });
5839
6017
  function defineWorkqueue(workqueueInput) {
5840
6018
  const queryInput = workqueueInput.query;
@@ -5895,6 +6073,11 @@ var BaseActionInput = z38.object({
5895
6073
  originalActionId: UUID.optional(),
5896
6074
  // should not be part of base action.
5897
6075
  keepAssignment: z38.boolean().optional(),
6076
+ keepAssignmentIfAccepted: z38.boolean().optional(),
6077
+ keepAssignmentIfRejected: z38.boolean().optional(),
6078
+ waitFor: z38.boolean().default(true).describe(
6079
+ "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."
6080
+ ),
5898
6081
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5899
6082
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
5900
6083
  createdAtLocation: UUID.nullish().describe(
@@ -6074,7 +6257,7 @@ var Draft = z39.object({
6074
6257
  }).describe(
6075
6258
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
6076
6259
  );
6077
- var DraftInput = BaseActionInput.extend({
6260
+ var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
6078
6261
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
6079
6262
  status: z39.enum([
6080
6263
  ActionStatus.Requested,
@@ -6148,7 +6331,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
6148
6331
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
6149
6332
  acceptedAt: acceptAction.createdAt,
6150
6333
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
6151
- createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
6152
6334
  registrationNumber
6153
6335
  };
6154
6336
  }
@@ -6206,26 +6388,43 @@ var import_date_fns3 = require("date-fns");
6206
6388
  function isEditInProgress(actions) {
6207
6389
  return actions.at(-1)?.type === ActionType.EDIT;
6208
6390
  }
6391
+ function findPendingCorrectionAction(writeActions2) {
6392
+ let correctionRequestAction;
6393
+ for (let i = writeActions2.length - 1; i >= 0; i--) {
6394
+ const action = writeActions2[i];
6395
+ if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
6396
+ break;
6397
+ }
6398
+ if (action.type === ActionType.REQUEST_CORRECTION) {
6399
+ correctionRequestAction = action;
6400
+ break;
6401
+ }
6402
+ }
6403
+ return correctionRequestAction;
6404
+ }
6209
6405
  function isCorrectionRequested(actions) {
6406
+ return findPendingCorrectionAction(actions) !== void 0;
6407
+ }
6408
+ function isDeclarationIncomplete(actions) {
6409
+ return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6410
+ }
6411
+ function isRejected(actions) {
6412
+ const resettingActionTypes = [
6413
+ ActionType.NOTIFY,
6414
+ ActionType.DECLARE,
6415
+ ActionType.EDIT,
6416
+ ActionType.REGISTER
6417
+ ];
6210
6418
  return actions.reduce((prev, { type }) => {
6211
- if (type === ActionType.REQUEST_CORRECTION) {
6419
+ if (type === ActionType.REJECT) {
6212
6420
  return true;
6213
6421
  }
6214
- if (type === ActionType.APPROVE_CORRECTION) {
6215
- return false;
6216
- }
6217
- if (type === ActionType.REJECT_CORRECTION) {
6422
+ if (resettingActionTypes.includes(type)) {
6218
6423
  return false;
6219
6424
  }
6220
6425
  return prev;
6221
6426
  }, false);
6222
6427
  }
6223
- function isDeclarationIncomplete(actions) {
6224
- return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
6225
- }
6226
- function isRejected(actions) {
6227
- return actions.at(-1)?.type === ActionType.REJECT;
6228
- }
6229
6428
  function isPotentialDuplicate(actions) {
6230
6429
  return actions.reduce((prev, { type }) => {
6231
6430
  if (type === ActionType.DUPLICATE_DETECTED) {
@@ -6288,8 +6487,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
6288
6487
  return (0, import_lodash3.uniq)(flags);
6289
6488
  }, []);
6290
6489
  }
6291
- function getEventFlags(event2, config) {
6292
- const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6490
+ function getActionStatusFlags(sortedActions) {
6293
6491
  const actionStatus = sortedActions.reduce(
6294
6492
  (actionStatuses, { type, status: status2 }) => ({
6295
6493
  ...actionStatuses,
@@ -6297,26 +6495,40 @@ function getEventFlags(event2, config) {
6297
6495
  }),
6298
6496
  {}
6299
6497
  );
6300
- const flags = Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6498
+ return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
6301
6499
  const flag2 = joinValues([type, status2], ":").toLowerCase();
6302
6500
  return flag2;
6303
6501
  });
6304
- if (isCorrectionRequested(sortedActions)) {
6305
- flags.push(InherentFlags.CORRECTION_REQUESTED);
6502
+ }
6503
+ function getInherentFlags(sortedActions) {
6504
+ const acceptedActions = sortedActions.filter(
6505
+ ({ status: status2 }) => status2 === ActionStatus.Accepted
6506
+ );
6507
+ const inherentFlags = [];
6508
+ if (isCorrectionRequested(acceptedActions)) {
6509
+ inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
6306
6510
  }
6307
- if (isDeclarationIncomplete(sortedActions)) {
6308
- flags.push(InherentFlags.INCOMPLETE);
6511
+ if (isDeclarationIncomplete(acceptedActions)) {
6512
+ inherentFlags.push(InherentFlags.INCOMPLETE);
6309
6513
  }
6310
- if (isRejected(sortedActions)) {
6311
- flags.push(InherentFlags.REJECTED);
6514
+ if (isRejected(acceptedActions)) {
6515
+ inherentFlags.push(InherentFlags.REJECTED);
6312
6516
  }
6313
- if (isPotentialDuplicate(sortedActions)) {
6314
- flags.push(InherentFlags.POTENTIAL_DUPLICATE);
6517
+ if (isPotentialDuplicate(acceptedActions)) {
6518
+ inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
6315
6519
  }
6316
- if (isEditInProgress(sortedActions)) {
6317
- flags.push(InherentFlags.EDIT_IN_PROGRESS);
6520
+ if (isEditInProgress(acceptedActions)) {
6521
+ inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
6318
6522
  }
6319
- return [...flags, ...resolveEventCustomFlags(event2, config)];
6523
+ return inherentFlags;
6524
+ }
6525
+ function getEventFlags(event2, config) {
6526
+ const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6527
+ return [
6528
+ ...getActionStatusFlags(sortedActions),
6529
+ ...getInherentFlags(sortedActions),
6530
+ ...resolveEventCustomFlags(event2, config)
6531
+ ];
6320
6532
  }
6321
6533
 
6322
6534
  // ../commons/src/events/state/index.ts
@@ -6362,17 +6574,6 @@ function getAssignedUserFromActions(actions) {
6362
6574
  return user2;
6363
6575
  }, null);
6364
6576
  }
6365
- function getAssignedUserSignatureFromActions(actions) {
6366
- return actions.reduce((signature, action) => {
6367
- if (action.type === ActionType.ASSIGN) {
6368
- return action.createdBySignature || null;
6369
- }
6370
- if (action.type === ActionType.UNASSIGN) {
6371
- return null;
6372
- }
6373
- return signature;
6374
- }, null);
6375
- }
6376
6577
  function deepDropNulls(obj) {
6377
6578
  if (Array.isArray(obj)) {
6378
6579
  return obj.map(deepDropNulls);
@@ -6468,10 +6669,8 @@ function getCurrentEventState(event2, config) {
6468
6669
  createdBy: creationAction.createdBy,
6469
6670
  createdByUserType: creationAction.createdByUserType,
6470
6671
  createdAtLocation: creationAction.createdAtLocation,
6471
- createdBySignature: creationAction.createdBySignature,
6472
6672
  updatedAt: acceptedActionMetadata.createdAt,
6473
6673
  assignedTo: getAssignedUserFromActions(acceptedActions),
6474
- assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
6475
6674
  updatedBy: requestActionMetadata.createdBy,
6476
6675
  updatedAtLocation: requestActionMetadata.createdAtLocation,
6477
6676
  declaration,
@@ -9730,7 +9929,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
9730
9929
  createdBy: overrides.createdBy ?? generateUuid(rng),
9731
9930
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
9732
9931
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
9733
- createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
9734
9932
  updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
9735
9933
  assignedTo: overrides.assignedTo ?? null,
9736
9934
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -10001,6 +10199,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
10001
10199
  (scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
10002
10200
  );
10003
10201
  }
10202
+ function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
10203
+ const collectedLocations = [];
10204
+ const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
10205
+ let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
10206
+ while (current) {
10207
+ collectedLocations.push(current);
10208
+ if (!current.parentId) {
10209
+ break;
10210
+ }
10211
+ const parentId = current.parentId;
10212
+ current = administrativeAreas.get(parentId);
10213
+ }
10214
+ return collectedLocations;
10215
+ }
10216
+ function getLocationHierarchy(selectedId, context) {
10217
+ const { administrativeAreas, locations } = context;
10218
+ const loc = locations.get(selectedId);
10219
+ if (loc) {
10220
+ if (loc.administrativeAreaId) {
10221
+ const hierarchy2 = getAdministrativeAreaHierarchy(
10222
+ loc.administrativeAreaId,
10223
+ administrativeAreas
10224
+ );
10225
+ return [...hierarchy2.reverse().map((area) => area.id), loc.id];
10226
+ }
10227
+ return [loc.id];
10228
+ }
10229
+ const hierarchy = getAdministrativeAreaHierarchy(
10230
+ selectedId,
10231
+ administrativeAreas
10232
+ );
10233
+ return hierarchy.reverse().map((area) => area.id);
10234
+ }
10004
10235
 
10005
10236
  // ../commons/src/events/scopes.ts
10006
10237
  var ACTION_SCOPE_MAP = {
@@ -10075,6 +10306,25 @@ function isActionInScope({
10075
10306
  );
10076
10307
  return canAccess;
10077
10308
  }
10309
+ function getAvailableRolesForUserUpdatePayload({
10310
+ allRoles,
10311
+ userLocation,
10312
+ acceptedScopes,
10313
+ userRequesting
10314
+ }) {
10315
+ const availableRoles = allRoles.filter((role) => {
10316
+ const canAccess = canAccessOtherUserWithScopes({
10317
+ userToAccess: {
10318
+ ...userLocation,
10319
+ role
10320
+ },
10321
+ user: userRequesting,
10322
+ scopes: acceptedScopes
10323
+ });
10324
+ return canAccess;
10325
+ });
10326
+ return availableRoles;
10327
+ }
10078
10328
 
10079
10329
  // ../commons/src/events/serializers/user/deserializer.ts
10080
10330
  function userDeserializer(serializedUserField, user2) {
@@ -10277,3 +10527,366 @@ function getFilePathsFromEvent(event2) {
10277
10527
  });
10278
10528
  return (0, import_lodash7.uniq)(filepaths);
10279
10529
  }
10530
+
10531
+ // ../commons/src/events/mocks.test.utils.ts
10532
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
10533
+ {
10534
+ id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10535
+ name: "Central",
10536
+ parentId: null,
10537
+ validUntil: null,
10538
+ externalId: "ydyJb1RAy4U1"
10539
+ },
10540
+ {
10541
+ id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10542
+ name: "Sulaka",
10543
+ parentId: null,
10544
+ validUntil: null,
10545
+ externalId: "pQ8nGxWmZ2Q3"
10546
+ },
10547
+ {
10548
+ id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
10549
+ name: "Pualula",
10550
+ parentId: null,
10551
+ validUntil: null,
10552
+ externalId: "Aq91DweLmT8k"
10553
+ },
10554
+ {
10555
+ id: "6d1a59df-988c-4021-a846-ccbc021931a7",
10556
+ name: "Chuminga",
10557
+ parentId: null,
10558
+ validUntil: null,
10559
+ externalId: "Rw0fYNh2Xk9a"
10560
+ },
10561
+ {
10562
+ id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10563
+ name: "Ibombo",
10564
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10565
+ validUntil: null,
10566
+ externalId: "k7DsP4vbN1Qe"
10567
+ },
10568
+ {
10569
+ id: "27160bbd-32d1-4625-812f-860226bfb92a",
10570
+ name: "Isango",
10571
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10572
+ validUntil: null,
10573
+ externalId: "Gm3Z9eQpHw4L"
10574
+ },
10575
+ {
10576
+ id: "967032fd-3f81-478a-826c-30cb8fe121bd",
10577
+ name: "Isamba",
10578
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10579
+ validUntil: null,
10580
+ externalId: "sT0xVu1KqJ7r"
10581
+ },
10582
+ {
10583
+ id: "89a33893-b17d-481d-a26d-6461e7ac1651",
10584
+ name: "Itambo",
10585
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10586
+ validUntil: null,
10587
+ externalId: "Nq6Bv2HpL9Te"
10588
+ },
10589
+ {
10590
+ id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
10591
+ name: "Ezhi",
10592
+ parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10593
+ validUntil: null,
10594
+ externalId: "xK8cQ0ZRy5Wd"
10595
+ },
10596
+ {
10597
+ id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10598
+ name: "Ilanga",
10599
+ parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10600
+ validUntil: null,
10601
+ externalId: "Cq4Jm1XvN8Ls"
10602
+ },
10603
+ // Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
10604
+ {
10605
+ id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
10606
+ name: "Klow",
10607
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10608
+ validUntil: null,
10609
+ externalId: "IkYcYBUcyY2"
10610
+ },
10611
+ {
10612
+ id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
10613
+ name: "Mbondo",
10614
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10615
+ validUntil: null,
10616
+ externalId: "Qhvv5hvo3mY"
10617
+ },
10618
+ {
10619
+ id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
10620
+ name: "Ndara",
10621
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10622
+ validUntil: null,
10623
+ externalId: "crXh068O9TR"
10624
+ },
10625
+ {
10626
+ id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
10627
+ name: "Olani",
10628
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10629
+ validUntil: null,
10630
+ externalId: "r00It8Tvvp7"
10631
+ },
10632
+ {
10633
+ id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
10634
+ name: "Pemba",
10635
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10636
+ validUntil: null,
10637
+ externalId: "ZnUWsbONIaH"
10638
+ },
10639
+ {
10640
+ id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
10641
+ name: "Quanza",
10642
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10643
+ validUntil: null,
10644
+ externalId: "fDZycvQTa7l"
10645
+ },
10646
+ {
10647
+ id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
10648
+ name: "Rivka",
10649
+ parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10650
+ validUntil: null,
10651
+ externalId: "KqswxCGTELa"
10652
+ },
10653
+ // Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
10654
+ {
10655
+ id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
10656
+ name: "Mbula",
10657
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10658
+ validUntil: null,
10659
+ externalId: "osEbKjRc9Kg"
10660
+ },
10661
+ {
10662
+ id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
10663
+ name: "Ndoki",
10664
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10665
+ validUntil: null,
10666
+ externalId: "aq4daBUAGr3"
10667
+ },
10668
+ {
10669
+ id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
10670
+ name: "Tsanga",
10671
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10672
+ validUntil: null,
10673
+ externalId: "cqis6Y8trbJ"
10674
+ },
10675
+ {
10676
+ id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
10677
+ name: "Waziri",
10678
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10679
+ validUntil: null,
10680
+ externalId: "LMijHPyyx6d"
10681
+ },
10682
+ {
10683
+ id: "2c5d6e7f-8a9b-4423-8def-456789012345",
10684
+ name: "Zimbi",
10685
+ parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10686
+ validUntil: null,
10687
+ externalId: "pcQYbPuKGZ7"
10688
+ },
10689
+ // Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
10690
+ {
10691
+ id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
10692
+ name: "Felani",
10693
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10694
+ validUntil: null,
10695
+ externalId: "gSqpoCGdMXp"
10696
+ },
10697
+ {
10698
+ id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
10699
+ name: "Goroma",
10700
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10701
+ validUntil: null,
10702
+ externalId: "KvAAIaNqVrp"
10703
+ },
10704
+ {
10705
+ id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
10706
+ name: "Halifu",
10707
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10708
+ validUntil: null,
10709
+ externalId: "qe4UnEVt1hv"
10710
+ },
10711
+ {
10712
+ id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
10713
+ name: "Jabari",
10714
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10715
+ validUntil: null,
10716
+ externalId: "yHH9Nz4rLOt"
10717
+ },
10718
+ {
10719
+ id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
10720
+ name: "Kifani",
10721
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10722
+ validUntil: null,
10723
+ externalId: "eSWmXIGeu1I"
10724
+ },
10725
+ {
10726
+ id: "8c1d2e3f-4a5b-4089-8def-012345678901",
10727
+ name: "Lumela",
10728
+ parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
10729
+ validUntil: null,
10730
+ externalId: "bh0b3aI1uP3"
10731
+ }
10732
+ ];
10733
+ var V2_DEFAULT_MOCK_LOCATIONS = [
10734
+ {
10735
+ id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
10736
+ name: "Central Provincial Office",
10737
+ locationType: "CRVS_OFFICE",
10738
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10739
+ validUntil: null,
10740
+ externalId: "Xr3Df8WpK6Ys"
10741
+ },
10742
+ {
10743
+ id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
10744
+ name: "Central Health Post",
10745
+ locationType: "HEALTH_FACILITY",
10746
+ administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
10747
+ validUntil: null
10748
+ },
10749
+ {
10750
+ id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
10751
+ name: "Ibombo District Office",
10752
+ locationType: "CRVS_OFFICE",
10753
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10754
+ validUntil: null,
10755
+ externalId: "Sm4Nw7GrD2Vy"
10756
+ },
10757
+ {
10758
+ id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
10759
+ name: "Isamba District Office",
10760
+ locationType: "CRVS_OFFICE",
10761
+ administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
10762
+ validUntil: null,
10763
+ externalId: "Vg1Bq5XeH9Lt"
10764
+ },
10765
+ {
10766
+ id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
10767
+ name: "Isango District Office",
10768
+ locationType: "CRVS_OFFICE",
10769
+ administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
10770
+ validUntil: null,
10771
+ externalId: "Je7Lm2XqN9Vz"
10772
+ },
10773
+ {
10774
+ id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
10775
+ name: "Sulaka Provincial Office",
10776
+ locationType: "CRVS_OFFICE",
10777
+ administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
10778
+ validUntil: null,
10779
+ externalId: "Ht2Wp9KcX5Qv"
10780
+ },
10781
+ {
10782
+ id: "030358c6-54af-44be-821b-8e4af963a49c",
10783
+ name: "Ilanga District Office",
10784
+ locationType: "CRVS_OFFICE",
10785
+ administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
10786
+ validUntil: null,
10787
+ externalId: "Yp6Ds1WqN3Xz"
10788
+ },
10789
+ {
10790
+ id: "423d000f-101b-47c0-8b86-21a908067cee",
10791
+ name: "Chamakubi Health Post",
10792
+ locationType: "HEALTH_FACILITY",
10793
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10794
+ validUntil: null,
10795
+ externalId: "M1nFr8LbC2Qy"
10796
+ },
10797
+ {
10798
+ id: "4d3279be-d026-420c-88f7-f0a4ae986973",
10799
+ name: "Ibombo Rural Health Centre",
10800
+ locationType: "HEALTH_FACILITY",
10801
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10802
+ validUntil: null,
10803
+ externalId: "bT7pV6YrW0Xc"
10804
+ },
10805
+ {
10806
+ id: "190902f4-1d77-476a-8947-41145af1db7d",
10807
+ name: "Chikobo Rural Health Centre",
10808
+ locationType: "HEALTH_FACILITY",
10809
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10810
+ validUntil: null,
10811
+ externalId: "zE4qPn2SgJ5d"
10812
+ },
10813
+ {
10814
+ id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
10815
+ name: "Chilochabalenje Health Post",
10816
+ locationType: "HEALTH_FACILITY",
10817
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10818
+ validUntil: null,
10819
+ externalId: "H8vDs1MqR4Uf"
10820
+ },
10821
+ {
10822
+ id: "dbfc178f-7295-4b90-b28d-111c95b03127",
10823
+ name: "Chipeso Rural Health Centre",
10824
+ locationType: "HEALTH_FACILITY",
10825
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10826
+ validUntil: null,
10827
+ externalId: "Qw3uZ9KfX6Lm"
10828
+ },
10829
+ {
10830
+ id: "09862bfe-c7ac-46cd-987b-668681533c80",
10831
+ name: "Chisamba Rural Health Centre",
10832
+ locationType: "HEALTH_FACILITY",
10833
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10834
+ validUntil: null,
10835
+ externalId: "Yr0pCg8LdM2s"
10836
+ },
10837
+ {
10838
+ id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
10839
+ name: "Chitanda Rural Health Centre",
10840
+ locationType: "HEALTH_FACILITY",
10841
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10842
+ validUntil: null,
10843
+ externalId: "tS9gJ4PwB1Qx"
10844
+ },
10845
+ {
10846
+ id: "0431c433-6062-4a4c-aee9-25271aec61ee",
10847
+ name: "Golden Valley Rural Health Centre",
10848
+ locationType: "HEALTH_FACILITY",
10849
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10850
+ validUntil: null,
10851
+ externalId: "Ld7Qm3XsA8Vr"
10852
+ },
10853
+ {
10854
+ id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
10855
+ name: "Ipongo Rural Health Centre",
10856
+ locationType: "HEALTH_FACILITY",
10857
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10858
+ validUntil: null,
10859
+ externalId: "kF2sW9DmH0Bt"
10860
+ },
10861
+ {
10862
+ id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
10863
+ name: "Itumbwe Health Post",
10864
+ locationType: "HEALTH_FACILITY",
10865
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10866
+ validUntil: null,
10867
+ externalId: "Ue5Xb3VaC7Pq"
10868
+ },
10869
+ {
10870
+ id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
10871
+ name: "Kabangalala Rural Health Centre",
10872
+ locationType: "HEALTH_FACILITY",
10873
+ administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
10874
+ validUntil: null,
10875
+ externalId: "Pz8Kc1TqH6Jn"
10876
+ },
10877
+ // Village offices
10878
+ {
10879
+ id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
10880
+ name: "Klow Village Office",
10881
+ locationType: "CRVS_OFFICE",
10882
+ administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
10883
+ validUntil: null,
10884
+ externalId: "PmAyxAJkxiJ"
10885
+ }
10886
+ ];
10887
+ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
10888
+ V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
10889
+ );
10890
+ var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
10891
+ V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
10892
+ );