@opencrvs/toolkit 2.0.0-rc.f3bc98a → 2.0.0-rc.f5b6bcb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/create-countryconfig/index.js +73 -0
- package/create-countryconfig/package.json +11 -0
- package/dist/application-config/index.js +209 -83
- package/dist/cli.js +504 -170
- package/dist/commons/api/router.d.ts +3322 -268
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- 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 +3 -0
- package/dist/commons/events/EventIndex.d.ts +0 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
- package/dist/commons/events/locations.d.ts +21 -0
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +24 -1
- package/dist/commons/events/state/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +5 -3
- package/dist/events/index.js +291 -131
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +502 -168
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- package/dist/notification/index.js +223 -101
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +5 -3
- package/opencrvs-toolkit-2.0.0-rc.f5b6bcb.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.f3bc98a.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -302,12 +302,13 @@ __export(events_exports, {
|
|
|
302
302
|
getActionConfig: () => getActionConfig,
|
|
303
303
|
getActionReview: () => getActionReview,
|
|
304
304
|
getActionReviewFields: () => getActionReviewFields,
|
|
305
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
305
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
306
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
307
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
308
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
309
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
310
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
311
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
311
312
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
312
313
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
313
314
|
getCurrentEventState: () => getCurrentEventState,
|
|
@@ -318,6 +319,7 @@ __export(events_exports, {
|
|
|
318
319
|
getDeclarationPages: () => getDeclarationPages,
|
|
319
320
|
getEventConfigById: () => getEventConfigById,
|
|
320
321
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
322
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
321
323
|
getMixedPath: () => getMixedPath,
|
|
322
324
|
getPendingAction: () => getPendingAction,
|
|
323
325
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -607,12 +609,14 @@ var SystemScopeType = z2.enum([
|
|
|
607
609
|
"organisation.read-locations",
|
|
608
610
|
"user.read",
|
|
609
611
|
"user.create",
|
|
610
|
-
"user.edit"
|
|
612
|
+
"user.edit",
|
|
613
|
+
"user.search"
|
|
611
614
|
]);
|
|
612
615
|
var UserScopeType = SystemScopeType.extract([
|
|
613
616
|
"user.read",
|
|
614
617
|
"user.create",
|
|
615
|
-
"user.edit"
|
|
618
|
+
"user.edit",
|
|
619
|
+
"user.search"
|
|
616
620
|
]);
|
|
617
621
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
618
622
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -621,7 +625,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
621
625
|
options: AllUserScopeOptions.optional()
|
|
622
626
|
}),
|
|
623
627
|
z2.object({
|
|
624
|
-
type: UserScopeType.extract(["user.read"]),
|
|
628
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
625
629
|
options: AccessLevelOptions.optional()
|
|
626
630
|
})
|
|
627
631
|
]);
|
|
@@ -1073,7 +1077,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1073
1077
|
ShowConditional,
|
|
1074
1078
|
// Action can be shown to the user in the list but as disabled
|
|
1075
1079
|
EnableConditional
|
|
1076
|
-
])
|
|
1080
|
+
]).meta({
|
|
1081
|
+
description: "Action conditional configuration",
|
|
1082
|
+
id: "ActionConditional"
|
|
1083
|
+
});
|
|
1077
1084
|
var DisplayOnReviewConditional = z7.object({
|
|
1078
1085
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1079
1086
|
conditional: Conditional
|
|
@@ -1409,28 +1416,20 @@ function schemaPriority(schema) {
|
|
|
1409
1416
|
return idx === -1 ? 9999 : idx;
|
|
1410
1417
|
}
|
|
1411
1418
|
function safeUnion(schemas) {
|
|
1419
|
+
const sortedSchemas = [...schemas].sort(
|
|
1420
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1421
|
+
);
|
|
1412
1422
|
return z12.any().superRefine((val, ctx) => {
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
if (successful.length === 0) {
|
|
1418
|
-
ctx.addIssue({
|
|
1419
|
-
code: "invalid_type",
|
|
1420
|
-
expected: "custom",
|
|
1421
|
-
message: "Value does not match any schema"
|
|
1422
|
-
});
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1426
|
-
const best = successful[0];
|
|
1427
|
-
if (!best.safeParse(val).success) {
|
|
1428
|
-
ctx.addIssue({
|
|
1429
|
-
expected: "custom",
|
|
1430
|
-
code: "invalid_type",
|
|
1431
|
-
message: "Value did not match the best schema"
|
|
1432
|
-
});
|
|
1423
|
+
for (const schema of sortedSchemas) {
|
|
1424
|
+
if (schema.safeParse(val).success) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1433
1427
|
}
|
|
1428
|
+
ctx.addIssue({
|
|
1429
|
+
code: "invalid_type",
|
|
1430
|
+
expected: "custom",
|
|
1431
|
+
message: "Value does not match any schema"
|
|
1432
|
+
});
|
|
1434
1433
|
}).meta({
|
|
1435
1434
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1436
1435
|
});
|
|
@@ -1740,6 +1739,9 @@ var FlagConfig = z15.object({
|
|
|
1740
1739
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1741
1740
|
),
|
|
1742
1741
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1742
|
+
}).meta({
|
|
1743
|
+
description: "Flag configuration",
|
|
1744
|
+
id: "FlagConfig"
|
|
1743
1745
|
});
|
|
1744
1746
|
var ActionFlagConfig = z15.object({
|
|
1745
1747
|
id: Flag,
|
|
@@ -1747,6 +1749,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1747
1749
|
conditional: Conditional.optional().describe(
|
|
1748
1750
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1749
1751
|
)
|
|
1752
|
+
}).meta({
|
|
1753
|
+
description: "Action flag configuration",
|
|
1754
|
+
id: "ActionFlagConfig"
|
|
1750
1755
|
});
|
|
1751
1756
|
|
|
1752
1757
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1768,8 +1773,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1768
1773
|
),
|
|
1769
1774
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1770
1775
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1771
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1772
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1776
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1773
1777
|
});
|
|
1774
1778
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1775
1779
|
registrationNumber: z16.string().describe(
|
|
@@ -1797,9 +1801,6 @@ var EventMetadata = z16.object({
|
|
|
1797
1801
|
createdAtLocation: UUID.nullish().describe(
|
|
1798
1802
|
"Location of the user who created the event."
|
|
1799
1803
|
),
|
|
1800
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1801
|
-
"Signature of the user who created the event."
|
|
1802
|
-
),
|
|
1803
1804
|
updatedAtLocation: UUID.nullish().describe(
|
|
1804
1805
|
"Location of the user who last changed the status."
|
|
1805
1806
|
),
|
|
@@ -2174,7 +2175,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2174
2175
|
}
|
|
2175
2176
|
}).describe("Unique identifier for the field");
|
|
2176
2177
|
var FieldReference = import_v43.default.object({
|
|
2177
|
-
$$field: FieldId,
|
|
2178
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2178
2179
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2179
2180
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2180
2181
|
)
|
|
@@ -2220,6 +2221,9 @@ var BaseField = import_v43.default.object({
|
|
|
2220
2221
|
}).describe("Common properties shared across all field types.");
|
|
2221
2222
|
var Divider = BaseField.extend({
|
|
2222
2223
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2224
|
+
}).meta({
|
|
2225
|
+
description: "A horizontal line divider",
|
|
2226
|
+
id: "Divider"
|
|
2223
2227
|
});
|
|
2224
2228
|
var TextField = BaseField.extend({
|
|
2225
2229
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2230,7 +2234,10 @@ var TextField = BaseField.extend({
|
|
|
2230
2234
|
prefix: TranslationConfig.optional(),
|
|
2231
2235
|
postfix: TranslationConfig.optional()
|
|
2232
2236
|
}).default({ type: "text" }).optional()
|
|
2233
|
-
}).
|
|
2237
|
+
}).meta({
|
|
2238
|
+
description: "A text input field",
|
|
2239
|
+
id: "TextField"
|
|
2240
|
+
});
|
|
2234
2241
|
var NumberField = BaseField.extend({
|
|
2235
2242
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2236
2243
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2240,7 +2247,10 @@ var NumberField = BaseField.extend({
|
|
|
2240
2247
|
prefix: TranslationConfig.optional(),
|
|
2241
2248
|
postfix: TranslationConfig.optional()
|
|
2242
2249
|
}).optional()
|
|
2243
|
-
}).
|
|
2250
|
+
}).meta({
|
|
2251
|
+
description: "A number input field",
|
|
2252
|
+
id: "NumberField"
|
|
2253
|
+
});
|
|
2244
2254
|
var TextAreaField = BaseField.extend({
|
|
2245
2255
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2246
2256
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2251,7 +2261,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2251
2261
|
prefix: TranslationConfig.optional(),
|
|
2252
2262
|
postfix: TranslationConfig.optional()
|
|
2253
2263
|
}).default({ rows: 4 }).optional()
|
|
2254
|
-
}).
|
|
2264
|
+
}).meta({
|
|
2265
|
+
description: "A multiline text input",
|
|
2266
|
+
id: "TextAreaField"
|
|
2267
|
+
});
|
|
2255
2268
|
var ImageMimeType = import_v43.default.enum([
|
|
2256
2269
|
"image/png",
|
|
2257
2270
|
"image/jpg",
|
|
@@ -2281,13 +2294,19 @@ var SignatureField = BaseField.extend({
|
|
|
2281
2294
|
}).default({
|
|
2282
2295
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2283
2296
|
})
|
|
2284
|
-
}).
|
|
2297
|
+
}).meta({
|
|
2298
|
+
description: "A signature input field",
|
|
2299
|
+
id: "SignatureField"
|
|
2300
|
+
});
|
|
2285
2301
|
var EmailField = BaseField.extend({
|
|
2286
2302
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2287
2303
|
configuration: import_v43.default.object({
|
|
2288
2304
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2289
2305
|
}).default({ maxLength: 255 }).optional(),
|
|
2290
2306
|
defaultValue: NonEmptyTextValue.optional()
|
|
2307
|
+
}).meta({
|
|
2308
|
+
description: "An email input field",
|
|
2309
|
+
id: "EmailField"
|
|
2291
2310
|
});
|
|
2292
2311
|
var DateField = BaseField.extend({
|
|
2293
2312
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2297,7 +2316,10 @@ var DateField = BaseField.extend({
|
|
|
2297
2316
|
"Text to display above the date input"
|
|
2298
2317
|
).optional()
|
|
2299
2318
|
}).optional()
|
|
2300
|
-
}).
|
|
2319
|
+
}).meta({
|
|
2320
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2321
|
+
id: "DateField"
|
|
2322
|
+
});
|
|
2301
2323
|
var AgeField = BaseField.extend({
|
|
2302
2324
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2303
2325
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2306,7 +2328,10 @@ var AgeField = BaseField.extend({
|
|
|
2306
2328
|
prefix: TranslationConfig.optional(),
|
|
2307
2329
|
postfix: TranslationConfig.optional()
|
|
2308
2330
|
})
|
|
2309
|
-
}).
|
|
2331
|
+
}).meta({
|
|
2332
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2333
|
+
id: "AgeField"
|
|
2334
|
+
});
|
|
2310
2335
|
var TimeField = BaseField.extend({
|
|
2311
2336
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2312
2337
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2316,7 +2341,10 @@ var TimeField = BaseField.extend({
|
|
|
2316
2341
|
"Text to display above the time input"
|
|
2317
2342
|
).optional()
|
|
2318
2343
|
}).optional()
|
|
2319
|
-
}).
|
|
2344
|
+
}).meta({
|
|
2345
|
+
description: "A single time input (HH-mm)",
|
|
2346
|
+
id: "TimeField"
|
|
2347
|
+
});
|
|
2320
2348
|
var DateRangeField = BaseField.extend({
|
|
2321
2349
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2322
2350
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2325,7 +2353,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2325
2353
|
"Text to display above the date input"
|
|
2326
2354
|
).optional()
|
|
2327
2355
|
}).optional()
|
|
2328
|
-
}).
|
|
2356
|
+
}).meta({
|
|
2357
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2358
|
+
id: "DateRangeField"
|
|
2359
|
+
});
|
|
2329
2360
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2330
2361
|
"reg12",
|
|
2331
2362
|
"reg14",
|
|
@@ -2369,18 +2400,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2369
2400
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2370
2401
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2371
2402
|
configuration: ImageConfiguration
|
|
2372
|
-
}).
|
|
2403
|
+
}).meta({
|
|
2404
|
+
description: "A read-only image component for form pages",
|
|
2405
|
+
id: "ImageViewField"
|
|
2406
|
+
});
|
|
2373
2407
|
var Paragraph = BaseField.extend({
|
|
2374
2408
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2375
2409
|
configuration: ParagraphConfiguration
|
|
2376
|
-
}).
|
|
2410
|
+
}).meta({
|
|
2411
|
+
description: "A read-only HTML <p> paragraph",
|
|
2412
|
+
id: "Paragraph"
|
|
2413
|
+
});
|
|
2377
2414
|
var Heading = BaseField.extend({
|
|
2378
2415
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2379
2416
|
configuration: HeadingConfiguration
|
|
2380
|
-
}).
|
|
2417
|
+
}).meta({
|
|
2418
|
+
description: "A read-only heading component for form pages",
|
|
2419
|
+
id: "Heading"
|
|
2420
|
+
});
|
|
2381
2421
|
var PageHeader = BaseField.extend({
|
|
2382
2422
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2383
|
-
}).
|
|
2423
|
+
}).meta({
|
|
2424
|
+
description: "A read-only header component for form pages",
|
|
2425
|
+
id: "PageHeader"
|
|
2426
|
+
});
|
|
2384
2427
|
var File = BaseField.extend({
|
|
2385
2428
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2386
2429
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2399,7 +2442,10 @@ var File = BaseField.extend({
|
|
|
2399
2442
|
}).default({
|
|
2400
2443
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2401
2444
|
})
|
|
2402
|
-
}).
|
|
2445
|
+
}).meta({
|
|
2446
|
+
description: "A file upload field",
|
|
2447
|
+
id: "File"
|
|
2448
|
+
});
|
|
2403
2449
|
var SelectOption = import_v43.default.object({
|
|
2404
2450
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2405
2451
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2416,7 +2462,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2416
2462
|
"Placeholder for the number field"
|
|
2417
2463
|
)
|
|
2418
2464
|
}).optional()
|
|
2419
|
-
}).
|
|
2465
|
+
}).meta({
|
|
2466
|
+
description: "A number with unit input field",
|
|
2467
|
+
id: "NumberWithUnitField"
|
|
2468
|
+
});
|
|
2420
2469
|
var RadioGroup = BaseField.extend({
|
|
2421
2470
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2422
2471
|
defaultValue: TextValue.optional(),
|
|
@@ -2426,7 +2475,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2426
2475
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2427
2476
|
}).optional()
|
|
2428
2477
|
}).optional()
|
|
2429
|
-
}).
|
|
2478
|
+
}).meta({
|
|
2479
|
+
description: "A grouped radio button field",
|
|
2480
|
+
id: "RadioGroup"
|
|
2481
|
+
});
|
|
2430
2482
|
var BulletList = BaseField.extend({
|
|
2431
2483
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2432
2484
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2435,7 +2487,10 @@ var BulletList = BaseField.extend({
|
|
|
2435
2487
|
fontVariant: HtmlFontVariant.optional()
|
|
2436
2488
|
}).optional()
|
|
2437
2489
|
}).default({})
|
|
2438
|
-
}).
|
|
2490
|
+
}).meta({
|
|
2491
|
+
description: "A list of bullet points",
|
|
2492
|
+
id: "BulletList"
|
|
2493
|
+
});
|
|
2439
2494
|
var Select = BaseField.extend({
|
|
2440
2495
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2441
2496
|
defaultValue: TextValue.optional(),
|
|
@@ -2450,7 +2505,10 @@ var Select = BaseField.extend({
|
|
|
2450
2505
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2451
2506
|
`
|
|
2452
2507
|
)
|
|
2453
|
-
}).
|
|
2508
|
+
}).meta({
|
|
2509
|
+
description: "A select input field",
|
|
2510
|
+
id: "Select"
|
|
2511
|
+
});
|
|
2454
2512
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2455
2513
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2456
2514
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2459,7 +2517,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2459
2517
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2460
2518
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2461
2519
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2462
|
-
}).
|
|
2520
|
+
}).meta({
|
|
2521
|
+
description: "A date range selection field",
|
|
2522
|
+
id: "SelectDateRangeField"
|
|
2523
|
+
});
|
|
2463
2524
|
var NameConfig = import_v43.default.object({
|
|
2464
2525
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2465
2526
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2490,26 +2551,41 @@ var NameField = BaseField.extend({
|
|
|
2490
2551
|
surname: { required: true }
|
|
2491
2552
|
}
|
|
2492
2553
|
}).optional()
|
|
2493
|
-
}).
|
|
2554
|
+
}).meta({
|
|
2555
|
+
description: "A field for entering a persons name",
|
|
2556
|
+
id: "NameField"
|
|
2557
|
+
});
|
|
2494
2558
|
var PhoneField = BaseField.extend({
|
|
2495
2559
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2496
2560
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2497
|
-
}).
|
|
2561
|
+
}).meta({
|
|
2562
|
+
description: "A field for entering a phone number",
|
|
2563
|
+
id: "PhoneField"
|
|
2564
|
+
});
|
|
2498
2565
|
var IdField = BaseField.extend({
|
|
2499
2566
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2500
2567
|
type: import_v43.default.literal(FieldType.ID)
|
|
2501
|
-
}).
|
|
2568
|
+
}).meta({
|
|
2569
|
+
description: "A field for entering an ID",
|
|
2570
|
+
id: "IdField"
|
|
2571
|
+
});
|
|
2502
2572
|
var Checkbox = BaseField.extend({
|
|
2503
2573
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2504
2574
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2505
|
-
}).
|
|
2575
|
+
}).meta({
|
|
2576
|
+
description: "A boolean checkbox field",
|
|
2577
|
+
id: "Checkbox"
|
|
2578
|
+
});
|
|
2506
2579
|
var Country = BaseField.extend({
|
|
2507
2580
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2508
2581
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2509
2582
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2510
2583
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2511
2584
|
)
|
|
2512
|
-
}).
|
|
2585
|
+
}).meta({
|
|
2586
|
+
description: "A field for selecting a country",
|
|
2587
|
+
id: "Country"
|
|
2588
|
+
});
|
|
2513
2589
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2514
2590
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2515
2591
|
);
|
|
@@ -2518,16 +2594,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2518
2594
|
"HEALTH_FACILITY",
|
|
2519
2595
|
"CRVS_OFFICE"
|
|
2520
2596
|
]);
|
|
2521
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2522
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2523
|
-
type: AdministrativeAreas,
|
|
2524
|
-
allowedLocations: AllowedLocations
|
|
2525
|
-
}).describe("Administrative area options");
|
|
2526
2597
|
var AdministrativeAreaField = BaseField.extend({
|
|
2527
2598
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2528
2599
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2529
|
-
configuration:
|
|
2530
|
-
|
|
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
|
+
});
|
|
2531
2609
|
var LocationInput = BaseField.extend({
|
|
2532
2610
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2533
2611
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2535,7 +2613,10 @@ var LocationInput = BaseField.extend({
|
|
|
2535
2613
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2536
2614
|
allowedLocations: AllowedLocations
|
|
2537
2615
|
}).optional()
|
|
2538
|
-
}).
|
|
2616
|
+
}).meta({
|
|
2617
|
+
description: "A field for selecting a location",
|
|
2618
|
+
id: "LocationInput"
|
|
2619
|
+
});
|
|
2539
2620
|
var FileUploadWithOptions = BaseField.extend({
|
|
2540
2621
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2541
2622
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2549,6 +2630,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2549
2630
|
}).default({
|
|
2550
2631
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2551
2632
|
})
|
|
2633
|
+
}).meta({
|
|
2634
|
+
description: "A field for uploading files with file type options",
|
|
2635
|
+
id: "FileUploadWithOptions"
|
|
2552
2636
|
});
|
|
2553
2637
|
var Facility = BaseField.extend({
|
|
2554
2638
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2594,7 +2678,10 @@ var Address = BaseField.extend({
|
|
|
2594
2678
|
allowedLocations: AllowedLocations
|
|
2595
2679
|
}).optional(),
|
|
2596
2680
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2597
|
-
}).
|
|
2681
|
+
}).meta({
|
|
2682
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2683
|
+
id: "Address"
|
|
2684
|
+
});
|
|
2598
2685
|
var StaticDataEntry = import_v43.default.object({
|
|
2599
2686
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2600
2687
|
label: TranslationConfig,
|
|
@@ -2609,7 +2696,10 @@ var DataField = BaseField.extend({
|
|
|
2609
2696
|
subtitle: TranslationConfig.optional(),
|
|
2610
2697
|
data: import_v43.default.array(DataEntry)
|
|
2611
2698
|
})
|
|
2612
|
-
}).
|
|
2699
|
+
}).meta({
|
|
2700
|
+
description: "A field for displaying a table of read-only data",
|
|
2701
|
+
id: "DataField"
|
|
2702
|
+
});
|
|
2613
2703
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2614
2704
|
var ButtonType = import_v43.default.enum([
|
|
2615
2705
|
"primary",
|
|
@@ -2636,11 +2726,17 @@ var ButtonField = BaseField.extend({
|
|
|
2636
2726
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2637
2727
|
defaultValue: ButtonFieldValue.optional(),
|
|
2638
2728
|
configuration: ButtonConfiguration
|
|
2639
|
-
}).
|
|
2729
|
+
}).meta({
|
|
2730
|
+
description: "A generic button that can be used to trigger an action",
|
|
2731
|
+
id: "ButtonField"
|
|
2732
|
+
});
|
|
2640
2733
|
var FieldGroup = BaseField.extend({
|
|
2641
2734
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2642
2735
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2643
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"
|
|
2644
2740
|
});
|
|
2645
2741
|
var AlphaPrintButton = BaseField.extend({
|
|
2646
2742
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2650,7 +2746,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2650
2746
|
"Label for the print button"
|
|
2651
2747
|
)
|
|
2652
2748
|
})
|
|
2653
|
-
}).
|
|
2749
|
+
}).meta({
|
|
2750
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2751
|
+
id: "AlphaPrintButton"
|
|
2752
|
+
});
|
|
2654
2753
|
var HttpField = BaseField.extend({
|
|
2655
2754
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2656
2755
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2666,20 +2765,30 @@ var HttpField = BaseField.extend({
|
|
|
2666
2765
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2667
2766
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2668
2767
|
})
|
|
2669
|
-
}).
|
|
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
|
+
});
|
|
2670
2772
|
var AutocompleteField = BaseField.extend({
|
|
2671
2773
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2672
2774
|
configuration: import_v43.default.object({
|
|
2673
|
-
url: import_v43.default.string().describe(
|
|
2775
|
+
url: import_v43.default.string().describe(
|
|
2776
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2777
|
+
).optional(),
|
|
2674
2778
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2675
2779
|
defaultOptions: import_v43.default.array(
|
|
2676
2780
|
import_v43.default.object({
|
|
2677
2781
|
label: import_v43.default.string(),
|
|
2678
2782
|
value: import_v43.default.string()
|
|
2679
2783
|
})
|
|
2680
|
-
).optional()
|
|
2784
|
+
).optional().describe(
|
|
2785
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2786
|
+
)
|
|
2681
2787
|
})
|
|
2682
|
-
}).
|
|
2788
|
+
}).meta({
|
|
2789
|
+
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.",
|
|
2790
|
+
id: "AutocompleteField"
|
|
2791
|
+
});
|
|
2683
2792
|
var SearchField = HttpField.extend({
|
|
2684
2793
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2685
2794
|
configuration: SearchQuery.pick({
|
|
@@ -2712,6 +2821,9 @@ var SearchField = HttpField.extend({
|
|
|
2712
2821
|
ok: TranslationConfig.optional()
|
|
2713
2822
|
}).optional()
|
|
2714
2823
|
})
|
|
2824
|
+
}).meta({
|
|
2825
|
+
description: "A search input field",
|
|
2826
|
+
id: "SearchField"
|
|
2715
2827
|
});
|
|
2716
2828
|
var LinkButtonField = BaseField.extend({
|
|
2717
2829
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2720,7 +2832,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2720
2832
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2721
2833
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2722
2834
|
})
|
|
2723
|
-
}).
|
|
2835
|
+
}).meta({
|
|
2836
|
+
description: "A button that opens a URL link",
|
|
2837
|
+
id: "LinkButtonField"
|
|
2838
|
+
});
|
|
2724
2839
|
var VerificationStatus = BaseField.extend({
|
|
2725
2840
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2726
2841
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2730,15 +2845,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2730
2845
|
"Explaining text on the banner in form."
|
|
2731
2846
|
)
|
|
2732
2847
|
})
|
|
2848
|
+
}).meta({
|
|
2849
|
+
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.",
|
|
2850
|
+
id: "VerificationStatus"
|
|
2733
2851
|
});
|
|
2734
2852
|
var QueryParamReaderField = BaseField.extend({
|
|
2735
2853
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2736
2854
|
configuration: import_v43.default.object({
|
|
2737
2855
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2738
2856
|
})
|
|
2739
|
-
}).
|
|
2740
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2741
|
-
|
|
2857
|
+
}).meta({
|
|
2858
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2859
|
+
id: "QueryParamReaderField"
|
|
2860
|
+
});
|
|
2742
2861
|
var QrReaderField = BaseField.extend({
|
|
2743
2862
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2744
2863
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2749,7 +2868,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2749
2868
|
})
|
|
2750
2869
|
}).optional()
|
|
2751
2870
|
}).meta({
|
|
2752
|
-
description: "
|
|
2871
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2753
2872
|
id: "QrReaderField"
|
|
2754
2873
|
});
|
|
2755
2874
|
var IdReaderField = BaseField.extend({
|
|
@@ -2758,12 +2877,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2758
2877
|
methods: import_v43.default.array(
|
|
2759
2878
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2760
2879
|
)
|
|
2880
|
+
}).meta({
|
|
2881
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2882
|
+
id: "IdReaderField"
|
|
2761
2883
|
});
|
|
2762
2884
|
var CustomField = BaseField.extend({
|
|
2763
2885
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2764
2886
|
defaultValue: CustomFieldValue.optional(),
|
|
2765
2887
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2766
2888
|
configuration: import_v43.default.unknown().optional()
|
|
2889
|
+
}).meta({
|
|
2890
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2891
|
+
id: "CustomField"
|
|
2767
2892
|
});
|
|
2768
2893
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2769
2894
|
var LoaderField = BaseField.extend({
|
|
@@ -2773,22 +2898,25 @@ var LoaderField = BaseField.extend({
|
|
|
2773
2898
|
configuration: import_v43.default.object({
|
|
2774
2899
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2775
2900
|
})
|
|
2776
|
-
}).
|
|
2777
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2778
|
-
|
|
2901
|
+
}).meta({
|
|
2902
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2903
|
+
id: "LoaderField"
|
|
2904
|
+
});
|
|
2779
2905
|
var HiddenField = BaseField.extend({
|
|
2780
2906
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2781
2907
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2782
2908
|
defaultValue: TextValue.optional()
|
|
2783
|
-
}).
|
|
2784
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2785
|
-
|
|
2909
|
+
}).meta({
|
|
2910
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2911
|
+
id: "HiddenField"
|
|
2912
|
+
});
|
|
2786
2913
|
var UserRoleField = BaseField.extend({
|
|
2787
2914
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2788
2915
|
defaultValue: TextValue.optional()
|
|
2789
|
-
}).
|
|
2790
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2791
|
-
|
|
2916
|
+
}).meta({
|
|
2917
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2918
|
+
id: "UserRoleField"
|
|
2919
|
+
});
|
|
2792
2920
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2793
2921
|
FieldGroup,
|
|
2794
2922
|
Address,
|
|
@@ -2887,10 +3015,10 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2887
3015
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2888
3016
|
actions: VerificationActionConfig
|
|
2889
3017
|
});
|
|
2890
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
3018
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3019
|
+
description: "Page configuration",
|
|
3020
|
+
id: "PageConfig"
|
|
3021
|
+
});
|
|
2894
3022
|
|
|
2895
3023
|
// ../commons/src/events/FormConfig.ts
|
|
2896
3024
|
var DeclarationFormConfig = z22.object({
|
|
@@ -3799,6 +3927,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3799
3927
|
function isAgeValue(value) {
|
|
3800
3928
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3801
3929
|
}
|
|
3930
|
+
function mergeWithBaseFormState(values, context) {
|
|
3931
|
+
return { ...context.baseFormState, ...values };
|
|
3932
|
+
}
|
|
3802
3933
|
function validate(schema, data) {
|
|
3803
3934
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3804
3935
|
if ("$form" in data) {
|
|
@@ -3837,7 +3968,7 @@ function isOnline() {
|
|
|
3837
3968
|
}
|
|
3838
3969
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3839
3970
|
return validate(conditional, {
|
|
3840
|
-
$form: values,
|
|
3971
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3841
3972
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3842
3973
|
$online: isOnline(),
|
|
3843
3974
|
$user: context.user,
|
|
@@ -3866,7 +3997,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3866
3997
|
return true;
|
|
3867
3998
|
}
|
|
3868
3999
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3869
|
-
$form: form,
|
|
4000
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3870
4001
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3871
4002
|
$online: isOnline(),
|
|
3872
4003
|
$user: context.user,
|
|
@@ -4058,7 +4189,7 @@ function runFieldValidations({
|
|
|
4058
4189
|
return [];
|
|
4059
4190
|
}
|
|
4060
4191
|
const conditionalParameters = {
|
|
4061
|
-
$form: form,
|
|
4192
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4062
4193
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4063
4194
|
/**
|
|
4064
4195
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4302,17 +4433,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4302
4433
|
}
|
|
4303
4434
|
return isConditionMet(page.conditional, formValues, context);
|
|
4304
4435
|
}
|
|
4305
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4436
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4306
4437
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4307
4438
|
function fn(prevVisibilityContext) {
|
|
4308
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4309
4439
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4310
4440
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4311
4441
|
if (!fieldConfig.length) {
|
|
4312
4442
|
return false;
|
|
4313
4443
|
}
|
|
4314
4444
|
const isHidden = fieldConfig.every(
|
|
4315
|
-
(f) => !isFieldVisible(f,
|
|
4445
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4316
4446
|
);
|
|
4317
4447
|
if (!isHidden) {
|
|
4318
4448
|
return false;
|
|
@@ -4330,7 +4460,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4330
4460
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4331
4461
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4332
4462
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4333
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4463
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4334
4464
|
});
|
|
4335
4465
|
return omitHiddenFields(
|
|
4336
4466
|
visibleFields,
|
|
@@ -4377,13 +4507,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4377
4507
|
}
|
|
4378
4508
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4379
4509
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4380
|
-
return omitHiddenFields(
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
false,
|
|
4385
|
-
declaration
|
|
4386
|
-
);
|
|
4510
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4511
|
+
...context,
|
|
4512
|
+
baseFormState: declaration
|
|
4513
|
+
});
|
|
4387
4514
|
}
|
|
4388
4515
|
function deepMerge(currentDocument, actionDocument) {
|
|
4389
4516
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5372,7 +5499,7 @@ var _EventConfigBase = z33.object({
|
|
|
5372
5499
|
),
|
|
5373
5500
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5374
5501
|
actions: z33.array(ActionConfig).describe(
|
|
5375
|
-
"Configuration of
|
|
5502
|
+
"Configuration of core and custom actions associated with the event."
|
|
5376
5503
|
),
|
|
5377
5504
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5378
5505
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5384,7 +5511,7 @@ var _EventConfigBase = z33.object({
|
|
|
5384
5511
|
"Configuration of fields available in the advanced search feature."
|
|
5385
5512
|
),
|
|
5386
5513
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5387
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5514
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5388
5515
|
),
|
|
5389
5516
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5390
5517
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5823,18 +5950,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5823
5950
|
query: true,
|
|
5824
5951
|
columns: true
|
|
5825
5952
|
});
|
|
5826
|
-
var WorkqueueConfigInput =
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
query: CountryConfigQueryInputType,
|
|
5832
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5833
|
-
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
5834
|
-
),
|
|
5835
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5836
|
-
icon: AvailableIcons,
|
|
5837
|
-
emptyMessage: TranslationConfig.optional()
|
|
5953
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
5954
|
+
query: CountryConfigQueryInputType
|
|
5955
|
+
}).meta({
|
|
5956
|
+
description: "Workqueue configuration",
|
|
5957
|
+
id: "WorkqueueConfig"
|
|
5838
5958
|
});
|
|
5839
5959
|
function defineWorkqueue(workqueueInput) {
|
|
5840
5960
|
const queryInput = workqueueInput.query;
|
|
@@ -5895,6 +6015,9 @@ var BaseActionInput = z38.object({
|
|
|
5895
6015
|
originalActionId: UUID.optional(),
|
|
5896
6016
|
// should not be part of base action.
|
|
5897
6017
|
keepAssignment: z38.boolean().optional(),
|
|
6018
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6019
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6020
|
+
waitFor: z38.boolean().optional(),
|
|
5898
6021
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5899
6022
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5900
6023
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6148,7 +6271,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6148
6271
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6149
6272
|
acceptedAt: acceptAction.createdAt,
|
|
6150
6273
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6151
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6152
6274
|
registrationNumber
|
|
6153
6275
|
};
|
|
6154
6276
|
}
|
|
@@ -6362,17 +6484,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6362
6484
|
return user2;
|
|
6363
6485
|
}, null);
|
|
6364
6486
|
}
|
|
6365
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6366
|
-
return actions.reduce((signature, action) => {
|
|
6367
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6368
|
-
return action.createdBySignature || null;
|
|
6369
|
-
}
|
|
6370
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6371
|
-
return null;
|
|
6372
|
-
}
|
|
6373
|
-
return signature;
|
|
6374
|
-
}, null);
|
|
6375
|
-
}
|
|
6376
6487
|
function deepDropNulls(obj) {
|
|
6377
6488
|
if (Array.isArray(obj)) {
|
|
6378
6489
|
return obj.map(deepDropNulls);
|
|
@@ -6468,10 +6579,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6468
6579
|
createdBy: creationAction.createdBy,
|
|
6469
6580
|
createdByUserType: creationAction.createdByUserType,
|
|
6470
6581
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6471
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6472
6582
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6473
6583
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6474
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6475
6584
|
updatedBy: requestActionMetadata.createdBy,
|
|
6476
6585
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6477
6586
|
declaration,
|
|
@@ -9730,7 +9839,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9730
9839
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9731
9840
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9732
9841
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9733
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9734
9842
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9735
9843
|
assignedTo: overrides.assignedTo ?? null,
|
|
9736
9844
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -10001,6 +10109,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10001
10109
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
10002
10110
|
);
|
|
10003
10111
|
}
|
|
10112
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10113
|
+
const collectedLocations = [];
|
|
10114
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10115
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10116
|
+
while (current) {
|
|
10117
|
+
collectedLocations.push(current);
|
|
10118
|
+
if (!current.parentId) {
|
|
10119
|
+
break;
|
|
10120
|
+
}
|
|
10121
|
+
const parentId = current.parentId;
|
|
10122
|
+
current = administrativeAreas.get(parentId);
|
|
10123
|
+
}
|
|
10124
|
+
return collectedLocations;
|
|
10125
|
+
}
|
|
10126
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10127
|
+
const { administrativeAreas, locations } = context;
|
|
10128
|
+
const loc = locations.get(selectedId);
|
|
10129
|
+
if (loc) {
|
|
10130
|
+
if (loc.administrativeAreaId) {
|
|
10131
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10132
|
+
loc.administrativeAreaId,
|
|
10133
|
+
administrativeAreas
|
|
10134
|
+
);
|
|
10135
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10136
|
+
}
|
|
10137
|
+
return [loc.id];
|
|
10138
|
+
}
|
|
10139
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10140
|
+
selectedId,
|
|
10141
|
+
administrativeAreas
|
|
10142
|
+
);
|
|
10143
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10144
|
+
}
|
|
10004
10145
|
|
|
10005
10146
|
// ../commons/src/events/scopes.ts
|
|
10006
10147
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10075,6 +10216,25 @@ function isActionInScope({
|
|
|
10075
10216
|
);
|
|
10076
10217
|
return canAccess;
|
|
10077
10218
|
}
|
|
10219
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10220
|
+
allRoles,
|
|
10221
|
+
userLocation,
|
|
10222
|
+
acceptedScopes,
|
|
10223
|
+
userRequesting
|
|
10224
|
+
}) {
|
|
10225
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10226
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10227
|
+
userToAccess: {
|
|
10228
|
+
...userLocation,
|
|
10229
|
+
role
|
|
10230
|
+
},
|
|
10231
|
+
user: userRequesting,
|
|
10232
|
+
scopes: acceptedScopes
|
|
10233
|
+
});
|
|
10234
|
+
return canAccess;
|
|
10235
|
+
});
|
|
10236
|
+
return availableRoles;
|
|
10237
|
+
}
|
|
10078
10238
|
|
|
10079
10239
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10080
10240
|
function userDeserializer(serializedUserField, user2) {
|