@opencrvs/toolkit 2.0.0-rc.ede78c9 → 2.0.0-rc.ee1414e
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 +225 -89
- package/dist/cli.js +507 -171
- package/dist/commons/api/router.d.ts +3403 -272
- package/dist/commons/conditionals/conditionals.d.ts +9 -3
- package/dist/commons/conditionals/validate.d.ts +1 -0
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +114 -0
- package/dist/commons/events/Draft.d.ts +4 -2
- package/dist/commons/events/EventDocument.d.ts +3 -0
- 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 +5 -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 +21 -0
- 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 +3 -2
- package/dist/commons/events/utils.d.ts +12 -1
- package/dist/conditionals/index.js +12 -4
- package/dist/events/index.js +813 -177
- 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 +505 -169
- 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 +661 -122
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +8 -4
- package/opencrvs-toolkit-2.0.0-rc.ee1414e.tgz +0 -0
- package/package.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.ede78c9.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,
|
|
@@ -277,6 +282,7 @@ __export(events_exports, {
|
|
|
277
282
|
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
|
278
283
|
findAllFields: () => findAllFields,
|
|
279
284
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
|
285
|
+
findPendingCorrectionAction: () => findPendingCorrectionAction,
|
|
280
286
|
findRecordActionPages: () => findRecordActionPages,
|
|
281
287
|
flag: () => flag,
|
|
282
288
|
flattenFieldReference: () => flattenFieldReference,
|
|
@@ -302,13 +308,15 @@ __export(events_exports, {
|
|
|
302
308
|
getActionConfig: () => getActionConfig,
|
|
303
309
|
getActionReview: () => getActionReview,
|
|
304
310
|
getActionReviewFields: () => getActionReviewFields,
|
|
311
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
305
312
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
306
313
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
307
314
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
308
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
309
315
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
310
316
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
317
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
311
318
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
319
|
+
getCompleteActionContent: () => getCompleteActionContent,
|
|
312
320
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
313
321
|
getCurrentEventState: () => getCurrentEventState,
|
|
314
322
|
getCustomActionFields: () => getCustomActionFields,
|
|
@@ -317,7 +325,9 @@ __export(events_exports, {
|
|
|
317
325
|
getDeclarationFields: () => getDeclarationFields,
|
|
318
326
|
getDeclarationPages: () => getDeclarationPages,
|
|
319
327
|
getEventConfigById: () => getEventConfigById,
|
|
328
|
+
getEventFlags: () => getEventFlags,
|
|
320
329
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
330
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
321
331
|
getMixedPath: () => getMixedPath,
|
|
322
332
|
getPendingAction: () => getPendingAction,
|
|
323
333
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -378,6 +388,7 @@ __export(events_exports, {
|
|
|
378
388
|
isPageVisible: () => isPageVisible,
|
|
379
389
|
isParagraphFieldType: () => isParagraphFieldType,
|
|
380
390
|
isPhoneFieldType: () => isPhoneFieldType,
|
|
391
|
+
isPotentialDuplicate: () => isPotentialDuplicate,
|
|
381
392
|
isPrintButtonFieldType: () => isPrintButtonFieldType,
|
|
382
393
|
isQrReaderFieldType: () => isQrReaderFieldType,
|
|
383
394
|
isQueryParamReaderFieldType: () => isQueryParamReaderFieldType,
|
|
@@ -411,6 +422,7 @@ __export(events_exports, {
|
|
|
411
422
|
plainDateToLocalDate: () => plainDateToLocalDate,
|
|
412
423
|
precompileActionSchemas: () => precompileActionSchemas,
|
|
413
424
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
425
|
+
resolveEventCustomFlags: () => resolveEventCustomFlags,
|
|
414
426
|
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
415
427
|
runFieldValidations: () => runFieldValidations,
|
|
416
428
|
runStructuralValidations: () => runStructuralValidations,
|
|
@@ -607,12 +619,14 @@ var SystemScopeType = z2.enum([
|
|
|
607
619
|
"organisation.read-locations",
|
|
608
620
|
"user.read",
|
|
609
621
|
"user.create",
|
|
610
|
-
"user.edit"
|
|
622
|
+
"user.edit",
|
|
623
|
+
"user.search"
|
|
611
624
|
]);
|
|
612
625
|
var UserScopeType = SystemScopeType.extract([
|
|
613
626
|
"user.read",
|
|
614
627
|
"user.create",
|
|
615
|
-
"user.edit"
|
|
628
|
+
"user.edit",
|
|
629
|
+
"user.search"
|
|
616
630
|
]);
|
|
617
631
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
618
632
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -621,7 +635,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
621
635
|
options: AllUserScopeOptions.optional()
|
|
622
636
|
}),
|
|
623
637
|
z2.object({
|
|
624
|
-
type: UserScopeType.extract(["user.read"]),
|
|
638
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
625
639
|
options: AccessLevelOptions.optional()
|
|
626
640
|
})
|
|
627
641
|
]);
|
|
@@ -700,7 +714,9 @@ var decodeScope = (query) => {
|
|
|
700
714
|
};
|
|
701
715
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
702
716
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
703
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
717
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
718
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
719
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
704
720
|
};
|
|
705
721
|
function getAcceptedScopesByType({
|
|
706
722
|
acceptedScopes,
|
|
@@ -1073,7 +1089,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1073
1089
|
ShowConditional,
|
|
1074
1090
|
// Action can be shown to the user in the list but as disabled
|
|
1075
1091
|
EnableConditional
|
|
1076
|
-
])
|
|
1092
|
+
]).meta({
|
|
1093
|
+
id: "ActionConditional",
|
|
1094
|
+
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."
|
|
1095
|
+
});
|
|
1077
1096
|
var DisplayOnReviewConditional = z7.object({
|
|
1078
1097
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1079
1098
|
conditional: Conditional
|
|
@@ -1088,8 +1107,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1088
1107
|
// Field output can be shown / hidden on the review page
|
|
1089
1108
|
DisplayOnReviewConditional
|
|
1090
1109
|
]).meta({
|
|
1091
|
-
|
|
1092
|
-
|
|
1110
|
+
id: "FieldConditional",
|
|
1111
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
1093
1112
|
});
|
|
1094
1113
|
|
|
1095
1114
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1409,28 +1428,20 @@ function schemaPriority(schema) {
|
|
|
1409
1428
|
return idx === -1 ? 9999 : idx;
|
|
1410
1429
|
}
|
|
1411
1430
|
function safeUnion(schemas) {
|
|
1431
|
+
const sortedSchemas = [...schemas].sort(
|
|
1432
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1433
|
+
);
|
|
1412
1434
|
return z12.any().superRefine((val, ctx) => {
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
if (successful.length === 0) {
|
|
1418
|
-
ctx.addIssue({
|
|
1419
|
-
code: "invalid_type",
|
|
1420
|
-
expected: "custom",
|
|
1421
|
-
message: "Value does not match any schema"
|
|
1422
|
-
});
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1426
|
-
const best = successful[0];
|
|
1427
|
-
if (!best.safeParse(val).success) {
|
|
1428
|
-
ctx.addIssue({
|
|
1429
|
-
expected: "custom",
|
|
1430
|
-
code: "invalid_type",
|
|
1431
|
-
message: "Value did not match the best schema"
|
|
1432
|
-
});
|
|
1435
|
+
for (const schema of sortedSchemas) {
|
|
1436
|
+
if (schema.safeParse(val).success) {
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1433
1439
|
}
|
|
1440
|
+
ctx.addIssue({
|
|
1441
|
+
code: "invalid_type",
|
|
1442
|
+
expected: "custom",
|
|
1443
|
+
message: "Value does not match any schema"
|
|
1444
|
+
});
|
|
1434
1445
|
}).meta({
|
|
1435
1446
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1436
1447
|
});
|
|
@@ -1647,8 +1658,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1647
1658
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1648
1659
|
z14.object({
|
|
1649
1660
|
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1650
|
-
requestId: z14.string()
|
|
1661
|
+
requestId: z14.string(),
|
|
1651
1662
|
// TODO move into 'content' property
|
|
1663
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1652
1664
|
}).shape
|
|
1653
1665
|
);
|
|
1654
1666
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1740,6 +1752,9 @@ var FlagConfig = z15.object({
|
|
|
1740
1752
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1741
1753
|
),
|
|
1742
1754
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1755
|
+
}).meta({
|
|
1756
|
+
id: "FlagConfig",
|
|
1757
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1743
1758
|
});
|
|
1744
1759
|
var ActionFlagConfig = z15.object({
|
|
1745
1760
|
id: Flag,
|
|
@@ -1747,6 +1762,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1747
1762
|
conditional: Conditional.optional().describe(
|
|
1748
1763
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1749
1764
|
)
|
|
1765
|
+
}).meta({
|
|
1766
|
+
id: "ActionFlagConfig",
|
|
1767
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1750
1768
|
});
|
|
1751
1769
|
|
|
1752
1770
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1768,8 +1786,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1768
1786
|
),
|
|
1769
1787
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1770
1788
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1771
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1772
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1789
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1773
1790
|
});
|
|
1774
1791
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1775
1792
|
registrationNumber: z16.string().describe(
|
|
@@ -1797,9 +1814,6 @@ var EventMetadata = z16.object({
|
|
|
1797
1814
|
createdAtLocation: UUID.nullish().describe(
|
|
1798
1815
|
"Location of the user who created the event."
|
|
1799
1816
|
),
|
|
1800
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1801
|
-
"Signature of the user who created the event."
|
|
1802
|
-
),
|
|
1803
1817
|
updatedAtLocation: UUID.nullish().describe(
|
|
1804
1818
|
"Location of the user who last changed the status."
|
|
1805
1819
|
),
|
|
@@ -2174,14 +2188,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2174
2188
|
}
|
|
2175
2189
|
}).describe("Unique identifier for the field");
|
|
2176
2190
|
var FieldReference = import_v43.default.object({
|
|
2177
|
-
$$field: FieldId,
|
|
2191
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2178
2192
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2179
2193
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2180
2194
|
)
|
|
2181
2195
|
}).describe("Reference to a field by its ID");
|
|
2182
2196
|
var ValidationConfig = import_v43.default.object({
|
|
2183
|
-
validator: Conditional
|
|
2184
|
-
|
|
2197
|
+
validator: Conditional.describe(
|
|
2198
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2199
|
+
),
|
|
2200
|
+
message: TranslationConfig.describe(
|
|
2201
|
+
"Error message displayed when the validator does not hold."
|
|
2202
|
+
)
|
|
2203
|
+
}).meta({
|
|
2204
|
+
id: "ValidationConfig",
|
|
2205
|
+
description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
|
|
2185
2206
|
});
|
|
2186
2207
|
var requiredSchema = import_v43.default.union([
|
|
2187
2208
|
import_v43.default.boolean(),
|
|
@@ -2220,6 +2241,9 @@ var BaseField = import_v43.default.object({
|
|
|
2220
2241
|
}).describe("Common properties shared across all field types.");
|
|
2221
2242
|
var Divider = BaseField.extend({
|
|
2222
2243
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2244
|
+
}).meta({
|
|
2245
|
+
description: "A horizontal line divider",
|
|
2246
|
+
id: "Divider"
|
|
2223
2247
|
});
|
|
2224
2248
|
var TextField = BaseField.extend({
|
|
2225
2249
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2230,7 +2254,10 @@ var TextField = BaseField.extend({
|
|
|
2230
2254
|
prefix: TranslationConfig.optional(),
|
|
2231
2255
|
postfix: TranslationConfig.optional()
|
|
2232
2256
|
}).default({ type: "text" }).optional()
|
|
2233
|
-
}).
|
|
2257
|
+
}).meta({
|
|
2258
|
+
description: "A text input field",
|
|
2259
|
+
id: "TextField"
|
|
2260
|
+
});
|
|
2234
2261
|
var NumberField = BaseField.extend({
|
|
2235
2262
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2236
2263
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2240,7 +2267,10 @@ var NumberField = BaseField.extend({
|
|
|
2240
2267
|
prefix: TranslationConfig.optional(),
|
|
2241
2268
|
postfix: TranslationConfig.optional()
|
|
2242
2269
|
}).optional()
|
|
2243
|
-
}).
|
|
2270
|
+
}).meta({
|
|
2271
|
+
description: "A number input field",
|
|
2272
|
+
id: "NumberField"
|
|
2273
|
+
});
|
|
2244
2274
|
var TextAreaField = BaseField.extend({
|
|
2245
2275
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2246
2276
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2251,7 +2281,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2251
2281
|
prefix: TranslationConfig.optional(),
|
|
2252
2282
|
postfix: TranslationConfig.optional()
|
|
2253
2283
|
}).default({ rows: 4 }).optional()
|
|
2254
|
-
}).
|
|
2284
|
+
}).meta({
|
|
2285
|
+
description: "A multiline text input",
|
|
2286
|
+
id: "TextAreaField"
|
|
2287
|
+
});
|
|
2255
2288
|
var ImageMimeType = import_v43.default.enum([
|
|
2256
2289
|
"image/png",
|
|
2257
2290
|
"image/jpg",
|
|
@@ -2281,13 +2314,19 @@ var SignatureField = BaseField.extend({
|
|
|
2281
2314
|
}).default({
|
|
2282
2315
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2283
2316
|
})
|
|
2284
|
-
}).
|
|
2317
|
+
}).meta({
|
|
2318
|
+
description: "A signature input field",
|
|
2319
|
+
id: "SignatureField"
|
|
2320
|
+
});
|
|
2285
2321
|
var EmailField = BaseField.extend({
|
|
2286
2322
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2287
2323
|
configuration: import_v43.default.object({
|
|
2288
2324
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2289
2325
|
}).default({ maxLength: 255 }).optional(),
|
|
2290
2326
|
defaultValue: NonEmptyTextValue.optional()
|
|
2327
|
+
}).meta({
|
|
2328
|
+
description: "An email input field",
|
|
2329
|
+
id: "EmailField"
|
|
2291
2330
|
});
|
|
2292
2331
|
var DateField = BaseField.extend({
|
|
2293
2332
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2297,7 +2336,10 @@ var DateField = BaseField.extend({
|
|
|
2297
2336
|
"Text to display above the date input"
|
|
2298
2337
|
).optional()
|
|
2299
2338
|
}).optional()
|
|
2300
|
-
}).
|
|
2339
|
+
}).meta({
|
|
2340
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2341
|
+
id: "DateField"
|
|
2342
|
+
});
|
|
2301
2343
|
var AgeField = BaseField.extend({
|
|
2302
2344
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2303
2345
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2306,7 +2348,10 @@ var AgeField = BaseField.extend({
|
|
|
2306
2348
|
prefix: TranslationConfig.optional(),
|
|
2307
2349
|
postfix: TranslationConfig.optional()
|
|
2308
2350
|
})
|
|
2309
|
-
}).
|
|
2351
|
+
}).meta({
|
|
2352
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2353
|
+
id: "AgeField"
|
|
2354
|
+
});
|
|
2310
2355
|
var TimeField = BaseField.extend({
|
|
2311
2356
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2312
2357
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2316,7 +2361,10 @@ var TimeField = BaseField.extend({
|
|
|
2316
2361
|
"Text to display above the time input"
|
|
2317
2362
|
).optional()
|
|
2318
2363
|
}).optional()
|
|
2319
|
-
}).
|
|
2364
|
+
}).meta({
|
|
2365
|
+
description: "A single time input (HH-mm)",
|
|
2366
|
+
id: "TimeField"
|
|
2367
|
+
});
|
|
2320
2368
|
var DateRangeField = BaseField.extend({
|
|
2321
2369
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2322
2370
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2325,7 +2373,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2325
2373
|
"Text to display above the date input"
|
|
2326
2374
|
).optional()
|
|
2327
2375
|
}).optional()
|
|
2328
|
-
}).
|
|
2376
|
+
}).meta({
|
|
2377
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2378
|
+
id: "DateRangeField"
|
|
2379
|
+
});
|
|
2329
2380
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2330
2381
|
"reg12",
|
|
2331
2382
|
"reg14",
|
|
@@ -2369,18 +2420,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2369
2420
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2370
2421
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2371
2422
|
configuration: ImageConfiguration
|
|
2372
|
-
}).
|
|
2423
|
+
}).meta({
|
|
2424
|
+
description: "A read-only image component for form pages",
|
|
2425
|
+
id: "ImageViewField"
|
|
2426
|
+
});
|
|
2373
2427
|
var Paragraph = BaseField.extend({
|
|
2374
2428
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2375
2429
|
configuration: ParagraphConfiguration
|
|
2376
|
-
}).
|
|
2430
|
+
}).meta({
|
|
2431
|
+
description: "A read-only HTML <p> paragraph",
|
|
2432
|
+
id: "Paragraph"
|
|
2433
|
+
});
|
|
2377
2434
|
var Heading = BaseField.extend({
|
|
2378
2435
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2379
2436
|
configuration: HeadingConfiguration
|
|
2380
|
-
}).
|
|
2437
|
+
}).meta({
|
|
2438
|
+
description: "A read-only heading component for form pages",
|
|
2439
|
+
id: "Heading"
|
|
2440
|
+
});
|
|
2381
2441
|
var PageHeader = BaseField.extend({
|
|
2382
2442
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2383
|
-
}).
|
|
2443
|
+
}).meta({
|
|
2444
|
+
description: "A read-only header component for form pages",
|
|
2445
|
+
id: "PageHeader"
|
|
2446
|
+
});
|
|
2384
2447
|
var File = BaseField.extend({
|
|
2385
2448
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2386
2449
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2399,7 +2462,10 @@ var File = BaseField.extend({
|
|
|
2399
2462
|
}).default({
|
|
2400
2463
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2401
2464
|
})
|
|
2402
|
-
}).
|
|
2465
|
+
}).meta({
|
|
2466
|
+
description: "A file upload field",
|
|
2467
|
+
id: "File"
|
|
2468
|
+
});
|
|
2403
2469
|
var SelectOption = import_v43.default.object({
|
|
2404
2470
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2405
2471
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2416,7 +2482,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2416
2482
|
"Placeholder for the number field"
|
|
2417
2483
|
)
|
|
2418
2484
|
}).optional()
|
|
2419
|
-
}).
|
|
2485
|
+
}).meta({
|
|
2486
|
+
description: "A number with unit input field",
|
|
2487
|
+
id: "NumberWithUnitField"
|
|
2488
|
+
});
|
|
2420
2489
|
var RadioGroup = BaseField.extend({
|
|
2421
2490
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2422
2491
|
defaultValue: TextValue.optional(),
|
|
@@ -2426,7 +2495,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2426
2495
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2427
2496
|
}).optional()
|
|
2428
2497
|
}).optional()
|
|
2429
|
-
}).
|
|
2498
|
+
}).meta({
|
|
2499
|
+
description: "A grouped radio button field",
|
|
2500
|
+
id: "RadioGroup"
|
|
2501
|
+
});
|
|
2430
2502
|
var BulletList = BaseField.extend({
|
|
2431
2503
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2432
2504
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2435,7 +2507,10 @@ var BulletList = BaseField.extend({
|
|
|
2435
2507
|
fontVariant: HtmlFontVariant.optional()
|
|
2436
2508
|
}).optional()
|
|
2437
2509
|
}).default({})
|
|
2438
|
-
}).
|
|
2510
|
+
}).meta({
|
|
2511
|
+
description: "A list of bullet points",
|
|
2512
|
+
id: "BulletList"
|
|
2513
|
+
});
|
|
2439
2514
|
var Select = BaseField.extend({
|
|
2440
2515
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2441
2516
|
defaultValue: TextValue.optional(),
|
|
@@ -2450,7 +2525,10 @@ var Select = BaseField.extend({
|
|
|
2450
2525
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2451
2526
|
`
|
|
2452
2527
|
)
|
|
2453
|
-
}).
|
|
2528
|
+
}).meta({
|
|
2529
|
+
description: "A select input field",
|
|
2530
|
+
id: "Select"
|
|
2531
|
+
});
|
|
2454
2532
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2455
2533
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2456
2534
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2459,7 +2537,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2459
2537
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2460
2538
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2461
2539
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2462
|
-
}).
|
|
2540
|
+
}).meta({
|
|
2541
|
+
description: "A date range selection field",
|
|
2542
|
+
id: "SelectDateRangeField"
|
|
2543
|
+
});
|
|
2463
2544
|
var NameConfig = import_v43.default.object({
|
|
2464
2545
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2465
2546
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2490,26 +2571,41 @@ var NameField = BaseField.extend({
|
|
|
2490
2571
|
surname: { required: true }
|
|
2491
2572
|
}
|
|
2492
2573
|
}).optional()
|
|
2493
|
-
}).
|
|
2574
|
+
}).meta({
|
|
2575
|
+
description: "A field for entering a persons name",
|
|
2576
|
+
id: "NameField"
|
|
2577
|
+
});
|
|
2494
2578
|
var PhoneField = BaseField.extend({
|
|
2495
2579
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2496
2580
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2497
|
-
}).
|
|
2581
|
+
}).meta({
|
|
2582
|
+
description: "A field for entering a phone number",
|
|
2583
|
+
id: "PhoneField"
|
|
2584
|
+
});
|
|
2498
2585
|
var IdField = BaseField.extend({
|
|
2499
2586
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2500
2587
|
type: import_v43.default.literal(FieldType.ID)
|
|
2501
|
-
}).
|
|
2588
|
+
}).meta({
|
|
2589
|
+
description: "A field for entering an ID",
|
|
2590
|
+
id: "IdField"
|
|
2591
|
+
});
|
|
2502
2592
|
var Checkbox = BaseField.extend({
|
|
2503
2593
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2504
2594
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2505
|
-
}).
|
|
2595
|
+
}).meta({
|
|
2596
|
+
description: "A boolean checkbox field",
|
|
2597
|
+
id: "Checkbox"
|
|
2598
|
+
});
|
|
2506
2599
|
var Country = BaseField.extend({
|
|
2507
2600
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2508
2601
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2509
2602
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2510
2603
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2511
2604
|
)
|
|
2512
|
-
}).
|
|
2605
|
+
}).meta({
|
|
2606
|
+
description: "A field for selecting a country",
|
|
2607
|
+
id: "Country"
|
|
2608
|
+
});
|
|
2513
2609
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2514
2610
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2515
2611
|
);
|
|
@@ -2518,16 +2614,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2518
2614
|
"HEALTH_FACILITY",
|
|
2519
2615
|
"CRVS_OFFICE"
|
|
2520
2616
|
]);
|
|
2521
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2522
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2523
|
-
type: AdministrativeAreas,
|
|
2524
|
-
allowedLocations: AllowedLocations
|
|
2525
|
-
}).describe("Administrative area options");
|
|
2526
2617
|
var AdministrativeAreaField = BaseField.extend({
|
|
2527
2618
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2528
2619
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2529
|
-
configuration:
|
|
2530
|
-
|
|
2620
|
+
configuration: import_v43.default.object({
|
|
2621
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2622
|
+
type: AdministrativeAreas,
|
|
2623
|
+
allowedLocations: AllowedLocations
|
|
2624
|
+
}).describe("Administrative area options")
|
|
2625
|
+
}).meta({
|
|
2626
|
+
description: "Administrative area input field",
|
|
2627
|
+
id: "AdministrativeAreaField"
|
|
2628
|
+
});
|
|
2531
2629
|
var LocationInput = BaseField.extend({
|
|
2532
2630
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2533
2631
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2535,7 +2633,10 @@ var LocationInput = BaseField.extend({
|
|
|
2535
2633
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2536
2634
|
allowedLocations: AllowedLocations
|
|
2537
2635
|
}).optional()
|
|
2538
|
-
}).
|
|
2636
|
+
}).meta({
|
|
2637
|
+
description: "A field for selecting a location",
|
|
2638
|
+
id: "LocationInput"
|
|
2639
|
+
});
|
|
2539
2640
|
var FileUploadWithOptions = BaseField.extend({
|
|
2540
2641
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2541
2642
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2549,6 +2650,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2549
2650
|
}).default({
|
|
2550
2651
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2551
2652
|
})
|
|
2653
|
+
}).meta({
|
|
2654
|
+
description: "A field for uploading files with file type options",
|
|
2655
|
+
id: "FileUploadWithOptions"
|
|
2552
2656
|
});
|
|
2553
2657
|
var Facility = BaseField.extend({
|
|
2554
2658
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2594,7 +2698,10 @@ var Address = BaseField.extend({
|
|
|
2594
2698
|
allowedLocations: AllowedLocations
|
|
2595
2699
|
}).optional(),
|
|
2596
2700
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2597
|
-
}).
|
|
2701
|
+
}).meta({
|
|
2702
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2703
|
+
id: "Address"
|
|
2704
|
+
});
|
|
2598
2705
|
var StaticDataEntry = import_v43.default.object({
|
|
2599
2706
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2600
2707
|
label: TranslationConfig,
|
|
@@ -2609,7 +2716,10 @@ var DataField = BaseField.extend({
|
|
|
2609
2716
|
subtitle: TranslationConfig.optional(),
|
|
2610
2717
|
data: import_v43.default.array(DataEntry)
|
|
2611
2718
|
})
|
|
2612
|
-
}).
|
|
2719
|
+
}).meta({
|
|
2720
|
+
description: "A field for displaying a table of read-only data",
|
|
2721
|
+
id: "DataField"
|
|
2722
|
+
});
|
|
2613
2723
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2614
2724
|
var ButtonType = import_v43.default.enum([
|
|
2615
2725
|
"primary",
|
|
@@ -2636,11 +2746,17 @@ var ButtonField = BaseField.extend({
|
|
|
2636
2746
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2637
2747
|
defaultValue: ButtonFieldValue.optional(),
|
|
2638
2748
|
configuration: ButtonConfiguration
|
|
2639
|
-
}).
|
|
2749
|
+
}).meta({
|
|
2750
|
+
description: "A generic button that can be used to trigger an action",
|
|
2751
|
+
id: "ButtonField"
|
|
2752
|
+
});
|
|
2640
2753
|
var FieldGroup = BaseField.extend({
|
|
2641
2754
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2642
2755
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2643
2756
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2757
|
+
}).meta({
|
|
2758
|
+
description: "A group of fields that are displayed together",
|
|
2759
|
+
id: "FieldGroup"
|
|
2644
2760
|
});
|
|
2645
2761
|
var AlphaPrintButton = BaseField.extend({
|
|
2646
2762
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2650,7 +2766,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2650
2766
|
"Label for the print button"
|
|
2651
2767
|
)
|
|
2652
2768
|
})
|
|
2653
|
-
}).
|
|
2769
|
+
}).meta({
|
|
2770
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2771
|
+
id: "AlphaPrintButton"
|
|
2772
|
+
});
|
|
2654
2773
|
var HttpField = BaseField.extend({
|
|
2655
2774
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2656
2775
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2666,20 +2785,30 @@ var HttpField = BaseField.extend({
|
|
|
2666
2785
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2667
2786
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2668
2787
|
})
|
|
2669
|
-
}).
|
|
2788
|
+
}).meta({
|
|
2789
|
+
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.",
|
|
2790
|
+
id: "HttpField"
|
|
2791
|
+
});
|
|
2670
2792
|
var AutocompleteField = BaseField.extend({
|
|
2671
2793
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2672
2794
|
configuration: import_v43.default.object({
|
|
2673
|
-
url: import_v43.default.string().describe(
|
|
2795
|
+
url: import_v43.default.string().describe(
|
|
2796
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2797
|
+
).optional(),
|
|
2674
2798
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2675
2799
|
defaultOptions: import_v43.default.array(
|
|
2676
2800
|
import_v43.default.object({
|
|
2677
2801
|
label: import_v43.default.string(),
|
|
2678
2802
|
value: import_v43.default.string()
|
|
2679
2803
|
})
|
|
2680
|
-
).optional()
|
|
2804
|
+
).optional().describe(
|
|
2805
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2806
|
+
)
|
|
2681
2807
|
})
|
|
2682
|
-
}).
|
|
2808
|
+
}).meta({
|
|
2809
|
+
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.",
|
|
2810
|
+
id: "AutocompleteField"
|
|
2811
|
+
});
|
|
2683
2812
|
var SearchField = HttpField.extend({
|
|
2684
2813
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2685
2814
|
configuration: SearchQuery.pick({
|
|
@@ -2712,6 +2841,9 @@ var SearchField = HttpField.extend({
|
|
|
2712
2841
|
ok: TranslationConfig.optional()
|
|
2713
2842
|
}).optional()
|
|
2714
2843
|
})
|
|
2844
|
+
}).meta({
|
|
2845
|
+
description: "A search input field",
|
|
2846
|
+
id: "SearchField"
|
|
2715
2847
|
});
|
|
2716
2848
|
var LinkButtonField = BaseField.extend({
|
|
2717
2849
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2720,7 +2852,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2720
2852
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2721
2853
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2722
2854
|
})
|
|
2723
|
-
}).
|
|
2855
|
+
}).meta({
|
|
2856
|
+
description: "A button that opens a URL link",
|
|
2857
|
+
id: "LinkButtonField"
|
|
2858
|
+
});
|
|
2724
2859
|
var VerificationStatus = BaseField.extend({
|
|
2725
2860
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2726
2861
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2730,15 +2865,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2730
2865
|
"Explaining text on the banner in form."
|
|
2731
2866
|
)
|
|
2732
2867
|
})
|
|
2868
|
+
}).meta({
|
|
2869
|
+
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.",
|
|
2870
|
+
id: "VerificationStatus"
|
|
2733
2871
|
});
|
|
2734
2872
|
var QueryParamReaderField = BaseField.extend({
|
|
2735
2873
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2736
2874
|
configuration: import_v43.default.object({
|
|
2737
2875
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2738
2876
|
})
|
|
2739
|
-
}).
|
|
2740
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2741
|
-
|
|
2877
|
+
}).meta({
|
|
2878
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2879
|
+
id: "QueryParamReaderField"
|
|
2880
|
+
});
|
|
2742
2881
|
var QrReaderField = BaseField.extend({
|
|
2743
2882
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2744
2883
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2749,7 +2888,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2749
2888
|
})
|
|
2750
2889
|
}).optional()
|
|
2751
2890
|
}).meta({
|
|
2752
|
-
description: "
|
|
2891
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2753
2892
|
id: "QrReaderField"
|
|
2754
2893
|
});
|
|
2755
2894
|
var IdReaderField = BaseField.extend({
|
|
@@ -2758,12 +2897,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2758
2897
|
methods: import_v43.default.array(
|
|
2759
2898
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2760
2899
|
)
|
|
2900
|
+
}).meta({
|
|
2901
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2902
|
+
id: "IdReaderField"
|
|
2761
2903
|
});
|
|
2762
2904
|
var CustomField = BaseField.extend({
|
|
2763
2905
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2764
2906
|
defaultValue: CustomFieldValue.optional(),
|
|
2765
2907
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2766
2908
|
configuration: import_v43.default.unknown().optional()
|
|
2909
|
+
}).meta({
|
|
2910
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2911
|
+
id: "CustomField"
|
|
2767
2912
|
});
|
|
2768
2913
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2769
2914
|
var LoaderField = BaseField.extend({
|
|
@@ -2773,22 +2918,25 @@ var LoaderField = BaseField.extend({
|
|
|
2773
2918
|
configuration: import_v43.default.object({
|
|
2774
2919
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2775
2920
|
})
|
|
2776
|
-
}).
|
|
2777
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2778
|
-
|
|
2921
|
+
}).meta({
|
|
2922
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2923
|
+
id: "LoaderField"
|
|
2924
|
+
});
|
|
2779
2925
|
var HiddenField = BaseField.extend({
|
|
2780
2926
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2781
2927
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2782
2928
|
defaultValue: TextValue.optional()
|
|
2783
|
-
}).
|
|
2784
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2785
|
-
|
|
2929
|
+
}).meta({
|
|
2930
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2931
|
+
id: "HiddenField"
|
|
2932
|
+
});
|
|
2786
2933
|
var UserRoleField = BaseField.extend({
|
|
2787
2934
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2788
2935
|
defaultValue: TextValue.optional()
|
|
2789
|
-
}).
|
|
2790
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2791
|
-
|
|
2936
|
+
}).meta({
|
|
2937
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2938
|
+
id: "UserRoleField"
|
|
2939
|
+
});
|
|
2792
2940
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2793
2941
|
FieldGroup,
|
|
2794
2942
|
Address,
|
|
@@ -2887,16 +3035,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2887
3035
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2888
3036
|
actions: VerificationActionConfig
|
|
2889
3037
|
});
|
|
2890
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
3038
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3039
|
+
id: "PageConfig",
|
|
3040
|
+
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."
|
|
3041
|
+
});
|
|
2894
3042
|
|
|
2895
3043
|
// ../commons/src/events/FormConfig.ts
|
|
2896
3044
|
var DeclarationFormConfig = z22.object({
|
|
2897
3045
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2898
3046
|
pages: z22.array(FormPageConfig)
|
|
2899
|
-
}).
|
|
3047
|
+
}).meta({
|
|
3048
|
+
id: "DeclarationFormConfig",
|
|
3049
|
+
description: "Configuration of the declaration form."
|
|
3050
|
+
});
|
|
2900
3051
|
var ActionFormConfig = z22.object({
|
|
2901
3052
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2902
3053
|
pages: z22.array(PageConfig)
|
|
@@ -2996,6 +3147,9 @@ var DeduplicationConfig = z23.object({
|
|
|
2996
3147
|
id: z23.string(),
|
|
2997
3148
|
label: TranslationConfig,
|
|
2998
3149
|
query: Clause
|
|
3150
|
+
}).meta({
|
|
3151
|
+
id: "DeduplicationConfig",
|
|
3152
|
+
description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
|
|
2999
3153
|
});
|
|
3000
3154
|
|
|
3001
3155
|
// ../commons/src/events/ActionConfig.ts
|
|
@@ -3113,17 +3267,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3113
3267
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3114
3268
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3115
3269
|
*/
|
|
3116
|
-
ReadActionConfig.meta({
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3270
|
+
ReadActionConfig.meta({
|
|
3271
|
+
id: "ReadActionConfig",
|
|
3272
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3273
|
+
}),
|
|
3274
|
+
DeclareConfig.meta({
|
|
3275
|
+
id: "DeclareActionConfig",
|
|
3276
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3277
|
+
}),
|
|
3278
|
+
RejectConfig.meta({
|
|
3279
|
+
id: "RejectActionConfig",
|
|
3280
|
+
description: "Configuration for rejecting a record before registration."
|
|
3281
|
+
}),
|
|
3282
|
+
RegisterConfig.meta({
|
|
3283
|
+
id: "RegisterActionConfig",
|
|
3284
|
+
description: "Configuration for registering a record."
|
|
3285
|
+
}),
|
|
3120
3286
|
PrintCertificateActionConfig.meta({
|
|
3121
|
-
id: "PrintCertificateActionConfig"
|
|
3287
|
+
id: "PrintCertificateActionConfig",
|
|
3288
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3289
|
+
}),
|
|
3290
|
+
RequestCorrectionConfig.meta({
|
|
3291
|
+
id: "RequestCorrectionActionConfig",
|
|
3292
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3293
|
+
}),
|
|
3294
|
+
EditActionConfig.meta({
|
|
3295
|
+
id: "EditActionConfig",
|
|
3296
|
+
description: "Configuration for editing a record before registration."
|
|
3122
3297
|
}),
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3298
|
+
ArchiveConfig.meta({
|
|
3299
|
+
id: "ArchiveActionConfig",
|
|
3300
|
+
description: "Configuration for archiving a record."
|
|
3301
|
+
}),
|
|
3302
|
+
CustomActionConfig.meta({
|
|
3303
|
+
id: "CustomActionConfig",
|
|
3304
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3305
|
+
})
|
|
3127
3306
|
]).describe(
|
|
3128
3307
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
3129
3308
|
).meta({ id: "ActionConfig" });
|
|
@@ -3199,7 +3378,10 @@ var Field = BaseField2.extend({
|
|
|
3199
3378
|
}).describe("Custom field defined for the summary view.");
|
|
3200
3379
|
var SummaryConfig = z27.object({
|
|
3201
3380
|
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3202
|
-
}).
|
|
3381
|
+
}).meta({
|
|
3382
|
+
id: "SummaryConfig",
|
|
3383
|
+
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."
|
|
3384
|
+
});
|
|
3203
3385
|
|
|
3204
3386
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3205
3387
|
var z28 = __toESM(require("zod/v4"));
|
|
@@ -3323,6 +3505,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
|
|
|
3323
3505
|
var AdvancedSearchConfig = z28.object({
|
|
3324
3506
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3325
3507
|
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3508
|
+
}).meta({
|
|
3509
|
+
id: "AdvancedSearchConfig",
|
|
3510
|
+
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
3326
3511
|
});
|
|
3327
3512
|
|
|
3328
3513
|
// ../commons/src/events/utils.ts
|
|
@@ -3799,6 +3984,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3799
3984
|
function isAgeValue(value) {
|
|
3800
3985
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3801
3986
|
}
|
|
3987
|
+
function mergeWithBaseFormState(values, context) {
|
|
3988
|
+
return { ...context.baseFormState, ...values };
|
|
3989
|
+
}
|
|
3802
3990
|
function validate(schema, data) {
|
|
3803
3991
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3804
3992
|
if ("$form" in data) {
|
|
@@ -3837,7 +4025,7 @@ function isOnline() {
|
|
|
3837
4025
|
}
|
|
3838
4026
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3839
4027
|
return validate(conditional, {
|
|
3840
|
-
$form: values,
|
|
4028
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3841
4029
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3842
4030
|
$online: isOnline(),
|
|
3843
4031
|
$user: context.user,
|
|
@@ -3866,7 +4054,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3866
4054
|
return true;
|
|
3867
4055
|
}
|
|
3868
4056
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3869
|
-
$form: form,
|
|
4057
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3870
4058
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3871
4059
|
$online: isOnline(),
|
|
3872
4060
|
$user: context.user,
|
|
@@ -4058,7 +4246,7 @@ function runFieldValidations({
|
|
|
4058
4246
|
return [];
|
|
4059
4247
|
}
|
|
4060
4248
|
const conditionalParameters = {
|
|
4061
|
-
$form: form,
|
|
4249
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4062
4250
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4063
4251
|
/**
|
|
4064
4252
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4302,17 +4490,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4302
4490
|
}
|
|
4303
4491
|
return isConditionMet(page.conditional, formValues, context);
|
|
4304
4492
|
}
|
|
4305
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4493
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4306
4494
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4307
4495
|
function fn(prevVisibilityContext) {
|
|
4308
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4309
4496
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4310
4497
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4311
4498
|
if (!fieldConfig.length) {
|
|
4312
4499
|
return false;
|
|
4313
4500
|
}
|
|
4314
4501
|
const isHidden = fieldConfig.every(
|
|
4315
|
-
(f) => !isFieldVisible(f,
|
|
4502
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4316
4503
|
);
|
|
4317
4504
|
if (!isHidden) {
|
|
4318
4505
|
return false;
|
|
@@ -4330,7 +4517,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4330
4517
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4331
4518
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4332
4519
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4333
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4520
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4334
4521
|
});
|
|
4335
4522
|
return omitHiddenFields(
|
|
4336
4523
|
visibleFields,
|
|
@@ -4377,13 +4564,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4377
4564
|
}
|
|
4378
4565
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4379
4566
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4380
|
-
return omitHiddenFields(
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
false,
|
|
4385
|
-
declaration
|
|
4386
|
-
);
|
|
4567
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4568
|
+
...context,
|
|
4569
|
+
baseFormState: declaration
|
|
4570
|
+
});
|
|
4387
4571
|
}
|
|
4388
4572
|
function deepMerge(currentDocument, actionDocument) {
|
|
4389
4573
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -4571,6 +4755,22 @@ function getCompleteActionAnnotation(annotation, event2, action) {
|
|
|
4571
4755
|
}
|
|
4572
4756
|
return deepMerge(annotation, action.annotation ?? {});
|
|
4573
4757
|
}
|
|
4758
|
+
function getCompleteActionContent(event2, action) {
|
|
4759
|
+
const currentContent = "content" in action ? action.content : void 0;
|
|
4760
|
+
if (!action.originalActionId) {
|
|
4761
|
+
return currentContent;
|
|
4762
|
+
}
|
|
4763
|
+
const originalAction = event2.actions.find(
|
|
4764
|
+
({ id }) => id === action.originalActionId
|
|
4765
|
+
);
|
|
4766
|
+
if (originalAction && "content" in originalAction && originalAction.content) {
|
|
4767
|
+
return {
|
|
4768
|
+
...originalAction.content,
|
|
4769
|
+
...currentContent ?? {}
|
|
4770
|
+
};
|
|
4771
|
+
}
|
|
4772
|
+
return currentContent;
|
|
4773
|
+
}
|
|
4574
4774
|
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4575
4775
|
if (action.originalActionId) {
|
|
4576
4776
|
const originalAction = event2.actions.find(
|
|
@@ -4677,6 +4877,9 @@ function not(condition) {
|
|
|
4677
4877
|
function never2() {
|
|
4678
4878
|
return not(alwaysTrue());
|
|
4679
4879
|
}
|
|
4880
|
+
function always() {
|
|
4881
|
+
return defineConditional(alwaysTrue());
|
|
4882
|
+
}
|
|
4680
4883
|
function jsonFieldPath(field3) {
|
|
4681
4884
|
return [field3.$$field, ...field3.$$subfield].join("/");
|
|
4682
4885
|
}
|
|
@@ -5372,7 +5575,7 @@ var _EventConfigBase = z33.object({
|
|
|
5372
5575
|
),
|
|
5373
5576
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5374
5577
|
actions: z33.array(ActionConfig).describe(
|
|
5375
|
-
"Configuration of
|
|
5578
|
+
"Configuration of core and custom actions associated with the event."
|
|
5376
5579
|
),
|
|
5377
5580
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5378
5581
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5384,7 +5587,7 @@ var _EventConfigBase = z33.object({
|
|
|
5384
5587
|
"Configuration of fields available in the advanced search feature."
|
|
5385
5588
|
),
|
|
5386
5589
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5387
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5590
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5388
5591
|
),
|
|
5389
5592
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5390
5593
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5397,8 +5600,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5397
5600
|
validateActionFlags(event2, ctx);
|
|
5398
5601
|
validateActionOrder(event2, ctx);
|
|
5399
5602
|
}).meta({
|
|
5400
|
-
id: "EventConfig"
|
|
5401
|
-
|
|
5603
|
+
id: "EventConfig",
|
|
5604
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5605
|
+
});
|
|
5402
5606
|
|
|
5403
5607
|
// ../commons/src/events/EventConfigInput.ts
|
|
5404
5608
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5621,6 +5825,9 @@ var WorkqueueColumnValue = z34.object({
|
|
|
5621
5825
|
var WorkqueueColumn = z34.object({
|
|
5622
5826
|
label: TranslationConfig,
|
|
5623
5827
|
value: WorkqueueColumnValue
|
|
5828
|
+
}).meta({
|
|
5829
|
+
id: "WorkqueueColumn",
|
|
5830
|
+
description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
|
|
5624
5831
|
});
|
|
5625
5832
|
function defineWorkqueuesColumns(workqueueColumns) {
|
|
5626
5833
|
return workqueueColumns.map(
|
|
@@ -5823,18 +6030,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5823
6030
|
query: true,
|
|
5824
6031
|
columns: true
|
|
5825
6032
|
});
|
|
5826
|
-
var WorkqueueConfigInput =
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
query: CountryConfigQueryInputType,
|
|
5832
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5833
|
-
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
5834
|
-
),
|
|
5835
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5836
|
-
icon: AvailableIcons,
|
|
5837
|
-
emptyMessage: TranslationConfig.optional()
|
|
6033
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6034
|
+
query: CountryConfigQueryInputType
|
|
6035
|
+
}).meta({
|
|
6036
|
+
id: "WorkqueueConfig",
|
|
6037
|
+
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
5838
6038
|
});
|
|
5839
6039
|
function defineWorkqueue(workqueueInput) {
|
|
5840
6040
|
const queryInput = workqueueInput.query;
|
|
@@ -5895,6 +6095,11 @@ var BaseActionInput = z38.object({
|
|
|
5895
6095
|
originalActionId: UUID.optional(),
|
|
5896
6096
|
// should not be part of base action.
|
|
5897
6097
|
keepAssignment: z38.boolean().optional(),
|
|
6098
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6099
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6100
|
+
waitFor: z38.boolean().default(true).describe(
|
|
6101
|
+
"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."
|
|
6102
|
+
),
|
|
5898
6103
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5899
6104
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5900
6105
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6012,7 +6217,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
|
6012
6217
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
6013
6218
|
z38.object({
|
|
6014
6219
|
requestId: z38.string(),
|
|
6015
|
-
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
6220
|
+
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
6221
|
+
content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
|
|
6016
6222
|
}).shape
|
|
6017
6223
|
);
|
|
6018
6224
|
var ReadActionInput = BaseActionInput.extend(
|
|
@@ -6074,7 +6280,7 @@ var Draft = z39.object({
|
|
|
6074
6280
|
}).describe(
|
|
6075
6281
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
6076
6282
|
);
|
|
6077
|
-
var DraftInput = BaseActionInput.extend({
|
|
6283
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
6078
6284
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6079
6285
|
status: z39.enum([
|
|
6080
6286
|
ActionStatus.Requested,
|
|
@@ -6148,7 +6354,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6148
6354
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6149
6355
|
acceptedAt: acceptAction.createdAt,
|
|
6150
6356
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6151
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6152
6357
|
registrationNumber
|
|
6153
6358
|
};
|
|
6154
6359
|
}
|
|
@@ -6206,26 +6411,43 @@ var import_date_fns3 = require("date-fns");
|
|
|
6206
6411
|
function isEditInProgress(actions) {
|
|
6207
6412
|
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6208
6413
|
}
|
|
6414
|
+
function findPendingCorrectionAction(writeActions2) {
|
|
6415
|
+
let correctionRequestAction;
|
|
6416
|
+
for (let i = writeActions2.length - 1; i >= 0; i--) {
|
|
6417
|
+
const action = writeActions2[i];
|
|
6418
|
+
if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
|
|
6419
|
+
break;
|
|
6420
|
+
}
|
|
6421
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
|
6422
|
+
correctionRequestAction = action;
|
|
6423
|
+
break;
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
return correctionRequestAction;
|
|
6427
|
+
}
|
|
6209
6428
|
function isCorrectionRequested(actions) {
|
|
6429
|
+
return findPendingCorrectionAction(actions) !== void 0;
|
|
6430
|
+
}
|
|
6431
|
+
function isDeclarationIncomplete(actions) {
|
|
6432
|
+
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6433
|
+
}
|
|
6434
|
+
function isRejected(actions) {
|
|
6435
|
+
const resettingActionTypes = [
|
|
6436
|
+
ActionType.NOTIFY,
|
|
6437
|
+
ActionType.DECLARE,
|
|
6438
|
+
ActionType.EDIT,
|
|
6439
|
+
ActionType.REGISTER
|
|
6440
|
+
];
|
|
6210
6441
|
return actions.reduce((prev, { type }) => {
|
|
6211
|
-
if (type === ActionType.
|
|
6442
|
+
if (type === ActionType.REJECT) {
|
|
6212
6443
|
return true;
|
|
6213
6444
|
}
|
|
6214
|
-
if (type
|
|
6215
|
-
return false;
|
|
6216
|
-
}
|
|
6217
|
-
if (type === ActionType.REJECT_CORRECTION) {
|
|
6445
|
+
if (resettingActionTypes.includes(type)) {
|
|
6218
6446
|
return false;
|
|
6219
6447
|
}
|
|
6220
6448
|
return prev;
|
|
6221
6449
|
}, false);
|
|
6222
6450
|
}
|
|
6223
|
-
function isDeclarationIncomplete(actions) {
|
|
6224
|
-
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
6225
|
-
}
|
|
6226
|
-
function isRejected(actions) {
|
|
6227
|
-
return actions.at(-1)?.type === ActionType.REJECT;
|
|
6228
|
-
}
|
|
6229
6451
|
function isPotentialDuplicate(actions) {
|
|
6230
6452
|
return actions.reduce((prev, { type }) => {
|
|
6231
6453
|
if (type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -6288,8 +6510,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
6288
6510
|
return (0, import_lodash3.uniq)(flags);
|
|
6289
6511
|
}, []);
|
|
6290
6512
|
}
|
|
6291
|
-
function
|
|
6292
|
-
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6513
|
+
function getActionStatusFlags(sortedActions) {
|
|
6293
6514
|
const actionStatus = sortedActions.reduce(
|
|
6294
6515
|
(actionStatuses, { type, status: status2 }) => ({
|
|
6295
6516
|
...actionStatuses,
|
|
@@ -6297,26 +6518,40 @@ function getEventFlags(event2, config) {
|
|
|
6297
6518
|
}),
|
|
6298
6519
|
{}
|
|
6299
6520
|
);
|
|
6300
|
-
|
|
6521
|
+
return Object.entries(actionStatus).filter(([, status2]) => status2 !== ActionStatus.Accepted).map(([type, status2]) => {
|
|
6301
6522
|
const flag2 = joinValues([type, status2], ":").toLowerCase();
|
|
6302
6523
|
return flag2;
|
|
6303
6524
|
});
|
|
6304
|
-
|
|
6305
|
-
|
|
6525
|
+
}
|
|
6526
|
+
function getInherentFlags(sortedActions) {
|
|
6527
|
+
const acceptedActions = sortedActions.filter(
|
|
6528
|
+
({ status: status2 }) => status2 === ActionStatus.Accepted
|
|
6529
|
+
);
|
|
6530
|
+
const inherentFlags = [];
|
|
6531
|
+
if (isCorrectionRequested(acceptedActions)) {
|
|
6532
|
+
inherentFlags.push(InherentFlags.CORRECTION_REQUESTED);
|
|
6306
6533
|
}
|
|
6307
|
-
if (isDeclarationIncomplete(
|
|
6308
|
-
|
|
6534
|
+
if (isDeclarationIncomplete(acceptedActions)) {
|
|
6535
|
+
inherentFlags.push(InherentFlags.INCOMPLETE);
|
|
6309
6536
|
}
|
|
6310
|
-
if (isRejected(
|
|
6311
|
-
|
|
6537
|
+
if (isRejected(acceptedActions)) {
|
|
6538
|
+
inherentFlags.push(InherentFlags.REJECTED);
|
|
6312
6539
|
}
|
|
6313
|
-
if (isPotentialDuplicate(
|
|
6314
|
-
|
|
6540
|
+
if (isPotentialDuplicate(acceptedActions)) {
|
|
6541
|
+
inherentFlags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
6315
6542
|
}
|
|
6316
|
-
if (isEditInProgress(
|
|
6317
|
-
|
|
6543
|
+
if (isEditInProgress(acceptedActions)) {
|
|
6544
|
+
inherentFlags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
6318
6545
|
}
|
|
6319
|
-
return
|
|
6546
|
+
return inherentFlags;
|
|
6547
|
+
}
|
|
6548
|
+
function getEventFlags(event2, config) {
|
|
6549
|
+
const sortedActions = event2.actions.filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
6550
|
+
return [
|
|
6551
|
+
...getActionStatusFlags(sortedActions),
|
|
6552
|
+
...getInherentFlags(sortedActions),
|
|
6553
|
+
...resolveEventCustomFlags(event2, config)
|
|
6554
|
+
];
|
|
6320
6555
|
}
|
|
6321
6556
|
|
|
6322
6557
|
// ../commons/src/events/state/index.ts
|
|
@@ -6362,17 +6597,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6362
6597
|
return user2;
|
|
6363
6598
|
}, null);
|
|
6364
6599
|
}
|
|
6365
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6366
|
-
return actions.reduce((signature, action) => {
|
|
6367
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6368
|
-
return action.createdBySignature || null;
|
|
6369
|
-
}
|
|
6370
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6371
|
-
return null;
|
|
6372
|
-
}
|
|
6373
|
-
return signature;
|
|
6374
|
-
}, null);
|
|
6375
|
-
}
|
|
6376
6600
|
function deepDropNulls(obj) {
|
|
6377
6601
|
if (Array.isArray(obj)) {
|
|
6378
6602
|
return obj.map(deepDropNulls);
|
|
@@ -6468,10 +6692,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6468
6692
|
createdBy: creationAction.createdBy,
|
|
6469
6693
|
createdByUserType: creationAction.createdByUserType,
|
|
6470
6694
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6471
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6472
6695
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6473
6696
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6474
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6475
6697
|
updatedBy: requestActionMetadata.createdBy,
|
|
6476
6698
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6477
6699
|
declaration,
|
|
@@ -9730,7 +9952,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9730
9952
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9731
9953
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9732
9954
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9733
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9734
9955
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9735
9956
|
assignedTo: overrides.assignedTo ?? null,
|
|
9736
9957
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -10001,6 +10222,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10001
10222
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
10002
10223
|
);
|
|
10003
10224
|
}
|
|
10225
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10226
|
+
const collectedLocations = [];
|
|
10227
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10228
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10229
|
+
while (current) {
|
|
10230
|
+
collectedLocations.push(current);
|
|
10231
|
+
if (!current.parentId) {
|
|
10232
|
+
break;
|
|
10233
|
+
}
|
|
10234
|
+
const parentId = current.parentId;
|
|
10235
|
+
current = administrativeAreas.get(parentId);
|
|
10236
|
+
}
|
|
10237
|
+
return collectedLocations;
|
|
10238
|
+
}
|
|
10239
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10240
|
+
const { administrativeAreas, locations } = context;
|
|
10241
|
+
const loc = locations.get(selectedId);
|
|
10242
|
+
if (loc) {
|
|
10243
|
+
if (loc.administrativeAreaId) {
|
|
10244
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10245
|
+
loc.administrativeAreaId,
|
|
10246
|
+
administrativeAreas
|
|
10247
|
+
);
|
|
10248
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10249
|
+
}
|
|
10250
|
+
return [loc.id];
|
|
10251
|
+
}
|
|
10252
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10253
|
+
selectedId,
|
|
10254
|
+
administrativeAreas
|
|
10255
|
+
);
|
|
10256
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10257
|
+
}
|
|
10004
10258
|
|
|
10005
10259
|
// ../commons/src/events/scopes.ts
|
|
10006
10260
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10075,6 +10329,25 @@ function isActionInScope({
|
|
|
10075
10329
|
);
|
|
10076
10330
|
return canAccess;
|
|
10077
10331
|
}
|
|
10332
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10333
|
+
allRoles,
|
|
10334
|
+
userLocation,
|
|
10335
|
+
acceptedScopes,
|
|
10336
|
+
userRequesting
|
|
10337
|
+
}) {
|
|
10338
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10339
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10340
|
+
userToAccess: {
|
|
10341
|
+
...userLocation,
|
|
10342
|
+
role
|
|
10343
|
+
},
|
|
10344
|
+
user: userRequesting,
|
|
10345
|
+
scopes: acceptedScopes
|
|
10346
|
+
});
|
|
10347
|
+
return canAccess;
|
|
10348
|
+
});
|
|
10349
|
+
return availableRoles;
|
|
10350
|
+
}
|
|
10078
10351
|
|
|
10079
10352
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10080
10353
|
function userDeserializer(serializedUserField, user2) {
|
|
@@ -10277,3 +10550,366 @@ function getFilePathsFromEvent(event2) {
|
|
|
10277
10550
|
});
|
|
10278
10551
|
return (0, import_lodash7.uniq)(filepaths);
|
|
10279
10552
|
}
|
|
10553
|
+
|
|
10554
|
+
// ../commons/src/events/mocks.test.utils.ts
|
|
10555
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
10556
|
+
{
|
|
10557
|
+
id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10558
|
+
name: "Central",
|
|
10559
|
+
parentId: null,
|
|
10560
|
+
validUntil: null,
|
|
10561
|
+
externalId: "ydyJb1RAy4U1"
|
|
10562
|
+
},
|
|
10563
|
+
{
|
|
10564
|
+
id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10565
|
+
name: "Sulaka",
|
|
10566
|
+
parentId: null,
|
|
10567
|
+
validUntil: null,
|
|
10568
|
+
externalId: "pQ8nGxWmZ2Q3"
|
|
10569
|
+
},
|
|
10570
|
+
{
|
|
10571
|
+
id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
|
|
10572
|
+
name: "Pualula",
|
|
10573
|
+
parentId: null,
|
|
10574
|
+
validUntil: null,
|
|
10575
|
+
externalId: "Aq91DweLmT8k"
|
|
10576
|
+
},
|
|
10577
|
+
{
|
|
10578
|
+
id: "6d1a59df-988c-4021-a846-ccbc021931a7",
|
|
10579
|
+
name: "Chuminga",
|
|
10580
|
+
parentId: null,
|
|
10581
|
+
validUntil: null,
|
|
10582
|
+
externalId: "Rw0fYNh2Xk9a"
|
|
10583
|
+
},
|
|
10584
|
+
{
|
|
10585
|
+
id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10586
|
+
name: "Ibombo",
|
|
10587
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10588
|
+
validUntil: null,
|
|
10589
|
+
externalId: "k7DsP4vbN1Qe"
|
|
10590
|
+
},
|
|
10591
|
+
{
|
|
10592
|
+
id: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
10593
|
+
name: "Isango",
|
|
10594
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10595
|
+
validUntil: null,
|
|
10596
|
+
externalId: "Gm3Z9eQpHw4L"
|
|
10597
|
+
},
|
|
10598
|
+
{
|
|
10599
|
+
id: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10600
|
+
name: "Isamba",
|
|
10601
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10602
|
+
validUntil: null,
|
|
10603
|
+
externalId: "sT0xVu1KqJ7r"
|
|
10604
|
+
},
|
|
10605
|
+
{
|
|
10606
|
+
id: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10607
|
+
name: "Itambo",
|
|
10608
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10609
|
+
validUntil: null,
|
|
10610
|
+
externalId: "Nq6Bv2HpL9Te"
|
|
10611
|
+
},
|
|
10612
|
+
{
|
|
10613
|
+
id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
|
|
10614
|
+
name: "Ezhi",
|
|
10615
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10616
|
+
validUntil: null,
|
|
10617
|
+
externalId: "xK8cQ0ZRy5Wd"
|
|
10618
|
+
},
|
|
10619
|
+
{
|
|
10620
|
+
id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
10621
|
+
name: "Ilanga",
|
|
10622
|
+
parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10623
|
+
validUntil: null,
|
|
10624
|
+
externalId: "Cq4Jm1XvN8Ls"
|
|
10625
|
+
},
|
|
10626
|
+
// Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
|
|
10627
|
+
{
|
|
10628
|
+
id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
10629
|
+
name: "Klow",
|
|
10630
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10631
|
+
validUntil: null,
|
|
10632
|
+
externalId: "IkYcYBUcyY2"
|
|
10633
|
+
},
|
|
10634
|
+
{
|
|
10635
|
+
id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
|
|
10636
|
+
name: "Mbondo",
|
|
10637
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10638
|
+
validUntil: null,
|
|
10639
|
+
externalId: "Qhvv5hvo3mY"
|
|
10640
|
+
},
|
|
10641
|
+
{
|
|
10642
|
+
id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
|
|
10643
|
+
name: "Ndara",
|
|
10644
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10645
|
+
validUntil: null,
|
|
10646
|
+
externalId: "crXh068O9TR"
|
|
10647
|
+
},
|
|
10648
|
+
{
|
|
10649
|
+
id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
|
|
10650
|
+
name: "Olani",
|
|
10651
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10652
|
+
validUntil: null,
|
|
10653
|
+
externalId: "r00It8Tvvp7"
|
|
10654
|
+
},
|
|
10655
|
+
{
|
|
10656
|
+
id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
|
|
10657
|
+
name: "Pemba",
|
|
10658
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10659
|
+
validUntil: null,
|
|
10660
|
+
externalId: "ZnUWsbONIaH"
|
|
10661
|
+
},
|
|
10662
|
+
{
|
|
10663
|
+
id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
|
|
10664
|
+
name: "Quanza",
|
|
10665
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10666
|
+
validUntil: null,
|
|
10667
|
+
externalId: "fDZycvQTa7l"
|
|
10668
|
+
},
|
|
10669
|
+
{
|
|
10670
|
+
id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
|
|
10671
|
+
name: "Rivka",
|
|
10672
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10673
|
+
validUntil: null,
|
|
10674
|
+
externalId: "KqswxCGTELa"
|
|
10675
|
+
},
|
|
10676
|
+
// Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
|
|
10677
|
+
{
|
|
10678
|
+
id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
|
|
10679
|
+
name: "Mbula",
|
|
10680
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10681
|
+
validUntil: null,
|
|
10682
|
+
externalId: "osEbKjRc9Kg"
|
|
10683
|
+
},
|
|
10684
|
+
{
|
|
10685
|
+
id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
|
|
10686
|
+
name: "Ndoki",
|
|
10687
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10688
|
+
validUntil: null,
|
|
10689
|
+
externalId: "aq4daBUAGr3"
|
|
10690
|
+
},
|
|
10691
|
+
{
|
|
10692
|
+
id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
|
|
10693
|
+
name: "Tsanga",
|
|
10694
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10695
|
+
validUntil: null,
|
|
10696
|
+
externalId: "cqis6Y8trbJ"
|
|
10697
|
+
},
|
|
10698
|
+
{
|
|
10699
|
+
id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
|
|
10700
|
+
name: "Waziri",
|
|
10701
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10702
|
+
validUntil: null,
|
|
10703
|
+
externalId: "LMijHPyyx6d"
|
|
10704
|
+
},
|
|
10705
|
+
{
|
|
10706
|
+
id: "2c5d6e7f-8a9b-4423-8def-456789012345",
|
|
10707
|
+
name: "Zimbi",
|
|
10708
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10709
|
+
validUntil: null,
|
|
10710
|
+
externalId: "pcQYbPuKGZ7"
|
|
10711
|
+
},
|
|
10712
|
+
// Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
|
|
10713
|
+
{
|
|
10714
|
+
id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
|
|
10715
|
+
name: "Felani",
|
|
10716
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10717
|
+
validUntil: null,
|
|
10718
|
+
externalId: "gSqpoCGdMXp"
|
|
10719
|
+
},
|
|
10720
|
+
{
|
|
10721
|
+
id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
|
|
10722
|
+
name: "Goroma",
|
|
10723
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10724
|
+
validUntil: null,
|
|
10725
|
+
externalId: "KvAAIaNqVrp"
|
|
10726
|
+
},
|
|
10727
|
+
{
|
|
10728
|
+
id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
|
|
10729
|
+
name: "Halifu",
|
|
10730
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10731
|
+
validUntil: null,
|
|
10732
|
+
externalId: "qe4UnEVt1hv"
|
|
10733
|
+
},
|
|
10734
|
+
{
|
|
10735
|
+
id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
|
|
10736
|
+
name: "Jabari",
|
|
10737
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10738
|
+
validUntil: null,
|
|
10739
|
+
externalId: "yHH9Nz4rLOt"
|
|
10740
|
+
},
|
|
10741
|
+
{
|
|
10742
|
+
id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
|
|
10743
|
+
name: "Kifani",
|
|
10744
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10745
|
+
validUntil: null,
|
|
10746
|
+
externalId: "eSWmXIGeu1I"
|
|
10747
|
+
},
|
|
10748
|
+
{
|
|
10749
|
+
id: "8c1d2e3f-4a5b-4089-8def-012345678901",
|
|
10750
|
+
name: "Lumela",
|
|
10751
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
10752
|
+
validUntil: null,
|
|
10753
|
+
externalId: "bh0b3aI1uP3"
|
|
10754
|
+
}
|
|
10755
|
+
];
|
|
10756
|
+
var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
10757
|
+
{
|
|
10758
|
+
id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
|
|
10759
|
+
name: "Central Provincial Office",
|
|
10760
|
+
locationType: "CRVS_OFFICE",
|
|
10761
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10762
|
+
validUntil: null,
|
|
10763
|
+
externalId: "Xr3Df8WpK6Ys"
|
|
10764
|
+
},
|
|
10765
|
+
{
|
|
10766
|
+
id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
|
|
10767
|
+
name: "Central Health Post",
|
|
10768
|
+
locationType: "HEALTH_FACILITY",
|
|
10769
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
10770
|
+
validUntil: null
|
|
10771
|
+
},
|
|
10772
|
+
{
|
|
10773
|
+
id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
|
|
10774
|
+
name: "Ibombo District Office",
|
|
10775
|
+
locationType: "CRVS_OFFICE",
|
|
10776
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10777
|
+
validUntil: null,
|
|
10778
|
+
externalId: "Sm4Nw7GrD2Vy"
|
|
10779
|
+
},
|
|
10780
|
+
{
|
|
10781
|
+
id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
|
|
10782
|
+
name: "Isamba District Office",
|
|
10783
|
+
locationType: "CRVS_OFFICE",
|
|
10784
|
+
administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
10785
|
+
validUntil: null,
|
|
10786
|
+
externalId: "Vg1Bq5XeH9Lt"
|
|
10787
|
+
},
|
|
10788
|
+
{
|
|
10789
|
+
id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
|
|
10790
|
+
name: "Isango District Office",
|
|
10791
|
+
locationType: "CRVS_OFFICE",
|
|
10792
|
+
administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
10793
|
+
validUntil: null,
|
|
10794
|
+
externalId: "Je7Lm2XqN9Vz"
|
|
10795
|
+
},
|
|
10796
|
+
{
|
|
10797
|
+
id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
|
|
10798
|
+
name: "Sulaka Provincial Office",
|
|
10799
|
+
locationType: "CRVS_OFFICE",
|
|
10800
|
+
administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
10801
|
+
validUntil: null,
|
|
10802
|
+
externalId: "Ht2Wp9KcX5Qv"
|
|
10803
|
+
},
|
|
10804
|
+
{
|
|
10805
|
+
id: "030358c6-54af-44be-821b-8e4af963a49c",
|
|
10806
|
+
name: "Ilanga District Office",
|
|
10807
|
+
locationType: "CRVS_OFFICE",
|
|
10808
|
+
administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
10809
|
+
validUntil: null,
|
|
10810
|
+
externalId: "Yp6Ds1WqN3Xz"
|
|
10811
|
+
},
|
|
10812
|
+
{
|
|
10813
|
+
id: "423d000f-101b-47c0-8b86-21a908067cee",
|
|
10814
|
+
name: "Chamakubi Health Post",
|
|
10815
|
+
locationType: "HEALTH_FACILITY",
|
|
10816
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10817
|
+
validUntil: null,
|
|
10818
|
+
externalId: "M1nFr8LbC2Qy"
|
|
10819
|
+
},
|
|
10820
|
+
{
|
|
10821
|
+
id: "4d3279be-d026-420c-88f7-f0a4ae986973",
|
|
10822
|
+
name: "Ibombo Rural Health Centre",
|
|
10823
|
+
locationType: "HEALTH_FACILITY",
|
|
10824
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10825
|
+
validUntil: null,
|
|
10826
|
+
externalId: "bT7pV6YrW0Xc"
|
|
10827
|
+
},
|
|
10828
|
+
{
|
|
10829
|
+
id: "190902f4-1d77-476a-8947-41145af1db7d",
|
|
10830
|
+
name: "Chikobo Rural Health Centre",
|
|
10831
|
+
locationType: "HEALTH_FACILITY",
|
|
10832
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10833
|
+
validUntil: null,
|
|
10834
|
+
externalId: "zE4qPn2SgJ5d"
|
|
10835
|
+
},
|
|
10836
|
+
{
|
|
10837
|
+
id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
|
|
10838
|
+
name: "Chilochabalenje Health Post",
|
|
10839
|
+
locationType: "HEALTH_FACILITY",
|
|
10840
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10841
|
+
validUntil: null,
|
|
10842
|
+
externalId: "H8vDs1MqR4Uf"
|
|
10843
|
+
},
|
|
10844
|
+
{
|
|
10845
|
+
id: "dbfc178f-7295-4b90-b28d-111c95b03127",
|
|
10846
|
+
name: "Chipeso Rural Health Centre",
|
|
10847
|
+
locationType: "HEALTH_FACILITY",
|
|
10848
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10849
|
+
validUntil: null,
|
|
10850
|
+
externalId: "Qw3uZ9KfX6Lm"
|
|
10851
|
+
},
|
|
10852
|
+
{
|
|
10853
|
+
id: "09862bfe-c7ac-46cd-987b-668681533c80",
|
|
10854
|
+
name: "Chisamba Rural Health Centre",
|
|
10855
|
+
locationType: "HEALTH_FACILITY",
|
|
10856
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10857
|
+
validUntil: null,
|
|
10858
|
+
externalId: "Yr0pCg8LdM2s"
|
|
10859
|
+
},
|
|
10860
|
+
{
|
|
10861
|
+
id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
|
|
10862
|
+
name: "Chitanda Rural Health Centre",
|
|
10863
|
+
locationType: "HEALTH_FACILITY",
|
|
10864
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10865
|
+
validUntil: null,
|
|
10866
|
+
externalId: "tS9gJ4PwB1Qx"
|
|
10867
|
+
},
|
|
10868
|
+
{
|
|
10869
|
+
id: "0431c433-6062-4a4c-aee9-25271aec61ee",
|
|
10870
|
+
name: "Golden Valley Rural Health Centre",
|
|
10871
|
+
locationType: "HEALTH_FACILITY",
|
|
10872
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10873
|
+
validUntil: null,
|
|
10874
|
+
externalId: "Ld7Qm3XsA8Vr"
|
|
10875
|
+
},
|
|
10876
|
+
{
|
|
10877
|
+
id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
|
|
10878
|
+
name: "Ipongo Rural Health Centre",
|
|
10879
|
+
locationType: "HEALTH_FACILITY",
|
|
10880
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10881
|
+
validUntil: null,
|
|
10882
|
+
externalId: "kF2sW9DmH0Bt"
|
|
10883
|
+
},
|
|
10884
|
+
{
|
|
10885
|
+
id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
|
|
10886
|
+
name: "Itumbwe Health Post",
|
|
10887
|
+
locationType: "HEALTH_FACILITY",
|
|
10888
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10889
|
+
validUntil: null,
|
|
10890
|
+
externalId: "Ue5Xb3VaC7Pq"
|
|
10891
|
+
},
|
|
10892
|
+
{
|
|
10893
|
+
id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
|
|
10894
|
+
name: "Kabangalala Rural Health Centre",
|
|
10895
|
+
locationType: "HEALTH_FACILITY",
|
|
10896
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
10897
|
+
validUntil: null,
|
|
10898
|
+
externalId: "Pz8Kc1TqH6Jn"
|
|
10899
|
+
},
|
|
10900
|
+
// Village offices
|
|
10901
|
+
{
|
|
10902
|
+
id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
|
|
10903
|
+
name: "Klow Village Office",
|
|
10904
|
+
locationType: "CRVS_OFFICE",
|
|
10905
|
+
administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
10906
|
+
validUntil: null,
|
|
10907
|
+
externalId: "PmAyxAJkxiJ"
|
|
10908
|
+
}
|
|
10909
|
+
];
|
|
10910
|
+
var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
10911
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
|
|
10912
|
+
);
|
|
10913
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
10914
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
10915
|
+
);
|