@opencrvs/toolkit 2.0.0-rc.7209e96 → 2.0.0-rc.72e1808
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 +195 -78
- package/dist/cli.js +203 -35
- package/dist/commons/api/router.d.ts +552 -31
- package/dist/commons/events/ActionInput.d.ts +36 -0
- package/dist/commons/events/Draft.d.ts +1 -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 +0 -2
- package/dist/events/index.js +207 -112
- 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 +201 -33
- 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 +207 -96
- package/opencrvs-toolkit-2.0.0-rc.72e1808.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.7209e96.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,
|
|
@@ -1078,7 +1077,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1078
1077
|
ShowConditional,
|
|
1079
1078
|
// Action can be shown to the user in the list but as disabled
|
|
1080
1079
|
EnableConditional
|
|
1081
|
-
])
|
|
1080
|
+
]).meta({
|
|
1081
|
+
description: "Action conditional configuration",
|
|
1082
|
+
id: "ActionConditional"
|
|
1083
|
+
});
|
|
1082
1084
|
var DisplayOnReviewConditional = z7.object({
|
|
1083
1085
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1084
1086
|
conditional: Conditional
|
|
@@ -1414,28 +1416,20 @@ function schemaPriority(schema) {
|
|
|
1414
1416
|
return idx === -1 ? 9999 : idx;
|
|
1415
1417
|
}
|
|
1416
1418
|
function safeUnion(schemas) {
|
|
1419
|
+
const sortedSchemas = [...schemas].sort(
|
|
1420
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1421
|
+
);
|
|
1417
1422
|
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
|
-
});
|
|
1423
|
+
for (const schema of sortedSchemas) {
|
|
1424
|
+
if (schema.safeParse(val).success) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1438
1427
|
}
|
|
1428
|
+
ctx.addIssue({
|
|
1429
|
+
code: "invalid_type",
|
|
1430
|
+
expected: "custom",
|
|
1431
|
+
message: "Value does not match any schema"
|
|
1432
|
+
});
|
|
1439
1433
|
}).meta({
|
|
1440
1434
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1441
1435
|
});
|
|
@@ -1745,6 +1739,9 @@ var FlagConfig = z15.object({
|
|
|
1745
1739
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1746
1740
|
),
|
|
1747
1741
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1742
|
+
}).meta({
|
|
1743
|
+
description: "Flag configuration",
|
|
1744
|
+
id: "FlagConfig"
|
|
1748
1745
|
});
|
|
1749
1746
|
var ActionFlagConfig = z15.object({
|
|
1750
1747
|
id: Flag,
|
|
@@ -1752,6 +1749,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1752
1749
|
conditional: Conditional.optional().describe(
|
|
1753
1750
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1754
1751
|
)
|
|
1752
|
+
}).meta({
|
|
1753
|
+
description: "Action flag configuration",
|
|
1754
|
+
id: "ActionFlagConfig"
|
|
1755
1755
|
});
|
|
1756
1756
|
|
|
1757
1757
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1773,8 +1773,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1773
1773
|
),
|
|
1774
1774
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1775
1775
|
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.")
|
|
1776
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1778
1777
|
});
|
|
1779
1778
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1780
1779
|
registrationNumber: z16.string().describe(
|
|
@@ -1802,9 +1801,6 @@ var EventMetadata = z16.object({
|
|
|
1802
1801
|
createdAtLocation: UUID.nullish().describe(
|
|
1803
1802
|
"Location of the user who created the event."
|
|
1804
1803
|
),
|
|
1805
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1806
|
-
"Signature of the user who created the event."
|
|
1807
|
-
),
|
|
1808
1804
|
updatedAtLocation: UUID.nullish().describe(
|
|
1809
1805
|
"Location of the user who last changed the status."
|
|
1810
1806
|
),
|
|
@@ -2179,7 +2175,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2179
2175
|
}
|
|
2180
2176
|
}).describe("Unique identifier for the field");
|
|
2181
2177
|
var FieldReference = import_v43.default.object({
|
|
2182
|
-
$$field: FieldId,
|
|
2178
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2183
2179
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2184
2180
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2185
2181
|
)
|
|
@@ -2225,6 +2221,9 @@ var BaseField = import_v43.default.object({
|
|
|
2225
2221
|
}).describe("Common properties shared across all field types.");
|
|
2226
2222
|
var Divider = BaseField.extend({
|
|
2227
2223
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2224
|
+
}).meta({
|
|
2225
|
+
description: "A horizontal line divider",
|
|
2226
|
+
id: "Divider"
|
|
2228
2227
|
});
|
|
2229
2228
|
var TextField = BaseField.extend({
|
|
2230
2229
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2235,7 +2234,10 @@ var TextField = BaseField.extend({
|
|
|
2235
2234
|
prefix: TranslationConfig.optional(),
|
|
2236
2235
|
postfix: TranslationConfig.optional()
|
|
2237
2236
|
}).default({ type: "text" }).optional()
|
|
2238
|
-
}).
|
|
2237
|
+
}).meta({
|
|
2238
|
+
description: "A text input field",
|
|
2239
|
+
id: "TextField"
|
|
2240
|
+
});
|
|
2239
2241
|
var NumberField = BaseField.extend({
|
|
2240
2242
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2241
2243
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2245,7 +2247,10 @@ var NumberField = BaseField.extend({
|
|
|
2245
2247
|
prefix: TranslationConfig.optional(),
|
|
2246
2248
|
postfix: TranslationConfig.optional()
|
|
2247
2249
|
}).optional()
|
|
2248
|
-
}).
|
|
2250
|
+
}).meta({
|
|
2251
|
+
description: "A number input field",
|
|
2252
|
+
id: "NumberField"
|
|
2253
|
+
});
|
|
2249
2254
|
var TextAreaField = BaseField.extend({
|
|
2250
2255
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2251
2256
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2256,7 +2261,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2256
2261
|
prefix: TranslationConfig.optional(),
|
|
2257
2262
|
postfix: TranslationConfig.optional()
|
|
2258
2263
|
}).default({ rows: 4 }).optional()
|
|
2259
|
-
}).
|
|
2264
|
+
}).meta({
|
|
2265
|
+
description: "A multiline text input",
|
|
2266
|
+
id: "TextAreaField"
|
|
2267
|
+
});
|
|
2260
2268
|
var ImageMimeType = import_v43.default.enum([
|
|
2261
2269
|
"image/png",
|
|
2262
2270
|
"image/jpg",
|
|
@@ -2286,13 +2294,19 @@ var SignatureField = BaseField.extend({
|
|
|
2286
2294
|
}).default({
|
|
2287
2295
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2288
2296
|
})
|
|
2289
|
-
}).
|
|
2297
|
+
}).meta({
|
|
2298
|
+
description: "A signature input field",
|
|
2299
|
+
id: "SignatureField"
|
|
2300
|
+
});
|
|
2290
2301
|
var EmailField = BaseField.extend({
|
|
2291
2302
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2292
2303
|
configuration: import_v43.default.object({
|
|
2293
2304
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2294
2305
|
}).default({ maxLength: 255 }).optional(),
|
|
2295
2306
|
defaultValue: NonEmptyTextValue.optional()
|
|
2307
|
+
}).meta({
|
|
2308
|
+
description: "An email input field",
|
|
2309
|
+
id: "EmailField"
|
|
2296
2310
|
});
|
|
2297
2311
|
var DateField = BaseField.extend({
|
|
2298
2312
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2302,7 +2316,10 @@ var DateField = BaseField.extend({
|
|
|
2302
2316
|
"Text to display above the date input"
|
|
2303
2317
|
).optional()
|
|
2304
2318
|
}).optional()
|
|
2305
|
-
}).
|
|
2319
|
+
}).meta({
|
|
2320
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2321
|
+
id: "DateField"
|
|
2322
|
+
});
|
|
2306
2323
|
var AgeField = BaseField.extend({
|
|
2307
2324
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2308
2325
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2311,7 +2328,10 @@ var AgeField = BaseField.extend({
|
|
|
2311
2328
|
prefix: TranslationConfig.optional(),
|
|
2312
2329
|
postfix: TranslationConfig.optional()
|
|
2313
2330
|
})
|
|
2314
|
-
}).
|
|
2331
|
+
}).meta({
|
|
2332
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2333
|
+
id: "AgeField"
|
|
2334
|
+
});
|
|
2315
2335
|
var TimeField = BaseField.extend({
|
|
2316
2336
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2317
2337
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2321,7 +2341,10 @@ var TimeField = BaseField.extend({
|
|
|
2321
2341
|
"Text to display above the time input"
|
|
2322
2342
|
).optional()
|
|
2323
2343
|
}).optional()
|
|
2324
|
-
}).
|
|
2344
|
+
}).meta({
|
|
2345
|
+
description: "A single time input (HH-mm)",
|
|
2346
|
+
id: "TimeField"
|
|
2347
|
+
});
|
|
2325
2348
|
var DateRangeField = BaseField.extend({
|
|
2326
2349
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2327
2350
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2330,7 +2353,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2330
2353
|
"Text to display above the date input"
|
|
2331
2354
|
).optional()
|
|
2332
2355
|
}).optional()
|
|
2333
|
-
}).
|
|
2356
|
+
}).meta({
|
|
2357
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2358
|
+
id: "DateRangeField"
|
|
2359
|
+
});
|
|
2334
2360
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2335
2361
|
"reg12",
|
|
2336
2362
|
"reg14",
|
|
@@ -2374,18 +2400,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2374
2400
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2375
2401
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2376
2402
|
configuration: ImageConfiguration
|
|
2377
|
-
}).
|
|
2403
|
+
}).meta({
|
|
2404
|
+
description: "A read-only image component for form pages",
|
|
2405
|
+
id: "ImageViewField"
|
|
2406
|
+
});
|
|
2378
2407
|
var Paragraph = BaseField.extend({
|
|
2379
2408
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2380
2409
|
configuration: ParagraphConfiguration
|
|
2381
|
-
}).
|
|
2410
|
+
}).meta({
|
|
2411
|
+
description: "A read-only HTML <p> paragraph",
|
|
2412
|
+
id: "Paragraph"
|
|
2413
|
+
});
|
|
2382
2414
|
var Heading = BaseField.extend({
|
|
2383
2415
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2384
2416
|
configuration: HeadingConfiguration
|
|
2385
|
-
}).
|
|
2417
|
+
}).meta({
|
|
2418
|
+
description: "A read-only heading component for form pages",
|
|
2419
|
+
id: "Heading"
|
|
2420
|
+
});
|
|
2386
2421
|
var PageHeader = BaseField.extend({
|
|
2387
2422
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2388
|
-
}).
|
|
2423
|
+
}).meta({
|
|
2424
|
+
description: "A read-only header component for form pages",
|
|
2425
|
+
id: "PageHeader"
|
|
2426
|
+
});
|
|
2389
2427
|
var File = BaseField.extend({
|
|
2390
2428
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2391
2429
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2404,7 +2442,10 @@ var File = BaseField.extend({
|
|
|
2404
2442
|
}).default({
|
|
2405
2443
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2406
2444
|
})
|
|
2407
|
-
}).
|
|
2445
|
+
}).meta({
|
|
2446
|
+
description: "A file upload field",
|
|
2447
|
+
id: "File"
|
|
2448
|
+
});
|
|
2408
2449
|
var SelectOption = import_v43.default.object({
|
|
2409
2450
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2410
2451
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2421,7 +2462,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2421
2462
|
"Placeholder for the number field"
|
|
2422
2463
|
)
|
|
2423
2464
|
}).optional()
|
|
2424
|
-
}).
|
|
2465
|
+
}).meta({
|
|
2466
|
+
description: "A number with unit input field",
|
|
2467
|
+
id: "NumberWithUnitField"
|
|
2468
|
+
});
|
|
2425
2469
|
var RadioGroup = BaseField.extend({
|
|
2426
2470
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2427
2471
|
defaultValue: TextValue.optional(),
|
|
@@ -2431,7 +2475,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2431
2475
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2432
2476
|
}).optional()
|
|
2433
2477
|
}).optional()
|
|
2434
|
-
}).
|
|
2478
|
+
}).meta({
|
|
2479
|
+
description: "A grouped radio button field",
|
|
2480
|
+
id: "RadioGroup"
|
|
2481
|
+
});
|
|
2435
2482
|
var BulletList = BaseField.extend({
|
|
2436
2483
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2437
2484
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2440,7 +2487,10 @@ var BulletList = BaseField.extend({
|
|
|
2440
2487
|
fontVariant: HtmlFontVariant.optional()
|
|
2441
2488
|
}).optional()
|
|
2442
2489
|
}).default({})
|
|
2443
|
-
}).
|
|
2490
|
+
}).meta({
|
|
2491
|
+
description: "A list of bullet points",
|
|
2492
|
+
id: "BulletList"
|
|
2493
|
+
});
|
|
2444
2494
|
var Select = BaseField.extend({
|
|
2445
2495
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2446
2496
|
defaultValue: TextValue.optional(),
|
|
@@ -2455,7 +2505,10 @@ var Select = BaseField.extend({
|
|
|
2455
2505
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2456
2506
|
`
|
|
2457
2507
|
)
|
|
2458
|
-
}).
|
|
2508
|
+
}).meta({
|
|
2509
|
+
description: "A select input field",
|
|
2510
|
+
id: "Select"
|
|
2511
|
+
});
|
|
2459
2512
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2460
2513
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2461
2514
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2464,7 +2517,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2464
2517
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2465
2518
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2466
2519
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2467
|
-
}).
|
|
2520
|
+
}).meta({
|
|
2521
|
+
description: "A date range selection field",
|
|
2522
|
+
id: "SelectDateRangeField"
|
|
2523
|
+
});
|
|
2468
2524
|
var NameConfig = import_v43.default.object({
|
|
2469
2525
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2470
2526
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2495,26 +2551,41 @@ var NameField = BaseField.extend({
|
|
|
2495
2551
|
surname: { required: true }
|
|
2496
2552
|
}
|
|
2497
2553
|
}).optional()
|
|
2498
|
-
}).
|
|
2554
|
+
}).meta({
|
|
2555
|
+
description: "A field for entering a persons name",
|
|
2556
|
+
id: "NameField"
|
|
2557
|
+
});
|
|
2499
2558
|
var PhoneField = BaseField.extend({
|
|
2500
2559
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2501
2560
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2502
|
-
}).
|
|
2561
|
+
}).meta({
|
|
2562
|
+
description: "A field for entering a phone number",
|
|
2563
|
+
id: "PhoneField"
|
|
2564
|
+
});
|
|
2503
2565
|
var IdField = BaseField.extend({
|
|
2504
2566
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2505
2567
|
type: import_v43.default.literal(FieldType.ID)
|
|
2506
|
-
}).
|
|
2568
|
+
}).meta({
|
|
2569
|
+
description: "A field for entering an ID",
|
|
2570
|
+
id: "IdField"
|
|
2571
|
+
});
|
|
2507
2572
|
var Checkbox = BaseField.extend({
|
|
2508
2573
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2509
2574
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2510
|
-
}).
|
|
2575
|
+
}).meta({
|
|
2576
|
+
description: "A boolean checkbox field",
|
|
2577
|
+
id: "Checkbox"
|
|
2578
|
+
});
|
|
2511
2579
|
var Country = BaseField.extend({
|
|
2512
2580
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2513
2581
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2514
2582
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2515
2583
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2516
2584
|
)
|
|
2517
|
-
}).
|
|
2585
|
+
}).meta({
|
|
2586
|
+
description: "A field for selecting a country",
|
|
2587
|
+
id: "Country"
|
|
2588
|
+
});
|
|
2518
2589
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2519
2590
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2520
2591
|
);
|
|
@@ -2523,16 +2594,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2523
2594
|
"HEALTH_FACILITY",
|
|
2524
2595
|
"CRVS_OFFICE"
|
|
2525
2596
|
]);
|
|
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
2597
|
var AdministrativeAreaField = BaseField.extend({
|
|
2532
2598
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2533
2599
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2534
|
-
configuration:
|
|
2535
|
-
|
|
2600
|
+
configuration: import_v43.default.object({
|
|
2601
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2602
|
+
type: AdministrativeAreas,
|
|
2603
|
+
allowedLocations: AllowedLocations
|
|
2604
|
+
}).describe("Administrative area options")
|
|
2605
|
+
}).meta({
|
|
2606
|
+
description: "Administrative area input field",
|
|
2607
|
+
id: "AdministrativeAreaField"
|
|
2608
|
+
});
|
|
2536
2609
|
var LocationInput = BaseField.extend({
|
|
2537
2610
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2538
2611
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2540,7 +2613,10 @@ var LocationInput = BaseField.extend({
|
|
|
2540
2613
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2541
2614
|
allowedLocations: AllowedLocations
|
|
2542
2615
|
}).optional()
|
|
2543
|
-
}).
|
|
2616
|
+
}).meta({
|
|
2617
|
+
description: "A field for selecting a location",
|
|
2618
|
+
id: "LocationInput"
|
|
2619
|
+
});
|
|
2544
2620
|
var FileUploadWithOptions = BaseField.extend({
|
|
2545
2621
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2546
2622
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2554,6 +2630,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2554
2630
|
}).default({
|
|
2555
2631
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2556
2632
|
})
|
|
2633
|
+
}).meta({
|
|
2634
|
+
description: "A field for uploading files with file type options",
|
|
2635
|
+
id: "FileUploadWithOptions"
|
|
2557
2636
|
});
|
|
2558
2637
|
var Facility = BaseField.extend({
|
|
2559
2638
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2599,7 +2678,10 @@ var Address = BaseField.extend({
|
|
|
2599
2678
|
allowedLocations: AllowedLocations
|
|
2600
2679
|
}).optional(),
|
|
2601
2680
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2602
|
-
}).
|
|
2681
|
+
}).meta({
|
|
2682
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2683
|
+
id: "Address"
|
|
2684
|
+
});
|
|
2603
2685
|
var StaticDataEntry = import_v43.default.object({
|
|
2604
2686
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2605
2687
|
label: TranslationConfig,
|
|
@@ -2614,7 +2696,10 @@ var DataField = BaseField.extend({
|
|
|
2614
2696
|
subtitle: TranslationConfig.optional(),
|
|
2615
2697
|
data: import_v43.default.array(DataEntry)
|
|
2616
2698
|
})
|
|
2617
|
-
}).
|
|
2699
|
+
}).meta({
|
|
2700
|
+
description: "A field for displaying a table of read-only data",
|
|
2701
|
+
id: "DataField"
|
|
2702
|
+
});
|
|
2618
2703
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2619
2704
|
var ButtonType = import_v43.default.enum([
|
|
2620
2705
|
"primary",
|
|
@@ -2641,11 +2726,17 @@ var ButtonField = BaseField.extend({
|
|
|
2641
2726
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2642
2727
|
defaultValue: ButtonFieldValue.optional(),
|
|
2643
2728
|
configuration: ButtonConfiguration
|
|
2644
|
-
}).
|
|
2729
|
+
}).meta({
|
|
2730
|
+
description: "A generic button that can be used to trigger an action",
|
|
2731
|
+
id: "ButtonField"
|
|
2732
|
+
});
|
|
2645
2733
|
var FieldGroup = BaseField.extend({
|
|
2646
2734
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2647
2735
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2648
2736
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2737
|
+
}).meta({
|
|
2738
|
+
description: "A group of fields that are displayed together",
|
|
2739
|
+
id: "FieldGroup"
|
|
2649
2740
|
});
|
|
2650
2741
|
var AlphaPrintButton = BaseField.extend({
|
|
2651
2742
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2655,7 +2746,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2655
2746
|
"Label for the print button"
|
|
2656
2747
|
)
|
|
2657
2748
|
})
|
|
2658
|
-
}).
|
|
2749
|
+
}).meta({
|
|
2750
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2751
|
+
id: "AlphaPrintButton"
|
|
2752
|
+
});
|
|
2659
2753
|
var HttpField = BaseField.extend({
|
|
2660
2754
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2661
2755
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2671,7 +2765,10 @@ var HttpField = BaseField.extend({
|
|
|
2671
2765
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2672
2766
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2673
2767
|
})
|
|
2674
|
-
}).
|
|
2768
|
+
}).meta({
|
|
2769
|
+
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.",
|
|
2770
|
+
id: "HttpField"
|
|
2771
|
+
});
|
|
2675
2772
|
var AutocompleteField = BaseField.extend({
|
|
2676
2773
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2677
2774
|
configuration: import_v43.default.object({
|
|
@@ -2684,7 +2781,10 @@ var AutocompleteField = BaseField.extend({
|
|
|
2684
2781
|
})
|
|
2685
2782
|
).optional()
|
|
2686
2783
|
})
|
|
2687
|
-
}).
|
|
2784
|
+
}).meta({
|
|
2785
|
+
description: "Autocomplete input field",
|
|
2786
|
+
id: "AutocompleteField"
|
|
2787
|
+
});
|
|
2688
2788
|
var SearchField = HttpField.extend({
|
|
2689
2789
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2690
2790
|
configuration: SearchQuery.pick({
|
|
@@ -2725,7 +2825,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2725
2825
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2726
2826
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2727
2827
|
})
|
|
2728
|
-
}).
|
|
2828
|
+
}).meta({
|
|
2829
|
+
description: "A button that opens a URL link",
|
|
2830
|
+
id: "LinkButtonField"
|
|
2831
|
+
});
|
|
2729
2832
|
var VerificationStatus = BaseField.extend({
|
|
2730
2833
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2731
2834
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2735,15 +2838,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2735
2838
|
"Explaining text on the banner in form."
|
|
2736
2839
|
)
|
|
2737
2840
|
})
|
|
2841
|
+
}).meta({
|
|
2842
|
+
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.",
|
|
2843
|
+
id: "VerificationStatus"
|
|
2738
2844
|
});
|
|
2739
2845
|
var QueryParamReaderField = BaseField.extend({
|
|
2740
2846
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2741
2847
|
configuration: import_v43.default.object({
|
|
2742
2848
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2743
2849
|
})
|
|
2744
|
-
}).
|
|
2745
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2746
|
-
|
|
2850
|
+
}).meta({
|
|
2851
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2852
|
+
id: "QueryParamReaderField"
|
|
2853
|
+
});
|
|
2747
2854
|
var QrReaderField = BaseField.extend({
|
|
2748
2855
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2749
2856
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2754,7 +2861,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2754
2861
|
})
|
|
2755
2862
|
}).optional()
|
|
2756
2863
|
}).meta({
|
|
2757
|
-
description: "
|
|
2864
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2758
2865
|
id: "QrReaderField"
|
|
2759
2866
|
});
|
|
2760
2867
|
var IdReaderField = BaseField.extend({
|
|
@@ -2763,12 +2870,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2763
2870
|
methods: import_v43.default.array(
|
|
2764
2871
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2765
2872
|
)
|
|
2873
|
+
}).meta({
|
|
2874
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2875
|
+
id: "IdReaderField"
|
|
2766
2876
|
});
|
|
2767
2877
|
var CustomField = BaseField.extend({
|
|
2768
2878
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2769
2879
|
defaultValue: CustomFieldValue.optional(),
|
|
2770
2880
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2771
2881
|
configuration: import_v43.default.unknown().optional()
|
|
2882
|
+
}).meta({
|
|
2883
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2884
|
+
id: "CustomField"
|
|
2772
2885
|
});
|
|
2773
2886
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2774
2887
|
var LoaderField = BaseField.extend({
|
|
@@ -2778,22 +2891,25 @@ var LoaderField = BaseField.extend({
|
|
|
2778
2891
|
configuration: import_v43.default.object({
|
|
2779
2892
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2780
2893
|
})
|
|
2781
|
-
}).
|
|
2782
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2783
|
-
|
|
2894
|
+
}).meta({
|
|
2895
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2896
|
+
id: "LoaderField"
|
|
2897
|
+
});
|
|
2784
2898
|
var HiddenField = BaseField.extend({
|
|
2785
2899
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2786
2900
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2787
2901
|
defaultValue: TextValue.optional()
|
|
2788
|
-
}).
|
|
2789
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2790
|
-
|
|
2902
|
+
}).meta({
|
|
2903
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2904
|
+
id: "HiddenField"
|
|
2905
|
+
});
|
|
2791
2906
|
var UserRoleField = BaseField.extend({
|
|
2792
2907
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2793
2908
|
defaultValue: TextValue.optional()
|
|
2794
|
-
}).
|
|
2795
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2796
|
-
|
|
2909
|
+
}).meta({
|
|
2910
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2911
|
+
id: "UserRoleField"
|
|
2912
|
+
});
|
|
2797
2913
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2798
2914
|
FieldGroup,
|
|
2799
2915
|
Address,
|
|
@@ -2892,10 +3008,10 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2892
3008
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2893
3009
|
actions: VerificationActionConfig
|
|
2894
3010
|
});
|
|
2895
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
3011
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3012
|
+
description: "Page configuration",
|
|
3013
|
+
id: "PageConfig"
|
|
3014
|
+
});
|
|
2899
3015
|
|
|
2900
3016
|
// ../commons/src/events/FormConfig.ts
|
|
2901
3017
|
var DeclarationFormConfig = z22.object({
|
|
@@ -5376,7 +5492,7 @@ var _EventConfigBase = z33.object({
|
|
|
5376
5492
|
),
|
|
5377
5493
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5378
5494
|
actions: z33.array(ActionConfig).describe(
|
|
5379
|
-
"Configuration of
|
|
5495
|
+
"Configuration of core and custom actions associated with the event."
|
|
5380
5496
|
),
|
|
5381
5497
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5382
5498
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5388,7 +5504,7 @@ var _EventConfigBase = z33.object({
|
|
|
5388
5504
|
"Configuration of fields available in the advanced search feature."
|
|
5389
5505
|
),
|
|
5390
5506
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5391
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5507
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5392
5508
|
),
|
|
5393
5509
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5394
5510
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5827,18 +5943,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5827
5943
|
query: true,
|
|
5828
5944
|
columns: true
|
|
5829
5945
|
});
|
|
5830
|
-
var WorkqueueConfigInput =
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
query: CountryConfigQueryInputType,
|
|
5836
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5837
|
-
"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."
|
|
5838
|
-
),
|
|
5839
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5840
|
-
icon: AvailableIcons,
|
|
5841
|
-
emptyMessage: TranslationConfig.optional()
|
|
5946
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
5947
|
+
query: CountryConfigQueryInputType
|
|
5948
|
+
}).meta({
|
|
5949
|
+
description: "Workqueue configuration",
|
|
5950
|
+
id: "WorkqueueConfig"
|
|
5842
5951
|
});
|
|
5843
5952
|
function defineWorkqueue(workqueueInput) {
|
|
5844
5953
|
const queryInput = workqueueInput.query;
|
|
@@ -5901,6 +6010,7 @@ var BaseActionInput = z38.object({
|
|
|
5901
6010
|
keepAssignment: z38.boolean().optional(),
|
|
5902
6011
|
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
5903
6012
|
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6013
|
+
waitFor: z38.boolean().optional(),
|
|
5904
6014
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5905
6015
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5906
6016
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6154,7 +6264,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6154
6264
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6155
6265
|
acceptedAt: acceptAction.createdAt,
|
|
6156
6266
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6157
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6158
6267
|
registrationNumber
|
|
6159
6268
|
};
|
|
6160
6269
|
}
|
|
@@ -6368,17 +6477,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6368
6477
|
return user2;
|
|
6369
6478
|
}, null);
|
|
6370
6479
|
}
|
|
6371
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6372
|
-
return actions.reduce((signature, action) => {
|
|
6373
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6374
|
-
return action.createdBySignature || null;
|
|
6375
|
-
}
|
|
6376
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6377
|
-
return null;
|
|
6378
|
-
}
|
|
6379
|
-
return signature;
|
|
6380
|
-
}, null);
|
|
6381
|
-
}
|
|
6382
6480
|
function deepDropNulls(obj) {
|
|
6383
6481
|
if (Array.isArray(obj)) {
|
|
6384
6482
|
return obj.map(deepDropNulls);
|
|
@@ -6474,10 +6572,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6474
6572
|
createdBy: creationAction.createdBy,
|
|
6475
6573
|
createdByUserType: creationAction.createdByUserType,
|
|
6476
6574
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6477
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6478
6575
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6479
6576
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6480
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6481
6577
|
updatedBy: requestActionMetadata.createdBy,
|
|
6482
6578
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6483
6579
|
declaration,
|
|
@@ -9736,7 +9832,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9736
9832
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9737
9833
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9738
9834
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9739
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9740
9835
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9741
9836
|
assignedTo: overrides.assignedTo ?? null,
|
|
9742
9837
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|