@opencrvs/toolkit 2.0.0-rc.725758 → 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/create-countryconfig/index.js +73 -0
- package/create-countryconfig/package.json +11 -0
- package/dist/application-config/index.js +195 -78
- package/dist/cli.js +389 -127
- package/dist/commons/api/router.d.ts +3302 -248
- 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/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/events/index.js +277 -126
- 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 +387 -125
- 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 +209 -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.0725758.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,
|
|
@@ -1075,7 +1077,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1075
1077
|
ShowConditional,
|
|
1076
1078
|
// Action can be shown to the user in the list but as disabled
|
|
1077
1079
|
EnableConditional
|
|
1078
|
-
])
|
|
1080
|
+
]).meta({
|
|
1081
|
+
description: "Action conditional configuration",
|
|
1082
|
+
id: "ActionConditional"
|
|
1083
|
+
});
|
|
1079
1084
|
var DisplayOnReviewConditional = z7.object({
|
|
1080
1085
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1081
1086
|
conditional: Conditional
|
|
@@ -1411,28 +1416,20 @@ function schemaPriority(schema) {
|
|
|
1411
1416
|
return idx === -1 ? 9999 : idx;
|
|
1412
1417
|
}
|
|
1413
1418
|
function safeUnion(schemas) {
|
|
1419
|
+
const sortedSchemas = [...schemas].sort(
|
|
1420
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1421
|
+
);
|
|
1414
1422
|
return z12.any().superRefine((val, ctx) => {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
if (successful.length === 0) {
|
|
1420
|
-
ctx.addIssue({
|
|
1421
|
-
code: "invalid_type",
|
|
1422
|
-
expected: "custom",
|
|
1423
|
-
message: "Value does not match any schema"
|
|
1424
|
-
});
|
|
1425
|
-
return;
|
|
1426
|
-
}
|
|
1427
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1428
|
-
const best = successful[0];
|
|
1429
|
-
if (!best.safeParse(val).success) {
|
|
1430
|
-
ctx.addIssue({
|
|
1431
|
-
expected: "custom",
|
|
1432
|
-
code: "invalid_type",
|
|
1433
|
-
message: "Value did not match the best schema"
|
|
1434
|
-
});
|
|
1423
|
+
for (const schema of sortedSchemas) {
|
|
1424
|
+
if (schema.safeParse(val).success) {
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1435
1427
|
}
|
|
1428
|
+
ctx.addIssue({
|
|
1429
|
+
code: "invalid_type",
|
|
1430
|
+
expected: "custom",
|
|
1431
|
+
message: "Value does not match any schema"
|
|
1432
|
+
});
|
|
1436
1433
|
}).meta({
|
|
1437
1434
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1438
1435
|
});
|
|
@@ -1742,6 +1739,9 @@ var FlagConfig = z15.object({
|
|
|
1742
1739
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1743
1740
|
),
|
|
1744
1741
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1742
|
+
}).meta({
|
|
1743
|
+
description: "Flag configuration",
|
|
1744
|
+
id: "FlagConfig"
|
|
1745
1745
|
});
|
|
1746
1746
|
var ActionFlagConfig = z15.object({
|
|
1747
1747
|
id: Flag,
|
|
@@ -1749,6 +1749,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1749
1749
|
conditional: Conditional.optional().describe(
|
|
1750
1750
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1751
1751
|
)
|
|
1752
|
+
}).meta({
|
|
1753
|
+
description: "Action flag configuration",
|
|
1754
|
+
id: "ActionFlagConfig"
|
|
1752
1755
|
});
|
|
1753
1756
|
|
|
1754
1757
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1770,8 +1773,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1770
1773
|
),
|
|
1771
1774
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1772
1775
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1773
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1774
|
-
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.")
|
|
1775
1777
|
});
|
|
1776
1778
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1777
1779
|
registrationNumber: z16.string().describe(
|
|
@@ -1799,9 +1801,6 @@ var EventMetadata = z16.object({
|
|
|
1799
1801
|
createdAtLocation: UUID.nullish().describe(
|
|
1800
1802
|
"Location of the user who created the event."
|
|
1801
1803
|
),
|
|
1802
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1803
|
-
"Signature of the user who created the event."
|
|
1804
|
-
),
|
|
1805
1804
|
updatedAtLocation: UUID.nullish().describe(
|
|
1806
1805
|
"Location of the user who last changed the status."
|
|
1807
1806
|
),
|
|
@@ -2176,7 +2175,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2176
2175
|
}
|
|
2177
2176
|
}).describe("Unique identifier for the field");
|
|
2178
2177
|
var FieldReference = import_v43.default.object({
|
|
2179
|
-
$$field: FieldId,
|
|
2178
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2180
2179
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2181
2180
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2182
2181
|
)
|
|
@@ -2222,6 +2221,9 @@ var BaseField = import_v43.default.object({
|
|
|
2222
2221
|
}).describe("Common properties shared across all field types.");
|
|
2223
2222
|
var Divider = BaseField.extend({
|
|
2224
2223
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2224
|
+
}).meta({
|
|
2225
|
+
description: "A horizontal line divider",
|
|
2226
|
+
id: "Divider"
|
|
2225
2227
|
});
|
|
2226
2228
|
var TextField = BaseField.extend({
|
|
2227
2229
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2232,7 +2234,10 @@ var TextField = BaseField.extend({
|
|
|
2232
2234
|
prefix: TranslationConfig.optional(),
|
|
2233
2235
|
postfix: TranslationConfig.optional()
|
|
2234
2236
|
}).default({ type: "text" }).optional()
|
|
2235
|
-
}).
|
|
2237
|
+
}).meta({
|
|
2238
|
+
description: "A text input field",
|
|
2239
|
+
id: "TextField"
|
|
2240
|
+
});
|
|
2236
2241
|
var NumberField = BaseField.extend({
|
|
2237
2242
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2238
2243
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2242,7 +2247,10 @@ var NumberField = BaseField.extend({
|
|
|
2242
2247
|
prefix: TranslationConfig.optional(),
|
|
2243
2248
|
postfix: TranslationConfig.optional()
|
|
2244
2249
|
}).optional()
|
|
2245
|
-
}).
|
|
2250
|
+
}).meta({
|
|
2251
|
+
description: "A number input field",
|
|
2252
|
+
id: "NumberField"
|
|
2253
|
+
});
|
|
2246
2254
|
var TextAreaField = BaseField.extend({
|
|
2247
2255
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2248
2256
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2253,7 +2261,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2253
2261
|
prefix: TranslationConfig.optional(),
|
|
2254
2262
|
postfix: TranslationConfig.optional()
|
|
2255
2263
|
}).default({ rows: 4 }).optional()
|
|
2256
|
-
}).
|
|
2264
|
+
}).meta({
|
|
2265
|
+
description: "A multiline text input",
|
|
2266
|
+
id: "TextAreaField"
|
|
2267
|
+
});
|
|
2257
2268
|
var ImageMimeType = import_v43.default.enum([
|
|
2258
2269
|
"image/png",
|
|
2259
2270
|
"image/jpg",
|
|
@@ -2283,13 +2294,19 @@ var SignatureField = BaseField.extend({
|
|
|
2283
2294
|
}).default({
|
|
2284
2295
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2285
2296
|
})
|
|
2286
|
-
}).
|
|
2297
|
+
}).meta({
|
|
2298
|
+
description: "A signature input field",
|
|
2299
|
+
id: "SignatureField"
|
|
2300
|
+
});
|
|
2287
2301
|
var EmailField = BaseField.extend({
|
|
2288
2302
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2289
2303
|
configuration: import_v43.default.object({
|
|
2290
2304
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2291
2305
|
}).default({ maxLength: 255 }).optional(),
|
|
2292
2306
|
defaultValue: NonEmptyTextValue.optional()
|
|
2307
|
+
}).meta({
|
|
2308
|
+
description: "An email input field",
|
|
2309
|
+
id: "EmailField"
|
|
2293
2310
|
});
|
|
2294
2311
|
var DateField = BaseField.extend({
|
|
2295
2312
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2299,7 +2316,10 @@ var DateField = BaseField.extend({
|
|
|
2299
2316
|
"Text to display above the date input"
|
|
2300
2317
|
).optional()
|
|
2301
2318
|
}).optional()
|
|
2302
|
-
}).
|
|
2319
|
+
}).meta({
|
|
2320
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2321
|
+
id: "DateField"
|
|
2322
|
+
});
|
|
2303
2323
|
var AgeField = BaseField.extend({
|
|
2304
2324
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2305
2325
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2308,7 +2328,10 @@ var AgeField = BaseField.extend({
|
|
|
2308
2328
|
prefix: TranslationConfig.optional(),
|
|
2309
2329
|
postfix: TranslationConfig.optional()
|
|
2310
2330
|
})
|
|
2311
|
-
}).
|
|
2331
|
+
}).meta({
|
|
2332
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2333
|
+
id: "AgeField"
|
|
2334
|
+
});
|
|
2312
2335
|
var TimeField = BaseField.extend({
|
|
2313
2336
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2314
2337
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2318,7 +2341,10 @@ var TimeField = BaseField.extend({
|
|
|
2318
2341
|
"Text to display above the time input"
|
|
2319
2342
|
).optional()
|
|
2320
2343
|
}).optional()
|
|
2321
|
-
}).
|
|
2344
|
+
}).meta({
|
|
2345
|
+
description: "A single time input (HH-mm)",
|
|
2346
|
+
id: "TimeField"
|
|
2347
|
+
});
|
|
2322
2348
|
var DateRangeField = BaseField.extend({
|
|
2323
2349
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2324
2350
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2327,7 +2353,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2327
2353
|
"Text to display above the date input"
|
|
2328
2354
|
).optional()
|
|
2329
2355
|
}).optional()
|
|
2330
|
-
}).
|
|
2356
|
+
}).meta({
|
|
2357
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2358
|
+
id: "DateRangeField"
|
|
2359
|
+
});
|
|
2331
2360
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2332
2361
|
"reg12",
|
|
2333
2362
|
"reg14",
|
|
@@ -2371,18 +2400,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2371
2400
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2372
2401
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2373
2402
|
configuration: ImageConfiguration
|
|
2374
|
-
}).
|
|
2403
|
+
}).meta({
|
|
2404
|
+
description: "A read-only image component for form pages",
|
|
2405
|
+
id: "ImageViewField"
|
|
2406
|
+
});
|
|
2375
2407
|
var Paragraph = BaseField.extend({
|
|
2376
2408
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2377
2409
|
configuration: ParagraphConfiguration
|
|
2378
|
-
}).
|
|
2410
|
+
}).meta({
|
|
2411
|
+
description: "A read-only HTML <p> paragraph",
|
|
2412
|
+
id: "Paragraph"
|
|
2413
|
+
});
|
|
2379
2414
|
var Heading = BaseField.extend({
|
|
2380
2415
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2381
2416
|
configuration: HeadingConfiguration
|
|
2382
|
-
}).
|
|
2417
|
+
}).meta({
|
|
2418
|
+
description: "A read-only heading component for form pages",
|
|
2419
|
+
id: "Heading"
|
|
2420
|
+
});
|
|
2383
2421
|
var PageHeader = BaseField.extend({
|
|
2384
2422
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2385
|
-
}).
|
|
2423
|
+
}).meta({
|
|
2424
|
+
description: "A read-only header component for form pages",
|
|
2425
|
+
id: "PageHeader"
|
|
2426
|
+
});
|
|
2386
2427
|
var File = BaseField.extend({
|
|
2387
2428
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2388
2429
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2401,7 +2442,10 @@ var File = BaseField.extend({
|
|
|
2401
2442
|
}).default({
|
|
2402
2443
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2403
2444
|
})
|
|
2404
|
-
}).
|
|
2445
|
+
}).meta({
|
|
2446
|
+
description: "A file upload field",
|
|
2447
|
+
id: "File"
|
|
2448
|
+
});
|
|
2405
2449
|
var SelectOption = import_v43.default.object({
|
|
2406
2450
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2407
2451
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2418,7 +2462,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2418
2462
|
"Placeholder for the number field"
|
|
2419
2463
|
)
|
|
2420
2464
|
}).optional()
|
|
2421
|
-
}).
|
|
2465
|
+
}).meta({
|
|
2466
|
+
description: "A number with unit input field",
|
|
2467
|
+
id: "NumberWithUnitField"
|
|
2468
|
+
});
|
|
2422
2469
|
var RadioGroup = BaseField.extend({
|
|
2423
2470
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2424
2471
|
defaultValue: TextValue.optional(),
|
|
@@ -2428,7 +2475,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2428
2475
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2429
2476
|
}).optional()
|
|
2430
2477
|
}).optional()
|
|
2431
|
-
}).
|
|
2478
|
+
}).meta({
|
|
2479
|
+
description: "A grouped radio button field",
|
|
2480
|
+
id: "RadioGroup"
|
|
2481
|
+
});
|
|
2432
2482
|
var BulletList = BaseField.extend({
|
|
2433
2483
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2434
2484
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2437,7 +2487,10 @@ var BulletList = BaseField.extend({
|
|
|
2437
2487
|
fontVariant: HtmlFontVariant.optional()
|
|
2438
2488
|
}).optional()
|
|
2439
2489
|
}).default({})
|
|
2440
|
-
}).
|
|
2490
|
+
}).meta({
|
|
2491
|
+
description: "A list of bullet points",
|
|
2492
|
+
id: "BulletList"
|
|
2493
|
+
});
|
|
2441
2494
|
var Select = BaseField.extend({
|
|
2442
2495
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2443
2496
|
defaultValue: TextValue.optional(),
|
|
@@ -2452,7 +2505,10 @@ var Select = BaseField.extend({
|
|
|
2452
2505
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2453
2506
|
`
|
|
2454
2507
|
)
|
|
2455
|
-
}).
|
|
2508
|
+
}).meta({
|
|
2509
|
+
description: "A select input field",
|
|
2510
|
+
id: "Select"
|
|
2511
|
+
});
|
|
2456
2512
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2457
2513
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2458
2514
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2461,7 +2517,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2461
2517
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2462
2518
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2463
2519
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2464
|
-
}).
|
|
2520
|
+
}).meta({
|
|
2521
|
+
description: "A date range selection field",
|
|
2522
|
+
id: "SelectDateRangeField"
|
|
2523
|
+
});
|
|
2465
2524
|
var NameConfig = import_v43.default.object({
|
|
2466
2525
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2467
2526
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2492,26 +2551,41 @@ var NameField = BaseField.extend({
|
|
|
2492
2551
|
surname: { required: true }
|
|
2493
2552
|
}
|
|
2494
2553
|
}).optional()
|
|
2495
|
-
}).
|
|
2554
|
+
}).meta({
|
|
2555
|
+
description: "A field for entering a persons name",
|
|
2556
|
+
id: "NameField"
|
|
2557
|
+
});
|
|
2496
2558
|
var PhoneField = BaseField.extend({
|
|
2497
2559
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2498
2560
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2499
|
-
}).
|
|
2561
|
+
}).meta({
|
|
2562
|
+
description: "A field for entering a phone number",
|
|
2563
|
+
id: "PhoneField"
|
|
2564
|
+
});
|
|
2500
2565
|
var IdField = BaseField.extend({
|
|
2501
2566
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2502
2567
|
type: import_v43.default.literal(FieldType.ID)
|
|
2503
|
-
}).
|
|
2568
|
+
}).meta({
|
|
2569
|
+
description: "A field for entering an ID",
|
|
2570
|
+
id: "IdField"
|
|
2571
|
+
});
|
|
2504
2572
|
var Checkbox = BaseField.extend({
|
|
2505
2573
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2506
2574
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2507
|
-
}).
|
|
2575
|
+
}).meta({
|
|
2576
|
+
description: "A boolean checkbox field",
|
|
2577
|
+
id: "Checkbox"
|
|
2578
|
+
});
|
|
2508
2579
|
var Country = BaseField.extend({
|
|
2509
2580
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2510
2581
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2511
2582
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2512
2583
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2513
2584
|
)
|
|
2514
|
-
}).
|
|
2585
|
+
}).meta({
|
|
2586
|
+
description: "A field for selecting a country",
|
|
2587
|
+
id: "Country"
|
|
2588
|
+
});
|
|
2515
2589
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2516
2590
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2517
2591
|
);
|
|
@@ -2520,16 +2594,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2520
2594
|
"HEALTH_FACILITY",
|
|
2521
2595
|
"CRVS_OFFICE"
|
|
2522
2596
|
]);
|
|
2523
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2524
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2525
|
-
type: AdministrativeAreas,
|
|
2526
|
-
allowedLocations: AllowedLocations
|
|
2527
|
-
}).describe("Administrative area options");
|
|
2528
2597
|
var AdministrativeAreaField = BaseField.extend({
|
|
2529
2598
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2530
2599
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2531
|
-
configuration:
|
|
2532
|
-
|
|
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
|
+
});
|
|
2533
2609
|
var LocationInput = BaseField.extend({
|
|
2534
2610
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2535
2611
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2537,7 +2613,10 @@ var LocationInput = BaseField.extend({
|
|
|
2537
2613
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2538
2614
|
allowedLocations: AllowedLocations
|
|
2539
2615
|
}).optional()
|
|
2540
|
-
}).
|
|
2616
|
+
}).meta({
|
|
2617
|
+
description: "A field for selecting a location",
|
|
2618
|
+
id: "LocationInput"
|
|
2619
|
+
});
|
|
2541
2620
|
var FileUploadWithOptions = BaseField.extend({
|
|
2542
2621
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2543
2622
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2551,6 +2630,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2551
2630
|
}).default({
|
|
2552
2631
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2553
2632
|
})
|
|
2633
|
+
}).meta({
|
|
2634
|
+
description: "A field for uploading files with file type options",
|
|
2635
|
+
id: "FileUploadWithOptions"
|
|
2554
2636
|
});
|
|
2555
2637
|
var Facility = BaseField.extend({
|
|
2556
2638
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2596,7 +2678,10 @@ var Address = BaseField.extend({
|
|
|
2596
2678
|
allowedLocations: AllowedLocations
|
|
2597
2679
|
}).optional(),
|
|
2598
2680
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2599
|
-
}).
|
|
2681
|
+
}).meta({
|
|
2682
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2683
|
+
id: "Address"
|
|
2684
|
+
});
|
|
2600
2685
|
var StaticDataEntry = import_v43.default.object({
|
|
2601
2686
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2602
2687
|
label: TranslationConfig,
|
|
@@ -2611,7 +2696,10 @@ var DataField = BaseField.extend({
|
|
|
2611
2696
|
subtitle: TranslationConfig.optional(),
|
|
2612
2697
|
data: import_v43.default.array(DataEntry)
|
|
2613
2698
|
})
|
|
2614
|
-
}).
|
|
2699
|
+
}).meta({
|
|
2700
|
+
description: "A field for displaying a table of read-only data",
|
|
2701
|
+
id: "DataField"
|
|
2702
|
+
});
|
|
2615
2703
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2616
2704
|
var ButtonType = import_v43.default.enum([
|
|
2617
2705
|
"primary",
|
|
@@ -2638,11 +2726,17 @@ var ButtonField = BaseField.extend({
|
|
|
2638
2726
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2639
2727
|
defaultValue: ButtonFieldValue.optional(),
|
|
2640
2728
|
configuration: ButtonConfiguration
|
|
2641
|
-
}).
|
|
2729
|
+
}).meta({
|
|
2730
|
+
description: "A generic button that can be used to trigger an action",
|
|
2731
|
+
id: "ButtonField"
|
|
2732
|
+
});
|
|
2642
2733
|
var FieldGroup = BaseField.extend({
|
|
2643
2734
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2644
2735
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2645
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"
|
|
2646
2740
|
});
|
|
2647
2741
|
var AlphaPrintButton = BaseField.extend({
|
|
2648
2742
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2652,7 +2746,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2652
2746
|
"Label for the print button"
|
|
2653
2747
|
)
|
|
2654
2748
|
})
|
|
2655
|
-
}).
|
|
2749
|
+
}).meta({
|
|
2750
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2751
|
+
id: "AlphaPrintButton"
|
|
2752
|
+
});
|
|
2656
2753
|
var HttpField = BaseField.extend({
|
|
2657
2754
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2658
2755
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2668,7 +2765,10 @@ var HttpField = BaseField.extend({
|
|
|
2668
2765
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2669
2766
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2670
2767
|
})
|
|
2671
|
-
}).
|
|
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
|
+
});
|
|
2672
2772
|
var AutocompleteField = BaseField.extend({
|
|
2673
2773
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2674
2774
|
configuration: import_v43.default.object({
|
|
@@ -2681,7 +2781,10 @@ var AutocompleteField = BaseField.extend({
|
|
|
2681
2781
|
})
|
|
2682
2782
|
).optional()
|
|
2683
2783
|
})
|
|
2684
|
-
}).
|
|
2784
|
+
}).meta({
|
|
2785
|
+
description: "Autocomplete input field",
|
|
2786
|
+
id: "AutocompleteField"
|
|
2787
|
+
});
|
|
2685
2788
|
var SearchField = HttpField.extend({
|
|
2686
2789
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2687
2790
|
configuration: SearchQuery.pick({
|
|
@@ -2722,7 +2825,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2722
2825
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2723
2826
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2724
2827
|
})
|
|
2725
|
-
}).
|
|
2828
|
+
}).meta({
|
|
2829
|
+
description: "A button that opens a URL link",
|
|
2830
|
+
id: "LinkButtonField"
|
|
2831
|
+
});
|
|
2726
2832
|
var VerificationStatus = BaseField.extend({
|
|
2727
2833
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2728
2834
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2732,15 +2838,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2732
2838
|
"Explaining text on the banner in form."
|
|
2733
2839
|
)
|
|
2734
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"
|
|
2735
2844
|
});
|
|
2736
2845
|
var QueryParamReaderField = BaseField.extend({
|
|
2737
2846
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2738
2847
|
configuration: import_v43.default.object({
|
|
2739
2848
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2740
2849
|
})
|
|
2741
|
-
}).
|
|
2742
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2743
|
-
|
|
2850
|
+
}).meta({
|
|
2851
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2852
|
+
id: "QueryParamReaderField"
|
|
2853
|
+
});
|
|
2744
2854
|
var QrReaderField = BaseField.extend({
|
|
2745
2855
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2746
2856
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2751,7 +2861,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2751
2861
|
})
|
|
2752
2862
|
}).optional()
|
|
2753
2863
|
}).meta({
|
|
2754
|
-
description: "
|
|
2864
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2755
2865
|
id: "QrReaderField"
|
|
2756
2866
|
});
|
|
2757
2867
|
var IdReaderField = BaseField.extend({
|
|
@@ -2760,12 +2870,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2760
2870
|
methods: import_v43.default.array(
|
|
2761
2871
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2762
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"
|
|
2763
2876
|
});
|
|
2764
2877
|
var CustomField = BaseField.extend({
|
|
2765
2878
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2766
2879
|
defaultValue: CustomFieldValue.optional(),
|
|
2767
2880
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2768
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"
|
|
2769
2885
|
});
|
|
2770
2886
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2771
2887
|
var LoaderField = BaseField.extend({
|
|
@@ -2775,22 +2891,25 @@ var LoaderField = BaseField.extend({
|
|
|
2775
2891
|
configuration: import_v43.default.object({
|
|
2776
2892
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2777
2893
|
})
|
|
2778
|
-
}).
|
|
2779
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2780
|
-
|
|
2894
|
+
}).meta({
|
|
2895
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2896
|
+
id: "LoaderField"
|
|
2897
|
+
});
|
|
2781
2898
|
var HiddenField = BaseField.extend({
|
|
2782
2899
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2783
2900
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2784
2901
|
defaultValue: TextValue.optional()
|
|
2785
|
-
}).
|
|
2786
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2787
|
-
|
|
2902
|
+
}).meta({
|
|
2903
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2904
|
+
id: "HiddenField"
|
|
2905
|
+
});
|
|
2788
2906
|
var UserRoleField = BaseField.extend({
|
|
2789
2907
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2790
2908
|
defaultValue: TextValue.optional()
|
|
2791
|
-
}).
|
|
2792
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2793
|
-
|
|
2909
|
+
}).meta({
|
|
2910
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2911
|
+
id: "UserRoleField"
|
|
2912
|
+
});
|
|
2794
2913
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2795
2914
|
FieldGroup,
|
|
2796
2915
|
Address,
|
|
@@ -2889,10 +3008,10 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2889
3008
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2890
3009
|
actions: VerificationActionConfig
|
|
2891
3010
|
});
|
|
2892
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
3011
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3012
|
+
description: "Page configuration",
|
|
3013
|
+
id: "PageConfig"
|
|
3014
|
+
});
|
|
2896
3015
|
|
|
2897
3016
|
// ../commons/src/events/FormConfig.ts
|
|
2898
3017
|
var DeclarationFormConfig = z22.object({
|
|
@@ -3801,6 +3920,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3801
3920
|
function isAgeValue(value) {
|
|
3802
3921
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3803
3922
|
}
|
|
3923
|
+
function mergeWithBaseFormState(values, context) {
|
|
3924
|
+
return { ...context.baseFormState, ...values };
|
|
3925
|
+
}
|
|
3804
3926
|
function validate(schema, data) {
|
|
3805
3927
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3806
3928
|
if ("$form" in data) {
|
|
@@ -3839,7 +3961,7 @@ function isOnline() {
|
|
|
3839
3961
|
}
|
|
3840
3962
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3841
3963
|
return validate(conditional, {
|
|
3842
|
-
$form: values,
|
|
3964
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3843
3965
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3844
3966
|
$online: isOnline(),
|
|
3845
3967
|
$user: context.user,
|
|
@@ -3868,7 +3990,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3868
3990
|
return true;
|
|
3869
3991
|
}
|
|
3870
3992
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3871
|
-
$form: form,
|
|
3993
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3872
3994
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3873
3995
|
$online: isOnline(),
|
|
3874
3996
|
$user: context.user,
|
|
@@ -4060,7 +4182,7 @@ function runFieldValidations({
|
|
|
4060
4182
|
return [];
|
|
4061
4183
|
}
|
|
4062
4184
|
const conditionalParameters = {
|
|
4063
|
-
$form: form,
|
|
4185
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4064
4186
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4065
4187
|
/**
|
|
4066
4188
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4304,17 +4426,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4304
4426
|
}
|
|
4305
4427
|
return isConditionMet(page.conditional, formValues, context);
|
|
4306
4428
|
}
|
|
4307
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4429
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4308
4430
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4309
4431
|
function fn(prevVisibilityContext) {
|
|
4310
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4311
4432
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4312
4433
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4313
4434
|
if (!fieldConfig.length) {
|
|
4314
4435
|
return false;
|
|
4315
4436
|
}
|
|
4316
4437
|
const isHidden = fieldConfig.every(
|
|
4317
|
-
(f) => !isFieldVisible(f,
|
|
4438
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4318
4439
|
);
|
|
4319
4440
|
if (!isHidden) {
|
|
4320
4441
|
return false;
|
|
@@ -4332,7 +4453,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4332
4453
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4333
4454
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4334
4455
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4335
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4456
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4336
4457
|
});
|
|
4337
4458
|
return omitHiddenFields(
|
|
4338
4459
|
visibleFields,
|
|
@@ -4379,13 +4500,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4379
4500
|
}
|
|
4380
4501
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4381
4502
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4382
|
-
return omitHiddenFields(
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
false,
|
|
4387
|
-
declaration
|
|
4388
|
-
);
|
|
4503
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4504
|
+
...context,
|
|
4505
|
+
baseFormState: declaration
|
|
4506
|
+
});
|
|
4389
4507
|
}
|
|
4390
4508
|
function deepMerge(currentDocument, actionDocument) {
|
|
4391
4509
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5374,7 +5492,7 @@ var _EventConfigBase = z33.object({
|
|
|
5374
5492
|
),
|
|
5375
5493
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5376
5494
|
actions: z33.array(ActionConfig).describe(
|
|
5377
|
-
"Configuration of
|
|
5495
|
+
"Configuration of core and custom actions associated with the event."
|
|
5378
5496
|
),
|
|
5379
5497
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5380
5498
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5386,7 +5504,7 @@ var _EventConfigBase = z33.object({
|
|
|
5386
5504
|
"Configuration of fields available in the advanced search feature."
|
|
5387
5505
|
),
|
|
5388
5506
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5389
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5507
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5390
5508
|
),
|
|
5391
5509
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5392
5510
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5825,18 +5943,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5825
5943
|
query: true,
|
|
5826
5944
|
columns: true
|
|
5827
5945
|
});
|
|
5828
|
-
var WorkqueueConfigInput =
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
query: CountryConfigQueryInputType,
|
|
5834
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5835
|
-
"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."
|
|
5836
|
-
),
|
|
5837
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5838
|
-
icon: AvailableIcons,
|
|
5839
|
-
emptyMessage: TranslationConfig.optional()
|
|
5946
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
5947
|
+
query: CountryConfigQueryInputType
|
|
5948
|
+
}).meta({
|
|
5949
|
+
description: "Workqueue configuration",
|
|
5950
|
+
id: "WorkqueueConfig"
|
|
5840
5951
|
});
|
|
5841
5952
|
function defineWorkqueue(workqueueInput) {
|
|
5842
5953
|
const queryInput = workqueueInput.query;
|
|
@@ -5897,6 +6008,9 @@ var BaseActionInput = z38.object({
|
|
|
5897
6008
|
originalActionId: UUID.optional(),
|
|
5898
6009
|
// should not be part of base action.
|
|
5899
6010
|
keepAssignment: z38.boolean().optional(),
|
|
6011
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6012
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6013
|
+
waitFor: z38.boolean().optional(),
|
|
5900
6014
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5901
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.
|
|
5902
6016
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6150,7 +6264,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6150
6264
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6151
6265
|
acceptedAt: acceptAction.createdAt,
|
|
6152
6266
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6153
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6154
6267
|
registrationNumber
|
|
6155
6268
|
};
|
|
6156
6269
|
}
|
|
@@ -6364,17 +6477,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6364
6477
|
return user2;
|
|
6365
6478
|
}, null);
|
|
6366
6479
|
}
|
|
6367
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6368
|
-
return actions.reduce((signature, action) => {
|
|
6369
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6370
|
-
return action.createdBySignature || null;
|
|
6371
|
-
}
|
|
6372
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6373
|
-
return null;
|
|
6374
|
-
}
|
|
6375
|
-
return signature;
|
|
6376
|
-
}, null);
|
|
6377
|
-
}
|
|
6378
6480
|
function deepDropNulls(obj) {
|
|
6379
6481
|
if (Array.isArray(obj)) {
|
|
6380
6482
|
return obj.map(deepDropNulls);
|
|
@@ -6470,10 +6572,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6470
6572
|
createdBy: creationAction.createdBy,
|
|
6471
6573
|
createdByUserType: creationAction.createdByUserType,
|
|
6472
6574
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6473
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6474
6575
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6475
6576
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6476
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6477
6577
|
updatedBy: requestActionMetadata.createdBy,
|
|
6478
6578
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6479
6579
|
declaration,
|
|
@@ -9732,7 +9832,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9732
9832
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9733
9833
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9734
9834
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9735
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9736
9835
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9737
9836
|
assignedTo: overrides.assignedTo ?? null,
|
|
9738
9837
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -10003,6 +10102,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
|
10003
10102
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
10004
10103
|
);
|
|
10005
10104
|
}
|
|
10105
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10106
|
+
const collectedLocations = [];
|
|
10107
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10108
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10109
|
+
while (current) {
|
|
10110
|
+
collectedLocations.push(current);
|
|
10111
|
+
if (!current.parentId) {
|
|
10112
|
+
break;
|
|
10113
|
+
}
|
|
10114
|
+
const parentId = current.parentId;
|
|
10115
|
+
current = administrativeAreas.get(parentId);
|
|
10116
|
+
}
|
|
10117
|
+
return collectedLocations;
|
|
10118
|
+
}
|
|
10119
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10120
|
+
const { administrativeAreas, locations } = context;
|
|
10121
|
+
const loc = locations.get(selectedId);
|
|
10122
|
+
if (loc) {
|
|
10123
|
+
if (loc.administrativeAreaId) {
|
|
10124
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10125
|
+
loc.administrativeAreaId,
|
|
10126
|
+
administrativeAreas
|
|
10127
|
+
);
|
|
10128
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10129
|
+
}
|
|
10130
|
+
return [loc.id];
|
|
10131
|
+
}
|
|
10132
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10133
|
+
selectedId,
|
|
10134
|
+
administrativeAreas
|
|
10135
|
+
);
|
|
10136
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10137
|
+
}
|
|
10006
10138
|
|
|
10007
10139
|
// ../commons/src/events/scopes.ts
|
|
10008
10140
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10077,6 +10209,25 @@ function isActionInScope({
|
|
|
10077
10209
|
);
|
|
10078
10210
|
return canAccess;
|
|
10079
10211
|
}
|
|
10212
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10213
|
+
allRoles,
|
|
10214
|
+
userLocation,
|
|
10215
|
+
acceptedScopes,
|
|
10216
|
+
userRequesting
|
|
10217
|
+
}) {
|
|
10218
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10219
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10220
|
+
userToAccess: {
|
|
10221
|
+
...userLocation,
|
|
10222
|
+
role
|
|
10223
|
+
},
|
|
10224
|
+
user: userRequesting,
|
|
10225
|
+
scopes: acceptedScopes
|
|
10226
|
+
});
|
|
10227
|
+
return canAccess;
|
|
10228
|
+
});
|
|
10229
|
+
return availableRoles;
|
|
10230
|
+
}
|
|
10080
10231
|
|
|
10081
10232
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10082
10233
|
function userDeserializer(serializedUserField, user2) {
|