@opencrvs/toolkit 2.0.0-rc.c0924af → 2.0.0-rc.c0c2dcd
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/dist/application-config/index.js +208 -66
- package/dist/cli.js +206 -36
- package/dist/commons/api/router.d.ts +3334 -221
- 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 +78 -0
- package/dist/commons/events/Draft.d.ts +2 -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/WorkqueueConfig.d.ts +150 -150
- 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 +3 -1
- package/dist/events/index.js +291 -127
- 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 +264 -97
- package/dist/scopes/index.js +3 -1
- package/opencrvs-toolkit-2.0.0-rc.c0c2dcd.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.c0924af.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -306,11 +306,11 @@ __export(events_exports, {
|
|
|
306
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
307
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
308
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
309
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
310
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
311
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
312
311
|
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
313
312
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
313
|
+
getCompleteActionContent: () => getCompleteActionContent,
|
|
314
314
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
315
315
|
getCurrentEventState: () => getCurrentEventState,
|
|
316
316
|
getCustomActionFields: () => getCustomActionFields,
|
|
@@ -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
|
|
@@ -1644,8 +1649,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1644
1649
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1645
1650
|
z14.object({
|
|
1646
1651
|
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1647
|
-
requestId: z14.string()
|
|
1652
|
+
requestId: z14.string(),
|
|
1648
1653
|
// TODO move into 'content' property
|
|
1654
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1649
1655
|
}).shape
|
|
1650
1656
|
);
|
|
1651
1657
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1737,6 +1743,9 @@ var FlagConfig = z15.object({
|
|
|
1737
1743
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1738
1744
|
),
|
|
1739
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."
|
|
1740
1749
|
});
|
|
1741
1750
|
var ActionFlagConfig = z15.object({
|
|
1742
1751
|
id: Flag,
|
|
@@ -1744,6 +1753,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1744
1753
|
conditional: Conditional.optional().describe(
|
|
1745
1754
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1746
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."
|
|
1747
1759
|
});
|
|
1748
1760
|
|
|
1749
1761
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1765,8 +1777,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1765
1777
|
),
|
|
1766
1778
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1767
1779
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1768
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1769
|
-
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.")
|
|
1770
1781
|
});
|
|
1771
1782
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1772
1783
|
registrationNumber: z16.string().describe(
|
|
@@ -1794,9 +1805,6 @@ var EventMetadata = z16.object({
|
|
|
1794
1805
|
createdAtLocation: UUID.nullish().describe(
|
|
1795
1806
|
"Location of the user who created the event."
|
|
1796
1807
|
),
|
|
1797
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1798
|
-
"Signature of the user who created the event."
|
|
1799
|
-
),
|
|
1800
1808
|
updatedAtLocation: UUID.nullish().describe(
|
|
1801
1809
|
"Location of the user who last changed the status."
|
|
1802
1810
|
),
|
|
@@ -2171,14 +2179,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2171
2179
|
}
|
|
2172
2180
|
}).describe("Unique identifier for the field");
|
|
2173
2181
|
var FieldReference = import_v43.default.object({
|
|
2174
|
-
$$field: FieldId,
|
|
2182
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2175
2183
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2176
2184
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2177
2185
|
)
|
|
2178
2186
|
}).describe("Reference to a field by its ID");
|
|
2179
2187
|
var ValidationConfig = import_v43.default.object({
|
|
2180
|
-
validator: Conditional
|
|
2181
|
-
|
|
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."
|
|
2182
2197
|
});
|
|
2183
2198
|
var requiredSchema = import_v43.default.union([
|
|
2184
2199
|
import_v43.default.boolean(),
|
|
@@ -2217,6 +2232,9 @@ var BaseField = import_v43.default.object({
|
|
|
2217
2232
|
}).describe("Common properties shared across all field types.");
|
|
2218
2233
|
var Divider = BaseField.extend({
|
|
2219
2234
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2235
|
+
}).meta({
|
|
2236
|
+
description: "A horizontal line divider",
|
|
2237
|
+
id: "Divider"
|
|
2220
2238
|
});
|
|
2221
2239
|
var TextField = BaseField.extend({
|
|
2222
2240
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2227,7 +2245,10 @@ var TextField = BaseField.extend({
|
|
|
2227
2245
|
prefix: TranslationConfig.optional(),
|
|
2228
2246
|
postfix: TranslationConfig.optional()
|
|
2229
2247
|
}).default({ type: "text" }).optional()
|
|
2230
|
-
}).
|
|
2248
|
+
}).meta({
|
|
2249
|
+
description: "A text input field",
|
|
2250
|
+
id: "TextField"
|
|
2251
|
+
});
|
|
2231
2252
|
var NumberField = BaseField.extend({
|
|
2232
2253
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2233
2254
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2237,7 +2258,10 @@ var NumberField = BaseField.extend({
|
|
|
2237
2258
|
prefix: TranslationConfig.optional(),
|
|
2238
2259
|
postfix: TranslationConfig.optional()
|
|
2239
2260
|
}).optional()
|
|
2240
|
-
}).
|
|
2261
|
+
}).meta({
|
|
2262
|
+
description: "A number input field",
|
|
2263
|
+
id: "NumberField"
|
|
2264
|
+
});
|
|
2241
2265
|
var TextAreaField = BaseField.extend({
|
|
2242
2266
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2243
2267
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2248,7 +2272,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2248
2272
|
prefix: TranslationConfig.optional(),
|
|
2249
2273
|
postfix: TranslationConfig.optional()
|
|
2250
2274
|
}).default({ rows: 4 }).optional()
|
|
2251
|
-
}).
|
|
2275
|
+
}).meta({
|
|
2276
|
+
description: "A multiline text input",
|
|
2277
|
+
id: "TextAreaField"
|
|
2278
|
+
});
|
|
2252
2279
|
var ImageMimeType = import_v43.default.enum([
|
|
2253
2280
|
"image/png",
|
|
2254
2281
|
"image/jpg",
|
|
@@ -2278,13 +2305,19 @@ var SignatureField = BaseField.extend({
|
|
|
2278
2305
|
}).default({
|
|
2279
2306
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2280
2307
|
})
|
|
2281
|
-
}).
|
|
2308
|
+
}).meta({
|
|
2309
|
+
description: "A signature input field",
|
|
2310
|
+
id: "SignatureField"
|
|
2311
|
+
});
|
|
2282
2312
|
var EmailField = BaseField.extend({
|
|
2283
2313
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2284
2314
|
configuration: import_v43.default.object({
|
|
2285
2315
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2286
2316
|
}).default({ maxLength: 255 }).optional(),
|
|
2287
2317
|
defaultValue: NonEmptyTextValue.optional()
|
|
2318
|
+
}).meta({
|
|
2319
|
+
description: "An email input field",
|
|
2320
|
+
id: "EmailField"
|
|
2288
2321
|
});
|
|
2289
2322
|
var DateField = BaseField.extend({
|
|
2290
2323
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2294,7 +2327,10 @@ var DateField = BaseField.extend({
|
|
|
2294
2327
|
"Text to display above the date input"
|
|
2295
2328
|
).optional()
|
|
2296
2329
|
}).optional()
|
|
2297
|
-
}).
|
|
2330
|
+
}).meta({
|
|
2331
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2332
|
+
id: "DateField"
|
|
2333
|
+
});
|
|
2298
2334
|
var AgeField = BaseField.extend({
|
|
2299
2335
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2300
2336
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2303,7 +2339,10 @@ var AgeField = BaseField.extend({
|
|
|
2303
2339
|
prefix: TranslationConfig.optional(),
|
|
2304
2340
|
postfix: TranslationConfig.optional()
|
|
2305
2341
|
})
|
|
2306
|
-
}).
|
|
2342
|
+
}).meta({
|
|
2343
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2344
|
+
id: "AgeField"
|
|
2345
|
+
});
|
|
2307
2346
|
var TimeField = BaseField.extend({
|
|
2308
2347
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2309
2348
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2313,7 +2352,10 @@ var TimeField = BaseField.extend({
|
|
|
2313
2352
|
"Text to display above the time input"
|
|
2314
2353
|
).optional()
|
|
2315
2354
|
}).optional()
|
|
2316
|
-
}).
|
|
2355
|
+
}).meta({
|
|
2356
|
+
description: "A single time input (HH-mm)",
|
|
2357
|
+
id: "TimeField"
|
|
2358
|
+
});
|
|
2317
2359
|
var DateRangeField = BaseField.extend({
|
|
2318
2360
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2319
2361
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2322,7 +2364,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2322
2364
|
"Text to display above the date input"
|
|
2323
2365
|
).optional()
|
|
2324
2366
|
}).optional()
|
|
2325
|
-
}).
|
|
2367
|
+
}).meta({
|
|
2368
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2369
|
+
id: "DateRangeField"
|
|
2370
|
+
});
|
|
2326
2371
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2327
2372
|
"reg12",
|
|
2328
2373
|
"reg14",
|
|
@@ -2366,18 +2411,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2366
2411
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2367
2412
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2368
2413
|
configuration: ImageConfiguration
|
|
2369
|
-
}).
|
|
2414
|
+
}).meta({
|
|
2415
|
+
description: "A read-only image component for form pages",
|
|
2416
|
+
id: "ImageViewField"
|
|
2417
|
+
});
|
|
2370
2418
|
var Paragraph = BaseField.extend({
|
|
2371
2419
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2372
2420
|
configuration: ParagraphConfiguration
|
|
2373
|
-
}).
|
|
2421
|
+
}).meta({
|
|
2422
|
+
description: "A read-only HTML <p> paragraph",
|
|
2423
|
+
id: "Paragraph"
|
|
2424
|
+
});
|
|
2374
2425
|
var Heading = BaseField.extend({
|
|
2375
2426
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2376
2427
|
configuration: HeadingConfiguration
|
|
2377
|
-
}).
|
|
2428
|
+
}).meta({
|
|
2429
|
+
description: "A read-only heading component for form pages",
|
|
2430
|
+
id: "Heading"
|
|
2431
|
+
});
|
|
2378
2432
|
var PageHeader = BaseField.extend({
|
|
2379
2433
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2380
|
-
}).
|
|
2434
|
+
}).meta({
|
|
2435
|
+
description: "A read-only header component for form pages",
|
|
2436
|
+
id: "PageHeader"
|
|
2437
|
+
});
|
|
2381
2438
|
var File = BaseField.extend({
|
|
2382
2439
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2383
2440
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2396,7 +2453,10 @@ var File = BaseField.extend({
|
|
|
2396
2453
|
}).default({
|
|
2397
2454
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2398
2455
|
})
|
|
2399
|
-
}).
|
|
2456
|
+
}).meta({
|
|
2457
|
+
description: "A file upload field",
|
|
2458
|
+
id: "File"
|
|
2459
|
+
});
|
|
2400
2460
|
var SelectOption = import_v43.default.object({
|
|
2401
2461
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2402
2462
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2413,7 +2473,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2413
2473
|
"Placeholder for the number field"
|
|
2414
2474
|
)
|
|
2415
2475
|
}).optional()
|
|
2416
|
-
}).
|
|
2476
|
+
}).meta({
|
|
2477
|
+
description: "A number with unit input field",
|
|
2478
|
+
id: "NumberWithUnitField"
|
|
2479
|
+
});
|
|
2417
2480
|
var RadioGroup = BaseField.extend({
|
|
2418
2481
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2419
2482
|
defaultValue: TextValue.optional(),
|
|
@@ -2423,7 +2486,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2423
2486
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2424
2487
|
}).optional()
|
|
2425
2488
|
}).optional()
|
|
2426
|
-
}).
|
|
2489
|
+
}).meta({
|
|
2490
|
+
description: "A grouped radio button field",
|
|
2491
|
+
id: "RadioGroup"
|
|
2492
|
+
});
|
|
2427
2493
|
var BulletList = BaseField.extend({
|
|
2428
2494
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2429
2495
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2432,7 +2498,10 @@ var BulletList = BaseField.extend({
|
|
|
2432
2498
|
fontVariant: HtmlFontVariant.optional()
|
|
2433
2499
|
}).optional()
|
|
2434
2500
|
}).default({})
|
|
2435
|
-
}).
|
|
2501
|
+
}).meta({
|
|
2502
|
+
description: "A list of bullet points",
|
|
2503
|
+
id: "BulletList"
|
|
2504
|
+
});
|
|
2436
2505
|
var Select = BaseField.extend({
|
|
2437
2506
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2438
2507
|
defaultValue: TextValue.optional(),
|
|
@@ -2447,7 +2516,10 @@ var Select = BaseField.extend({
|
|
|
2447
2516
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2448
2517
|
`
|
|
2449
2518
|
)
|
|
2450
|
-
}).
|
|
2519
|
+
}).meta({
|
|
2520
|
+
description: "A select input field",
|
|
2521
|
+
id: "Select"
|
|
2522
|
+
});
|
|
2451
2523
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2452
2524
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2453
2525
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2456,7 +2528,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2456
2528
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2457
2529
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2458
2530
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2459
|
-
}).
|
|
2531
|
+
}).meta({
|
|
2532
|
+
description: "A date range selection field",
|
|
2533
|
+
id: "SelectDateRangeField"
|
|
2534
|
+
});
|
|
2460
2535
|
var NameConfig = import_v43.default.object({
|
|
2461
2536
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2462
2537
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2487,26 +2562,41 @@ var NameField = BaseField.extend({
|
|
|
2487
2562
|
surname: { required: true }
|
|
2488
2563
|
}
|
|
2489
2564
|
}).optional()
|
|
2490
|
-
}).
|
|
2565
|
+
}).meta({
|
|
2566
|
+
description: "A field for entering a persons name",
|
|
2567
|
+
id: "NameField"
|
|
2568
|
+
});
|
|
2491
2569
|
var PhoneField = BaseField.extend({
|
|
2492
2570
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2493
2571
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2494
|
-
}).
|
|
2572
|
+
}).meta({
|
|
2573
|
+
description: "A field for entering a phone number",
|
|
2574
|
+
id: "PhoneField"
|
|
2575
|
+
});
|
|
2495
2576
|
var IdField = BaseField.extend({
|
|
2496
2577
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2497
2578
|
type: import_v43.default.literal(FieldType.ID)
|
|
2498
|
-
}).
|
|
2579
|
+
}).meta({
|
|
2580
|
+
description: "A field for entering an ID",
|
|
2581
|
+
id: "IdField"
|
|
2582
|
+
});
|
|
2499
2583
|
var Checkbox = BaseField.extend({
|
|
2500
2584
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2501
2585
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2502
|
-
}).
|
|
2586
|
+
}).meta({
|
|
2587
|
+
description: "A boolean checkbox field",
|
|
2588
|
+
id: "Checkbox"
|
|
2589
|
+
});
|
|
2503
2590
|
var Country = BaseField.extend({
|
|
2504
2591
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2505
2592
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2506
2593
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2507
2594
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2508
2595
|
)
|
|
2509
|
-
}).
|
|
2596
|
+
}).meta({
|
|
2597
|
+
description: "A field for selecting a country",
|
|
2598
|
+
id: "Country"
|
|
2599
|
+
});
|
|
2510
2600
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2511
2601
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2512
2602
|
);
|
|
@@ -2515,16 +2605,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2515
2605
|
"HEALTH_FACILITY",
|
|
2516
2606
|
"CRVS_OFFICE"
|
|
2517
2607
|
]);
|
|
2518
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2519
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2520
|
-
type: AdministrativeAreas,
|
|
2521
|
-
allowedLocations: AllowedLocations
|
|
2522
|
-
}).describe("Administrative area options");
|
|
2523
2608
|
var AdministrativeAreaField = BaseField.extend({
|
|
2524
2609
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2525
2610
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2526
|
-
configuration:
|
|
2527
|
-
|
|
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
|
+
});
|
|
2528
2620
|
var LocationInput = BaseField.extend({
|
|
2529
2621
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2530
2622
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2532,7 +2624,10 @@ var LocationInput = BaseField.extend({
|
|
|
2532
2624
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2533
2625
|
allowedLocations: AllowedLocations
|
|
2534
2626
|
}).optional()
|
|
2535
|
-
}).
|
|
2627
|
+
}).meta({
|
|
2628
|
+
description: "A field for selecting a location",
|
|
2629
|
+
id: "LocationInput"
|
|
2630
|
+
});
|
|
2536
2631
|
var FileUploadWithOptions = BaseField.extend({
|
|
2537
2632
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2538
2633
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2546,6 +2641,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2546
2641
|
}).default({
|
|
2547
2642
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2548
2643
|
})
|
|
2644
|
+
}).meta({
|
|
2645
|
+
description: "A field for uploading files with file type options",
|
|
2646
|
+
id: "FileUploadWithOptions"
|
|
2549
2647
|
});
|
|
2550
2648
|
var Facility = BaseField.extend({
|
|
2551
2649
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2591,7 +2689,10 @@ var Address = BaseField.extend({
|
|
|
2591
2689
|
allowedLocations: AllowedLocations
|
|
2592
2690
|
}).optional(),
|
|
2593
2691
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2594
|
-
}).
|
|
2692
|
+
}).meta({
|
|
2693
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2694
|
+
id: "Address"
|
|
2695
|
+
});
|
|
2595
2696
|
var StaticDataEntry = import_v43.default.object({
|
|
2596
2697
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2597
2698
|
label: TranslationConfig,
|
|
@@ -2606,7 +2707,10 @@ var DataField = BaseField.extend({
|
|
|
2606
2707
|
subtitle: TranslationConfig.optional(),
|
|
2607
2708
|
data: import_v43.default.array(DataEntry)
|
|
2608
2709
|
})
|
|
2609
|
-
}).
|
|
2710
|
+
}).meta({
|
|
2711
|
+
description: "A field for displaying a table of read-only data",
|
|
2712
|
+
id: "DataField"
|
|
2713
|
+
});
|
|
2610
2714
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2611
2715
|
var ButtonType = import_v43.default.enum([
|
|
2612
2716
|
"primary",
|
|
@@ -2633,11 +2737,17 @@ var ButtonField = BaseField.extend({
|
|
|
2633
2737
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2634
2738
|
defaultValue: ButtonFieldValue.optional(),
|
|
2635
2739
|
configuration: ButtonConfiguration
|
|
2636
|
-
}).
|
|
2740
|
+
}).meta({
|
|
2741
|
+
description: "A generic button that can be used to trigger an action",
|
|
2742
|
+
id: "ButtonField"
|
|
2743
|
+
});
|
|
2637
2744
|
var FieldGroup = BaseField.extend({
|
|
2638
2745
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2639
2746
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2640
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"
|
|
2641
2751
|
});
|
|
2642
2752
|
var AlphaPrintButton = BaseField.extend({
|
|
2643
2753
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2647,7 +2757,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2647
2757
|
"Label for the print button"
|
|
2648
2758
|
)
|
|
2649
2759
|
})
|
|
2650
|
-
}).
|
|
2760
|
+
}).meta({
|
|
2761
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2762
|
+
id: "AlphaPrintButton"
|
|
2763
|
+
});
|
|
2651
2764
|
var HttpField = BaseField.extend({
|
|
2652
2765
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2653
2766
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2663,20 +2776,30 @@ var HttpField = BaseField.extend({
|
|
|
2663
2776
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2664
2777
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2665
2778
|
})
|
|
2666
|
-
}).
|
|
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
|
+
});
|
|
2667
2783
|
var AutocompleteField = BaseField.extend({
|
|
2668
2784
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2669
2785
|
configuration: import_v43.default.object({
|
|
2670
|
-
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(),
|
|
2671
2789
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2672
2790
|
defaultOptions: import_v43.default.array(
|
|
2673
2791
|
import_v43.default.object({
|
|
2674
2792
|
label: import_v43.default.string(),
|
|
2675
2793
|
value: import_v43.default.string()
|
|
2676
2794
|
})
|
|
2677
|
-
).optional()
|
|
2795
|
+
).optional().describe(
|
|
2796
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2797
|
+
)
|
|
2678
2798
|
})
|
|
2679
|
-
}).
|
|
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
|
+
});
|
|
2680
2803
|
var SearchField = HttpField.extend({
|
|
2681
2804
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2682
2805
|
configuration: SearchQuery.pick({
|
|
@@ -2709,6 +2832,9 @@ var SearchField = HttpField.extend({
|
|
|
2709
2832
|
ok: TranslationConfig.optional()
|
|
2710
2833
|
}).optional()
|
|
2711
2834
|
})
|
|
2835
|
+
}).meta({
|
|
2836
|
+
description: "A search input field",
|
|
2837
|
+
id: "SearchField"
|
|
2712
2838
|
});
|
|
2713
2839
|
var LinkButtonField = BaseField.extend({
|
|
2714
2840
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2717,7 +2843,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2717
2843
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2718
2844
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2719
2845
|
})
|
|
2720
|
-
}).
|
|
2846
|
+
}).meta({
|
|
2847
|
+
description: "A button that opens a URL link",
|
|
2848
|
+
id: "LinkButtonField"
|
|
2849
|
+
});
|
|
2721
2850
|
var VerificationStatus = BaseField.extend({
|
|
2722
2851
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2723
2852
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2727,15 +2856,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2727
2856
|
"Explaining text on the banner in form."
|
|
2728
2857
|
)
|
|
2729
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"
|
|
2730
2862
|
});
|
|
2731
2863
|
var QueryParamReaderField = BaseField.extend({
|
|
2732
2864
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2733
2865
|
configuration: import_v43.default.object({
|
|
2734
2866
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2735
2867
|
})
|
|
2736
|
-
}).
|
|
2737
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2738
|
-
|
|
2868
|
+
}).meta({
|
|
2869
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2870
|
+
id: "QueryParamReaderField"
|
|
2871
|
+
});
|
|
2739
2872
|
var QrReaderField = BaseField.extend({
|
|
2740
2873
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2741
2874
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2746,7 +2879,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2746
2879
|
})
|
|
2747
2880
|
}).optional()
|
|
2748
2881
|
}).meta({
|
|
2749
|
-
description: "
|
|
2882
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2750
2883
|
id: "QrReaderField"
|
|
2751
2884
|
});
|
|
2752
2885
|
var IdReaderField = BaseField.extend({
|
|
@@ -2755,12 +2888,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2755
2888
|
methods: import_v43.default.array(
|
|
2756
2889
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2757
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"
|
|
2758
2894
|
});
|
|
2759
2895
|
var CustomField = BaseField.extend({
|
|
2760
2896
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2761
2897
|
defaultValue: CustomFieldValue.optional(),
|
|
2762
2898
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2763
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"
|
|
2764
2903
|
});
|
|
2765
2904
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2766
2905
|
var LoaderField = BaseField.extend({
|
|
@@ -2770,22 +2909,25 @@ var LoaderField = BaseField.extend({
|
|
|
2770
2909
|
configuration: import_v43.default.object({
|
|
2771
2910
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2772
2911
|
})
|
|
2773
|
-
}).
|
|
2774
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2775
|
-
|
|
2912
|
+
}).meta({
|
|
2913
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2914
|
+
id: "LoaderField"
|
|
2915
|
+
});
|
|
2776
2916
|
var HiddenField = BaseField.extend({
|
|
2777
2917
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2778
2918
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2779
2919
|
defaultValue: TextValue.optional()
|
|
2780
|
-
}).
|
|
2781
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2782
|
-
|
|
2920
|
+
}).meta({
|
|
2921
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2922
|
+
id: "HiddenField"
|
|
2923
|
+
});
|
|
2783
2924
|
var UserRoleField = BaseField.extend({
|
|
2784
2925
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2785
2926
|
defaultValue: TextValue.optional()
|
|
2786
|
-
}).
|
|
2787
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2788
|
-
|
|
2927
|
+
}).meta({
|
|
2928
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2929
|
+
id: "UserRoleField"
|
|
2930
|
+
});
|
|
2789
2931
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2790
2932
|
FieldGroup,
|
|
2791
2933
|
Address,
|
|
@@ -2884,16 +3026,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2884
3026
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2885
3027
|
actions: VerificationActionConfig
|
|
2886
3028
|
});
|
|
2887
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
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
|
+
});
|
|
2891
3033
|
|
|
2892
3034
|
// ../commons/src/events/FormConfig.ts
|
|
2893
3035
|
var DeclarationFormConfig = z22.object({
|
|
2894
3036
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2895
3037
|
pages: z22.array(FormPageConfig)
|
|
2896
|
-
}).
|
|
3038
|
+
}).meta({
|
|
3039
|
+
id: "DeclarationFormConfig",
|
|
3040
|
+
description: "Configuration of the declaration form."
|
|
3041
|
+
});
|
|
2897
3042
|
var ActionFormConfig = z22.object({
|
|
2898
3043
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2899
3044
|
pages: z22.array(PageConfig)
|
|
@@ -3110,17 +3255,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3110
3255
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3111
3256
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3112
3257
|
*/
|
|
3113
|
-
ReadActionConfig.meta({
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
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
|
+
}),
|
|
3117
3274
|
PrintCertificateActionConfig.meta({
|
|
3118
|
-
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."
|
|
3119
3285
|
}),
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
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
|
+
})
|
|
3124
3294
|
]).describe(
|
|
3125
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."
|
|
3126
3296
|
).meta({ id: "ActionConfig" });
|
|
@@ -3796,6 +3966,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3796
3966
|
function isAgeValue(value) {
|
|
3797
3967
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3798
3968
|
}
|
|
3969
|
+
function mergeWithBaseFormState(values, context) {
|
|
3970
|
+
return { ...context.baseFormState, ...values };
|
|
3971
|
+
}
|
|
3799
3972
|
function validate(schema, data) {
|
|
3800
3973
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3801
3974
|
if ("$form" in data) {
|
|
@@ -3834,7 +4007,7 @@ function isOnline() {
|
|
|
3834
4007
|
}
|
|
3835
4008
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3836
4009
|
return validate(conditional, {
|
|
3837
|
-
$form: values,
|
|
4010
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3838
4011
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3839
4012
|
$online: isOnline(),
|
|
3840
4013
|
$user: context.user,
|
|
@@ -3863,7 +4036,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3863
4036
|
return true;
|
|
3864
4037
|
}
|
|
3865
4038
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3866
|
-
$form: form,
|
|
4039
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3867
4040
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3868
4041
|
$online: isOnline(),
|
|
3869
4042
|
$user: context.user,
|
|
@@ -4055,7 +4228,7 @@ function runFieldValidations({
|
|
|
4055
4228
|
return [];
|
|
4056
4229
|
}
|
|
4057
4230
|
const conditionalParameters = {
|
|
4058
|
-
$form: form,
|
|
4231
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4059
4232
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4060
4233
|
/**
|
|
4061
4234
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4299,17 +4472,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4299
4472
|
}
|
|
4300
4473
|
return isConditionMet(page.conditional, formValues, context);
|
|
4301
4474
|
}
|
|
4302
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4475
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4303
4476
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4304
4477
|
function fn(prevVisibilityContext) {
|
|
4305
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4306
4478
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4307
4479
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4308
4480
|
if (!fieldConfig.length) {
|
|
4309
4481
|
return false;
|
|
4310
4482
|
}
|
|
4311
4483
|
const isHidden = fieldConfig.every(
|
|
4312
|
-
(f) => !isFieldVisible(f,
|
|
4484
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4313
4485
|
);
|
|
4314
4486
|
if (!isHidden) {
|
|
4315
4487
|
return false;
|
|
@@ -4327,7 +4499,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4327
4499
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4328
4500
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4329
4501
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4330
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4502
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4331
4503
|
});
|
|
4332
4504
|
return omitHiddenFields(
|
|
4333
4505
|
visibleFields,
|
|
@@ -4374,13 +4546,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4374
4546
|
}
|
|
4375
4547
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4376
4548
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4377
|
-
return omitHiddenFields(
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
false,
|
|
4382
|
-
declaration
|
|
4383
|
-
);
|
|
4549
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4550
|
+
...context,
|
|
4551
|
+
baseFormState: declaration
|
|
4552
|
+
});
|
|
4384
4553
|
}
|
|
4385
4554
|
function deepMerge(currentDocument, actionDocument) {
|
|
4386
4555
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -4568,6 +4737,19 @@ function getCompleteActionAnnotation(annotation, event2, action) {
|
|
|
4568
4737
|
}
|
|
4569
4738
|
return deepMerge(annotation, action.annotation ?? {});
|
|
4570
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
|
+
}
|
|
4571
4753
|
function getCompleteActionDeclaration(declaration, event2, action) {
|
|
4572
4754
|
if (action.originalActionId) {
|
|
4573
4755
|
const originalAction = event2.actions.find(
|
|
@@ -5369,7 +5551,7 @@ var _EventConfigBase = z33.object({
|
|
|
5369
5551
|
),
|
|
5370
5552
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5371
5553
|
actions: z33.array(ActionConfig).describe(
|
|
5372
|
-
"Configuration of
|
|
5554
|
+
"Configuration of core and custom actions associated with the event."
|
|
5373
5555
|
),
|
|
5374
5556
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5375
5557
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5381,7 +5563,7 @@ var _EventConfigBase = z33.object({
|
|
|
5381
5563
|
"Configuration of fields available in the advanced search feature."
|
|
5382
5564
|
),
|
|
5383
5565
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5384
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5566
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5385
5567
|
),
|
|
5386
5568
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5387
5569
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5394,8 +5576,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5394
5576
|
validateActionFlags(event2, ctx);
|
|
5395
5577
|
validateActionOrder(event2, ctx);
|
|
5396
5578
|
}).meta({
|
|
5397
|
-
id: "EventConfig"
|
|
5398
|
-
|
|
5579
|
+
id: "EventConfig",
|
|
5580
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5581
|
+
});
|
|
5399
5582
|
|
|
5400
5583
|
// ../commons/src/events/EventConfigInput.ts
|
|
5401
5584
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5820,18 +6003,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5820
6003
|
query: true,
|
|
5821
6004
|
columns: true
|
|
5822
6005
|
});
|
|
5823
|
-
var WorkqueueConfigInput =
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
query: CountryConfigQueryInputType,
|
|
5829
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5830
|
-
"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."
|
|
5831
|
-
),
|
|
5832
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5833
|
-
icon: AvailableIcons,
|
|
5834
|
-
emptyMessage: TranslationConfig.optional()
|
|
6006
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
6007
|
+
query: CountryConfigQueryInputType
|
|
6008
|
+
}).meta({
|
|
6009
|
+
description: "Workqueue configuration",
|
|
6010
|
+
id: "WorkqueueConfig"
|
|
5835
6011
|
});
|
|
5836
6012
|
function defineWorkqueue(workqueueInput) {
|
|
5837
6013
|
const queryInput = workqueueInput.query;
|
|
@@ -5892,6 +6068,8 @@ var BaseActionInput = z38.object({
|
|
|
5892
6068
|
originalActionId: UUID.optional(),
|
|
5893
6069
|
// should not be part of base action.
|
|
5894
6070
|
keepAssignment: z38.boolean().optional(),
|
|
6071
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6072
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
5895
6073
|
waitFor: z38.boolean().optional(),
|
|
5896
6074
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5897
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.
|
|
@@ -6010,7 +6188,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
|
6010
6188
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
6011
6189
|
z38.object({
|
|
6012
6190
|
requestId: z38.string(),
|
|
6013
|
-
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()
|
|
6014
6193
|
}).shape
|
|
6015
6194
|
);
|
|
6016
6195
|
var ReadActionInput = BaseActionInput.extend(
|
|
@@ -6146,7 +6325,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6146
6325
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6147
6326
|
acceptedAt: acceptAction.createdAt,
|
|
6148
6327
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6149
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6150
6328
|
registrationNumber
|
|
6151
6329
|
};
|
|
6152
6330
|
}
|
|
@@ -6360,17 +6538,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6360
6538
|
return user2;
|
|
6361
6539
|
}, null);
|
|
6362
6540
|
}
|
|
6363
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6364
|
-
return actions.reduce((signature, action) => {
|
|
6365
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6366
|
-
return action.createdBySignature || null;
|
|
6367
|
-
}
|
|
6368
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6369
|
-
return null;
|
|
6370
|
-
}
|
|
6371
|
-
return signature;
|
|
6372
|
-
}, null);
|
|
6373
|
-
}
|
|
6374
6541
|
function deepDropNulls(obj) {
|
|
6375
6542
|
if (Array.isArray(obj)) {
|
|
6376
6543
|
return obj.map(deepDropNulls);
|
|
@@ -6466,10 +6633,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6466
6633
|
createdBy: creationAction.createdBy,
|
|
6467
6634
|
createdByUserType: creationAction.createdByUserType,
|
|
6468
6635
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6469
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6470
6636
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6471
6637
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6472
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6473
6638
|
updatedBy: requestActionMetadata.createdBy,
|
|
6474
6639
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6475
6640
|
declaration,
|
|
@@ -9728,7 +9893,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9728
9893
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9729
9894
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9730
9895
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9731
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9732
9896
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9733
9897
|
assignedTo: overrides.assignedTo ?? null,
|
|
9734
9898
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|