@opencrvs/toolkit 2.0.0-rc.622827a → 2.0.0-rc.65195ed
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 +73 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/application-config/index.js +225 -89
- package/dist/cli.js +397 -131
- package/dist/commons/api/router.d.ts +3380 -260
- package/dist/commons/conditionals/conditionals.d.ts +3 -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 +3 -0
- 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/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/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 +8 -4
- package/dist/events/index.js +364 -150
- 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 +395 -129
- 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 +282 -120
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +8 -4
- package/opencrvs-toolkit-2.0.0-rc.65195ed.tgz +0 -0
- package/package.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.622827a.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -302,13 +302,15 @@ __export(events_exports, {
|
|
|
302
302
|
getActionConfig: () => getActionConfig,
|
|
303
303
|
getActionReview: () => getActionReview,
|
|
304
304
|
getActionReviewFields: () => getActionReviewFields,
|
|
305
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
305
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
306
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
307
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
308
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
309
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
310
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
311
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
311
312
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
313
|
+
getCompleteActionContent: () => getCompleteActionContent,
|
|
312
314
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
313
315
|
getCurrentEventState: () => getCurrentEventState,
|
|
314
316
|
getCustomActionFields: () => getCustomActionFields,
|
|
@@ -318,6 +320,7 @@ __export(events_exports, {
|
|
|
318
320
|
getDeclarationPages: () => getDeclarationPages,
|
|
319
321
|
getEventConfigById: () => getEventConfigById,
|
|
320
322
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
323
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
321
324
|
getMixedPath: () => getMixedPath,
|
|
322
325
|
getPendingAction: () => getPendingAction,
|
|
323
326
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -607,12 +610,14 @@ var SystemScopeType = z2.enum([
|
|
|
607
610
|
"organisation.read-locations",
|
|
608
611
|
"user.read",
|
|
609
612
|
"user.create",
|
|
610
|
-
"user.edit"
|
|
613
|
+
"user.edit",
|
|
614
|
+
"user.search"
|
|
611
615
|
]);
|
|
612
616
|
var UserScopeType = SystemScopeType.extract([
|
|
613
617
|
"user.read",
|
|
614
618
|
"user.create",
|
|
615
|
-
"user.edit"
|
|
619
|
+
"user.edit",
|
|
620
|
+
"user.search"
|
|
616
621
|
]);
|
|
617
622
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
618
623
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -621,7 +626,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
621
626
|
options: AllUserScopeOptions.optional()
|
|
622
627
|
}),
|
|
623
628
|
z2.object({
|
|
624
|
-
type: UserScopeType.extract(["user.read"]),
|
|
629
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
625
630
|
options: AccessLevelOptions.optional()
|
|
626
631
|
})
|
|
627
632
|
]);
|
|
@@ -700,7 +705,9 @@ var decodeScope = (query) => {
|
|
|
700
705
|
};
|
|
701
706
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
702
707
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
703
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
708
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
709
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
710
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
704
711
|
};
|
|
705
712
|
function getAcceptedScopesByType({
|
|
706
713
|
acceptedScopes,
|
|
@@ -1073,7 +1080,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1073
1080
|
ShowConditional,
|
|
1074
1081
|
// Action can be shown to the user in the list but as disabled
|
|
1075
1082
|
EnableConditional
|
|
1076
|
-
])
|
|
1083
|
+
]).meta({
|
|
1084
|
+
id: "ActionConditional",
|
|
1085
|
+
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."
|
|
1086
|
+
});
|
|
1077
1087
|
var DisplayOnReviewConditional = z7.object({
|
|
1078
1088
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1079
1089
|
conditional: Conditional
|
|
@@ -1088,8 +1098,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1088
1098
|
// Field output can be shown / hidden on the review page
|
|
1089
1099
|
DisplayOnReviewConditional
|
|
1090
1100
|
]).meta({
|
|
1091
|
-
|
|
1092
|
-
|
|
1101
|
+
id: "FieldConditional",
|
|
1102
|
+
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
1103
|
});
|
|
1094
1104
|
|
|
1095
1105
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1409,28 +1419,20 @@ function schemaPriority(schema) {
|
|
|
1409
1419
|
return idx === -1 ? 9999 : idx;
|
|
1410
1420
|
}
|
|
1411
1421
|
function safeUnion(schemas) {
|
|
1422
|
+
const sortedSchemas = [...schemas].sort(
|
|
1423
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1424
|
+
);
|
|
1412
1425
|
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
|
-
});
|
|
1426
|
+
for (const schema of sortedSchemas) {
|
|
1427
|
+
if (schema.safeParse(val).success) {
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1433
1430
|
}
|
|
1431
|
+
ctx.addIssue({
|
|
1432
|
+
code: "invalid_type",
|
|
1433
|
+
expected: "custom",
|
|
1434
|
+
message: "Value does not match any schema"
|
|
1435
|
+
});
|
|
1434
1436
|
}).meta({
|
|
1435
1437
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1436
1438
|
});
|
|
@@ -1647,8 +1649,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1647
1649
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1648
1650
|
z14.object({
|
|
1649
1651
|
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1650
|
-
requestId: z14.string()
|
|
1652
|
+
requestId: z14.string(),
|
|
1651
1653
|
// TODO move into 'content' property
|
|
1654
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1652
1655
|
}).shape
|
|
1653
1656
|
);
|
|
1654
1657
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1740,6 +1743,9 @@ var FlagConfig = z15.object({
|
|
|
1740
1743
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1741
1744
|
),
|
|
1742
1745
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1746
|
+
}).meta({
|
|
1747
|
+
id: "FlagConfig",
|
|
1748
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1743
1749
|
});
|
|
1744
1750
|
var ActionFlagConfig = z15.object({
|
|
1745
1751
|
id: Flag,
|
|
@@ -1747,6 +1753,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1747
1753
|
conditional: Conditional.optional().describe(
|
|
1748
1754
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1749
1755
|
)
|
|
1756
|
+
}).meta({
|
|
1757
|
+
id: "ActionFlagConfig",
|
|
1758
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1750
1759
|
});
|
|
1751
1760
|
|
|
1752
1761
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1768,8 +1777,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1768
1777
|
),
|
|
1769
1778
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1770
1779
|
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.")
|
|
1780
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1773
1781
|
});
|
|
1774
1782
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1775
1783
|
registrationNumber: z16.string().describe(
|
|
@@ -1797,9 +1805,6 @@ var EventMetadata = z16.object({
|
|
|
1797
1805
|
createdAtLocation: UUID.nullish().describe(
|
|
1798
1806
|
"Location of the user who created the event."
|
|
1799
1807
|
),
|
|
1800
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1801
|
-
"Signature of the user who created the event."
|
|
1802
|
-
),
|
|
1803
1808
|
updatedAtLocation: UUID.nullish().describe(
|
|
1804
1809
|
"Location of the user who last changed the status."
|
|
1805
1810
|
),
|
|
@@ -2174,14 +2179,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2174
2179
|
}
|
|
2175
2180
|
}).describe("Unique identifier for the field");
|
|
2176
2181
|
var FieldReference = import_v43.default.object({
|
|
2177
|
-
$$field: FieldId,
|
|
2182
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2178
2183
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2179
2184
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2180
2185
|
)
|
|
2181
2186
|
}).describe("Reference to a field by its ID");
|
|
2182
2187
|
var ValidationConfig = import_v43.default.object({
|
|
2183
|
-
validator: Conditional
|
|
2184
|
-
|
|
2188
|
+
validator: Conditional.describe(
|
|
2189
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2190
|
+
),
|
|
2191
|
+
message: TranslationConfig.describe(
|
|
2192
|
+
"Error message displayed when the validator does not hold."
|
|
2193
|
+
)
|
|
2194
|
+
}).meta({
|
|
2195
|
+
id: "ValidationConfig",
|
|
2196
|
+
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
2197
|
});
|
|
2186
2198
|
var requiredSchema = import_v43.default.union([
|
|
2187
2199
|
import_v43.default.boolean(),
|
|
@@ -2220,6 +2232,9 @@ var BaseField = import_v43.default.object({
|
|
|
2220
2232
|
}).describe("Common properties shared across all field types.");
|
|
2221
2233
|
var Divider = BaseField.extend({
|
|
2222
2234
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2235
|
+
}).meta({
|
|
2236
|
+
description: "A horizontal line divider",
|
|
2237
|
+
id: "Divider"
|
|
2223
2238
|
});
|
|
2224
2239
|
var TextField = BaseField.extend({
|
|
2225
2240
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2230,7 +2245,10 @@ var TextField = BaseField.extend({
|
|
|
2230
2245
|
prefix: TranslationConfig.optional(),
|
|
2231
2246
|
postfix: TranslationConfig.optional()
|
|
2232
2247
|
}).default({ type: "text" }).optional()
|
|
2233
|
-
}).
|
|
2248
|
+
}).meta({
|
|
2249
|
+
description: "A text input field",
|
|
2250
|
+
id: "TextField"
|
|
2251
|
+
});
|
|
2234
2252
|
var NumberField = BaseField.extend({
|
|
2235
2253
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2236
2254
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2240,7 +2258,10 @@ var NumberField = BaseField.extend({
|
|
|
2240
2258
|
prefix: TranslationConfig.optional(),
|
|
2241
2259
|
postfix: TranslationConfig.optional()
|
|
2242
2260
|
}).optional()
|
|
2243
|
-
}).
|
|
2261
|
+
}).meta({
|
|
2262
|
+
description: "A number input field",
|
|
2263
|
+
id: "NumberField"
|
|
2264
|
+
});
|
|
2244
2265
|
var TextAreaField = BaseField.extend({
|
|
2245
2266
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2246
2267
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2251,7 +2272,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2251
2272
|
prefix: TranslationConfig.optional(),
|
|
2252
2273
|
postfix: TranslationConfig.optional()
|
|
2253
2274
|
}).default({ rows: 4 }).optional()
|
|
2254
|
-
}).
|
|
2275
|
+
}).meta({
|
|
2276
|
+
description: "A multiline text input",
|
|
2277
|
+
id: "TextAreaField"
|
|
2278
|
+
});
|
|
2255
2279
|
var ImageMimeType = import_v43.default.enum([
|
|
2256
2280
|
"image/png",
|
|
2257
2281
|
"image/jpg",
|
|
@@ -2281,13 +2305,19 @@ var SignatureField = BaseField.extend({
|
|
|
2281
2305
|
}).default({
|
|
2282
2306
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2283
2307
|
})
|
|
2284
|
-
}).
|
|
2308
|
+
}).meta({
|
|
2309
|
+
description: "A signature input field",
|
|
2310
|
+
id: "SignatureField"
|
|
2311
|
+
});
|
|
2285
2312
|
var EmailField = BaseField.extend({
|
|
2286
2313
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2287
2314
|
configuration: import_v43.default.object({
|
|
2288
2315
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2289
2316
|
}).default({ maxLength: 255 }).optional(),
|
|
2290
2317
|
defaultValue: NonEmptyTextValue.optional()
|
|
2318
|
+
}).meta({
|
|
2319
|
+
description: "An email input field",
|
|
2320
|
+
id: "EmailField"
|
|
2291
2321
|
});
|
|
2292
2322
|
var DateField = BaseField.extend({
|
|
2293
2323
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2297,7 +2327,10 @@ var DateField = BaseField.extend({
|
|
|
2297
2327
|
"Text to display above the date input"
|
|
2298
2328
|
).optional()
|
|
2299
2329
|
}).optional()
|
|
2300
|
-
}).
|
|
2330
|
+
}).meta({
|
|
2331
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2332
|
+
id: "DateField"
|
|
2333
|
+
});
|
|
2301
2334
|
var AgeField = BaseField.extend({
|
|
2302
2335
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2303
2336
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2306,7 +2339,10 @@ var AgeField = BaseField.extend({
|
|
|
2306
2339
|
prefix: TranslationConfig.optional(),
|
|
2307
2340
|
postfix: TranslationConfig.optional()
|
|
2308
2341
|
})
|
|
2309
|
-
}).
|
|
2342
|
+
}).meta({
|
|
2343
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2344
|
+
id: "AgeField"
|
|
2345
|
+
});
|
|
2310
2346
|
var TimeField = BaseField.extend({
|
|
2311
2347
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2312
2348
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2316,7 +2352,10 @@ var TimeField = BaseField.extend({
|
|
|
2316
2352
|
"Text to display above the time input"
|
|
2317
2353
|
).optional()
|
|
2318
2354
|
}).optional()
|
|
2319
|
-
}).
|
|
2355
|
+
}).meta({
|
|
2356
|
+
description: "A single time input (HH-mm)",
|
|
2357
|
+
id: "TimeField"
|
|
2358
|
+
});
|
|
2320
2359
|
var DateRangeField = BaseField.extend({
|
|
2321
2360
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2322
2361
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2325,7 +2364,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2325
2364
|
"Text to display above the date input"
|
|
2326
2365
|
).optional()
|
|
2327
2366
|
}).optional()
|
|
2328
|
-
}).
|
|
2367
|
+
}).meta({
|
|
2368
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2369
|
+
id: "DateRangeField"
|
|
2370
|
+
});
|
|
2329
2371
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2330
2372
|
"reg12",
|
|
2331
2373
|
"reg14",
|
|
@@ -2369,18 +2411,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2369
2411
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2370
2412
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2371
2413
|
configuration: ImageConfiguration
|
|
2372
|
-
}).
|
|
2414
|
+
}).meta({
|
|
2415
|
+
description: "A read-only image component for form pages",
|
|
2416
|
+
id: "ImageViewField"
|
|
2417
|
+
});
|
|
2373
2418
|
var Paragraph = BaseField.extend({
|
|
2374
2419
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2375
2420
|
configuration: ParagraphConfiguration
|
|
2376
|
-
}).
|
|
2421
|
+
}).meta({
|
|
2422
|
+
description: "A read-only HTML <p> paragraph",
|
|
2423
|
+
id: "Paragraph"
|
|
2424
|
+
});
|
|
2377
2425
|
var Heading = BaseField.extend({
|
|
2378
2426
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2379
2427
|
configuration: HeadingConfiguration
|
|
2380
|
-
}).
|
|
2428
|
+
}).meta({
|
|
2429
|
+
description: "A read-only heading component for form pages",
|
|
2430
|
+
id: "Heading"
|
|
2431
|
+
});
|
|
2381
2432
|
var PageHeader = BaseField.extend({
|
|
2382
2433
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2383
|
-
}).
|
|
2434
|
+
}).meta({
|
|
2435
|
+
description: "A read-only header component for form pages",
|
|
2436
|
+
id: "PageHeader"
|
|
2437
|
+
});
|
|
2384
2438
|
var File = BaseField.extend({
|
|
2385
2439
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2386
2440
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2399,7 +2453,10 @@ var File = BaseField.extend({
|
|
|
2399
2453
|
}).default({
|
|
2400
2454
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2401
2455
|
})
|
|
2402
|
-
}).
|
|
2456
|
+
}).meta({
|
|
2457
|
+
description: "A file upload field",
|
|
2458
|
+
id: "File"
|
|
2459
|
+
});
|
|
2403
2460
|
var SelectOption = import_v43.default.object({
|
|
2404
2461
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2405
2462
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2416,7 +2473,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2416
2473
|
"Placeholder for the number field"
|
|
2417
2474
|
)
|
|
2418
2475
|
}).optional()
|
|
2419
|
-
}).
|
|
2476
|
+
}).meta({
|
|
2477
|
+
description: "A number with unit input field",
|
|
2478
|
+
id: "NumberWithUnitField"
|
|
2479
|
+
});
|
|
2420
2480
|
var RadioGroup = BaseField.extend({
|
|
2421
2481
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2422
2482
|
defaultValue: TextValue.optional(),
|
|
@@ -2426,7 +2486,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2426
2486
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2427
2487
|
}).optional()
|
|
2428
2488
|
}).optional()
|
|
2429
|
-
}).
|
|
2489
|
+
}).meta({
|
|
2490
|
+
description: "A grouped radio button field",
|
|
2491
|
+
id: "RadioGroup"
|
|
2492
|
+
});
|
|
2430
2493
|
var BulletList = BaseField.extend({
|
|
2431
2494
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2432
2495
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2435,7 +2498,10 @@ var BulletList = BaseField.extend({
|
|
|
2435
2498
|
fontVariant: HtmlFontVariant.optional()
|
|
2436
2499
|
}).optional()
|
|
2437
2500
|
}).default({})
|
|
2438
|
-
}).
|
|
2501
|
+
}).meta({
|
|
2502
|
+
description: "A list of bullet points",
|
|
2503
|
+
id: "BulletList"
|
|
2504
|
+
});
|
|
2439
2505
|
var Select = BaseField.extend({
|
|
2440
2506
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2441
2507
|
defaultValue: TextValue.optional(),
|
|
@@ -2450,7 +2516,10 @@ var Select = BaseField.extend({
|
|
|
2450
2516
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2451
2517
|
`
|
|
2452
2518
|
)
|
|
2453
|
-
}).
|
|
2519
|
+
}).meta({
|
|
2520
|
+
description: "A select input field",
|
|
2521
|
+
id: "Select"
|
|
2522
|
+
});
|
|
2454
2523
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2455
2524
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2456
2525
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2459,7 +2528,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2459
2528
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2460
2529
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2461
2530
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2462
|
-
}).
|
|
2531
|
+
}).meta({
|
|
2532
|
+
description: "A date range selection field",
|
|
2533
|
+
id: "SelectDateRangeField"
|
|
2534
|
+
});
|
|
2463
2535
|
var NameConfig = import_v43.default.object({
|
|
2464
2536
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2465
2537
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2490,26 +2562,41 @@ var NameField = BaseField.extend({
|
|
|
2490
2562
|
surname: { required: true }
|
|
2491
2563
|
}
|
|
2492
2564
|
}).optional()
|
|
2493
|
-
}).
|
|
2565
|
+
}).meta({
|
|
2566
|
+
description: "A field for entering a persons name",
|
|
2567
|
+
id: "NameField"
|
|
2568
|
+
});
|
|
2494
2569
|
var PhoneField = BaseField.extend({
|
|
2495
2570
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2496
2571
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2497
|
-
}).
|
|
2572
|
+
}).meta({
|
|
2573
|
+
description: "A field for entering a phone number",
|
|
2574
|
+
id: "PhoneField"
|
|
2575
|
+
});
|
|
2498
2576
|
var IdField = BaseField.extend({
|
|
2499
2577
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2500
2578
|
type: import_v43.default.literal(FieldType.ID)
|
|
2501
|
-
}).
|
|
2579
|
+
}).meta({
|
|
2580
|
+
description: "A field for entering an ID",
|
|
2581
|
+
id: "IdField"
|
|
2582
|
+
});
|
|
2502
2583
|
var Checkbox = BaseField.extend({
|
|
2503
2584
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2504
2585
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2505
|
-
}).
|
|
2586
|
+
}).meta({
|
|
2587
|
+
description: "A boolean checkbox field",
|
|
2588
|
+
id: "Checkbox"
|
|
2589
|
+
});
|
|
2506
2590
|
var Country = BaseField.extend({
|
|
2507
2591
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2508
2592
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2509
2593
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2510
2594
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2511
2595
|
)
|
|
2512
|
-
}).
|
|
2596
|
+
}).meta({
|
|
2597
|
+
description: "A field for selecting a country",
|
|
2598
|
+
id: "Country"
|
|
2599
|
+
});
|
|
2513
2600
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2514
2601
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2515
2602
|
);
|
|
@@ -2518,16 +2605,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2518
2605
|
"HEALTH_FACILITY",
|
|
2519
2606
|
"CRVS_OFFICE"
|
|
2520
2607
|
]);
|
|
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
2608
|
var AdministrativeAreaField = BaseField.extend({
|
|
2527
2609
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2528
2610
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2529
|
-
configuration:
|
|
2530
|
-
|
|
2611
|
+
configuration: import_v43.default.object({
|
|
2612
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2613
|
+
type: AdministrativeAreas,
|
|
2614
|
+
allowedLocations: AllowedLocations
|
|
2615
|
+
}).describe("Administrative area options")
|
|
2616
|
+
}).meta({
|
|
2617
|
+
description: "Administrative area input field",
|
|
2618
|
+
id: "AdministrativeAreaField"
|
|
2619
|
+
});
|
|
2531
2620
|
var LocationInput = BaseField.extend({
|
|
2532
2621
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2533
2622
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2535,7 +2624,10 @@ var LocationInput = BaseField.extend({
|
|
|
2535
2624
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2536
2625
|
allowedLocations: AllowedLocations
|
|
2537
2626
|
}).optional()
|
|
2538
|
-
}).
|
|
2627
|
+
}).meta({
|
|
2628
|
+
description: "A field for selecting a location",
|
|
2629
|
+
id: "LocationInput"
|
|
2630
|
+
});
|
|
2539
2631
|
var FileUploadWithOptions = BaseField.extend({
|
|
2540
2632
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2541
2633
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2549,6 +2641,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2549
2641
|
}).default({
|
|
2550
2642
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2551
2643
|
})
|
|
2644
|
+
}).meta({
|
|
2645
|
+
description: "A field for uploading files with file type options",
|
|
2646
|
+
id: "FileUploadWithOptions"
|
|
2552
2647
|
});
|
|
2553
2648
|
var Facility = BaseField.extend({
|
|
2554
2649
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2594,7 +2689,10 @@ var Address = BaseField.extend({
|
|
|
2594
2689
|
allowedLocations: AllowedLocations
|
|
2595
2690
|
}).optional(),
|
|
2596
2691
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2597
|
-
}).
|
|
2692
|
+
}).meta({
|
|
2693
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2694
|
+
id: "Address"
|
|
2695
|
+
});
|
|
2598
2696
|
var StaticDataEntry = import_v43.default.object({
|
|
2599
2697
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2600
2698
|
label: TranslationConfig,
|
|
@@ -2609,7 +2707,10 @@ var DataField = BaseField.extend({
|
|
|
2609
2707
|
subtitle: TranslationConfig.optional(),
|
|
2610
2708
|
data: import_v43.default.array(DataEntry)
|
|
2611
2709
|
})
|
|
2612
|
-
}).
|
|
2710
|
+
}).meta({
|
|
2711
|
+
description: "A field for displaying a table of read-only data",
|
|
2712
|
+
id: "DataField"
|
|
2713
|
+
});
|
|
2613
2714
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2614
2715
|
var ButtonType = import_v43.default.enum([
|
|
2615
2716
|
"primary",
|
|
@@ -2636,11 +2737,17 @@ var ButtonField = BaseField.extend({
|
|
|
2636
2737
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2637
2738
|
defaultValue: ButtonFieldValue.optional(),
|
|
2638
2739
|
configuration: ButtonConfiguration
|
|
2639
|
-
}).
|
|
2740
|
+
}).meta({
|
|
2741
|
+
description: "A generic button that can be used to trigger an action",
|
|
2742
|
+
id: "ButtonField"
|
|
2743
|
+
});
|
|
2640
2744
|
var FieldGroup = BaseField.extend({
|
|
2641
2745
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2642
2746
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2643
2747
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2748
|
+
}).meta({
|
|
2749
|
+
description: "A group of fields that are displayed together",
|
|
2750
|
+
id: "FieldGroup"
|
|
2644
2751
|
});
|
|
2645
2752
|
var AlphaPrintButton = BaseField.extend({
|
|
2646
2753
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2650,7 +2757,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2650
2757
|
"Label for the print button"
|
|
2651
2758
|
)
|
|
2652
2759
|
})
|
|
2653
|
-
}).
|
|
2760
|
+
}).meta({
|
|
2761
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2762
|
+
id: "AlphaPrintButton"
|
|
2763
|
+
});
|
|
2654
2764
|
var HttpField = BaseField.extend({
|
|
2655
2765
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2656
2766
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2666,20 +2776,30 @@ var HttpField = BaseField.extend({
|
|
|
2666
2776
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2667
2777
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2668
2778
|
})
|
|
2669
|
-
}).
|
|
2779
|
+
}).meta({
|
|
2780
|
+
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.",
|
|
2781
|
+
id: "HttpField"
|
|
2782
|
+
});
|
|
2670
2783
|
var AutocompleteField = BaseField.extend({
|
|
2671
2784
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2672
2785
|
configuration: import_v43.default.object({
|
|
2673
|
-
url: import_v43.default.string().describe(
|
|
2786
|
+
url: import_v43.default.string().describe(
|
|
2787
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2788
|
+
).optional(),
|
|
2674
2789
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2675
2790
|
defaultOptions: import_v43.default.array(
|
|
2676
2791
|
import_v43.default.object({
|
|
2677
2792
|
label: import_v43.default.string(),
|
|
2678
2793
|
value: import_v43.default.string()
|
|
2679
2794
|
})
|
|
2680
|
-
).optional()
|
|
2795
|
+
).optional().describe(
|
|
2796
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2797
|
+
)
|
|
2681
2798
|
})
|
|
2682
|
-
}).
|
|
2799
|
+
}).meta({
|
|
2800
|
+
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.",
|
|
2801
|
+
id: "AutocompleteField"
|
|
2802
|
+
});
|
|
2683
2803
|
var SearchField = HttpField.extend({
|
|
2684
2804
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2685
2805
|
configuration: SearchQuery.pick({
|
|
@@ -2712,6 +2832,9 @@ var SearchField = HttpField.extend({
|
|
|
2712
2832
|
ok: TranslationConfig.optional()
|
|
2713
2833
|
}).optional()
|
|
2714
2834
|
})
|
|
2835
|
+
}).meta({
|
|
2836
|
+
description: "A search input field",
|
|
2837
|
+
id: "SearchField"
|
|
2715
2838
|
});
|
|
2716
2839
|
var LinkButtonField = BaseField.extend({
|
|
2717
2840
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2720,7 +2843,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2720
2843
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2721
2844
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2722
2845
|
})
|
|
2723
|
-
}).
|
|
2846
|
+
}).meta({
|
|
2847
|
+
description: "A button that opens a URL link",
|
|
2848
|
+
id: "LinkButtonField"
|
|
2849
|
+
});
|
|
2724
2850
|
var VerificationStatus = BaseField.extend({
|
|
2725
2851
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2726
2852
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2730,15 +2856,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2730
2856
|
"Explaining text on the banner in form."
|
|
2731
2857
|
)
|
|
2732
2858
|
})
|
|
2859
|
+
}).meta({
|
|
2860
|
+
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.",
|
|
2861
|
+
id: "VerificationStatus"
|
|
2733
2862
|
});
|
|
2734
2863
|
var QueryParamReaderField = BaseField.extend({
|
|
2735
2864
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2736
2865
|
configuration: import_v43.default.object({
|
|
2737
2866
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2738
2867
|
})
|
|
2739
|
-
}).
|
|
2740
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2741
|
-
|
|
2868
|
+
}).meta({
|
|
2869
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2870
|
+
id: "QueryParamReaderField"
|
|
2871
|
+
});
|
|
2742
2872
|
var QrReaderField = BaseField.extend({
|
|
2743
2873
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2744
2874
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2749,7 +2879,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2749
2879
|
})
|
|
2750
2880
|
}).optional()
|
|
2751
2881
|
}).meta({
|
|
2752
|
-
description: "
|
|
2882
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2753
2883
|
id: "QrReaderField"
|
|
2754
2884
|
});
|
|
2755
2885
|
var IdReaderField = BaseField.extend({
|
|
@@ -2758,12 +2888,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2758
2888
|
methods: import_v43.default.array(
|
|
2759
2889
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2760
2890
|
)
|
|
2891
|
+
}).meta({
|
|
2892
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2893
|
+
id: "IdReaderField"
|
|
2761
2894
|
});
|
|
2762
2895
|
var CustomField = BaseField.extend({
|
|
2763
2896
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2764
2897
|
defaultValue: CustomFieldValue.optional(),
|
|
2765
2898
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2766
2899
|
configuration: import_v43.default.unknown().optional()
|
|
2900
|
+
}).meta({
|
|
2901
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2902
|
+
id: "CustomField"
|
|
2767
2903
|
});
|
|
2768
2904
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2769
2905
|
var LoaderField = BaseField.extend({
|
|
@@ -2773,22 +2909,25 @@ var LoaderField = BaseField.extend({
|
|
|
2773
2909
|
configuration: import_v43.default.object({
|
|
2774
2910
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2775
2911
|
})
|
|
2776
|
-
}).
|
|
2777
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2778
|
-
|
|
2912
|
+
}).meta({
|
|
2913
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2914
|
+
id: "LoaderField"
|
|
2915
|
+
});
|
|
2779
2916
|
var HiddenField = BaseField.extend({
|
|
2780
2917
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2781
2918
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2782
2919
|
defaultValue: TextValue.optional()
|
|
2783
|
-
}).
|
|
2784
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2785
|
-
|
|
2920
|
+
}).meta({
|
|
2921
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2922
|
+
id: "HiddenField"
|
|
2923
|
+
});
|
|
2786
2924
|
var UserRoleField = BaseField.extend({
|
|
2787
2925
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2788
2926
|
defaultValue: TextValue.optional()
|
|
2789
|
-
}).
|
|
2790
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2791
|
-
|
|
2927
|
+
}).meta({
|
|
2928
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2929
|
+
id: "UserRoleField"
|
|
2930
|
+
});
|
|
2792
2931
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2793
2932
|
FieldGroup,
|
|
2794
2933
|
Address,
|
|
@@ -2887,16 +3026,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2887
3026
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2888
3027
|
actions: VerificationActionConfig
|
|
2889
3028
|
});
|
|
2890
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
3029
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3030
|
+
id: "PageConfig",
|
|
3031
|
+
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."
|
|
3032
|
+
});
|
|
2894
3033
|
|
|
2895
3034
|
// ../commons/src/events/FormConfig.ts
|
|
2896
3035
|
var DeclarationFormConfig = z22.object({
|
|
2897
3036
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2898
3037
|
pages: z22.array(FormPageConfig)
|
|
2899
|
-
}).
|
|
3038
|
+
}).meta({
|
|
3039
|
+
id: "DeclarationFormConfig",
|
|
3040
|
+
description: "Configuration of the declaration form."
|
|
3041
|
+
});
|
|
2900
3042
|
var ActionFormConfig = z22.object({
|
|
2901
3043
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2902
3044
|
pages: z22.array(PageConfig)
|
|
@@ -3113,17 +3255,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3113
3255
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3114
3256
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3115
3257
|
*/
|
|
3116
|
-
ReadActionConfig.meta({
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3258
|
+
ReadActionConfig.meta({
|
|
3259
|
+
id: "ReadActionConfig",
|
|
3260
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3261
|
+
}),
|
|
3262
|
+
DeclareConfig.meta({
|
|
3263
|
+
id: "DeclareActionConfig",
|
|
3264
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3265
|
+
}),
|
|
3266
|
+
RejectConfig.meta({
|
|
3267
|
+
id: "RejectActionConfig",
|
|
3268
|
+
description: "Configuration for rejecting a record before registration."
|
|
3269
|
+
}),
|
|
3270
|
+
RegisterConfig.meta({
|
|
3271
|
+
id: "RegisterActionConfig",
|
|
3272
|
+
description: "Configuration for registering a record."
|
|
3273
|
+
}),
|
|
3120
3274
|
PrintCertificateActionConfig.meta({
|
|
3121
|
-
id: "PrintCertificateActionConfig"
|
|
3275
|
+
id: "PrintCertificateActionConfig",
|
|
3276
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3277
|
+
}),
|
|
3278
|
+
RequestCorrectionConfig.meta({
|
|
3279
|
+
id: "RequestCorrectionActionConfig",
|
|
3280
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3281
|
+
}),
|
|
3282
|
+
EditActionConfig.meta({
|
|
3283
|
+
id: "EditActionConfig",
|
|
3284
|
+
description: "Configuration for editing a record before registration."
|
|
3122
3285
|
}),
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3286
|
+
ArchiveConfig.meta({
|
|
3287
|
+
id: "ArchiveActionConfig",
|
|
3288
|
+
description: "Configuration for archiving a record."
|
|
3289
|
+
}),
|
|
3290
|
+
CustomActionConfig.meta({
|
|
3291
|
+
id: "CustomActionConfig",
|
|
3292
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3293
|
+
})
|
|
3127
3294
|
]).describe(
|
|
3128
3295
|
"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
3296
|
).meta({ id: "ActionConfig" });
|
|
@@ -3799,6 +3966,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3799
3966
|
function isAgeValue(value) {
|
|
3800
3967
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3801
3968
|
}
|
|
3969
|
+
function mergeWithBaseFormState(values, context) {
|
|
3970
|
+
return { ...context.baseFormState, ...values };
|
|
3971
|
+
}
|
|
3802
3972
|
function validate(schema, data) {
|
|
3803
3973
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3804
3974
|
if ("$form" in data) {
|
|
@@ -3837,7 +4007,7 @@ function isOnline() {
|
|
|
3837
4007
|
}
|
|
3838
4008
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3839
4009
|
return validate(conditional, {
|
|
3840
|
-
$form: values,
|
|
4010
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3841
4011
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3842
4012
|
$online: isOnline(),
|
|
3843
4013
|
$user: context.user,
|
|
@@ -3866,7 +4036,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3866
4036
|
return true;
|
|
3867
4037
|
}
|
|
3868
4038
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3869
|
-
$form: form,
|
|
4039
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3870
4040
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3871
4041
|
$online: isOnline(),
|
|
3872
4042
|
$user: context.user,
|
|
@@ -4058,7 +4228,7 @@ function runFieldValidations({
|
|
|
4058
4228
|
return [];
|
|
4059
4229
|
}
|
|
4060
4230
|
const conditionalParameters = {
|
|
4061
|
-
$form: form,
|
|
4231
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4062
4232
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4063
4233
|
/**
|
|
4064
4234
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4302,17 +4472,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4302
4472
|
}
|
|
4303
4473
|
return isConditionMet(page.conditional, formValues, context);
|
|
4304
4474
|
}
|
|
4305
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4475
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4306
4476
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4307
4477
|
function fn(prevVisibilityContext) {
|
|
4308
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4309
4478
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4310
4479
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4311
4480
|
if (!fieldConfig.length) {
|
|
4312
4481
|
return false;
|
|
4313
4482
|
}
|
|
4314
4483
|
const isHidden = fieldConfig.every(
|
|
4315
|
-
(f) => !isFieldVisible(f,
|
|
4484
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4316
4485
|
);
|
|
4317
4486
|
if (!isHidden) {
|
|
4318
4487
|
return false;
|
|
@@ -4330,7 +4499,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4330
4499
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4331
4500
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4332
4501
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4333
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4502
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4334
4503
|
});
|
|
4335
4504
|
return omitHiddenFields(
|
|
4336
4505
|
visibleFields,
|
|
@@ -4377,13 +4546,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4377
4546
|
}
|
|
4378
4547
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4379
4548
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4380
|
-
return omitHiddenFields(
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
false,
|
|
4385
|
-
declaration
|
|
4386
|
-
);
|
|
4549
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4550
|
+
...context,
|
|
4551
|
+
baseFormState: declaration
|
|
4552
|
+
});
|
|
4387
4553
|
}
|
|
4388
4554
|
function deepMerge(currentDocument, actionDocument) {
|
|
4389
4555
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -4571,6 +4737,19 @@ function getCompleteActionAnnotation(annotation, event2, action) {
|
|
|
4571
4737
|
}
|
|
4572
4738
|
return deepMerge(annotation, action.annotation ?? {});
|
|
4573
4739
|
}
|
|
4740
|
+
function getCompleteActionContent(event2, action) {
|
|
4741
|
+
const currentContent = "content" in action ? action.content : void 0;
|
|
4742
|
+
if (!action.originalActionId || currentContent) {
|
|
4743
|
+
return currentContent;
|
|
4744
|
+
}
|
|
4745
|
+
const originalAction = event2.actions.find(
|
|
4746
|
+
({ id }) => id === action.originalActionId
|
|
4747
|
+
);
|
|
4748
|
+
if (originalAction?.status === ActionStatus.Requested && "content" in originalAction && originalAction.content) {
|
|
4749
|
+
return originalAction.content;
|
|
4750
|
+
}
|
|
4751
|
+
return currentContent;
|
|
4752
|
+
}
|
|
4574
4753
|
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4575
4754
|
if (action.originalActionId) {
|
|
4576
4755
|
const originalAction = event2.actions.find(
|
|
@@ -5372,7 +5551,7 @@ var _EventConfigBase = z33.object({
|
|
|
5372
5551
|
),
|
|
5373
5552
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5374
5553
|
actions: z33.array(ActionConfig).describe(
|
|
5375
|
-
"Configuration of
|
|
5554
|
+
"Configuration of core and custom actions associated with the event."
|
|
5376
5555
|
),
|
|
5377
5556
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5378
5557
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5384,7 +5563,7 @@ var _EventConfigBase = z33.object({
|
|
|
5384
5563
|
"Configuration of fields available in the advanced search feature."
|
|
5385
5564
|
),
|
|
5386
5565
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5387
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5566
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5388
5567
|
),
|
|
5389
5568
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5390
5569
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5397,8 +5576,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5397
5576
|
validateActionFlags(event2, ctx);
|
|
5398
5577
|
validateActionOrder(event2, ctx);
|
|
5399
5578
|
}).meta({
|
|
5400
|
-
id: "EventConfig"
|
|
5401
|
-
|
|
5579
|
+
id: "EventConfig",
|
|
5580
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5581
|
+
});
|
|
5402
5582
|
|
|
5403
5583
|
// ../commons/src/events/EventConfigInput.ts
|
|
5404
5584
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5823,18 +6003,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5823
6003
|
query: true,
|
|
5824
6004
|
columns: true
|
|
5825
6005
|
});
|
|
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()
|
|
6006
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6007
|
+
query: CountryConfigQueryInputType
|
|
6008
|
+
}).meta({
|
|
6009
|
+
description: "Workqueue configuration",
|
|
6010
|
+
id: "WorkqueueConfig"
|
|
5838
6011
|
});
|
|
5839
6012
|
function defineWorkqueue(workqueueInput) {
|
|
5840
6013
|
const queryInput = workqueueInput.query;
|
|
@@ -5895,6 +6068,9 @@ var BaseActionInput = z38.object({
|
|
|
5895
6068
|
originalActionId: UUID.optional(),
|
|
5896
6069
|
// should not be part of base action.
|
|
5897
6070
|
keepAssignment: z38.boolean().optional(),
|
|
6071
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6072
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6073
|
+
waitFor: z38.boolean().optional(),
|
|
5898
6074
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5899
6075
|
// @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
6076
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6012,7 +6188,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
|
6012
6188
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
6013
6189
|
z38.object({
|
|
6014
6190
|
requestId: z38.string(),
|
|
6015
|
-
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
6191
|
+
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
6192
|
+
content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
|
|
6016
6193
|
}).shape
|
|
6017
6194
|
);
|
|
6018
6195
|
var ReadActionInput = BaseActionInput.extend(
|
|
@@ -6148,7 +6325,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6148
6325
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6149
6326
|
acceptedAt: acceptAction.createdAt,
|
|
6150
6327
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6151
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6152
6328
|
registrationNumber
|
|
6153
6329
|
};
|
|
6154
6330
|
}
|
|
@@ -6362,17 +6538,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6362
6538
|
return user2;
|
|
6363
6539
|
}, null);
|
|
6364
6540
|
}
|
|
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
6541
|
function deepDropNulls(obj) {
|
|
6377
6542
|
if (Array.isArray(obj)) {
|
|
6378
6543
|
return obj.map(deepDropNulls);
|
|
@@ -6468,10 +6633,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6468
6633
|
createdBy: creationAction.createdBy,
|
|
6469
6634
|
createdByUserType: creationAction.createdByUserType,
|
|
6470
6635
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6471
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6472
6636
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6473
6637
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6474
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6475
6638
|
updatedBy: requestActionMetadata.createdBy,
|
|
6476
6639
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6477
6640
|
declaration,
|
|
@@ -9730,7 +9893,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9730
9893
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9731
9894
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9732
9895
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9733
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9734
9896
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9735
9897
|
assignedTo: overrides.assignedTo ?? null,
|
|
9736
9898
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -10001,6 +10163,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10001
10163
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
10002
10164
|
);
|
|
10003
10165
|
}
|
|
10166
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10167
|
+
const collectedLocations = [];
|
|
10168
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10169
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10170
|
+
while (current) {
|
|
10171
|
+
collectedLocations.push(current);
|
|
10172
|
+
if (!current.parentId) {
|
|
10173
|
+
break;
|
|
10174
|
+
}
|
|
10175
|
+
const parentId = current.parentId;
|
|
10176
|
+
current = administrativeAreas.get(parentId);
|
|
10177
|
+
}
|
|
10178
|
+
return collectedLocations;
|
|
10179
|
+
}
|
|
10180
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10181
|
+
const { administrativeAreas, locations } = context;
|
|
10182
|
+
const loc = locations.get(selectedId);
|
|
10183
|
+
if (loc) {
|
|
10184
|
+
if (loc.administrativeAreaId) {
|
|
10185
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10186
|
+
loc.administrativeAreaId,
|
|
10187
|
+
administrativeAreas
|
|
10188
|
+
);
|
|
10189
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10190
|
+
}
|
|
10191
|
+
return [loc.id];
|
|
10192
|
+
}
|
|
10193
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10194
|
+
selectedId,
|
|
10195
|
+
administrativeAreas
|
|
10196
|
+
);
|
|
10197
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10198
|
+
}
|
|
10004
10199
|
|
|
10005
10200
|
// ../commons/src/events/scopes.ts
|
|
10006
10201
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10075,6 +10270,25 @@ function isActionInScope({
|
|
|
10075
10270
|
);
|
|
10076
10271
|
return canAccess;
|
|
10077
10272
|
}
|
|
10273
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10274
|
+
allRoles,
|
|
10275
|
+
userLocation,
|
|
10276
|
+
acceptedScopes,
|
|
10277
|
+
userRequesting
|
|
10278
|
+
}) {
|
|
10279
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10280
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10281
|
+
userToAccess: {
|
|
10282
|
+
...userLocation,
|
|
10283
|
+
role
|
|
10284
|
+
},
|
|
10285
|
+
user: userRequesting,
|
|
10286
|
+
scopes: acceptedScopes
|
|
10287
|
+
});
|
|
10288
|
+
return canAccess;
|
|
10289
|
+
});
|
|
10290
|
+
return availableRoles;
|
|
10291
|
+
}
|
|
10078
10292
|
|
|
10079
10293
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10080
10294
|
function userDeserializer(serializedUserField, user2) {
|