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