@opencrvs/toolkit 2.0.0-rc.df1ed4f → 2.0.0-rc.dfba38c
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 +255 -92
- package/dist/cli.js +539 -175
- package/dist/commons/api/router.d.ts +3365 -298
- 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 +2 -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/flags.d.ts +16 -0
- 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 +862 -179
- 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 +60 -35
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- 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 +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +537 -173
- 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 +90 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- 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.dfba38c.tgz +0 -0
- package/package.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.df1ed4f.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,
|
|
@@ -275,6 +282,7 @@ __export(events_exports, {
|
|
|
275
282
|
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
|
276
283
|
findAllFields: () => findAllFields,
|
|
277
284
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
|
285
|
+
findPendingCorrectionAction: () => findPendingCorrectionAction,
|
|
278
286
|
findRecordActionPages: () => findRecordActionPages,
|
|
279
287
|
flag: () => flag,
|
|
280
288
|
flattenFieldReference: () => flattenFieldReference,
|
|
@@ -300,12 +308,13 @@ __export(events_exports, {
|
|
|
300
308
|
getActionConfig: () => getActionConfig,
|
|
301
309
|
getActionReview: () => getActionReview,
|
|
302
310
|
getActionReviewFields: () => getActionReviewFields,
|
|
311
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
303
312
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
304
313
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
305
314
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
306
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
307
315
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
308
316
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
317
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
309
318
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
310
319
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
311
320
|
getCurrentEventState: () => getCurrentEventState,
|
|
@@ -315,7 +324,9 @@ __export(events_exports, {
|
|
|
315
324
|
getDeclarationFields: () => getDeclarationFields,
|
|
316
325
|
getDeclarationPages: () => getDeclarationPages,
|
|
317
326
|
getEventConfigById: () => getEventConfigById,
|
|
327
|
+
getEventFlags: () => getEventFlags,
|
|
318
328
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
329
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
319
330
|
getMixedPath: () => getMixedPath,
|
|
320
331
|
getPendingAction: () => getPendingAction,
|
|
321
332
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -376,6 +387,7 @@ __export(events_exports, {
|
|
|
376
387
|
isPageVisible: () => isPageVisible,
|
|
377
388
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
378
389
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
390
|
+
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
379
391
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
380
392
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
381
393
|
isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
|
|
@@ -409,6 +421,7 @@ __export(events_exports, {
|
|
|
409
421
|
plainDateToLocalDate: () => plainDateToLocalDate,
|
|
410
422
|
precompileActionSchemas: () => precompileActionSchemas,
|
|
411
423
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
424
|
+
resolveEventCustomFlags: () => resolveEventCustomFlags,
|
|
412
425
|
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
413
426
|
runFieldValidations: () => runFieldValidations,
|
|
414
427
|
runStructuralValidations: () => runStructuralValidations,
|
|
@@ -489,6 +502,10 @@ var scopeByEvent = z2.preprocess(
|
|
|
489
502
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
503
|
z2.array(z2.string()).optional()
|
|
491
504
|
).describe("Event type, e.g. birth, death");
|
|
505
|
+
var userRole = z2.preprocess(
|
|
506
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
507
|
+
z2.array(z2.string()).optional()
|
|
508
|
+
).describe("User role, e.g. admin, field agent");
|
|
492
509
|
var scopeOptionsPlaceEvent = z2.object({
|
|
493
510
|
event: scopeByEvent,
|
|
494
511
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -512,6 +529,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
512
529
|
var AccessLevelOptions = z2.object({
|
|
513
530
|
accessLevel: JurisdictionFilter.optional()
|
|
514
531
|
});
|
|
532
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
533
|
+
role: userRole.optional()
|
|
534
|
+
});
|
|
515
535
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
536
|
ids: z2.preprocess(
|
|
517
537
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -521,6 +541,7 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
521
541
|
var AllScopeOptions = z2.object({
|
|
522
542
|
...AllRecordScopeOptions.shape,
|
|
523
543
|
...AccessLevelOptions.shape,
|
|
544
|
+
...AllUserScopeOptions.shape,
|
|
524
545
|
...WorkqueueOrDashboardOptions.shape
|
|
525
546
|
});
|
|
526
547
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -593,6 +614,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
593
614
|
]).describe(
|
|
594
615
|
"Scopes used to check user's permission to perform actions on a record."
|
|
595
616
|
);
|
|
617
|
+
var SystemScopeType = z2.enum([
|
|
618
|
+
"organisation.read-locations",
|
|
619
|
+
"user.read",
|
|
620
|
+
"user.create",
|
|
621
|
+
"user.edit",
|
|
622
|
+
"user.search"
|
|
623
|
+
]);
|
|
624
|
+
var UserScopeType = SystemScopeType.extract([
|
|
625
|
+
"user.read",
|
|
626
|
+
"user.create",
|
|
627
|
+
"user.edit",
|
|
628
|
+
"user.search"
|
|
629
|
+
]);
|
|
630
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
631
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
632
|
+
z2.object({
|
|
633
|
+
type: ScopesWithRoleOption,
|
|
634
|
+
options: AllUserScopeOptions.optional()
|
|
635
|
+
}),
|
|
636
|
+
z2.object({
|
|
637
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
638
|
+
options: AccessLevelOptions.optional()
|
|
639
|
+
})
|
|
640
|
+
]);
|
|
641
|
+
function scopeUsesRoleOptions(scope) {
|
|
642
|
+
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
643
|
+
}
|
|
596
644
|
function scopeUsesDeclaredOptions(scope) {
|
|
597
645
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
646
|
}
|
|
@@ -625,16 +673,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
625
673
|
}).optional()
|
|
626
674
|
})
|
|
627
675
|
]).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
676
|
var Scope = z2.discriminatedUnion("type", [
|
|
635
677
|
z2.object({ type: PlainScopeType }),
|
|
636
678
|
...RecordScopeV2.options,
|
|
637
|
-
|
|
679
|
+
...UserScopeV2.options,
|
|
680
|
+
z2.object({
|
|
681
|
+
type: z2.literal("organisation.read-locations"),
|
|
682
|
+
options: AccessLevelOptions.optional()
|
|
683
|
+
}),
|
|
638
684
|
z2.object({
|
|
639
685
|
type: z2.literal("workqueue"),
|
|
640
686
|
options: WorkqueueOrDashboardOptions
|
|
@@ -667,7 +713,9 @@ var decodeScope = (query) => {
|
|
|
667
713
|
};
|
|
668
714
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
669
715
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
670
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
716
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
717
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
718
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
671
719
|
};
|
|
672
720
|
function getAcceptedScopesByType({
|
|
673
721
|
acceptedScopes,
|
|
@@ -1040,7 +1088,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1040
1088
|
ShowConditional,
|
|
1041
1089
|
// Action can be shown to the user in the list but as disabled
|
|
1042
1090
|
EnableConditional
|
|
1043
|
-
])
|
|
1091
|
+
]).meta({
|
|
1092
|
+
id: "ActionConditional",
|
|
1093
|
+
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."
|
|
1094
|
+
});
|
|
1044
1095
|
var DisplayOnReviewConditional = z7.object({
|
|
1045
1096
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1046
1097
|
conditional: Conditional
|
|
@@ -1055,8 +1106,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1055
1106
|
// Field output can be shown / hidden on the review page
|
|
1056
1107
|
DisplayOnReviewConditional
|
|
1057
1108
|
]).meta({
|
|
1058
|
-
|
|
1059
|
-
|
|
1109
|
+
id: "FieldConditional",
|
|
1110
|
+
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
1111
|
});
|
|
1061
1112
|
|
|
1062
1113
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1376,28 +1427,20 @@ function schemaPriority(schema) {
|
|
|
1376
1427
|
return idx === -1 ? 9999 : idx;
|
|
1377
1428
|
}
|
|
1378
1429
|
function safeUnion(schemas) {
|
|
1430
|
+
const sortedSchemas = [...schemas].sort(
|
|
1431
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1432
|
+
);
|
|
1379
1433
|
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
|
-
});
|
|
1434
|
+
for (const schema of sortedSchemas) {
|
|
1435
|
+
if (schema.safeParse(val).success) {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1400
1438
|
}
|
|
1439
|
+
ctx.addIssue({
|
|
1440
|
+
code: "invalid_type",
|
|
1441
|
+
expected: "custom",
|
|
1442
|
+
message: "Value does not match any schema"
|
|
1443
|
+
});
|
|
1401
1444
|
}).meta({
|
|
1402
1445
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1403
1446
|
});
|
|
@@ -1707,6 +1750,9 @@ var FlagConfig = z15.object({
|
|
|
1707
1750
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1708
1751
|
),
|
|
1709
1752
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1753
|
+
}).meta({
|
|
1754
|
+
id: "FlagConfig",
|
|
1755
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1710
1756
|
});
|
|
1711
1757
|
var ActionFlagConfig = z15.object({
|
|
1712
1758
|
id: Flag,
|
|
@@ -1714,6 +1760,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1714
1760
|
conditional: Conditional.optional().describe(
|
|
1715
1761
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1716
1762
|
)
|
|
1763
|
+
}).meta({
|
|
1764
|
+
id: "ActionFlagConfig",
|
|
1765
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1717
1766
|
});
|
|
1718
1767
|
|
|
1719
1768
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1735,8 +1784,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1735
1784
|
),
|
|
1736
1785
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1737
1786
|
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.")
|
|
1787
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1740
1788
|
});
|
|
1741
1789
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1742
1790
|
registrationNumber: z16.string().describe(
|
|
@@ -1764,9 +1812,6 @@ var EventMetadata = z16.object({
|
|
|
1764
1812
|
createdAtLocation: UUID.nullish().describe(
|
|
1765
1813
|
"Location of the user who created the event."
|
|
1766
1814
|
),
|
|
1767
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1768
|
-
"Signature of the user who created the event."
|
|
1769
|
-
),
|
|
1770
1815
|
updatedAtLocation: UUID.nullish().describe(
|
|
1771
1816
|
"Location of the user who last changed the status."
|
|
1772
1817
|
),
|
|
@@ -2141,14 +2186,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2141
2186
|
}
|
|
2142
2187
|
}).describe("Unique identifier for the field");
|
|
2143
2188
|
var FieldReference = import_v43.default.object({
|
|
2144
|
-
$$field: FieldId,
|
|
2189
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2145
2190
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2146
2191
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2147
2192
|
)
|
|
2148
2193
|
}).describe("Reference to a field by its ID");
|
|
2149
2194
|
var ValidationConfig = import_v43.default.object({
|
|
2150
|
-
validator: Conditional
|
|
2151
|
-
|
|
2195
|
+
validator: Conditional.describe(
|
|
2196
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2197
|
+
),
|
|
2198
|
+
message: TranslationConfig.describe(
|
|
2199
|
+
"Error message displayed when the validator does not hold."
|
|
2200
|
+
)
|
|
2201
|
+
}).meta({
|
|
2202
|
+
id: "ValidationConfig",
|
|
2203
|
+
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
2204
|
});
|
|
2153
2205
|
var requiredSchema = import_v43.default.union([
|
|
2154
2206
|
import_v43.default.boolean(),
|
|
@@ -2187,6 +2239,9 @@ var BaseField = import_v43.default.object({
|
|
|
2187
2239
|
}).describe("Common properties shared across all field types.");
|
|
2188
2240
|
var Divider = BaseField.extend({
|
|
2189
2241
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2242
|
+
}).meta({
|
|
2243
|
+
description: "A horizontal line divider",
|
|
2244
|
+
id: "Divider"
|
|
2190
2245
|
});
|
|
2191
2246
|
var TextField = BaseField.extend({
|
|
2192
2247
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2197,7 +2252,10 @@ var TextField = BaseField.extend({
|
|
|
2197
2252
|
prefix: TranslationConfig.optional(),
|
|
2198
2253
|
postfix: TranslationConfig.optional()
|
|
2199
2254
|
}).default({ type: "text" }).optional()
|
|
2200
|
-
}).
|
|
2255
|
+
}).meta({
|
|
2256
|
+
description: "A text input field",
|
|
2257
|
+
id: "TextField"
|
|
2258
|
+
});
|
|
2201
2259
|
var NumberField = BaseField.extend({
|
|
2202
2260
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2203
2261
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2207,7 +2265,10 @@ var NumberField = BaseField.extend({
|
|
|
2207
2265
|
prefix: TranslationConfig.optional(),
|
|
2208
2266
|
postfix: TranslationConfig.optional()
|
|
2209
2267
|
}).optional()
|
|
2210
|
-
}).
|
|
2268
|
+
}).meta({
|
|
2269
|
+
description: "A number input field",
|
|
2270
|
+
id: "NumberField"
|
|
2271
|
+
});
|
|
2211
2272
|
var TextAreaField = BaseField.extend({
|
|
2212
2273
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2213
2274
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2218,7 +2279,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2218
2279
|
prefix: TranslationConfig.optional(),
|
|
2219
2280
|
postfix: TranslationConfig.optional()
|
|
2220
2281
|
}).default({ rows: 4 }).optional()
|
|
2221
|
-
}).
|
|
2282
|
+
}).meta({
|
|
2283
|
+
description: "A multiline text input",
|
|
2284
|
+
id: "TextAreaField"
|
|
2285
|
+
});
|
|
2222
2286
|
var ImageMimeType = import_v43.default.enum([
|
|
2223
2287
|
"image/png",
|
|
2224
2288
|
"image/jpg",
|
|
@@ -2248,13 +2312,19 @@ var SignatureField = BaseField.extend({
|
|
|
2248
2312
|
}).default({
|
|
2249
2313
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2250
2314
|
})
|
|
2251
|
-
}).
|
|
2315
|
+
}).meta({
|
|
2316
|
+
description: "A signature input field",
|
|
2317
|
+
id: "SignatureField"
|
|
2318
|
+
});
|
|
2252
2319
|
var EmailField = BaseField.extend({
|
|
2253
2320
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2254
2321
|
configuration: import_v43.default.object({
|
|
2255
2322
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2256
2323
|
}).default({ maxLength: 255 }).optional(),
|
|
2257
2324
|
defaultValue: NonEmptyTextValue.optional()
|
|
2325
|
+
}).meta({
|
|
2326
|
+
description: "An email input field",
|
|
2327
|
+
id: "EmailField"
|
|
2258
2328
|
});
|
|
2259
2329
|
var DateField = BaseField.extend({
|
|
2260
2330
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2264,7 +2334,10 @@ var DateField = BaseField.extend({
|
|
|
2264
2334
|
"Text to display above the date input"
|
|
2265
2335
|
).optional()
|
|
2266
2336
|
}).optional()
|
|
2267
|
-
}).
|
|
2337
|
+
}).meta({
|
|
2338
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2339
|
+
id: "DateField"
|
|
2340
|
+
});
|
|
2268
2341
|
var AgeField = BaseField.extend({
|
|
2269
2342
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2270
2343
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2273,7 +2346,10 @@ var AgeField = BaseField.extend({
|
|
|
2273
2346
|
prefix: TranslationConfig.optional(),
|
|
2274
2347
|
postfix: TranslationConfig.optional()
|
|
2275
2348
|
})
|
|
2276
|
-
}).
|
|
2349
|
+
}).meta({
|
|
2350
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2351
|
+
id: "AgeField"
|
|
2352
|
+
});
|
|
2277
2353
|
var TimeField = BaseField.extend({
|
|
2278
2354
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2279
2355
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2283,7 +2359,10 @@ var TimeField = BaseField.extend({
|
|
|
2283
2359
|
"Text to display above the time input"
|
|
2284
2360
|
).optional()
|
|
2285
2361
|
}).optional()
|
|
2286
|
-
}).
|
|
2362
|
+
}).meta({
|
|
2363
|
+
description: "A single time input (HH-mm)",
|
|
2364
|
+
id: "TimeField"
|
|
2365
|
+
});
|
|
2287
2366
|
var DateRangeField = BaseField.extend({
|
|
2288
2367
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2289
2368
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2292,7 +2371,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2292
2371
|
"Text to display above the date input"
|
|
2293
2372
|
).optional()
|
|
2294
2373
|
}).optional()
|
|
2295
|
-
}).
|
|
2374
|
+
}).meta({
|
|
2375
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2376
|
+
id: "DateRangeField"
|
|
2377
|
+
});
|
|
2296
2378
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2297
2379
|
"reg12",
|
|
2298
2380
|
"reg14",
|
|
@@ -2336,18 +2418,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2336
2418
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2337
2419
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2338
2420
|
configuration: ImageConfiguration
|
|
2339
|
-
}).
|
|
2421
|
+
}).meta({
|
|
2422
|
+
description: "A read-only image component for form pages",
|
|
2423
|
+
id: "ImageViewField"
|
|
2424
|
+
});
|
|
2340
2425
|
var Paragraph = BaseField.extend({
|
|
2341
2426
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2342
2427
|
configuration: ParagraphConfiguration
|
|
2343
|
-
}).
|
|
2428
|
+
}).meta({
|
|
2429
|
+
description: "A read-only HTML <p> paragraph",
|
|
2430
|
+
id: "Paragraph"
|
|
2431
|
+
});
|
|
2344
2432
|
var Heading = BaseField.extend({
|
|
2345
2433
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2346
2434
|
configuration: HeadingConfiguration
|
|
2347
|
-
}).
|
|
2435
|
+
}).meta({
|
|
2436
|
+
description: "A read-only heading component for form pages",
|
|
2437
|
+
id: "Heading"
|
|
2438
|
+
});
|
|
2348
2439
|
var PageHeader = BaseField.extend({
|
|
2349
2440
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2350
|
-
}).
|
|
2441
|
+
}).meta({
|
|
2442
|
+
description: "A read-only header component for form pages",
|
|
2443
|
+
id: "PageHeader"
|
|
2444
|
+
});
|
|
2351
2445
|
var File = BaseField.extend({
|
|
2352
2446
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2353
2447
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2366,7 +2460,10 @@ var File = BaseField.extend({
|
|
|
2366
2460
|
}).default({
|
|
2367
2461
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2368
2462
|
})
|
|
2369
|
-
}).
|
|
2463
|
+
}).meta({
|
|
2464
|
+
description: "A file upload field",
|
|
2465
|
+
id: "File"
|
|
2466
|
+
});
|
|
2370
2467
|
var SelectOption = import_v43.default.object({
|
|
2371
2468
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2372
2469
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2383,7 +2480,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2383
2480
|
"Placeholder for the number field"
|
|
2384
2481
|
)
|
|
2385
2482
|
}).optional()
|
|
2386
|
-
}).
|
|
2483
|
+
}).meta({
|
|
2484
|
+
description: "A number with unit input field",
|
|
2485
|
+
id: "NumberWithUnitField"
|
|
2486
|
+
});
|
|
2387
2487
|
var RadioGroup = BaseField.extend({
|
|
2388
2488
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2389
2489
|
defaultValue: TextValue.optional(),
|
|
@@ -2393,7 +2493,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2393
2493
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2394
2494
|
}).optional()
|
|
2395
2495
|
}).optional()
|
|
2396
|
-
}).
|
|
2496
|
+
}).meta({
|
|
2497
|
+
description: "A grouped radio button field",
|
|
2498
|
+
id: "RadioGroup"
|
|
2499
|
+
});
|
|
2397
2500
|
var BulletList = BaseField.extend({
|
|
2398
2501
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2399
2502
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2402,7 +2505,10 @@ var BulletList = BaseField.extend({
|
|
|
2402
2505
|
fontVariant: HtmlFontVariant.optional()
|
|
2403
2506
|
}).optional()
|
|
2404
2507
|
}).default({})
|
|
2405
|
-
}).
|
|
2508
|
+
}).meta({
|
|
2509
|
+
description: "A list of bullet points",
|
|
2510
|
+
id: "BulletList"
|
|
2511
|
+
});
|
|
2406
2512
|
var Select = BaseField.extend({
|
|
2407
2513
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2408
2514
|
defaultValue: TextValue.optional(),
|
|
@@ -2417,7 +2523,10 @@ var Select = BaseField.extend({
|
|
|
2417
2523
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2418
2524
|
`
|
|
2419
2525
|
)
|
|
2420
|
-
}).
|
|
2526
|
+
}).meta({
|
|
2527
|
+
description: "A select input field",
|
|
2528
|
+
id: "Select"
|
|
2529
|
+
});
|
|
2421
2530
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2422
2531
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2423
2532
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2426,7 +2535,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2426
2535
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2427
2536
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2428
2537
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2429
|
-
}).
|
|
2538
|
+
}).meta({
|
|
2539
|
+
description: "A date range selection field",
|
|
2540
|
+
id: "SelectDateRangeField"
|
|
2541
|
+
});
|
|
2430
2542
|
var NameConfig = import_v43.default.object({
|
|
2431
2543
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2432
2544
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2457,26 +2569,41 @@ var NameField = BaseField.extend({
|
|
|
2457
2569
|
surname: { required: true }
|
|
2458
2570
|
}
|
|
2459
2571
|
}).optional()
|
|
2460
|
-
}).
|
|
2572
|
+
}).meta({
|
|
2573
|
+
description: "A field for entering a persons name",
|
|
2574
|
+
id: "NameField"
|
|
2575
|
+
});
|
|
2461
2576
|
var PhoneField = BaseField.extend({
|
|
2462
2577
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2463
2578
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2464
|
-
}).
|
|
2579
|
+
}).meta({
|
|
2580
|
+
description: "A field for entering a phone number",
|
|
2581
|
+
id: "PhoneField"
|
|
2582
|
+
});
|
|
2465
2583
|
var IdField = BaseField.extend({
|
|
2466
2584
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2467
2585
|
type: import_v43.default.literal(FieldType.ID)
|
|
2468
|
-
}).
|
|
2586
|
+
}).meta({
|
|
2587
|
+
description: "A field for entering an ID",
|
|
2588
|
+
id: "IdField"
|
|
2589
|
+
});
|
|
2469
2590
|
var Checkbox = BaseField.extend({
|
|
2470
2591
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2471
2592
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2472
|
-
}).
|
|
2593
|
+
}).meta({
|
|
2594
|
+
description: "A boolean checkbox field",
|
|
2595
|
+
id: "Checkbox"
|
|
2596
|
+
});
|
|
2473
2597
|
var Country = BaseField.extend({
|
|
2474
2598
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2475
2599
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2476
2600
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2477
2601
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2478
2602
|
)
|
|
2479
|
-
}).
|
|
2603
|
+
}).meta({
|
|
2604
|
+
description: "A field for selecting a country",
|
|
2605
|
+
id: "Country"
|
|
2606
|
+
});
|
|
2480
2607
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2481
2608
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2482
2609
|
);
|
|
@@ -2485,16 +2612,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2485
2612
|
"HEALTH_FACILITY",
|
|
2486
2613
|
"CRVS_OFFICE"
|
|
2487
2614
|
]);
|
|
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
2615
|
var AdministrativeAreaField = BaseField.extend({
|
|
2494
2616
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2495
2617
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2496
|
-
configuration:
|
|
2497
|
-
|
|
2618
|
+
configuration: import_v43.default.object({
|
|
2619
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2620
|
+
type: AdministrativeAreas,
|
|
2621
|
+
allowedLocations: AllowedLocations
|
|
2622
|
+
}).describe("Administrative area options")
|
|
2623
|
+
}).meta({
|
|
2624
|
+
description: "Administrative area input field",
|
|
2625
|
+
id: "AdministrativeAreaField"
|
|
2626
|
+
});
|
|
2498
2627
|
var LocationInput = BaseField.extend({
|
|
2499
2628
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2500
2629
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2502,7 +2631,10 @@ var LocationInput = BaseField.extend({
|
|
|
2502
2631
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2503
2632
|
allowedLocations: AllowedLocations
|
|
2504
2633
|
}).optional()
|
|
2505
|
-
}).
|
|
2634
|
+
}).meta({
|
|
2635
|
+
description: "A field for selecting a location",
|
|
2636
|
+
id: "LocationInput"
|
|
2637
|
+
});
|
|
2506
2638
|
var FileUploadWithOptions = BaseField.extend({
|
|
2507
2639
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2508
2640
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2516,6 +2648,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2516
2648
|
}).default({
|
|
2517
2649
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2518
2650
|
})
|
|
2651
|
+
}).meta({
|
|
2652
|
+
description: "A field for uploading files with file type options",
|
|
2653
|
+
id: "FileUploadWithOptions"
|
|
2519
2654
|
});
|
|
2520
2655
|
var Facility = BaseField.extend({
|
|
2521
2656
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2561,7 +2696,10 @@ var Address = BaseField.extend({
|
|
|
2561
2696
|
allowedLocations: AllowedLocations
|
|
2562
2697
|
}).optional(),
|
|
2563
2698
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2564
|
-
}).
|
|
2699
|
+
}).meta({
|
|
2700
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2701
|
+
id: "Address"
|
|
2702
|
+
});
|
|
2565
2703
|
var StaticDataEntry = import_v43.default.object({
|
|
2566
2704
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2567
2705
|
label: TranslationConfig,
|
|
@@ -2576,7 +2714,10 @@ var DataField = BaseField.extend({
|
|
|
2576
2714
|
subtitle: TranslationConfig.optional(),
|
|
2577
2715
|
data: import_v43.default.array(DataEntry)
|
|
2578
2716
|
})
|
|
2579
|
-
}).
|
|
2717
|
+
}).meta({
|
|
2718
|
+
description: "A field for displaying a table of read-only data",
|
|
2719
|
+
id: "DataField"
|
|
2720
|
+
});
|
|
2580
2721
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2581
2722
|
var ButtonType = import_v43.default.enum([
|
|
2582
2723
|
"primary",
|
|
@@ -2603,11 +2744,17 @@ var ButtonField = BaseField.extend({
|
|
|
2603
2744
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2604
2745
|
defaultValue: ButtonFieldValue.optional(),
|
|
2605
2746
|
configuration: ButtonConfiguration
|
|
2606
|
-
}).
|
|
2747
|
+
}).meta({
|
|
2748
|
+
description: "A generic button that can be used to trigger an action",
|
|
2749
|
+
id: "ButtonField"
|
|
2750
|
+
});
|
|
2607
2751
|
var FieldGroup = BaseField.extend({
|
|
2608
2752
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2609
2753
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2610
2754
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2755
|
+
}).meta({
|
|
2756
|
+
description: "A group of fields that are displayed together",
|
|
2757
|
+
id: "FieldGroup"
|
|
2611
2758
|
});
|
|
2612
2759
|
var AlphaPrintButton = BaseField.extend({
|
|
2613
2760
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2617,7 +2764,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2617
2764
|
"Label for the print button"
|
|
2618
2765
|
)
|
|
2619
2766
|
})
|
|
2620
|
-
}).
|
|
2767
|
+
}).meta({
|
|
2768
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2769
|
+
id: "AlphaPrintButton"
|
|
2770
|
+
});
|
|
2621
2771
|
var HttpField = BaseField.extend({
|
|
2622
2772
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2623
2773
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2633,20 +2783,30 @@ var HttpField = BaseField.extend({
|
|
|
2633
2783
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2634
2784
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2635
2785
|
})
|
|
2636
|
-
}).
|
|
2786
|
+
}).meta({
|
|
2787
|
+
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.",
|
|
2788
|
+
id: "HttpField"
|
|
2789
|
+
});
|
|
2637
2790
|
var AutocompleteField = BaseField.extend({
|
|
2638
2791
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2639
2792
|
configuration: import_v43.default.object({
|
|
2640
|
-
url: import_v43.default.string().describe(
|
|
2793
|
+
url: import_v43.default.string().describe(
|
|
2794
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2795
|
+
).optional(),
|
|
2641
2796
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2642
2797
|
defaultOptions: import_v43.default.array(
|
|
2643
2798
|
import_v43.default.object({
|
|
2644
2799
|
label: import_v43.default.string(),
|
|
2645
2800
|
value: import_v43.default.string()
|
|
2646
2801
|
})
|
|
2647
|
-
).optional()
|
|
2802
|
+
).optional().describe(
|
|
2803
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2804
|
+
)
|
|
2648
2805
|
})
|
|
2649
|
-
}).
|
|
2806
|
+
}).meta({
|
|
2807
|
+
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.",
|
|
2808
|
+
id: "AutocompleteField"
|
|
2809
|
+
});
|
|
2650
2810
|
var SearchField = HttpField.extend({
|
|
2651
2811
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2652
2812
|
configuration: SearchQuery.pick({
|
|
@@ -2679,6 +2839,9 @@ var SearchField = HttpField.extend({
|
|
|
2679
2839
|
ok: TranslationConfig.optional()
|
|
2680
2840
|
}).optional()
|
|
2681
2841
|
})
|
|
2842
|
+
}).meta({
|
|
2843
|
+
description: "A search input field",
|
|
2844
|
+
id: "SearchField"
|
|
2682
2845
|
});
|
|
2683
2846
|
var LinkButtonField = BaseField.extend({
|
|
2684
2847
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2687,7 +2850,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2687
2850
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2688
2851
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2689
2852
|
})
|
|
2690
|
-
}).
|
|
2853
|
+
}).meta({
|
|
2854
|
+
description: "A button that opens a URL link",
|
|
2855
|
+
id: "LinkButtonField"
|
|
2856
|
+
});
|
|
2691
2857
|
var VerificationStatus = BaseField.extend({
|
|
2692
2858
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2693
2859
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2697,15 +2863,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2697
2863
|
"Explaining text on the banner in form."
|
|
2698
2864
|
)
|
|
2699
2865
|
})
|
|
2866
|
+
}).meta({
|
|
2867
|
+
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.",
|
|
2868
|
+
id: "VerificationStatus"
|
|
2700
2869
|
});
|
|
2701
2870
|
var QueryParamReaderField = BaseField.extend({
|
|
2702
2871
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2703
2872
|
configuration: import_v43.default.object({
|
|
2704
2873
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2705
2874
|
})
|
|
2706
|
-
}).
|
|
2707
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2708
|
-
|
|
2875
|
+
}).meta({
|
|
2876
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2877
|
+
id: "QueryParamReaderField"
|
|
2878
|
+
});
|
|
2709
2879
|
var QrReaderField = BaseField.extend({
|
|
2710
2880
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2711
2881
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2716,7 +2886,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2716
2886
|
})
|
|
2717
2887
|
}).optional()
|
|
2718
2888
|
}).meta({
|
|
2719
|
-
description: "
|
|
2889
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2720
2890
|
id: "QrReaderField"
|
|
2721
2891
|
});
|
|
2722
2892
|
var IdReaderField = BaseField.extend({
|
|
@@ -2725,12 +2895,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2725
2895
|
methods: import_v43.default.array(
|
|
2726
2896
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2727
2897
|
)
|
|
2898
|
+
}).meta({
|
|
2899
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2900
|
+
id: "IdReaderField"
|
|
2728
2901
|
});
|
|
2729
2902
|
var CustomField = BaseField.extend({
|
|
2730
2903
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2731
2904
|
defaultValue: CustomFieldValue.optional(),
|
|
2732
2905
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2733
2906
|
configuration: import_v43.default.unknown().optional()
|
|
2907
|
+
}).meta({
|
|
2908
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2909
|
+
id: "CustomField"
|
|
2734
2910
|
});
|
|
2735
2911
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2736
2912
|
var LoaderField = BaseField.extend({
|
|
@@ -2740,22 +2916,25 @@ var LoaderField = BaseField.extend({
|
|
|
2740
2916
|
configuration: import_v43.default.object({
|
|
2741
2917
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2742
2918
|
})
|
|
2743
|
-
}).
|
|
2744
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2745
|
-
|
|
2919
|
+
}).meta({
|
|
2920
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2921
|
+
id: "LoaderField"
|
|
2922
|
+
});
|
|
2746
2923
|
var HiddenField = BaseField.extend({
|
|
2747
2924
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2748
2925
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2749
2926
|
defaultValue: TextValue.optional()
|
|
2750
|
-
}).
|
|
2751
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2752
|
-
|
|
2927
|
+
}).meta({
|
|
2928
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2929
|
+
id: "HiddenField"
|
|
2930
|
+
});
|
|
2753
2931
|
var UserRoleField = BaseField.extend({
|
|
2754
2932
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2755
2933
|
defaultValue: TextValue.optional()
|
|
2756
|
-
}).
|
|
2757
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2758
|
-
|
|
2934
|
+
}).meta({
|
|
2935
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2936
|
+
id: "UserRoleField"
|
|
2937
|
+
});
|
|
2759
2938
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2760
2939
|
FieldGroup,
|
|
2761
2940
|
Address,
|
|
@@ -2854,16 +3033,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2854
3033
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2855
3034
|
actions: VerificationActionConfig
|
|
2856
3035
|
});
|
|
2857
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
3036
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3037
|
+
id: "PageConfig",
|
|
3038
|
+
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."
|
|
3039
|
+
});
|
|
2861
3040
|
|
|
2862
3041
|
// ../commons/src/events/FormConfig.ts
|
|
2863
3042
|
var DeclarationFormConfig = z22.object({
|
|
2864
3043
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2865
3044
|
pages: z22.array(FormPageConfig)
|
|
2866
|
-
}).
|
|
3045
|
+
}).meta({
|
|
3046
|
+
id: "DeclarationFormConfig",
|
|
3047
|
+
description: "Configuration of the declaration form."
|
|
3048
|
+
});
|
|
2867
3049
|
var ActionFormConfig = z22.object({
|
|
2868
3050
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2869
3051
|
pages: z22.array(PageConfig)
|
|
@@ -2963,6 +3145,9 @@ var DeduplicationConfig = z23.object({
|
|
|
2963
3145
|
id: z23.string(),
|
|
2964
3146
|
label: TranslationConfig,
|
|
2965
3147
|
query: Clause
|
|
3148
|
+
}).meta({
|
|
3149
|
+
id: "DeduplicationConfig",
|
|
3150
|
+
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
3151
|
});
|
|
2967
3152
|
|
|
2968
3153
|
// ../commons/src/events/ActionConfig.ts
|
|
@@ -3080,17 +3265,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3080
3265
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3081
3266
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3082
3267
|
*/
|
|
3083
|
-
ReadActionConfig.meta({
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3268
|
+
ReadActionConfig.meta({
|
|
3269
|
+
id: "ReadActionConfig",
|
|
3270
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3271
|
+
}),
|
|
3272
|
+
DeclareConfig.meta({
|
|
3273
|
+
id: "DeclareActionConfig",
|
|
3274
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3275
|
+
}),
|
|
3276
|
+
RejectConfig.meta({
|
|
3277
|
+
id: "RejectActionConfig",
|
|
3278
|
+
description: "Configuration for rejecting a record before registration."
|
|
3279
|
+
}),
|
|
3280
|
+
RegisterConfig.meta({
|
|
3281
|
+
id: "RegisterActionConfig",
|
|
3282
|
+
description: "Configuration for registering a record."
|
|
3283
|
+
}),
|
|
3087
3284
|
PrintCertificateActionConfig.meta({
|
|
3088
|
-
id: "PrintCertificateActionConfig"
|
|
3285
|
+
id: "PrintCertificateActionConfig",
|
|
3286
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3089
3287
|
}),
|
|
3090
|
-
RequestCorrectionConfig.meta({
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3288
|
+
RequestCorrectionConfig.meta({
|
|
3289
|
+
id: "RequestCorrectionActionConfig",
|
|
3290
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3291
|
+
}),
|
|
3292
|
+
EditActionConfig.meta({
|
|
3293
|
+
id: "EditActionConfig",
|
|
3294
|
+
description: "Configuration for editing a record before registration."
|
|
3295
|
+
}),
|
|
3296
|
+
ArchiveConfig.meta({
|
|
3297
|
+
id: "ArchiveActionConfig",
|
|
3298
|
+
description: "Configuration for archiving a record."
|
|
3299
|
+
}),
|
|
3300
|
+
CustomActionConfig.meta({
|
|
3301
|
+
id: "CustomActionConfig",
|
|
3302
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3303
|
+
})
|
|
3094
3304
|
]).describe(
|
|
3095
3305
|
"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
3306
|
).meta({ id: "ActionConfig" });
|
|
@@ -3166,7 +3376,10 @@ var Field = BaseField2.extend({
|
|
|
3166
3376
|
}).describe("Custom field defined for the summary view.");
|
|
3167
3377
|
var SummaryConfig = z27.object({
|
|
3168
3378
|
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3169
|
-
}).
|
|
3379
|
+
}).meta({
|
|
3380
|
+
id: "SummaryConfig",
|
|
3381
|
+
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."
|
|
3382
|
+
});
|
|
3170
3383
|
|
|
3171
3384
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3172
3385
|
var z28 = __toESM(require("zod/v4"));
|
|
@@ -3290,6 +3503,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
|
|
|
3290
3503
|
var AdvancedSearchConfig = z28.object({
|
|
3291
3504
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3292
3505
|
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3506
|
+
}).meta({
|
|
3507
|
+
id: "AdvancedSearchConfig",
|
|
3508
|
+
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
3509
|
});
|
|
3294
3510
|
|
|
3295
3511
|
// ../commons/src/events/utils.ts
|
|
@@ -3766,6 +3982,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3766
3982
|
function isAgeValue(value) {
|
|
3767
3983
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3768
3984
|
}
|
|
3985
|
+
function mergeWithBaseFormState(values, context) {
|
|
3986
|
+
return { ...context.baseFormState, ...values };
|
|
3987
|
+
}
|
|
3769
3988
|
function validate(schema, data) {
|
|
3770
3989
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3771
3990
|
if ("$form" in data) {
|
|
@@ -3804,7 +4023,7 @@ function isOnline() {
|
|
|
3804
4023
|
}
|
|
3805
4024
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3806
4025
|
return validate(conditional, {
|
|
3807
|
-
$form: values,
|
|
4026
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3808
4027
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3809
4028
|
$online: isOnline(),
|
|
3810
4029
|
$user: context.user,
|
|
@@ -3833,7 +4052,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3833
4052
|
return true;
|
|
3834
4053
|
}
|
|
3835
4054
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3836
|
-
$form: form,
|
|
4055
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3837
4056
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3838
4057
|
$online: isOnline(),
|
|
3839
4058
|
$user: context.user,
|
|
@@ -4025,7 +4244,7 @@ function runFieldValidations({
|
|
|
4025
4244
|
return [];
|
|
4026
4245
|
}
|
|
4027
4246
|
const conditionalParameters = {
|
|
4028
|
-
$form: form,
|
|
4247
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4029
4248
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4030
4249
|
/**
|
|
4031
4250
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4269,17 +4488,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4269
4488
|
}
|
|
4270
4489
|
return isConditionMet(page.conditional, formValues, context);
|
|
4271
4490
|
}
|
|
4272
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4491
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4273
4492
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4274
4493
|
function fn(prevVisibilityContext) {
|
|
4275
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4276
4494
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4277
4495
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4278
4496
|
if (!fieldConfig.length) {
|
|
4279
4497
|
return false;
|
|
4280
4498
|
}
|
|
4281
4499
|
const isHidden = fieldConfig.every(
|
|
4282
|
-
(f) => !isFieldVisible(f,
|
|
4500
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4283
4501
|
);
|
|
4284
4502
|
if (!isHidden) {
|
|
4285
4503
|
return false;
|
|
@@ -4297,7 +4515,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4297
4515
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4298
4516
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4299
4517
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4300
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4518
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4301
4519
|
});
|
|
4302
4520
|
return omitHiddenFields(
|
|
4303
4521
|
visibleFields,
|
|
@@ -4344,13 +4562,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4344
4562
|
}
|
|
4345
4563
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4346
4564
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4347
|
-
return omitHiddenFields(
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
false,
|
|
4352
|
-
declaration
|
|
4353
|
-
);
|
|
4565
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4566
|
+
...context,
|
|
4567
|
+
baseFormState: declaration
|
|
4568
|
+
});
|
|
4354
4569
|
}
|
|
4355
4570
|
function deepMerge(currentDocument, actionDocument) {
|
|
4356
4571
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -4644,6 +4859,9 @@ function not(condition) {
|
|
|
4644
4859
|
function never2() {
|
|
4645
4860
|
return not(alwaysTrue());
|
|
4646
4861
|
}
|
|
4862
|
+
function always() {
|
|
4863
|
+
return defineConditional(alwaysTrue());
|
|
4864
|
+
}
|
|
4647
4865
|
function jsonFieldPath(field3) {
|
|
4648
4866
|
return [field3.$$field, ...field3.$$subfield].join("/");
|
|
4649
4867
|
}
|
|
@@ -5339,7 +5557,7 @@ var _EventConfigBase = z33.object({
|
|
|
5339
5557
|
),
|
|
5340
5558
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5341
5559
|
actions: z33.array(ActionConfig).describe(
|
|
5342
|
-
"Configuration of
|
|
5560
|
+
"Configuration of core and custom actions associated with the event."
|
|
5343
5561
|
),
|
|
5344
5562
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5345
5563
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5351,7 +5569,7 @@ var _EventConfigBase = z33.object({
|
|
|
5351
5569
|
"Configuration of fields available in the advanced search feature."
|
|
5352
5570
|
),
|
|
5353
5571
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5354
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5572
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5355
5573
|
),
|
|
5356
5574
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5357
5575
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5364,8 +5582,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5364
5582
|
validateActionFlags(event2, ctx);
|
|
5365
5583
|
validateActionOrder(event2, ctx);
|
|
5366
5584
|
}).meta({
|
|
5367
|
-
id: "EventConfig"
|
|
5368
|
-
|
|
5585
|
+
id: "EventConfig",
|
|
5586
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5587
|
+
});
|
|
5369
5588
|
|
|
5370
5589
|
// ../commons/src/events/EventConfigInput.ts
|
|
5371
5590
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5588,6 +5807,9 @@ var WorkqueueColumnValue = z34.object({
|
|
|
5588
5807
|
var WorkqueueColumn = z34.object({
|
|
5589
5808
|
label: TranslationConfig,
|
|
5590
5809
|
value: WorkqueueColumnValue
|
|
5810
|
+
}).meta({
|
|
5811
|
+
id: "WorkqueueColumn",
|
|
5812
|
+
description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
|
|
5591
5813
|
});
|
|
5592
5814
|
function defineWorkqueuesColumns(workqueueColumns) {
|
|
5593
5815
|
return workqueueColumns.map(
|
|
@@ -5790,18 +6012,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5790
6012
|
query: true,
|
|
5791
6013
|
columns: true
|
|
5792
6014
|
});
|
|
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()
|
|
6015
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6016
|
+
query: CountryConfigQueryInputType
|
|
6017
|
+
}).meta({
|
|
6018
|
+
id: "WorkqueueConfig",
|
|
6019
|
+
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
6020
|
});
|
|
5806
6021
|
function defineWorkqueue(workqueueInput) {
|
|
5807
6022
|
const queryInput = workqueueInput.query;
|
|
@@ -5862,6 +6077,11 @@ var BaseActionInput = z38.object({
|
|
|
5862
6077
|
originalActionId: UUID.optional(),
|
|
5863
6078
|
// should not be part of base action.
|
|
5864
6079
|
keepAssignment: z38.boolean().optional(),
|
|
6080
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6081
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6082
|
+
waitFor: z38.boolean().default(true).describe(
|
|
6083
|
+
"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."
|
|
6084
|
+
),
|
|
5865
6085
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5866
6086
|
// @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
6087
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6041,7 +6261,7 @@ var Draft = z39.object({
|
|
|
6041
6261
|
}).describe(
|
|
6042
6262
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
6043
6263
|
);
|
|
6044
|
-
var DraftInput = BaseActionInput.extend({
|
|
6264
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
6045
6265
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6046
6266
|
status: z39.enum([
|
|
6047
6267
|
ActionStatus.Requested,
|
|
@@ -6115,7 +6335,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6115
6335
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6116
6336
|
acceptedAt: acceptAction.createdAt,
|
|
6117
6337
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6118
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6119
6338
|
registrationNumber
|
|
6120
6339
|
};
|
|
6121
6340
|
}
|
|
@@ -6173,26 +6392,43 @@ var import_date_fns3 = require("date-fns");
|
|
|
6173
6392
|
function isEditInProgress(actions) {
|
|
6174
6393
|
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6175
6394
|
}
|
|
6395
|
+
function findPendingCorrectionAction(writeActions2) {
|
|
6396
|
+
let correctionRequestAction;
|
|
6397
|
+
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
6398
|
+
const action = writeActions2[i];
|
|
6399
|
+
if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
|
|
6400
|
+
break;
|
|
6401
|
+
}
|
|
6402
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
|
6403
|
+
correctionRequestAction = action;
|
|
6404
|
+
break;
|
|
6405
|
+
}
|
|
6406
|
+
}
|
|
6407
|
+
return correctionRequestAction;
|
|
6408
|
+
}
|
|
6176
6409
|
function isCorrectionRequested(actions) {
|
|
6410
|
+
return findPendingCorrectionAction(actions) !== void 0;
|
|
6411
|
+
}
|
|
6412
|
+
function isDeclarationIncomplete(actions) {
|
|
6413
|
+
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6414
|
+
}
|
|
6415
|
+
function isRejected(actions) {
|
|
6416
|
+
const resettingActionTypes = [
|
|
6417
|
+
ActionType.NOTIFY,
|
|
6418
|
+
ActionType.DECLARE,
|
|
6419
|
+
ActionType.EDIT,
|
|
6420
|
+
ActionType.REGISTER
|
|
6421
|
+
];
|
|
6177
6422
|
return actions.reduce((prev, { type }) => {
|
|
6178
|
-
if (type === ActionType.
|
|
6423
|
+
if (type === ActionType.REJECT) {
|
|
6179
6424
|
return true;
|
|
6180
6425
|
}
|
|
6181
|
-
if (type
|
|
6182
|
-
return false;
|
|
6183
|
-
}
|
|
6184
|
-
if (type === ActionType.REJECT_CORRECTION) {
|
|
6426
|
+
if (resettingActionTypes.includes(type)) {
|
|
6185
6427
|
return false;
|
|
6186
6428
|
}
|
|
6187
6429
|
return prev;
|
|
6188
6430
|
}, false);
|
|
6189
6431
|
}
|
|
6190
|
-
function isDeclarationIncomplete(actions) {
|
|
6191
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6192
|
-
}
|
|
6193
|
-
function isRejected(actions) {
|
|
6194
|
-
return actions.at(-1)?.type === ActionType.REJECT;
|
|
6195
|
-
}
|
|
6196
6432
|
function isPotentialDuplicate(actions) {
|
|
6197
6433
|
return actions.reduce((prev, { type }) => {
|
|
6198
6434
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6255,8 +6491,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6255
6491
|
return (0, import_lodash3.uniq)(flags);
|
|
6256
6492
|
}, []);
|
|
6257
6493
|
}
|
|
6258
|
-
function
|
|
6259
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6494
|
+
function getActionStatusFlags(sortedActions) {
|
|
6260
6495
|
const actionStatus = sortedActions.reduce(
|
|
6261
6496
|
(actionStatuses, { type, status: status2 }) => ({
|
|
6262
6497
|
...actionStatuses,
|
|
@@ -6264,26 +6499,40 @@ function getEventFlags(event2, config) {
|
|
|
6264
6499
|
}),
|
|
6265
6500
|
{}
|
|
6266
6501
|
);
|
|
6267
|
-
|
|
6502
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
6268
6503
|
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
6269
6504
|
return flag2;
|
|
6270
6505
|
});
|
|
6271
|
-
|
|
6272
|
-
|
|
6506
|
+
}
|
|
6507
|
+
function getInherentFlags(sortedActions) {
|
|
6508
|
+
const acceptedActions = sortedActions.filter(
|
|
6509
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6510
|
+
);
|
|
6511
|
+
const inherentFlags = [];
|
|
6512
|
+
if (isCorrectionRequested(acceptedActions)) {
|
|
6513
|
+
inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
|
|
6273
6514
|
}
|
|
6274
|
-
if (isDeclarationIncomplete(
|
|
6275
|
-
|
|
6515
|
+
if (isDeclarationIncomplete(acceptedActions)) {
|
|
6516
|
+
inherentFlags.push(InherentFlags.INCOMPLETE);
|
|
6276
6517
|
}
|
|
6277
|
-
if (isRejected(
|
|
6278
|
-
|
|
6518
|
+
if (isRejected(acceptedActions)) {
|
|
6519
|
+
inherentFlags.push(InherentFlags.REJECTED);
|
|
6279
6520
|
}
|
|
6280
|
-
if (isPotentialDuplicate(
|
|
6281
|
-
|
|
6521
|
+
if (isPotentialDuplicate(acceptedActions)) {
|
|
6522
|
+
inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
6282
6523
|
}
|
|
6283
|
-
if (isEditInProgress(
|
|
6284
|
-
|
|
6524
|
+
if (isEditInProgress(acceptedActions)) {
|
|
6525
|
+
inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
6285
6526
|
}
|
|
6286
|
-
return
|
|
6527
|
+
return inherentFlags;
|
|
6528
|
+
}
|
|
6529
|
+
function getEventFlags(event2, config) {
|
|
6530
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6531
|
+
return [
|
|
6532
|
+
...getActionStatusFlags(sortedActions),
|
|
6533
|
+
...getInherentFlags(sortedActions),
|
|
6534
|
+
...resolveEventCustomFlags(event2, config)
|
|
6535
|
+
];
|
|
6287
6536
|
}
|
|
6288
6537
|
|
|
6289
6538
|
// ../commons/src/events/state/index.ts
|
|
@@ -6329,17 +6578,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6329
6578
|
return user2;
|
|
6330
6579
|
}, null);
|
|
6331
6580
|
}
|
|
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
6581
|
function deepDropNulls(obj) {
|
|
6344
6582
|
if (Array.isArray(obj)) {
|
|
6345
6583
|
return obj.map(deepDropNulls);
|
|
@@ -6435,10 +6673,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6435
6673
|
createdBy: creationAction.createdBy,
|
|
6436
6674
|
createdByUserType: creationAction.createdByUserType,
|
|
6437
6675
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6438
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6439
6676
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6440
6677
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6441
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6442
6678
|
updatedBy: requestActionMetadata.createdBy,
|
|
6443
6679
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6444
6680
|
declaration,
|
|
@@ -9697,7 +9933,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9697
9933
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9698
9934
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9699
9935
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9700
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9701
9936
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9702
9937
|
assignedTo: overrides.assignedTo ?? null,
|
|
9703
9938
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -9930,11 +10165,77 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9930
10165
|
}
|
|
9931
10166
|
return true;
|
|
9932
10167
|
}
|
|
10168
|
+
function canAccessUserWithScope({
|
|
10169
|
+
userToAccess,
|
|
10170
|
+
scope,
|
|
10171
|
+
user: user2
|
|
10172
|
+
}) {
|
|
10173
|
+
const opts = scope.options;
|
|
10174
|
+
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
10175
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
10176
|
+
return false;
|
|
10177
|
+
}
|
|
10178
|
+
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10179
|
+
(id) => user2.administrativeAreaId === id
|
|
10180
|
+
) || user2.administrativeAreaId === null;
|
|
10181
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10182
|
+
return false;
|
|
10183
|
+
}
|
|
10184
|
+
if (scopeUsesRoleOptions(scope)) {
|
|
10185
|
+
const { options } = scope;
|
|
10186
|
+
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
10187
|
+
return false;
|
|
10188
|
+
}
|
|
10189
|
+
}
|
|
10190
|
+
return true;
|
|
10191
|
+
}
|
|
10192
|
+
function canAccessOtherUserWithScopes({
|
|
10193
|
+
scopes,
|
|
10194
|
+
userToAccess,
|
|
10195
|
+
user: user2
|
|
10196
|
+
}) {
|
|
10197
|
+
return scopes.some(
|
|
10198
|
+
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
10199
|
+
);
|
|
10200
|
+
}
|
|
9933
10201
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
9934
10202
|
return scopes.some(
|
|
9935
10203
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
9936
10204
|
);
|
|
9937
10205
|
}
|
|
10206
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10207
|
+
const collectedLocations = [];
|
|
10208
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10209
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10210
|
+
while (current) {
|
|
10211
|
+
collectedLocations.push(current);
|
|
10212
|
+
if (!current.parentId) {
|
|
10213
|
+
break;
|
|
10214
|
+
}
|
|
10215
|
+
const parentId = current.parentId;
|
|
10216
|
+
current = administrativeAreas.get(parentId);
|
|
10217
|
+
}
|
|
10218
|
+
return collectedLocations;
|
|
10219
|
+
}
|
|
10220
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10221
|
+
const { administrativeAreas, locations } = context;
|
|
10222
|
+
const loc = locations.get(selectedId);
|
|
10223
|
+
if (loc) {
|
|
10224
|
+
if (loc.administrativeAreaId) {
|
|
10225
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10226
|
+
loc.administrativeAreaId,
|
|
10227
|
+
administrativeAreas
|
|
10228
|
+
);
|
|
10229
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10230
|
+
}
|
|
10231
|
+
return [loc.id];
|
|
10232
|
+
}
|
|
10233
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10234
|
+
selectedId,
|
|
10235
|
+
administrativeAreas
|
|
10236
|
+
);
|
|
10237
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10238
|
+
}
|
|
9938
10239
|
|
|
9939
10240
|
// ../commons/src/events/scopes.ts
|
|
9940
10241
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10009,6 +10310,25 @@ function isActionInScope({
|
|
|
10009
10310
|
);
|
|
10010
10311
|
return canAccess;
|
|
10011
10312
|
}
|
|
10313
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10314
|
+
allRoles,
|
|
10315
|
+
userLocation,
|
|
10316
|
+
acceptedScopes,
|
|
10317
|
+
userRequesting
|
|
10318
|
+
}) {
|
|
10319
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10320
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10321
|
+
userToAccess: {
|
|
10322
|
+
...userLocation,
|
|
10323
|
+
role
|
|
10324
|
+
},
|
|
10325
|
+
user: userRequesting,
|
|
10326
|
+
scopes: acceptedScopes
|
|
10327
|
+
});
|
|
10328
|
+
return canAccess;
|
|
10329
|
+
});
|
|
10330
|
+
return availableRoles;
|
|
10331
|
+
}
|
|
10012
10332
|
|
|
10013
10333
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10014
10334
|
function userDeserializer(serializedUserField, user2) {
|
|
@@ -10211,3 +10531,366 @@ function getFilePathsFromEvent(event2) {
|
|
|
10211
10531
|
});
|
|
10212
10532
|
return (0, import_lodash7.uniq)(filepaths);
|
|
10213
10533
|
}
|
|
10534
|
+
|
|
10535
|
+
// ../commons/src/events/mocks.test.utils.ts
|
|
10536
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
10537
|
+
{
|
|
10538
|
+
id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10539
|
+
name: "Central",
|
|
10540
|
+
parentId: null,
|
|
10541
|
+
validUntil: null,
|
|
10542
|
+
externalId: "ydyJb1RAy4U1"
|
|
10543
|
+
},
|
|
10544
|
+
{
|
|
10545
|
+
id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10546
|
+
name: "Sulaka",
|
|
10547
|
+
parentId: null,
|
|
10548
|
+
validUntil: null,
|
|
10549
|
+
externalId: "pQ8nGxWmZ2Q3"
|
|
10550
|
+
},
|
|
10551
|
+
{
|
|
10552
|
+
id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
|
|
10553
|
+
name: "Pualula",
|
|
10554
|
+
parentId: null,
|
|
10555
|
+
validUntil: null,
|
|
10556
|
+
externalId: "Aq91DweLmT8k"
|
|
10557
|
+
},
|
|
10558
|
+
{
|
|
10559
|
+
id: "6d1a59df-988c-4021-a846-ccbc021931a7",
|
|
10560
|
+
name: "Chuminga",
|
|
10561
|
+
parentId: null,
|
|
10562
|
+
validUntil: null,
|
|
10563
|
+
externalId: "Rw0fYNh2Xk9a"
|
|
10564
|
+
},
|
|
10565
|
+
{
|
|
10566
|
+
id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10567
|
+
name: "Ibombo",
|
|
10568
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10569
|
+
validUntil: null,
|
|
10570
|
+
externalId: "k7DsP4vbN1Qe"
|
|
10571
|
+
},
|
|
10572
|
+
{
|
|
10573
|
+
id: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
10574
|
+
name: "Isango",
|
|
10575
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10576
|
+
validUntil: null,
|
|
10577
|
+
externalId: "Gm3Z9eQpHw4L"
|
|
10578
|
+
},
|
|
10579
|
+
{
|
|
10580
|
+
id: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10581
|
+
name: "Isamba",
|
|
10582
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10583
|
+
validUntil: null,
|
|
10584
|
+
externalId: "sT0xVu1KqJ7r"
|
|
10585
|
+
},
|
|
10586
|
+
{
|
|
10587
|
+
id: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10588
|
+
name: "Itambo",
|
|
10589
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10590
|
+
validUntil: null,
|
|
10591
|
+
externalId: "Nq6Bv2HpL9Te"
|
|
10592
|
+
},
|
|
10593
|
+
{
|
|
10594
|
+
id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
|
|
10595
|
+
name: "Ezhi",
|
|
10596
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10597
|
+
validUntil: null,
|
|
10598
|
+
externalId: "xK8cQ0ZRy5Wd"
|
|
10599
|
+
},
|
|
10600
|
+
{
|
|
10601
|
+
id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
10602
|
+
name: "Ilanga",
|
|
10603
|
+
parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10604
|
+
validUntil: null,
|
|
10605
|
+
externalId: "Cq4Jm1XvN8Ls"
|
|
10606
|
+
},
|
|
10607
|
+
// Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
|
|
10608
|
+
{
|
|
10609
|
+
id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
10610
|
+
name: "Klow",
|
|
10611
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10612
|
+
validUntil: null,
|
|
10613
|
+
externalId: "IkYcYBUcyY2"
|
|
10614
|
+
},
|
|
10615
|
+
{
|
|
10616
|
+
id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
|
|
10617
|
+
name: "Mbondo",
|
|
10618
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10619
|
+
validUntil: null,
|
|
10620
|
+
externalId: "Qhvv5hvo3mY"
|
|
10621
|
+
},
|
|
10622
|
+
{
|
|
10623
|
+
id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
|
|
10624
|
+
name: "Ndara",
|
|
10625
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10626
|
+
validUntil: null,
|
|
10627
|
+
externalId: "crXh068O9TR"
|
|
10628
|
+
},
|
|
10629
|
+
{
|
|
10630
|
+
id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
|
|
10631
|
+
name: "Olani",
|
|
10632
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10633
|
+
validUntil: null,
|
|
10634
|
+
externalId: "r00It8Tvvp7"
|
|
10635
|
+
},
|
|
10636
|
+
{
|
|
10637
|
+
id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
|
|
10638
|
+
name: "Pemba",
|
|
10639
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10640
|
+
validUntil: null,
|
|
10641
|
+
externalId: "ZnUWsbONIaH"
|
|
10642
|
+
},
|
|
10643
|
+
{
|
|
10644
|
+
id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
|
|
10645
|
+
name: "Quanza",
|
|
10646
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10647
|
+
validUntil: null,
|
|
10648
|
+
externalId: "fDZycvQTa7l"
|
|
10649
|
+
},
|
|
10650
|
+
{
|
|
10651
|
+
id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
|
|
10652
|
+
name: "Rivka",
|
|
10653
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10654
|
+
validUntil: null,
|
|
10655
|
+
externalId: "KqswxCGTELa"
|
|
10656
|
+
},
|
|
10657
|
+
// Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
|
|
10658
|
+
{
|
|
10659
|
+
id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
|
|
10660
|
+
name: "Mbula",
|
|
10661
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10662
|
+
validUntil: null,
|
|
10663
|
+
externalId: "osEbKjRc9Kg"
|
|
10664
|
+
},
|
|
10665
|
+
{
|
|
10666
|
+
id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
|
|
10667
|
+
name: "Ndoki",
|
|
10668
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10669
|
+
validUntil: null,
|
|
10670
|
+
externalId: "aq4daBUAGr3"
|
|
10671
|
+
},
|
|
10672
|
+
{
|
|
10673
|
+
id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
|
|
10674
|
+
name: "Tsanga",
|
|
10675
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10676
|
+
validUntil: null,
|
|
10677
|
+
externalId: "cqis6Y8trbJ"
|
|
10678
|
+
},
|
|
10679
|
+
{
|
|
10680
|
+
id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
|
|
10681
|
+
name: "Waziri",
|
|
10682
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10683
|
+
validUntil: null,
|
|
10684
|
+
externalId: "LMijHPyyx6d"
|
|
10685
|
+
},
|
|
10686
|
+
{
|
|
10687
|
+
id: "2c5d6e7f-8a9b-4423-8def-456789012345",
|
|
10688
|
+
name: "Zimbi",
|
|
10689
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10690
|
+
validUntil: null,
|
|
10691
|
+
externalId: "pcQYbPuKGZ7"
|
|
10692
|
+
},
|
|
10693
|
+
// Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
|
|
10694
|
+
{
|
|
10695
|
+
id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
|
|
10696
|
+
name: "Felani",
|
|
10697
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10698
|
+
validUntil: null,
|
|
10699
|
+
externalId: "gSqpoCGdMXp"
|
|
10700
|
+
},
|
|
10701
|
+
{
|
|
10702
|
+
id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
|
|
10703
|
+
name: "Goroma",
|
|
10704
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10705
|
+
validUntil: null,
|
|
10706
|
+
externalId: "KvAAIaNqVrp"
|
|
10707
|
+
},
|
|
10708
|
+
{
|
|
10709
|
+
id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
|
|
10710
|
+
name: "Halifu",
|
|
10711
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10712
|
+
validUntil: null,
|
|
10713
|
+
externalId: "qe4UnEVt1hv"
|
|
10714
|
+
},
|
|
10715
|
+
{
|
|
10716
|
+
id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
|
|
10717
|
+
name: "Jabari",
|
|
10718
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10719
|
+
validUntil: null,
|
|
10720
|
+
externalId: "yHH9Nz4rLOt"
|
|
10721
|
+
},
|
|
10722
|
+
{
|
|
10723
|
+
id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
|
|
10724
|
+
name: "Kifani",
|
|
10725
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10726
|
+
validUntil: null,
|
|
10727
|
+
externalId: "eSWmXIGeu1I"
|
|
10728
|
+
},
|
|
10729
|
+
{
|
|
10730
|
+
id: "8c1d2e3f-4a5b-4089-8def-012345678901",
|
|
10731
|
+
name: "Lumela",
|
|
10732
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10733
|
+
validUntil: null,
|
|
10734
|
+
externalId: "bh0b3aI1uP3"
|
|
10735
|
+
}
|
|
10736
|
+
];
|
|
10737
|
+
var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
10738
|
+
{
|
|
10739
|
+
id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
|
|
10740
|
+
name: "Central Provincial Office",
|
|
10741
|
+
locationType: "CRVS_OFFICE",
|
|
10742
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10743
|
+
validUntil: null,
|
|
10744
|
+
externalId: "Xr3Df8WpK6Ys"
|
|
10745
|
+
},
|
|
10746
|
+
{
|
|
10747
|
+
id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
|
|
10748
|
+
name: "Central Health Post",
|
|
10749
|
+
locationType: "HEALTH_FACILITY",
|
|
10750
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10751
|
+
validUntil: null
|
|
10752
|
+
},
|
|
10753
|
+
{
|
|
10754
|
+
id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
|
|
10755
|
+
name: "Ibombo District Office",
|
|
10756
|
+
locationType: "CRVS_OFFICE",
|
|
10757
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10758
|
+
validUntil: null,
|
|
10759
|
+
externalId: "Sm4Nw7GrD2Vy"
|
|
10760
|
+
},
|
|
10761
|
+
{
|
|
10762
|
+
id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
|
|
10763
|
+
name: "Isamba District Office",
|
|
10764
|
+
locationType: "CRVS_OFFICE",
|
|
10765
|
+
administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10766
|
+
validUntil: null,
|
|
10767
|
+
externalId: "Vg1Bq5XeH9Lt"
|
|
10768
|
+
},
|
|
10769
|
+
{
|
|
10770
|
+
id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
|
|
10771
|
+
name: "Isango District Office",
|
|
10772
|
+
locationType: "CRVS_OFFICE",
|
|
10773
|
+
administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
10774
|
+
validUntil: null,
|
|
10775
|
+
externalId: "Je7Lm2XqN9Vz"
|
|
10776
|
+
},
|
|
10777
|
+
{
|
|
10778
|
+
id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
|
|
10779
|
+
name: "Sulaka Provincial Office",
|
|
10780
|
+
locationType: "CRVS_OFFICE",
|
|
10781
|
+
administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10782
|
+
validUntil: null,
|
|
10783
|
+
externalId: "Ht2Wp9KcX5Qv"
|
|
10784
|
+
},
|
|
10785
|
+
{
|
|
10786
|
+
id: "030358c6-54af-44be-821b-8e4af963a49c",
|
|
10787
|
+
name: "Ilanga District Office",
|
|
10788
|
+
locationType: "CRVS_OFFICE",
|
|
10789
|
+
administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
10790
|
+
validUntil: null,
|
|
10791
|
+
externalId: "Yp6Ds1WqN3Xz"
|
|
10792
|
+
},
|
|
10793
|
+
{
|
|
10794
|
+
id: "423d000f-101b-47c0-8b86-21a908067cee",
|
|
10795
|
+
name: "Chamakubi Health Post",
|
|
10796
|
+
locationType: "HEALTH_FACILITY",
|
|
10797
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10798
|
+
validUntil: null,
|
|
10799
|
+
externalId: "M1nFr8LbC2Qy"
|
|
10800
|
+
},
|
|
10801
|
+
{
|
|
10802
|
+
id: "4d3279be-d026-420c-88f7-f0a4ae986973",
|
|
10803
|
+
name: "Ibombo Rural Health Centre",
|
|
10804
|
+
locationType: "HEALTH_FACILITY",
|
|
10805
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10806
|
+
validUntil: null,
|
|
10807
|
+
externalId: "bT7pV6YrW0Xc"
|
|
10808
|
+
},
|
|
10809
|
+
{
|
|
10810
|
+
id: "190902f4-1d77-476a-8947-41145af1db7d",
|
|
10811
|
+
name: "Chikobo Rural Health Centre",
|
|
10812
|
+
locationType: "HEALTH_FACILITY",
|
|
10813
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10814
|
+
validUntil: null,
|
|
10815
|
+
externalId: "zE4qPn2SgJ5d"
|
|
10816
|
+
},
|
|
10817
|
+
{
|
|
10818
|
+
id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
|
|
10819
|
+
name: "Chilochabalenje Health Post",
|
|
10820
|
+
locationType: "HEALTH_FACILITY",
|
|
10821
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10822
|
+
validUntil: null,
|
|
10823
|
+
externalId: "H8vDs1MqR4Uf"
|
|
10824
|
+
},
|
|
10825
|
+
{
|
|
10826
|
+
id: "dbfc178f-7295-4b90-b28d-111c95b03127",
|
|
10827
|
+
name: "Chipeso Rural Health Centre",
|
|
10828
|
+
locationType: "HEALTH_FACILITY",
|
|
10829
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10830
|
+
validUntil: null,
|
|
10831
|
+
externalId: "Qw3uZ9KfX6Lm"
|
|
10832
|
+
},
|
|
10833
|
+
{
|
|
10834
|
+
id: "09862bfe-c7ac-46cd-987b-668681533c80",
|
|
10835
|
+
name: "Chisamba Rural Health Centre",
|
|
10836
|
+
locationType: "HEALTH_FACILITY",
|
|
10837
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10838
|
+
validUntil: null,
|
|
10839
|
+
externalId: "Yr0pCg8LdM2s"
|
|
10840
|
+
},
|
|
10841
|
+
{
|
|
10842
|
+
id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
|
|
10843
|
+
name: "Chitanda Rural Health Centre",
|
|
10844
|
+
locationType: "HEALTH_FACILITY",
|
|
10845
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10846
|
+
validUntil: null,
|
|
10847
|
+
externalId: "tS9gJ4PwB1Qx"
|
|
10848
|
+
},
|
|
10849
|
+
{
|
|
10850
|
+
id: "0431c433-6062-4a4c-aee9-25271aec61ee",
|
|
10851
|
+
name: "Golden Valley Rural Health Centre",
|
|
10852
|
+
locationType: "HEALTH_FACILITY",
|
|
10853
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10854
|
+
validUntil: null,
|
|
10855
|
+
externalId: "Ld7Qm3XsA8Vr"
|
|
10856
|
+
},
|
|
10857
|
+
{
|
|
10858
|
+
id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
|
|
10859
|
+
name: "Ipongo Rural Health Centre",
|
|
10860
|
+
locationType: "HEALTH_FACILITY",
|
|
10861
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10862
|
+
validUntil: null,
|
|
10863
|
+
externalId: "kF2sW9DmH0Bt"
|
|
10864
|
+
},
|
|
10865
|
+
{
|
|
10866
|
+
id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
|
|
10867
|
+
name: "Itumbwe Health Post",
|
|
10868
|
+
locationType: "HEALTH_FACILITY",
|
|
10869
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10870
|
+
validUntil: null,
|
|
10871
|
+
externalId: "Ue5Xb3VaC7Pq"
|
|
10872
|
+
},
|
|
10873
|
+
{
|
|
10874
|
+
id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
|
|
10875
|
+
name: "Kabangalala Rural Health Centre",
|
|
10876
|
+
locationType: "HEALTH_FACILITY",
|
|
10877
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10878
|
+
validUntil: null,
|
|
10879
|
+
externalId: "Pz8Kc1TqH6Jn"
|
|
10880
|
+
},
|
|
10881
|
+
// Village offices
|
|
10882
|
+
{
|
|
10883
|
+
id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
|
|
10884
|
+
name: "Klow Village Office",
|
|
10885
|
+
locationType: "CRVS_OFFICE",
|
|
10886
|
+
administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
10887
|
+
validUntil: null,
|
|
10888
|
+
externalId: "PmAyxAJkxiJ"
|
|
10889
|
+
}
|
|
10890
|
+
];
|
|
10891
|
+
var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
10892
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
|
|
10893
|
+
);
|
|
10894
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
10895
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
10896
|
+
);
|