@opencrvs/toolkit 2.0.0-rc.6112454 → 2.0.0-rc.61553b5
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/package.json +12 -2
- package/dist/application-config/index.js +218 -85
- package/dist/cli.js +206 -36
- package/dist/commons/api/router.d.ts +3311 -246
- package/dist/commons/conditionals/validate.d.ts +1 -0
- package/dist/commons/events/ActionInput.d.ts +108 -0
- package/dist/commons/events/Draft.d.ts +4 -2
- package/dist/commons/events/EventIndex.d.ts +0 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
- package/dist/commons/events/state/flags.d.ts +7 -0
- package/dist/commons/events/state/index.d.ts +1 -5
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +3 -1
- package/dist/events/index.js +314 -158
- 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.map +1 -1
- package/dist/migrations/v2.0/index.js +204 -34
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/notification/index.js +289 -117
- package/dist/scopes/index.js +3 -1
- package/opencrvs-toolkit-2.0.0-rc.61553b5.tgz +0 -0
- package/package.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.6112454.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -277,6 +277,7 @@ __export(events_exports, {
|
|
|
277
277
|
findActiveDraftForEvent: () => findActiveDraftForEvent,
|
|
278
278
|
findAllFields: () => findAllFields,
|
|
279
279
|
findLastAssignmentAction: () => findLastAssignmentAction,
|
|
280
|
+
findPendingCorrectionRequest: () => findPendingCorrectionRequest,
|
|
280
281
|
findRecordActionPages: () => findRecordActionPages,
|
|
281
282
|
flag: () => flag,
|
|
282
283
|
flattenFieldReference: () => flattenFieldReference,
|
|
@@ -306,7 +307,6 @@ __export(events_exports, {
|
|
|
306
307
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
307
308
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
308
309
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
309
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
310
310
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
311
311
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
312
312
|
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
@@ -705,7 +705,9 @@ var decodeScope = (query) => {
|
|
|
705
705
|
};
|
|
706
706
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
707
707
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
708
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
708
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
709
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
710
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
709
711
|
};
|
|
710
712
|
function getAcceptedScopesByType({
|
|
711
713
|
acceptedScopes,
|
|
@@ -1078,7 +1080,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1078
1080
|
ShowConditional,
|
|
1079
1081
|
// Action can be shown to the user in the list but as disabled
|
|
1080
1082
|
EnableConditional
|
|
1081
|
-
])
|
|
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
|
+
});
|
|
1082
1087
|
var DisplayOnReviewConditional = z7.object({
|
|
1083
1088
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1084
1089
|
conditional: Conditional
|
|
@@ -1093,8 +1098,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1093
1098
|
// Field output can be shown / hidden on the review page
|
|
1094
1099
|
DisplayOnReviewConditional
|
|
1095
1100
|
]).meta({
|
|
1096
|
-
|
|
1097
|
-
|
|
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."
|
|
1098
1103
|
});
|
|
1099
1104
|
|
|
1100
1105
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1414,28 +1419,20 @@ function schemaPriority(schema) {
|
|
|
1414
1419
|
return idx === -1 ? 9999 : idx;
|
|
1415
1420
|
}
|
|
1416
1421
|
function safeUnion(schemas) {
|
|
1422
|
+
const sortedSchemas = [...schemas].sort(
|
|
1423
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1424
|
+
);
|
|
1417
1425
|
return z12.any().superRefine((val, ctx) => {
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
if (successful.length === 0) {
|
|
1423
|
-
ctx.addIssue({
|
|
1424
|
-
code: "invalid_type",
|
|
1425
|
-
expected: "custom",
|
|
1426
|
-
message: "Value does not match any schema"
|
|
1427
|
-
});
|
|
1428
|
-
return;
|
|
1429
|
-
}
|
|
1430
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1431
|
-
const best = successful[0];
|
|
1432
|
-
if (!best.safeParse(val).success) {
|
|
1433
|
-
ctx.addIssue({
|
|
1434
|
-
expected: "custom",
|
|
1435
|
-
code: "invalid_type",
|
|
1436
|
-
message: "Value did not match the best schema"
|
|
1437
|
-
});
|
|
1426
|
+
for (const schema of sortedSchemas) {
|
|
1427
|
+
if (schema.safeParse(val).success) {
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1438
1430
|
}
|
|
1431
|
+
ctx.addIssue({
|
|
1432
|
+
code: "invalid_type",
|
|
1433
|
+
expected: "custom",
|
|
1434
|
+
message: "Value does not match any schema"
|
|
1435
|
+
});
|
|
1439
1436
|
}).meta({
|
|
1440
1437
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1441
1438
|
});
|
|
@@ -1745,6 +1742,9 @@ var FlagConfig = z15.object({
|
|
|
1745
1742
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1746
1743
|
),
|
|
1747
1744
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1745
|
+
}).meta({
|
|
1746
|
+
id: "FlagConfig",
|
|
1747
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1748
1748
|
});
|
|
1749
1749
|
var ActionFlagConfig = z15.object({
|
|
1750
1750
|
id: Flag,
|
|
@@ -1752,6 +1752,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1752
1752
|
conditional: Conditional.optional().describe(
|
|
1753
1753
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1754
1754
|
)
|
|
1755
|
+
}).meta({
|
|
1756
|
+
id: "ActionFlagConfig",
|
|
1757
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1755
1758
|
});
|
|
1756
1759
|
|
|
1757
1760
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1773,8 +1776,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1773
1776
|
),
|
|
1774
1777
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1775
1778
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1776
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1777
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1779
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1778
1780
|
});
|
|
1779
1781
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1780
1782
|
registrationNumber: z16.string().describe(
|
|
@@ -1802,9 +1804,6 @@ var EventMetadata = z16.object({
|
|
|
1802
1804
|
createdAtLocation: UUID.nullish().describe(
|
|
1803
1805
|
"Location of the user who created the event."
|
|
1804
1806
|
),
|
|
1805
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1806
|
-
"Signature of the user who created the event."
|
|
1807
|
-
),
|
|
1808
1807
|
updatedAtLocation: UUID.nullish().describe(
|
|
1809
1808
|
"Location of the user who last changed the status."
|
|
1810
1809
|
),
|
|
@@ -2179,14 +2178,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2179
2178
|
}
|
|
2180
2179
|
}).describe("Unique identifier for the field");
|
|
2181
2180
|
var FieldReference = import_v43.default.object({
|
|
2182
|
-
$$field: FieldId,
|
|
2181
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2183
2182
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2184
2183
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2185
2184
|
)
|
|
2186
2185
|
}).describe("Reference to a field by its ID");
|
|
2187
2186
|
var ValidationConfig = import_v43.default.object({
|
|
2188
|
-
validator: Conditional
|
|
2189
|
-
|
|
2187
|
+
validator: Conditional.describe(
|
|
2188
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2189
|
+
),
|
|
2190
|
+
message: TranslationConfig.describe(
|
|
2191
|
+
"Error message displayed when the validator does not hold."
|
|
2192
|
+
)
|
|
2193
|
+
}).meta({
|
|
2194
|
+
id: "ValidationConfig",
|
|
2195
|
+
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."
|
|
2190
2196
|
});
|
|
2191
2197
|
var requiredSchema = import_v43.default.union([
|
|
2192
2198
|
import_v43.default.boolean(),
|
|
@@ -2225,6 +2231,9 @@ var BaseField = import_v43.default.object({
|
|
|
2225
2231
|
}).describe("Common properties shared across all field types.");
|
|
2226
2232
|
var Divider = BaseField.extend({
|
|
2227
2233
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2234
|
+
}).meta({
|
|
2235
|
+
description: "A horizontal line divider",
|
|
2236
|
+
id: "Divider"
|
|
2228
2237
|
});
|
|
2229
2238
|
var TextField = BaseField.extend({
|
|
2230
2239
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2235,7 +2244,10 @@ var TextField = BaseField.extend({
|
|
|
2235
2244
|
prefix: TranslationConfig.optional(),
|
|
2236
2245
|
postfix: TranslationConfig.optional()
|
|
2237
2246
|
}).default({ type: "text" }).optional()
|
|
2238
|
-
}).
|
|
2247
|
+
}).meta({
|
|
2248
|
+
description: "A text input field",
|
|
2249
|
+
id: "TextField"
|
|
2250
|
+
});
|
|
2239
2251
|
var NumberField = BaseField.extend({
|
|
2240
2252
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2241
2253
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2245,7 +2257,10 @@ var NumberField = BaseField.extend({
|
|
|
2245
2257
|
prefix: TranslationConfig.optional(),
|
|
2246
2258
|
postfix: TranslationConfig.optional()
|
|
2247
2259
|
}).optional()
|
|
2248
|
-
}).
|
|
2260
|
+
}).meta({
|
|
2261
|
+
description: "A number input field",
|
|
2262
|
+
id: "NumberField"
|
|
2263
|
+
});
|
|
2249
2264
|
var TextAreaField = BaseField.extend({
|
|
2250
2265
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2251
2266
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2256,7 +2271,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2256
2271
|
prefix: TranslationConfig.optional(),
|
|
2257
2272
|
postfix: TranslationConfig.optional()
|
|
2258
2273
|
}).default({ rows: 4 }).optional()
|
|
2259
|
-
}).
|
|
2274
|
+
}).meta({
|
|
2275
|
+
description: "A multiline text input",
|
|
2276
|
+
id: "TextAreaField"
|
|
2277
|
+
});
|
|
2260
2278
|
var ImageMimeType = import_v43.default.enum([
|
|
2261
2279
|
"image/png",
|
|
2262
2280
|
"image/jpg",
|
|
@@ -2286,13 +2304,19 @@ var SignatureField = BaseField.extend({
|
|
|
2286
2304
|
}).default({
|
|
2287
2305
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2288
2306
|
})
|
|
2289
|
-
}).
|
|
2307
|
+
}).meta({
|
|
2308
|
+
description: "A signature input field",
|
|
2309
|
+
id: "SignatureField"
|
|
2310
|
+
});
|
|
2290
2311
|
var EmailField = BaseField.extend({
|
|
2291
2312
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2292
2313
|
configuration: import_v43.default.object({
|
|
2293
2314
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2294
2315
|
}).default({ maxLength: 255 }).optional(),
|
|
2295
2316
|
defaultValue: NonEmptyTextValue.optional()
|
|
2317
|
+
}).meta({
|
|
2318
|
+
description: "An email input field",
|
|
2319
|
+
id: "EmailField"
|
|
2296
2320
|
});
|
|
2297
2321
|
var DateField = BaseField.extend({
|
|
2298
2322
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2302,7 +2326,10 @@ var DateField = BaseField.extend({
|
|
|
2302
2326
|
"Text to display above the date input"
|
|
2303
2327
|
).optional()
|
|
2304
2328
|
}).optional()
|
|
2305
|
-
}).
|
|
2329
|
+
}).meta({
|
|
2330
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2331
|
+
id: "DateField"
|
|
2332
|
+
});
|
|
2306
2333
|
var AgeField = BaseField.extend({
|
|
2307
2334
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2308
2335
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2311,7 +2338,10 @@ var AgeField = BaseField.extend({
|
|
|
2311
2338
|
prefix: TranslationConfig.optional(),
|
|
2312
2339
|
postfix: TranslationConfig.optional()
|
|
2313
2340
|
})
|
|
2314
|
-
}).
|
|
2341
|
+
}).meta({
|
|
2342
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2343
|
+
id: "AgeField"
|
|
2344
|
+
});
|
|
2315
2345
|
var TimeField = BaseField.extend({
|
|
2316
2346
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2317
2347
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2321,7 +2351,10 @@ var TimeField = BaseField.extend({
|
|
|
2321
2351
|
"Text to display above the time input"
|
|
2322
2352
|
).optional()
|
|
2323
2353
|
}).optional()
|
|
2324
|
-
}).
|
|
2354
|
+
}).meta({
|
|
2355
|
+
description: "A single time input (HH-mm)",
|
|
2356
|
+
id: "TimeField"
|
|
2357
|
+
});
|
|
2325
2358
|
var DateRangeField = BaseField.extend({
|
|
2326
2359
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2327
2360
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2330,7 +2363,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2330
2363
|
"Text to display above the date input"
|
|
2331
2364
|
).optional()
|
|
2332
2365
|
}).optional()
|
|
2333
|
-
}).
|
|
2366
|
+
}).meta({
|
|
2367
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2368
|
+
id: "DateRangeField"
|
|
2369
|
+
});
|
|
2334
2370
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2335
2371
|
"reg12",
|
|
2336
2372
|
"reg14",
|
|
@@ -2374,18 +2410,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2374
2410
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2375
2411
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2376
2412
|
configuration: ImageConfiguration
|
|
2377
|
-
}).
|
|
2413
|
+
}).meta({
|
|
2414
|
+
description: "A read-only image component for form pages",
|
|
2415
|
+
id: "ImageViewField"
|
|
2416
|
+
});
|
|
2378
2417
|
var Paragraph = BaseField.extend({
|
|
2379
2418
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2380
2419
|
configuration: ParagraphConfiguration
|
|
2381
|
-
}).
|
|
2420
|
+
}).meta({
|
|
2421
|
+
description: "A read-only HTML <p> paragraph",
|
|
2422
|
+
id: "Paragraph"
|
|
2423
|
+
});
|
|
2382
2424
|
var Heading = BaseField.extend({
|
|
2383
2425
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2384
2426
|
configuration: HeadingConfiguration
|
|
2385
|
-
}).
|
|
2427
|
+
}).meta({
|
|
2428
|
+
description: "A read-only heading component for form pages",
|
|
2429
|
+
id: "Heading"
|
|
2430
|
+
});
|
|
2386
2431
|
var PageHeader = BaseField.extend({
|
|
2387
2432
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2388
|
-
}).
|
|
2433
|
+
}).meta({
|
|
2434
|
+
description: "A read-only header component for form pages",
|
|
2435
|
+
id: "PageHeader"
|
|
2436
|
+
});
|
|
2389
2437
|
var File = BaseField.extend({
|
|
2390
2438
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2391
2439
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2404,7 +2452,10 @@ var File = BaseField.extend({
|
|
|
2404
2452
|
}).default({
|
|
2405
2453
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2406
2454
|
})
|
|
2407
|
-
}).
|
|
2455
|
+
}).meta({
|
|
2456
|
+
description: "A file upload field",
|
|
2457
|
+
id: "File"
|
|
2458
|
+
});
|
|
2408
2459
|
var SelectOption = import_v43.default.object({
|
|
2409
2460
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2410
2461
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2421,7 +2472,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2421
2472
|
"Placeholder for the number field"
|
|
2422
2473
|
)
|
|
2423
2474
|
}).optional()
|
|
2424
|
-
}).
|
|
2475
|
+
}).meta({
|
|
2476
|
+
description: "A number with unit input field",
|
|
2477
|
+
id: "NumberWithUnitField"
|
|
2478
|
+
});
|
|
2425
2479
|
var RadioGroup = BaseField.extend({
|
|
2426
2480
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2427
2481
|
defaultValue: TextValue.optional(),
|
|
@@ -2431,7 +2485,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2431
2485
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2432
2486
|
}).optional()
|
|
2433
2487
|
}).optional()
|
|
2434
|
-
}).
|
|
2488
|
+
}).meta({
|
|
2489
|
+
description: "A grouped radio button field",
|
|
2490
|
+
id: "RadioGroup"
|
|
2491
|
+
});
|
|
2435
2492
|
var BulletList = BaseField.extend({
|
|
2436
2493
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2437
2494
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2440,7 +2497,10 @@ var BulletList = BaseField.extend({
|
|
|
2440
2497
|
fontVariant: HtmlFontVariant.optional()
|
|
2441
2498
|
}).optional()
|
|
2442
2499
|
}).default({})
|
|
2443
|
-
}).
|
|
2500
|
+
}).meta({
|
|
2501
|
+
description: "A list of bullet points",
|
|
2502
|
+
id: "BulletList"
|
|
2503
|
+
});
|
|
2444
2504
|
var Select = BaseField.extend({
|
|
2445
2505
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2446
2506
|
defaultValue: TextValue.optional(),
|
|
@@ -2455,7 +2515,10 @@ var Select = BaseField.extend({
|
|
|
2455
2515
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2456
2516
|
`
|
|
2457
2517
|
)
|
|
2458
|
-
}).
|
|
2518
|
+
}).meta({
|
|
2519
|
+
description: "A select input field",
|
|
2520
|
+
id: "Select"
|
|
2521
|
+
});
|
|
2459
2522
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2460
2523
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2461
2524
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2464,7 +2527,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2464
2527
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2465
2528
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2466
2529
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2467
|
-
}).
|
|
2530
|
+
}).meta({
|
|
2531
|
+
description: "A date range selection field",
|
|
2532
|
+
id: "SelectDateRangeField"
|
|
2533
|
+
});
|
|
2468
2534
|
var NameConfig = import_v43.default.object({
|
|
2469
2535
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2470
2536
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2495,26 +2561,41 @@ var NameField = BaseField.extend({
|
|
|
2495
2561
|
surname: { required: true }
|
|
2496
2562
|
}
|
|
2497
2563
|
}).optional()
|
|
2498
|
-
}).
|
|
2564
|
+
}).meta({
|
|
2565
|
+
description: "A field for entering a persons name",
|
|
2566
|
+
id: "NameField"
|
|
2567
|
+
});
|
|
2499
2568
|
var PhoneField = BaseField.extend({
|
|
2500
2569
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2501
2570
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2502
|
-
}).
|
|
2571
|
+
}).meta({
|
|
2572
|
+
description: "A field for entering a phone number",
|
|
2573
|
+
id: "PhoneField"
|
|
2574
|
+
});
|
|
2503
2575
|
var IdField = BaseField.extend({
|
|
2504
2576
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2505
2577
|
type: import_v43.default.literal(FieldType.ID)
|
|
2506
|
-
}).
|
|
2578
|
+
}).meta({
|
|
2579
|
+
description: "A field for entering an ID",
|
|
2580
|
+
id: "IdField"
|
|
2581
|
+
});
|
|
2507
2582
|
var Checkbox = BaseField.extend({
|
|
2508
2583
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2509
2584
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2510
|
-
}).
|
|
2585
|
+
}).meta({
|
|
2586
|
+
description: "A boolean checkbox field",
|
|
2587
|
+
id: "Checkbox"
|
|
2588
|
+
});
|
|
2511
2589
|
var Country = BaseField.extend({
|
|
2512
2590
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2513
2591
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2514
2592
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2515
2593
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2516
2594
|
)
|
|
2517
|
-
}).
|
|
2595
|
+
}).meta({
|
|
2596
|
+
description: "A field for selecting a country",
|
|
2597
|
+
id: "Country"
|
|
2598
|
+
});
|
|
2518
2599
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2519
2600
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2520
2601
|
);
|
|
@@ -2523,16 +2604,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2523
2604
|
"HEALTH_FACILITY",
|
|
2524
2605
|
"CRVS_OFFICE"
|
|
2525
2606
|
]);
|
|
2526
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2527
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2528
|
-
type: AdministrativeAreas,
|
|
2529
|
-
allowedLocations: AllowedLocations
|
|
2530
|
-
}).describe("Administrative area options");
|
|
2531
2607
|
var AdministrativeAreaField = BaseField.extend({
|
|
2532
2608
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2533
2609
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2534
|
-
configuration:
|
|
2535
|
-
|
|
2610
|
+
configuration: import_v43.default.object({
|
|
2611
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2612
|
+
type: AdministrativeAreas,
|
|
2613
|
+
allowedLocations: AllowedLocations
|
|
2614
|
+
}).describe("Administrative area options")
|
|
2615
|
+
}).meta({
|
|
2616
|
+
description: "Administrative area input field",
|
|
2617
|
+
id: "AdministrativeAreaField"
|
|
2618
|
+
});
|
|
2536
2619
|
var LocationInput = BaseField.extend({
|
|
2537
2620
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2538
2621
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2540,7 +2623,10 @@ var LocationInput = BaseField.extend({
|
|
|
2540
2623
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2541
2624
|
allowedLocations: AllowedLocations
|
|
2542
2625
|
}).optional()
|
|
2543
|
-
}).
|
|
2626
|
+
}).meta({
|
|
2627
|
+
description: "A field for selecting a location",
|
|
2628
|
+
id: "LocationInput"
|
|
2629
|
+
});
|
|
2544
2630
|
var FileUploadWithOptions = BaseField.extend({
|
|
2545
2631
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2546
2632
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2554,6 +2640,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2554
2640
|
}).default({
|
|
2555
2641
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2556
2642
|
})
|
|
2643
|
+
}).meta({
|
|
2644
|
+
description: "A field for uploading files with file type options",
|
|
2645
|
+
id: "FileUploadWithOptions"
|
|
2557
2646
|
});
|
|
2558
2647
|
var Facility = BaseField.extend({
|
|
2559
2648
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2599,7 +2688,10 @@ var Address = BaseField.extend({
|
|
|
2599
2688
|
allowedLocations: AllowedLocations
|
|
2600
2689
|
}).optional(),
|
|
2601
2690
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2602
|
-
}).
|
|
2691
|
+
}).meta({
|
|
2692
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2693
|
+
id: "Address"
|
|
2694
|
+
});
|
|
2603
2695
|
var StaticDataEntry = import_v43.default.object({
|
|
2604
2696
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2605
2697
|
label: TranslationConfig,
|
|
@@ -2614,7 +2706,10 @@ var DataField = BaseField.extend({
|
|
|
2614
2706
|
subtitle: TranslationConfig.optional(),
|
|
2615
2707
|
data: import_v43.default.array(DataEntry)
|
|
2616
2708
|
})
|
|
2617
|
-
}).
|
|
2709
|
+
}).meta({
|
|
2710
|
+
description: "A field for displaying a table of read-only data",
|
|
2711
|
+
id: "DataField"
|
|
2712
|
+
});
|
|
2618
2713
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2619
2714
|
var ButtonType = import_v43.default.enum([
|
|
2620
2715
|
"primary",
|
|
@@ -2641,11 +2736,17 @@ var ButtonField = BaseField.extend({
|
|
|
2641
2736
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2642
2737
|
defaultValue: ButtonFieldValue.optional(),
|
|
2643
2738
|
configuration: ButtonConfiguration
|
|
2644
|
-
}).
|
|
2739
|
+
}).meta({
|
|
2740
|
+
description: "A generic button that can be used to trigger an action",
|
|
2741
|
+
id: "ButtonField"
|
|
2742
|
+
});
|
|
2645
2743
|
var FieldGroup = BaseField.extend({
|
|
2646
2744
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2647
2745
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2648
2746
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2747
|
+
}).meta({
|
|
2748
|
+
description: "A group of fields that are displayed together",
|
|
2749
|
+
id: "FieldGroup"
|
|
2649
2750
|
});
|
|
2650
2751
|
var AlphaPrintButton = BaseField.extend({
|
|
2651
2752
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2655,7 +2756,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2655
2756
|
"Label for the print button"
|
|
2656
2757
|
)
|
|
2657
2758
|
})
|
|
2658
|
-
}).
|
|
2759
|
+
}).meta({
|
|
2760
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2761
|
+
id: "AlphaPrintButton"
|
|
2762
|
+
});
|
|
2659
2763
|
var HttpField = BaseField.extend({
|
|
2660
2764
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2661
2765
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2671,20 +2775,30 @@ var HttpField = BaseField.extend({
|
|
|
2671
2775
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2672
2776
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2673
2777
|
})
|
|
2674
|
-
}).
|
|
2778
|
+
}).meta({
|
|
2779
|
+
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.",
|
|
2780
|
+
id: "HttpField"
|
|
2781
|
+
});
|
|
2675
2782
|
var AutocompleteField = BaseField.extend({
|
|
2676
2783
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2677
2784
|
configuration: import_v43.default.object({
|
|
2678
|
-
url: import_v43.default.string().describe(
|
|
2785
|
+
url: import_v43.default.string().describe(
|
|
2786
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2787
|
+
).optional(),
|
|
2679
2788
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2680
2789
|
defaultOptions: import_v43.default.array(
|
|
2681
2790
|
import_v43.default.object({
|
|
2682
2791
|
label: import_v43.default.string(),
|
|
2683
2792
|
value: import_v43.default.string()
|
|
2684
2793
|
})
|
|
2685
|
-
).optional()
|
|
2794
|
+
).optional().describe(
|
|
2795
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2796
|
+
)
|
|
2686
2797
|
})
|
|
2687
|
-
}).
|
|
2798
|
+
}).meta({
|
|
2799
|
+
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.",
|
|
2800
|
+
id: "AutocompleteField"
|
|
2801
|
+
});
|
|
2688
2802
|
var SearchField = HttpField.extend({
|
|
2689
2803
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2690
2804
|
configuration: SearchQuery.pick({
|
|
@@ -2717,6 +2831,9 @@ var SearchField = HttpField.extend({
|
|
|
2717
2831
|
ok: TranslationConfig.optional()
|
|
2718
2832
|
}).optional()
|
|
2719
2833
|
})
|
|
2834
|
+
}).meta({
|
|
2835
|
+
description: "A search input field",
|
|
2836
|
+
id: "SearchField"
|
|
2720
2837
|
});
|
|
2721
2838
|
var LinkButtonField = BaseField.extend({
|
|
2722
2839
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2725,7 +2842,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2725
2842
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2726
2843
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2727
2844
|
})
|
|
2728
|
-
}).
|
|
2845
|
+
}).meta({
|
|
2846
|
+
description: "A button that opens a URL link",
|
|
2847
|
+
id: "LinkButtonField"
|
|
2848
|
+
});
|
|
2729
2849
|
var VerificationStatus = BaseField.extend({
|
|
2730
2850
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2731
2851
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2735,15 +2855,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2735
2855
|
"Explaining text on the banner in form."
|
|
2736
2856
|
)
|
|
2737
2857
|
})
|
|
2858
|
+
}).meta({
|
|
2859
|
+
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.",
|
|
2860
|
+
id: "VerificationStatus"
|
|
2738
2861
|
});
|
|
2739
2862
|
var QueryParamReaderField = BaseField.extend({
|
|
2740
2863
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2741
2864
|
configuration: import_v43.default.object({
|
|
2742
2865
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2743
2866
|
})
|
|
2744
|
-
}).
|
|
2745
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2746
|
-
|
|
2867
|
+
}).meta({
|
|
2868
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2869
|
+
id: "QueryParamReaderField"
|
|
2870
|
+
});
|
|
2747
2871
|
var QrReaderField = BaseField.extend({
|
|
2748
2872
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2749
2873
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2754,7 +2878,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2754
2878
|
})
|
|
2755
2879
|
}).optional()
|
|
2756
2880
|
}).meta({
|
|
2757
|
-
description: "
|
|
2881
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2758
2882
|
id: "QrReaderField"
|
|
2759
2883
|
});
|
|
2760
2884
|
var IdReaderField = BaseField.extend({
|
|
@@ -2763,12 +2887,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2763
2887
|
methods: import_v43.default.array(
|
|
2764
2888
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2765
2889
|
)
|
|
2890
|
+
}).meta({
|
|
2891
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2892
|
+
id: "IdReaderField"
|
|
2766
2893
|
});
|
|
2767
2894
|
var CustomField = BaseField.extend({
|
|
2768
2895
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2769
2896
|
defaultValue: CustomFieldValue.optional(),
|
|
2770
2897
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2771
2898
|
configuration: import_v43.default.unknown().optional()
|
|
2899
|
+
}).meta({
|
|
2900
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2901
|
+
id: "CustomField"
|
|
2772
2902
|
});
|
|
2773
2903
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2774
2904
|
var LoaderField = BaseField.extend({
|
|
@@ -2778,22 +2908,25 @@ var LoaderField = BaseField.extend({
|
|
|
2778
2908
|
configuration: import_v43.default.object({
|
|
2779
2909
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2780
2910
|
})
|
|
2781
|
-
}).
|
|
2782
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2783
|
-
|
|
2911
|
+
}).meta({
|
|
2912
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2913
|
+
id: "LoaderField"
|
|
2914
|
+
});
|
|
2784
2915
|
var HiddenField = BaseField.extend({
|
|
2785
2916
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2786
2917
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2787
2918
|
defaultValue: TextValue.optional()
|
|
2788
|
-
}).
|
|
2789
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2790
|
-
|
|
2919
|
+
}).meta({
|
|
2920
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2921
|
+
id: "HiddenField"
|
|
2922
|
+
});
|
|
2791
2923
|
var UserRoleField = BaseField.extend({
|
|
2792
2924
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2793
2925
|
defaultValue: TextValue.optional()
|
|
2794
|
-
}).
|
|
2795
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2796
|
-
|
|
2926
|
+
}).meta({
|
|
2927
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2928
|
+
id: "UserRoleField"
|
|
2929
|
+
});
|
|
2797
2930
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2798
2931
|
FieldGroup,
|
|
2799
2932
|
Address,
|
|
@@ -2892,16 +3025,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2892
3025
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2893
3026
|
actions: VerificationActionConfig
|
|
2894
3027
|
});
|
|
2895
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3028
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3029
|
+
id: "PageConfig",
|
|
3030
|
+
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."
|
|
3031
|
+
});
|
|
2899
3032
|
|
|
2900
3033
|
// ../commons/src/events/FormConfig.ts
|
|
2901
3034
|
var DeclarationFormConfig = z22.object({
|
|
2902
3035
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2903
3036
|
pages: z22.array(FormPageConfig)
|
|
2904
|
-
}).
|
|
3037
|
+
}).meta({
|
|
3038
|
+
id: "DeclarationFormConfig",
|
|
3039
|
+
description: "Configuration of the declaration form."
|
|
3040
|
+
});
|
|
2905
3041
|
var ActionFormConfig = z22.object({
|
|
2906
3042
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2907
3043
|
pages: z22.array(PageConfig)
|
|
@@ -3001,6 +3137,9 @@ var DeduplicationConfig = z23.object({
|
|
|
3001
3137
|
id: z23.string(),
|
|
3002
3138
|
label: TranslationConfig,
|
|
3003
3139
|
query: Clause
|
|
3140
|
+
}).meta({
|
|
3141
|
+
id: "DeduplicationConfig",
|
|
3142
|
+
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."
|
|
3004
3143
|
});
|
|
3005
3144
|
|
|
3006
3145
|
// ../commons/src/events/ActionConfig.ts
|
|
@@ -3118,17 +3257,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3118
3257
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3119
3258
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3120
3259
|
*/
|
|
3121
|
-
ReadActionConfig.meta({
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3260
|
+
ReadActionConfig.meta({
|
|
3261
|
+
id: "ReadActionConfig",
|
|
3262
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3263
|
+
}),
|
|
3264
|
+
DeclareConfig.meta({
|
|
3265
|
+
id: "DeclareActionConfig",
|
|
3266
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3267
|
+
}),
|
|
3268
|
+
RejectConfig.meta({
|
|
3269
|
+
id: "RejectActionConfig",
|
|
3270
|
+
description: "Configuration for rejecting a record before registration."
|
|
3271
|
+
}),
|
|
3272
|
+
RegisterConfig.meta({
|
|
3273
|
+
id: "RegisterActionConfig",
|
|
3274
|
+
description: "Configuration for registering a record."
|
|
3275
|
+
}),
|
|
3125
3276
|
PrintCertificateActionConfig.meta({
|
|
3126
|
-
id: "PrintCertificateActionConfig"
|
|
3277
|
+
id: "PrintCertificateActionConfig",
|
|
3278
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3279
|
+
}),
|
|
3280
|
+
RequestCorrectionConfig.meta({
|
|
3281
|
+
id: "RequestCorrectionActionConfig",
|
|
3282
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3127
3283
|
}),
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3284
|
+
EditActionConfig.meta({
|
|
3285
|
+
id: "EditActionConfig",
|
|
3286
|
+
description: "Configuration for editing a record before registration."
|
|
3287
|
+
}),
|
|
3288
|
+
ArchiveConfig.meta({
|
|
3289
|
+
id: "ArchiveActionConfig",
|
|
3290
|
+
description: "Configuration for archiving a record."
|
|
3291
|
+
}),
|
|
3292
|
+
CustomActionConfig.meta({
|
|
3293
|
+
id: "CustomActionConfig",
|
|
3294
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3295
|
+
})
|
|
3132
3296
|
]).describe(
|
|
3133
3297
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
3134
3298
|
).meta({ id: "ActionConfig" });
|
|
@@ -3204,7 +3368,10 @@ var Field = BaseField2.extend({
|
|
|
3204
3368
|
}).describe("Custom field defined for the summary view.");
|
|
3205
3369
|
var SummaryConfig = z27.object({
|
|
3206
3370
|
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
3207
|
-
}).
|
|
3371
|
+
}).meta({
|
|
3372
|
+
id: "SummaryConfig",
|
|
3373
|
+
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."
|
|
3374
|
+
});
|
|
3208
3375
|
|
|
3209
3376
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
3210
3377
|
var z28 = __toESM(require("zod/v4"));
|
|
@@ -3328,6 +3495,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
|
|
|
3328
3495
|
var AdvancedSearchConfig = z28.object({
|
|
3329
3496
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
3330
3497
|
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3498
|
+
}).meta({
|
|
3499
|
+
id: "AdvancedSearchConfig",
|
|
3500
|
+
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()`)."
|
|
3331
3501
|
});
|
|
3332
3502
|
|
|
3333
3503
|
// ../commons/src/events/utils.ts
|
|
@@ -3804,6 +3974,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3804
3974
|
function isAgeValue(value) {
|
|
3805
3975
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3806
3976
|
}
|
|
3977
|
+
function mergeWithBaseFormState(values, context) {
|
|
3978
|
+
return { ...context.baseFormState, ...values };
|
|
3979
|
+
}
|
|
3807
3980
|
function validate(schema, data) {
|
|
3808
3981
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3809
3982
|
if ("$form" in data) {
|
|
@@ -3842,7 +4015,7 @@ function isOnline() {
|
|
|
3842
4015
|
}
|
|
3843
4016
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3844
4017
|
return validate(conditional, {
|
|
3845
|
-
$form: values,
|
|
4018
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3846
4019
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3847
4020
|
$online: isOnline(),
|
|
3848
4021
|
$user: context.user,
|
|
@@ -3871,7 +4044,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3871
4044
|
return true;
|
|
3872
4045
|
}
|
|
3873
4046
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3874
|
-
$form: form,
|
|
4047
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3875
4048
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3876
4049
|
$online: isOnline(),
|
|
3877
4050
|
$user: context.user,
|
|
@@ -4063,7 +4236,7 @@ function runFieldValidations({
|
|
|
4063
4236
|
return [];
|
|
4064
4237
|
}
|
|
4065
4238
|
const conditionalParameters = {
|
|
4066
|
-
$form: form,
|
|
4239
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4067
4240
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4068
4241
|
/**
|
|
4069
4242
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4307,17 +4480,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4307
4480
|
}
|
|
4308
4481
|
return isConditionMet(page.conditional, formValues, context);
|
|
4309
4482
|
}
|
|
4310
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4483
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4311
4484
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4312
4485
|
function fn(prevVisibilityContext) {
|
|
4313
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4314
4486
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4315
4487
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4316
4488
|
if (!fieldConfig.length) {
|
|
4317
4489
|
return false;
|
|
4318
4490
|
}
|
|
4319
4491
|
const isHidden = fieldConfig.every(
|
|
4320
|
-
(f) => !isFieldVisible(f,
|
|
4492
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4321
4493
|
);
|
|
4322
4494
|
if (!isHidden) {
|
|
4323
4495
|
return false;
|
|
@@ -4335,7 +4507,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4335
4507
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4336
4508
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4337
4509
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4338
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4510
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4339
4511
|
});
|
|
4340
4512
|
return omitHiddenFields(
|
|
4341
4513
|
visibleFields,
|
|
@@ -4382,13 +4554,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4382
4554
|
}
|
|
4383
4555
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4384
4556
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4385
|
-
return omitHiddenFields(
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
false,
|
|
4390
|
-
declaration
|
|
4391
|
-
);
|
|
4557
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4558
|
+
...context,
|
|
4559
|
+
baseFormState: declaration
|
|
4560
|
+
});
|
|
4392
4561
|
}
|
|
4393
4562
|
function deepMerge(currentDocument, actionDocument) {
|
|
4394
4563
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5377,7 +5546,7 @@ var _EventConfigBase = z33.object({
|
|
|
5377
5546
|
),
|
|
5378
5547
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5379
5548
|
actions: z33.array(ActionConfig).describe(
|
|
5380
|
-
"Configuration of
|
|
5549
|
+
"Configuration of core and custom actions associated with the event."
|
|
5381
5550
|
),
|
|
5382
5551
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5383
5552
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5389,7 +5558,7 @@ var _EventConfigBase = z33.object({
|
|
|
5389
5558
|
"Configuration of fields available in the advanced search feature."
|
|
5390
5559
|
),
|
|
5391
5560
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5392
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5561
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5393
5562
|
),
|
|
5394
5563
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5395
5564
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5402,8 +5571,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5402
5571
|
validateActionFlags(event2, ctx);
|
|
5403
5572
|
validateActionOrder(event2, ctx);
|
|
5404
5573
|
}).meta({
|
|
5405
|
-
id: "EventConfig"
|
|
5406
|
-
|
|
5574
|
+
id: "EventConfig",
|
|
5575
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5576
|
+
});
|
|
5407
5577
|
|
|
5408
5578
|
// ../commons/src/events/EventConfigInput.ts
|
|
5409
5579
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5626,6 +5796,9 @@ var WorkqueueColumnValue = z34.object({
|
|
|
5626
5796
|
var WorkqueueColumn = z34.object({
|
|
5627
5797
|
label: TranslationConfig,
|
|
5628
5798
|
value: WorkqueueColumnValue
|
|
5799
|
+
}).meta({
|
|
5800
|
+
id: "WorkqueueColumn",
|
|
5801
|
+
description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
|
|
5629
5802
|
});
|
|
5630
5803
|
function defineWorkqueuesColumns(workqueueColumns) {
|
|
5631
5804
|
return workqueueColumns.map(
|
|
@@ -5828,18 +6001,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5828
6001
|
query: true,
|
|
5829
6002
|
columns: true
|
|
5830
6003
|
});
|
|
5831
|
-
var WorkqueueConfigInput =
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
query: CountryConfigQueryInputType,
|
|
5837
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5838
|
-
"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."
|
|
5839
|
-
),
|
|
5840
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5841
|
-
icon: AvailableIcons,
|
|
5842
|
-
emptyMessage: TranslationConfig.optional()
|
|
6004
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6005
|
+
query: CountryConfigQueryInputType
|
|
6006
|
+
}).meta({
|
|
6007
|
+
id: "WorkqueueConfig",
|
|
6008
|
+
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."
|
|
5843
6009
|
});
|
|
5844
6010
|
function defineWorkqueue(workqueueInput) {
|
|
5845
6011
|
const queryInput = workqueueInput.query;
|
|
@@ -5900,6 +6066,11 @@ var BaseActionInput = z38.object({
|
|
|
5900
6066
|
originalActionId: UUID.optional(),
|
|
5901
6067
|
// should not be part of base action.
|
|
5902
6068
|
keepAssignment: z38.boolean().optional(),
|
|
6069
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6070
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6071
|
+
waitFor: z38.boolean().default(true).describe(
|
|
6072
|
+
"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."
|
|
6073
|
+
),
|
|
5903
6074
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5904
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.
|
|
5905
6076
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6079,7 +6250,7 @@ var Draft = z39.object({
|
|
|
6079
6250
|
}).describe(
|
|
6080
6251
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
6081
6252
|
);
|
|
6082
|
-
var DraftInput = BaseActionInput.extend({
|
|
6253
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
6083
6254
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6084
6255
|
status: z39.enum([
|
|
6085
6256
|
ActionStatus.Requested,
|
|
@@ -6153,7 +6324,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6153
6324
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6154
6325
|
acceptedAt: acceptAction.createdAt,
|
|
6155
6326
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6156
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6157
6327
|
registrationNumber
|
|
6158
6328
|
};
|
|
6159
6329
|
}
|
|
@@ -6211,19 +6381,19 @@ var import_date_fns3 = require("date-fns");
|
|
|
6211
6381
|
function isEditInProgress(actions) {
|
|
6212
6382
|
return actions.at(-1)?.type === ActionType.EDIT;
|
|
6213
6383
|
}
|
|
6214
|
-
function
|
|
6215
|
-
return actions.
|
|
6216
|
-
if (type === ActionType.REQUEST_CORRECTION) {
|
|
6217
|
-
return
|
|
6384
|
+
function findPendingCorrectionRequest(actions) {
|
|
6385
|
+
return actions.filter((a) => a.status === ActionStatus.Accepted).reduce((pending, action) => {
|
|
6386
|
+
if (action.type === ActionType.REQUEST_CORRECTION) {
|
|
6387
|
+
return action;
|
|
6218
6388
|
}
|
|
6219
|
-
if (type === ActionType.APPROVE_CORRECTION) {
|
|
6220
|
-
return
|
|
6221
|
-
}
|
|
6222
|
-
if (type === ActionType.REJECT_CORRECTION) {
|
|
6223
|
-
return false;
|
|
6389
|
+
if (action.type === ActionType.APPROVE_CORRECTION || action.type === ActionType.REJECT_CORRECTION) {
|
|
6390
|
+
return void 0;
|
|
6224
6391
|
}
|
|
6225
|
-
return
|
|
6226
|
-
},
|
|
6392
|
+
return pending;
|
|
6393
|
+
}, void 0);
|
|
6394
|
+
}
|
|
6395
|
+
function isCorrectionRequested(actions) {
|
|
6396
|
+
return findPendingCorrectionRequest(actions) !== void 0;
|
|
6227
6397
|
}
|
|
6228
6398
|
function isDeclarationIncomplete(actions) {
|
|
6229
6399
|
return getStatusFromActions(actions) === EventStatus.enum.NOTIFIED;
|
|
@@ -6367,17 +6537,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6367
6537
|
return user2;
|
|
6368
6538
|
}, null);
|
|
6369
6539
|
}
|
|
6370
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6371
|
-
return actions.reduce((signature, action) => {
|
|
6372
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6373
|
-
return action.createdBySignature || null;
|
|
6374
|
-
}
|
|
6375
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6376
|
-
return null;
|
|
6377
|
-
}
|
|
6378
|
-
return signature;
|
|
6379
|
-
}, null);
|
|
6380
|
-
}
|
|
6381
6540
|
function deepDropNulls(obj) {
|
|
6382
6541
|
if (Array.isArray(obj)) {
|
|
6383
6542
|
return obj.map(deepDropNulls);
|
|
@@ -6473,10 +6632,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6473
6632
|
createdBy: creationAction.createdBy,
|
|
6474
6633
|
createdByUserType: creationAction.createdByUserType,
|
|
6475
6634
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6476
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6477
6635
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6478
6636
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6479
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6480
6637
|
updatedBy: requestActionMetadata.createdBy,
|
|
6481
6638
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6482
6639
|
declaration,
|
|
@@ -9735,7 +9892,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9735
9892
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9736
9893
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9737
9894
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9738
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9739
9895
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9740
9896
|
assignedTo: overrides.assignedTo ?? null,
|
|
9741
9897
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|