@opencrvs/toolkit 2.0.0-rc.a657c77 → 2.0.0-rc.a6e6000
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/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +3 -1
- package/dist/events/index.js +289 -146
- 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 +276 -116
- package/dist/scopes/index.js +3 -1
- package/opencrvs-toolkit-2.0.0-rc.a6e6000.tgz +0 -0
- package/package.json +5 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.a657c77.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -306,7 +306,6 @@ __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,
|
|
@@ -705,7 +704,9 @@ var decodeScope = (query) => {
|
|
|
705
704
|
};
|
|
706
705
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
707
706
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
708
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
707
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
708
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
709
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
709
710
|
};
|
|
710
711
|
function getAcceptedScopesByType({
|
|
711
712
|
acceptedScopes,
|
|
@@ -1078,7 +1079,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1078
1079
|
ShowConditional,
|
|
1079
1080
|
// Action can be shown to the user in the list but as disabled
|
|
1080
1081
|
EnableConditional
|
|
1081
|
-
])
|
|
1082
|
+
]).meta({
|
|
1083
|
+
id: "ActionConditional",
|
|
1084
|
+
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."
|
|
1085
|
+
});
|
|
1082
1086
|
var DisplayOnReviewConditional = z7.object({
|
|
1083
1087
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1084
1088
|
conditional: Conditional
|
|
@@ -1093,8 +1097,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
1093
1097
|
// Field output can be shown / hidden on the review page
|
|
1094
1098
|
DisplayOnReviewConditional
|
|
1095
1099
|
]).meta({
|
|
1096
|
-
|
|
1097
|
-
|
|
1100
|
+
id: "FieldConditional",
|
|
1101
|
+
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
1102
|
});
|
|
1099
1103
|
|
|
1100
1104
|
// ../commons/src/events/FieldType.ts
|
|
@@ -1414,28 +1418,20 @@ function schemaPriority(schema) {
|
|
|
1414
1418
|
return idx === -1 ? 9999 : idx;
|
|
1415
1419
|
}
|
|
1416
1420
|
function safeUnion(schemas) {
|
|
1421
|
+
const sortedSchemas = [...schemas].sort(
|
|
1422
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1423
|
+
);
|
|
1417
1424
|
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
|
-
});
|
|
1425
|
+
for (const schema of sortedSchemas) {
|
|
1426
|
+
if (schema.safeParse(val).success) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1438
1429
|
}
|
|
1430
|
+
ctx.addIssue({
|
|
1431
|
+
code: "invalid_type",
|
|
1432
|
+
expected: "custom",
|
|
1433
|
+
message: "Value does not match any schema"
|
|
1434
|
+
});
|
|
1439
1435
|
}).meta({
|
|
1440
1436
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1441
1437
|
});
|
|
@@ -1745,6 +1741,9 @@ var FlagConfig = z15.object({
|
|
|
1745
1741
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1746
1742
|
),
|
|
1747
1743
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1744
|
+
}).meta({
|
|
1745
|
+
id: "FlagConfig",
|
|
1746
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1748
1747
|
});
|
|
1749
1748
|
var ActionFlagConfig = z15.object({
|
|
1750
1749
|
id: Flag,
|
|
@@ -1752,6 +1751,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1752
1751
|
conditional: Conditional.optional().describe(
|
|
1753
1752
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1754
1753
|
)
|
|
1754
|
+
}).meta({
|
|
1755
|
+
id: "ActionFlagConfig",
|
|
1756
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1755
1757
|
});
|
|
1756
1758
|
|
|
1757
1759
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1773,8 +1775,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1773
1775
|
),
|
|
1774
1776
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1775
1777
|
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.")
|
|
1778
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1778
1779
|
});
|
|
1779
1780
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1780
1781
|
registrationNumber: z16.string().describe(
|
|
@@ -1802,9 +1803,6 @@ var EventMetadata = z16.object({
|
|
|
1802
1803
|
createdAtLocation: UUID.nullish().describe(
|
|
1803
1804
|
"Location of the user who created the event."
|
|
1804
1805
|
),
|
|
1805
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1806
|
-
"Signature of the user who created the event."
|
|
1807
|
-
),
|
|
1808
1806
|
updatedAtLocation: UUID.nullish().describe(
|
|
1809
1807
|
"Location of the user who last changed the status."
|
|
1810
1808
|
),
|
|
@@ -2179,14 +2177,21 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2179
2177
|
}
|
|
2180
2178
|
}).describe("Unique identifier for the field");
|
|
2181
2179
|
var FieldReference = import_v43.default.object({
|
|
2182
|
-
$$field: FieldId,
|
|
2180
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2183
2181
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2184
2182
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2185
2183
|
)
|
|
2186
2184
|
}).describe("Reference to a field by its ID");
|
|
2187
2185
|
var ValidationConfig = import_v43.default.object({
|
|
2188
|
-
validator: Conditional
|
|
2189
|
-
|
|
2186
|
+
validator: Conditional.describe(
|
|
2187
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
2188
|
+
),
|
|
2189
|
+
message: TranslationConfig.describe(
|
|
2190
|
+
"Error message displayed when the validator does not hold."
|
|
2191
|
+
)
|
|
2192
|
+
}).meta({
|
|
2193
|
+
id: "ValidationConfig",
|
|
2194
|
+
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
2195
|
});
|
|
2191
2196
|
var requiredSchema = import_v43.default.union([
|
|
2192
2197
|
import_v43.default.boolean(),
|
|
@@ -2225,6 +2230,9 @@ var BaseField = import_v43.default.object({
|
|
|
2225
2230
|
}).describe("Common properties shared across all field types.");
|
|
2226
2231
|
var Divider = BaseField.extend({
|
|
2227
2232
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2233
|
+
}).meta({
|
|
2234
|
+
description: "A horizontal line divider",
|
|
2235
|
+
id: "Divider"
|
|
2228
2236
|
});
|
|
2229
2237
|
var TextField = BaseField.extend({
|
|
2230
2238
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2235,7 +2243,10 @@ var TextField = BaseField.extend({
|
|
|
2235
2243
|
prefix: TranslationConfig.optional(),
|
|
2236
2244
|
postfix: TranslationConfig.optional()
|
|
2237
2245
|
}).default({ type: "text" }).optional()
|
|
2238
|
-
}).
|
|
2246
|
+
}).meta({
|
|
2247
|
+
description: "A text input field",
|
|
2248
|
+
id: "TextField"
|
|
2249
|
+
});
|
|
2239
2250
|
var NumberField = BaseField.extend({
|
|
2240
2251
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2241
2252
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2245,7 +2256,10 @@ var NumberField = BaseField.extend({
|
|
|
2245
2256
|
prefix: TranslationConfig.optional(),
|
|
2246
2257
|
postfix: TranslationConfig.optional()
|
|
2247
2258
|
}).optional()
|
|
2248
|
-
}).
|
|
2259
|
+
}).meta({
|
|
2260
|
+
description: "A number input field",
|
|
2261
|
+
id: "NumberField"
|
|
2262
|
+
});
|
|
2249
2263
|
var TextAreaField = BaseField.extend({
|
|
2250
2264
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2251
2265
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2256,7 +2270,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2256
2270
|
prefix: TranslationConfig.optional(),
|
|
2257
2271
|
postfix: TranslationConfig.optional()
|
|
2258
2272
|
}).default({ rows: 4 }).optional()
|
|
2259
|
-
}).
|
|
2273
|
+
}).meta({
|
|
2274
|
+
description: "A multiline text input",
|
|
2275
|
+
id: "TextAreaField"
|
|
2276
|
+
});
|
|
2260
2277
|
var ImageMimeType = import_v43.default.enum([
|
|
2261
2278
|
"image/png",
|
|
2262
2279
|
"image/jpg",
|
|
@@ -2286,13 +2303,19 @@ var SignatureField = BaseField.extend({
|
|
|
2286
2303
|
}).default({
|
|
2287
2304
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2288
2305
|
})
|
|
2289
|
-
}).
|
|
2306
|
+
}).meta({
|
|
2307
|
+
description: "A signature input field",
|
|
2308
|
+
id: "SignatureField"
|
|
2309
|
+
});
|
|
2290
2310
|
var EmailField = BaseField.extend({
|
|
2291
2311
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2292
2312
|
configuration: import_v43.default.object({
|
|
2293
2313
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2294
2314
|
}).default({ maxLength: 255 }).optional(),
|
|
2295
2315
|
defaultValue: NonEmptyTextValue.optional()
|
|
2316
|
+
}).meta({
|
|
2317
|
+
description: "An email input field",
|
|
2318
|
+
id: "EmailField"
|
|
2296
2319
|
});
|
|
2297
2320
|
var DateField = BaseField.extend({
|
|
2298
2321
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2302,7 +2325,10 @@ var DateField = BaseField.extend({
|
|
|
2302
2325
|
"Text to display above the date input"
|
|
2303
2326
|
).optional()
|
|
2304
2327
|
}).optional()
|
|
2305
|
-
}).
|
|
2328
|
+
}).meta({
|
|
2329
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2330
|
+
id: "DateField"
|
|
2331
|
+
});
|
|
2306
2332
|
var AgeField = BaseField.extend({
|
|
2307
2333
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2308
2334
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2311,7 +2337,10 @@ var AgeField = BaseField.extend({
|
|
|
2311
2337
|
prefix: TranslationConfig.optional(),
|
|
2312
2338
|
postfix: TranslationConfig.optional()
|
|
2313
2339
|
})
|
|
2314
|
-
}).
|
|
2340
|
+
}).meta({
|
|
2341
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2342
|
+
id: "AgeField"
|
|
2343
|
+
});
|
|
2315
2344
|
var TimeField = BaseField.extend({
|
|
2316
2345
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2317
2346
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2321,7 +2350,10 @@ var TimeField = BaseField.extend({
|
|
|
2321
2350
|
"Text to display above the time input"
|
|
2322
2351
|
).optional()
|
|
2323
2352
|
}).optional()
|
|
2324
|
-
}).
|
|
2353
|
+
}).meta({
|
|
2354
|
+
description: "A single time input (HH-mm)",
|
|
2355
|
+
id: "TimeField"
|
|
2356
|
+
});
|
|
2325
2357
|
var DateRangeField = BaseField.extend({
|
|
2326
2358
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2327
2359
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2330,7 +2362,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2330
2362
|
"Text to display above the date input"
|
|
2331
2363
|
).optional()
|
|
2332
2364
|
}).optional()
|
|
2333
|
-
}).
|
|
2365
|
+
}).meta({
|
|
2366
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2367
|
+
id: "DateRangeField"
|
|
2368
|
+
});
|
|
2334
2369
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2335
2370
|
"reg12",
|
|
2336
2371
|
"reg14",
|
|
@@ -2374,18 +2409,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2374
2409
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2375
2410
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2376
2411
|
configuration: ImageConfiguration
|
|
2377
|
-
}).
|
|
2412
|
+
}).meta({
|
|
2413
|
+
description: "A read-only image component for form pages",
|
|
2414
|
+
id: "ImageViewField"
|
|
2415
|
+
});
|
|
2378
2416
|
var Paragraph = BaseField.extend({
|
|
2379
2417
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2380
2418
|
configuration: ParagraphConfiguration
|
|
2381
|
-
}).
|
|
2419
|
+
}).meta({
|
|
2420
|
+
description: "A read-only HTML <p> paragraph",
|
|
2421
|
+
id: "Paragraph"
|
|
2422
|
+
});
|
|
2382
2423
|
var Heading = BaseField.extend({
|
|
2383
2424
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2384
2425
|
configuration: HeadingConfiguration
|
|
2385
|
-
}).
|
|
2426
|
+
}).meta({
|
|
2427
|
+
description: "A read-only heading component for form pages",
|
|
2428
|
+
id: "Heading"
|
|
2429
|
+
});
|
|
2386
2430
|
var PageHeader = BaseField.extend({
|
|
2387
2431
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2388
|
-
}).
|
|
2432
|
+
}).meta({
|
|
2433
|
+
description: "A read-only header component for form pages",
|
|
2434
|
+
id: "PageHeader"
|
|
2435
|
+
});
|
|
2389
2436
|
var File = BaseField.extend({
|
|
2390
2437
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2391
2438
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2404,7 +2451,10 @@ var File = BaseField.extend({
|
|
|
2404
2451
|
}).default({
|
|
2405
2452
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2406
2453
|
})
|
|
2407
|
-
}).
|
|
2454
|
+
}).meta({
|
|
2455
|
+
description: "A file upload field",
|
|
2456
|
+
id: "File"
|
|
2457
|
+
});
|
|
2408
2458
|
var SelectOption = import_v43.default.object({
|
|
2409
2459
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2410
2460
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2421,7 +2471,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2421
2471
|
"Placeholder for the number field"
|
|
2422
2472
|
)
|
|
2423
2473
|
}).optional()
|
|
2424
|
-
}).
|
|
2474
|
+
}).meta({
|
|
2475
|
+
description: "A number with unit input field",
|
|
2476
|
+
id: "NumberWithUnitField"
|
|
2477
|
+
});
|
|
2425
2478
|
var RadioGroup = BaseField.extend({
|
|
2426
2479
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2427
2480
|
defaultValue: TextValue.optional(),
|
|
@@ -2431,7 +2484,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2431
2484
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2432
2485
|
}).optional()
|
|
2433
2486
|
}).optional()
|
|
2434
|
-
}).
|
|
2487
|
+
}).meta({
|
|
2488
|
+
description: "A grouped radio button field",
|
|
2489
|
+
id: "RadioGroup"
|
|
2490
|
+
});
|
|
2435
2491
|
var BulletList = BaseField.extend({
|
|
2436
2492
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2437
2493
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2440,7 +2496,10 @@ var BulletList = BaseField.extend({
|
|
|
2440
2496
|
fontVariant: HtmlFontVariant.optional()
|
|
2441
2497
|
}).optional()
|
|
2442
2498
|
}).default({})
|
|
2443
|
-
}).
|
|
2499
|
+
}).meta({
|
|
2500
|
+
description: "A list of bullet points",
|
|
2501
|
+
id: "BulletList"
|
|
2502
|
+
});
|
|
2444
2503
|
var Select = BaseField.extend({
|
|
2445
2504
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2446
2505
|
defaultValue: TextValue.optional(),
|
|
@@ -2455,7 +2514,10 @@ var Select = BaseField.extend({
|
|
|
2455
2514
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2456
2515
|
`
|
|
2457
2516
|
)
|
|
2458
|
-
}).
|
|
2517
|
+
}).meta({
|
|
2518
|
+
description: "A select input field",
|
|
2519
|
+
id: "Select"
|
|
2520
|
+
});
|
|
2459
2521
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2460
2522
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2461
2523
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2464,7 +2526,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2464
2526
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2465
2527
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2466
2528
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2467
|
-
}).
|
|
2529
|
+
}).meta({
|
|
2530
|
+
description: "A date range selection field",
|
|
2531
|
+
id: "SelectDateRangeField"
|
|
2532
|
+
});
|
|
2468
2533
|
var NameConfig = import_v43.default.object({
|
|
2469
2534
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2470
2535
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2495,26 +2560,41 @@ var NameField = BaseField.extend({
|
|
|
2495
2560
|
surname: { required: true }
|
|
2496
2561
|
}
|
|
2497
2562
|
}).optional()
|
|
2498
|
-
}).
|
|
2563
|
+
}).meta({
|
|
2564
|
+
description: "A field for entering a persons name",
|
|
2565
|
+
id: "NameField"
|
|
2566
|
+
});
|
|
2499
2567
|
var PhoneField = BaseField.extend({
|
|
2500
2568
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2501
2569
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2502
|
-
}).
|
|
2570
|
+
}).meta({
|
|
2571
|
+
description: "A field for entering a phone number",
|
|
2572
|
+
id: "PhoneField"
|
|
2573
|
+
});
|
|
2503
2574
|
var IdField = BaseField.extend({
|
|
2504
2575
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2505
2576
|
type: import_v43.default.literal(FieldType.ID)
|
|
2506
|
-
}).
|
|
2577
|
+
}).meta({
|
|
2578
|
+
description: "A field for entering an ID",
|
|
2579
|
+
id: "IdField"
|
|
2580
|
+
});
|
|
2507
2581
|
var Checkbox = BaseField.extend({
|
|
2508
2582
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2509
2583
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2510
|
-
}).
|
|
2584
|
+
}).meta({
|
|
2585
|
+
description: "A boolean checkbox field",
|
|
2586
|
+
id: "Checkbox"
|
|
2587
|
+
});
|
|
2511
2588
|
var Country = BaseField.extend({
|
|
2512
2589
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2513
2590
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2514
2591
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2515
2592
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2516
2593
|
)
|
|
2517
|
-
}).
|
|
2594
|
+
}).meta({
|
|
2595
|
+
description: "A field for selecting a country",
|
|
2596
|
+
id: "Country"
|
|
2597
|
+
});
|
|
2518
2598
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2519
2599
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2520
2600
|
);
|
|
@@ -2523,16 +2603,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2523
2603
|
"HEALTH_FACILITY",
|
|
2524
2604
|
"CRVS_OFFICE"
|
|
2525
2605
|
]);
|
|
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
2606
|
var AdministrativeAreaField = BaseField.extend({
|
|
2532
2607
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2533
2608
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2534
|
-
configuration:
|
|
2535
|
-
|
|
2609
|
+
configuration: import_v43.default.object({
|
|
2610
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2611
|
+
type: AdministrativeAreas,
|
|
2612
|
+
allowedLocations: AllowedLocations
|
|
2613
|
+
}).describe("Administrative area options")
|
|
2614
|
+
}).meta({
|
|
2615
|
+
description: "Administrative area input field",
|
|
2616
|
+
id: "AdministrativeAreaField"
|
|
2617
|
+
});
|
|
2536
2618
|
var LocationInput = BaseField.extend({
|
|
2537
2619
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2538
2620
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2540,7 +2622,10 @@ var LocationInput = BaseField.extend({
|
|
|
2540
2622
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2541
2623
|
allowedLocations: AllowedLocations
|
|
2542
2624
|
}).optional()
|
|
2543
|
-
}).
|
|
2625
|
+
}).meta({
|
|
2626
|
+
description: "A field for selecting a location",
|
|
2627
|
+
id: "LocationInput"
|
|
2628
|
+
});
|
|
2544
2629
|
var FileUploadWithOptions = BaseField.extend({
|
|
2545
2630
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2546
2631
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2554,6 +2639,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2554
2639
|
}).default({
|
|
2555
2640
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2556
2641
|
})
|
|
2642
|
+
}).meta({
|
|
2643
|
+
description: "A field for uploading files with file type options",
|
|
2644
|
+
id: "FileUploadWithOptions"
|
|
2557
2645
|
});
|
|
2558
2646
|
var Facility = BaseField.extend({
|
|
2559
2647
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2599,7 +2687,10 @@ var Address = BaseField.extend({
|
|
|
2599
2687
|
allowedLocations: AllowedLocations
|
|
2600
2688
|
}).optional(),
|
|
2601
2689
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2602
|
-
}).
|
|
2690
|
+
}).meta({
|
|
2691
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2692
|
+
id: "Address"
|
|
2693
|
+
});
|
|
2603
2694
|
var StaticDataEntry = import_v43.default.object({
|
|
2604
2695
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2605
2696
|
label: TranslationConfig,
|
|
@@ -2614,7 +2705,10 @@ var DataField = BaseField.extend({
|
|
|
2614
2705
|
subtitle: TranslationConfig.optional(),
|
|
2615
2706
|
data: import_v43.default.array(DataEntry)
|
|
2616
2707
|
})
|
|
2617
|
-
}).
|
|
2708
|
+
}).meta({
|
|
2709
|
+
description: "A field for displaying a table of read-only data",
|
|
2710
|
+
id: "DataField"
|
|
2711
|
+
});
|
|
2618
2712
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2619
2713
|
var ButtonType = import_v43.default.enum([
|
|
2620
2714
|
"primary",
|
|
@@ -2641,11 +2735,17 @@ var ButtonField = BaseField.extend({
|
|
|
2641
2735
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2642
2736
|
defaultValue: ButtonFieldValue.optional(),
|
|
2643
2737
|
configuration: ButtonConfiguration
|
|
2644
|
-
}).
|
|
2738
|
+
}).meta({
|
|
2739
|
+
description: "A generic button that can be used to trigger an action",
|
|
2740
|
+
id: "ButtonField"
|
|
2741
|
+
});
|
|
2645
2742
|
var FieldGroup = BaseField.extend({
|
|
2646
2743
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2647
2744
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2648
2745
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2746
|
+
}).meta({
|
|
2747
|
+
description: "A group of fields that are displayed together",
|
|
2748
|
+
id: "FieldGroup"
|
|
2649
2749
|
});
|
|
2650
2750
|
var AlphaPrintButton = BaseField.extend({
|
|
2651
2751
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2655,7 +2755,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2655
2755
|
"Label for the print button"
|
|
2656
2756
|
)
|
|
2657
2757
|
})
|
|
2658
|
-
}).
|
|
2758
|
+
}).meta({
|
|
2759
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2760
|
+
id: "AlphaPrintButton"
|
|
2761
|
+
});
|
|
2659
2762
|
var HttpField = BaseField.extend({
|
|
2660
2763
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2661
2764
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2671,20 +2774,30 @@ var HttpField = BaseField.extend({
|
|
|
2671
2774
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2672
2775
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2673
2776
|
})
|
|
2674
|
-
}).
|
|
2777
|
+
}).meta({
|
|
2778
|
+
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.",
|
|
2779
|
+
id: "HttpField"
|
|
2780
|
+
});
|
|
2675
2781
|
var AutocompleteField = BaseField.extend({
|
|
2676
2782
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2677
2783
|
configuration: import_v43.default.object({
|
|
2678
|
-
url: import_v43.default.string().describe(
|
|
2784
|
+
url: import_v43.default.string().describe(
|
|
2785
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2786
|
+
).optional(),
|
|
2679
2787
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2680
2788
|
defaultOptions: import_v43.default.array(
|
|
2681
2789
|
import_v43.default.object({
|
|
2682
2790
|
label: import_v43.default.string(),
|
|
2683
2791
|
value: import_v43.default.string()
|
|
2684
2792
|
})
|
|
2685
|
-
).optional()
|
|
2793
|
+
).optional().describe(
|
|
2794
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2795
|
+
)
|
|
2686
2796
|
})
|
|
2687
|
-
}).
|
|
2797
|
+
}).meta({
|
|
2798
|
+
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.",
|
|
2799
|
+
id: "AutocompleteField"
|
|
2800
|
+
});
|
|
2688
2801
|
var SearchField = HttpField.extend({
|
|
2689
2802
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2690
2803
|
configuration: SearchQuery.pick({
|
|
@@ -2717,6 +2830,9 @@ var SearchField = HttpField.extend({
|
|
|
2717
2830
|
ok: TranslationConfig.optional()
|
|
2718
2831
|
}).optional()
|
|
2719
2832
|
})
|
|
2833
|
+
}).meta({
|
|
2834
|
+
description: "A search input field",
|
|
2835
|
+
id: "SearchField"
|
|
2720
2836
|
});
|
|
2721
2837
|
var LinkButtonField = BaseField.extend({
|
|
2722
2838
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2725,7 +2841,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2725
2841
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2726
2842
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2727
2843
|
})
|
|
2728
|
-
}).
|
|
2844
|
+
}).meta({
|
|
2845
|
+
description: "A button that opens a URL link",
|
|
2846
|
+
id: "LinkButtonField"
|
|
2847
|
+
});
|
|
2729
2848
|
var VerificationStatus = BaseField.extend({
|
|
2730
2849
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2731
2850
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2735,15 +2854,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2735
2854
|
"Explaining text on the banner in form."
|
|
2736
2855
|
)
|
|
2737
2856
|
})
|
|
2857
|
+
}).meta({
|
|
2858
|
+
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.",
|
|
2859
|
+
id: "VerificationStatus"
|
|
2738
2860
|
});
|
|
2739
2861
|
var QueryParamReaderField = BaseField.extend({
|
|
2740
2862
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2741
2863
|
configuration: import_v43.default.object({
|
|
2742
2864
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2743
2865
|
})
|
|
2744
|
-
}).
|
|
2745
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2746
|
-
|
|
2866
|
+
}).meta({
|
|
2867
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2868
|
+
id: "QueryParamReaderField"
|
|
2869
|
+
});
|
|
2747
2870
|
var QrReaderField = BaseField.extend({
|
|
2748
2871
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2749
2872
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2754,7 +2877,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2754
2877
|
})
|
|
2755
2878
|
}).optional()
|
|
2756
2879
|
}).meta({
|
|
2757
|
-
description: "
|
|
2880
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2758
2881
|
id: "QrReaderField"
|
|
2759
2882
|
});
|
|
2760
2883
|
var IdReaderField = BaseField.extend({
|
|
@@ -2763,12 +2886,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2763
2886
|
methods: import_v43.default.array(
|
|
2764
2887
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2765
2888
|
)
|
|
2889
|
+
}).meta({
|
|
2890
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2891
|
+
id: "IdReaderField"
|
|
2766
2892
|
});
|
|
2767
2893
|
var CustomField = BaseField.extend({
|
|
2768
2894
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2769
2895
|
defaultValue: CustomFieldValue.optional(),
|
|
2770
2896
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2771
2897
|
configuration: import_v43.default.unknown().optional()
|
|
2898
|
+
}).meta({
|
|
2899
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2900
|
+
id: "CustomField"
|
|
2772
2901
|
});
|
|
2773
2902
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2774
2903
|
var LoaderField = BaseField.extend({
|
|
@@ -2778,22 +2907,25 @@ var LoaderField = BaseField.extend({
|
|
|
2778
2907
|
configuration: import_v43.default.object({
|
|
2779
2908
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2780
2909
|
})
|
|
2781
|
-
}).
|
|
2782
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2783
|
-
|
|
2910
|
+
}).meta({
|
|
2911
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2912
|
+
id: "LoaderField"
|
|
2913
|
+
});
|
|
2784
2914
|
var HiddenField = BaseField.extend({
|
|
2785
2915
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2786
2916
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2787
2917
|
defaultValue: TextValue.optional()
|
|
2788
|
-
}).
|
|
2789
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2790
|
-
|
|
2918
|
+
}).meta({
|
|
2919
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2920
|
+
id: "HiddenField"
|
|
2921
|
+
});
|
|
2791
2922
|
var UserRoleField = BaseField.extend({
|
|
2792
2923
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2793
2924
|
defaultValue: TextValue.optional()
|
|
2794
|
-
}).
|
|
2795
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2796
|
-
|
|
2925
|
+
}).meta({
|
|
2926
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2927
|
+
id: "UserRoleField"
|
|
2928
|
+
});
|
|
2797
2929
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2798
2930
|
FieldGroup,
|
|
2799
2931
|
Address,
|
|
@@ -2892,16 +3024,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2892
3024
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2893
3025
|
actions: VerificationActionConfig
|
|
2894
3026
|
});
|
|
2895
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3027
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3028
|
+
id: "PageConfig",
|
|
3029
|
+
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."
|
|
3030
|
+
});
|
|
2899
3031
|
|
|
2900
3032
|
// ../commons/src/events/FormConfig.ts
|
|
2901
3033
|
var DeclarationFormConfig = z22.object({
|
|
2902
3034
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2903
3035
|
pages: z22.array(FormPageConfig)
|
|
2904
|
-
}).
|
|
3036
|
+
}).meta({
|
|
3037
|
+
id: "DeclarationFormConfig",
|
|
3038
|
+
description: "Configuration of the declaration form."
|
|
3039
|
+
});
|
|
2905
3040
|
var ActionFormConfig = z22.object({
|
|
2906
3041
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2907
3042
|
pages: z22.array(PageConfig)
|
|
@@ -3118,17 +3253,42 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3118
3253
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3119
3254
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3120
3255
|
*/
|
|
3121
|
-
ReadActionConfig.meta({
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3256
|
+
ReadActionConfig.meta({
|
|
3257
|
+
id: "ReadActionConfig",
|
|
3258
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
3259
|
+
}),
|
|
3260
|
+
DeclareConfig.meta({
|
|
3261
|
+
id: "DeclareActionConfig",
|
|
3262
|
+
description: "Configuration for the declare action. Includes review-page fields. Shared with the notify action (ActionType.NOTIFY)."
|
|
3263
|
+
}),
|
|
3264
|
+
RejectConfig.meta({
|
|
3265
|
+
id: "RejectActionConfig",
|
|
3266
|
+
description: "Configuration for rejecting a record before registration."
|
|
3267
|
+
}),
|
|
3268
|
+
RegisterConfig.meta({
|
|
3269
|
+
id: "RegisterActionConfig",
|
|
3270
|
+
description: "Configuration for registering a record."
|
|
3271
|
+
}),
|
|
3125
3272
|
PrintCertificateActionConfig.meta({
|
|
3126
|
-
id: "PrintCertificateActionConfig"
|
|
3273
|
+
id: "PrintCertificateActionConfig",
|
|
3274
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
3127
3275
|
}),
|
|
3128
|
-
RequestCorrectionConfig.meta({
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3276
|
+
RequestCorrectionConfig.meta({
|
|
3277
|
+
id: "RequestCorrectionActionConfig",
|
|
3278
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
3279
|
+
}),
|
|
3280
|
+
EditActionConfig.meta({
|
|
3281
|
+
id: "EditActionConfig",
|
|
3282
|
+
description: "Configuration for editing a record before registration."
|
|
3283
|
+
}),
|
|
3284
|
+
ArchiveConfig.meta({
|
|
3285
|
+
id: "ArchiveActionConfig",
|
|
3286
|
+
description: "Configuration for archiving a record."
|
|
3287
|
+
}),
|
|
3288
|
+
CustomActionConfig.meta({
|
|
3289
|
+
id: "CustomActionConfig",
|
|
3290
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
3291
|
+
})
|
|
3132
3292
|
]).describe(
|
|
3133
3293
|
"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
3294
|
).meta({ id: "ActionConfig" });
|
|
@@ -3804,6 +3964,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3804
3964
|
function isAgeValue(value) {
|
|
3805
3965
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3806
3966
|
}
|
|
3967
|
+
function mergeWithBaseFormState(values, context) {
|
|
3968
|
+
return { ...context.baseFormState, ...values };
|
|
3969
|
+
}
|
|
3807
3970
|
function validate(schema, data) {
|
|
3808
3971
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3809
3972
|
if ("$form" in data) {
|
|
@@ -3842,7 +4005,7 @@ function isOnline() {
|
|
|
3842
4005
|
}
|
|
3843
4006
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3844
4007
|
return validate(conditional, {
|
|
3845
|
-
$form: values,
|
|
4008
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3846
4009
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3847
4010
|
$online: isOnline(),
|
|
3848
4011
|
$user: context.user,
|
|
@@ -3871,7 +4034,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3871
4034
|
return true;
|
|
3872
4035
|
}
|
|
3873
4036
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3874
|
-
$form: form,
|
|
4037
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3875
4038
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3876
4039
|
$online: isOnline(),
|
|
3877
4040
|
$user: context.user,
|
|
@@ -4063,7 +4226,7 @@ function runFieldValidations({
|
|
|
4063
4226
|
return [];
|
|
4064
4227
|
}
|
|
4065
4228
|
const conditionalParameters = {
|
|
4066
|
-
$form: form,
|
|
4229
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4067
4230
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4068
4231
|
/**
|
|
4069
4232
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4307,17 +4470,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4307
4470
|
}
|
|
4308
4471
|
return isConditionMet(page.conditional, formValues, context);
|
|
4309
4472
|
}
|
|
4310
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4473
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4311
4474
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4312
4475
|
function fn(prevVisibilityContext) {
|
|
4313
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4314
4476
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4315
4477
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4316
4478
|
if (!fieldConfig.length) {
|
|
4317
4479
|
return false;
|
|
4318
4480
|
}
|
|
4319
4481
|
const isHidden = fieldConfig.every(
|
|
4320
|
-
(f) => !isFieldVisible(f,
|
|
4482
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4321
4483
|
);
|
|
4322
4484
|
if (!isHidden) {
|
|
4323
4485
|
return false;
|
|
@@ -4335,7 +4497,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4335
4497
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4336
4498
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4337
4499
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4338
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4500
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4339
4501
|
});
|
|
4340
4502
|
return omitHiddenFields(
|
|
4341
4503
|
visibleFields,
|
|
@@ -4382,13 +4544,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4382
4544
|
}
|
|
4383
4545
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4384
4546
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4385
|
-
return omitHiddenFields(
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
false,
|
|
4390
|
-
declaration
|
|
4391
|
-
);
|
|
4547
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4548
|
+
...context,
|
|
4549
|
+
baseFormState: declaration
|
|
4550
|
+
});
|
|
4392
4551
|
}
|
|
4393
4552
|
function deepMerge(currentDocument, actionDocument) {
|
|
4394
4553
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5377,7 +5536,7 @@ var _EventConfigBase = z33.object({
|
|
|
5377
5536
|
),
|
|
5378
5537
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5379
5538
|
actions: z33.array(ActionConfig).describe(
|
|
5380
|
-
"Configuration of
|
|
5539
|
+
"Configuration of core and custom actions associated with the event."
|
|
5381
5540
|
),
|
|
5382
5541
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5383
5542
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5389,7 +5548,7 @@ var _EventConfigBase = z33.object({
|
|
|
5389
5548
|
"Configuration of fields available in the advanced search feature."
|
|
5390
5549
|
),
|
|
5391
5550
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5392
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5551
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5393
5552
|
),
|
|
5394
5553
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5395
5554
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5402,8 +5561,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
5402
5561
|
validateActionFlags(event2, ctx);
|
|
5403
5562
|
validateActionOrder(event2, ctx);
|
|
5404
5563
|
}).meta({
|
|
5405
|
-
id: "EventConfig"
|
|
5406
|
-
|
|
5564
|
+
id: "EventConfig",
|
|
5565
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
5566
|
+
});
|
|
5407
5567
|
|
|
5408
5568
|
// ../commons/src/events/EventConfigInput.ts
|
|
5409
5569
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -5828,18 +5988,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5828
5988
|
query: true,
|
|
5829
5989
|
columns: true
|
|
5830
5990
|
});
|
|
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()
|
|
5991
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
5992
|
+
query: CountryConfigQueryInputType
|
|
5993
|
+
}).meta({
|
|
5994
|
+
description: "Workqueue configuration",
|
|
5995
|
+
id: "WorkqueueConfig"
|
|
5843
5996
|
});
|
|
5844
5997
|
function defineWorkqueue(workqueueInput) {
|
|
5845
5998
|
const queryInput = workqueueInput.query;
|
|
@@ -5900,6 +6053,11 @@ var BaseActionInput = z38.object({
|
|
|
5900
6053
|
originalActionId: UUID.optional(),
|
|
5901
6054
|
// should not be part of base action.
|
|
5902
6055
|
keepAssignment: z38.boolean().optional(),
|
|
6056
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6057
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6058
|
+
waitFor: z38.boolean().default(true).describe(
|
|
6059
|
+
"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."
|
|
6060
|
+
),
|
|
5903
6061
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5904
6062
|
// @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
6063
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6079,7 +6237,7 @@ var Draft = z39.object({
|
|
|
6079
6237
|
}).describe(
|
|
6080
6238
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
6081
6239
|
);
|
|
6082
|
-
var DraftInput = BaseActionInput.extend({
|
|
6240
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
6083
6241
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
6084
6242
|
status: z39.enum([
|
|
6085
6243
|
ActionStatus.Requested,
|
|
@@ -6153,7 +6311,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6153
6311
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6154
6312
|
acceptedAt: acceptAction.createdAt,
|
|
6155
6313
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6156
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6157
6314
|
registrationNumber
|
|
6158
6315
|
};
|
|
6159
6316
|
}
|
|
@@ -6367,17 +6524,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6367
6524
|
return user2;
|
|
6368
6525
|
}, null);
|
|
6369
6526
|
}
|
|
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
6527
|
function deepDropNulls(obj) {
|
|
6382
6528
|
if (Array.isArray(obj)) {
|
|
6383
6529
|
return obj.map(deepDropNulls);
|
|
@@ -6473,10 +6619,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6473
6619
|
createdBy: creationAction.createdBy,
|
|
6474
6620
|
createdByUserType: creationAction.createdByUserType,
|
|
6475
6621
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6476
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6477
6622
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6478
6623
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6479
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6480
6624
|
updatedBy: requestActionMetadata.createdBy,
|
|
6481
6625
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6482
6626
|
declaration,
|
|
@@ -9735,7 +9879,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9735
9879
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9736
9880
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9737
9881
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9738
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9739
9882
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9740
9883
|
assignedTo: overrides.assignedTo ?? null,
|
|
9741
9884
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|