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