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