@opencrvs/toolkit 2.0.0-rc.474f7a9 → 2.0.0-rc.4844c26
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 +248 -92
- package/dist/cli.js +539 -175
- package/dist/commons/api/router.d.ts +3334 -268
- package/dist/commons/application-config/index.d.ts +16 -4
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- 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 +10 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
- package/dist/commons/events/locations.d.ts +38 -1
- 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 +40 -8
- package/dist/events/index.js +394 -144
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +537 -173
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- package/dist/notification/index.js +288 -114
- package/dist/scopes/index.d.ts +87 -10
- package/dist/scopes/index.js +46 -9
- package/opencrvs-toolkit-2.0.0-rc.4844c26.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.474f7a9.tgz +0 -0
package/dist/events/index.js
CHANGED
|
@@ -243,6 +243,8 @@ __export(events_exports, {
|
|
|
243
243
|
areConditionsMet: () => areConditionsMet,
|
|
244
244
|
buildFormState: () => buildFormState,
|
|
245
245
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
246
|
+
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
247
|
+
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
246
248
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
247
249
|
createEmptyDraft: () => createEmptyDraft,
|
|
248
250
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -300,12 +302,13 @@ __export(events_exports, {
|
|
|
300
302
|
getActionConfig: () => getActionConfig,
|
|
301
303
|
getActionReview: () => getActionReview,
|
|
302
304
|
getActionReviewFields: () => getActionReviewFields,
|
|
305
|
+
getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
|
|
303
306
|
getAllUniqueFields: () => getAllUniqueFields,
|
|
304
307
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
|
305
308
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
|
306
|
-
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
|
307
309
|
getAssignmentStatus: () => getAssignmentStatus,
|
|
308
310
|
getAvailableActionsForEvent: () => getAvailableActionsForEvent,
|
|
311
|
+
getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
|
|
309
312
|
getCompleteActionAnnotation: () => getCompleteActionAnnotation,
|
|
310
313
|
getCompleteActionDeclaration: () => getCompleteActionDeclaration,
|
|
311
314
|
getCurrentEventState: () => getCurrentEventState,
|
|
@@ -316,6 +319,7 @@ __export(events_exports, {
|
|
|
316
319
|
getDeclarationPages: () => getDeclarationPages,
|
|
317
320
|
getEventConfigById: () => getEventConfigById,
|
|
318
321
|
getFilePathsFromEvent: () => getFilePathsFromEvent,
|
|
322
|
+
getLocationHierarchy: () => getLocationHierarchy,
|
|
319
323
|
getMixedPath: () => getMixedPath,
|
|
320
324
|
getPendingAction: () => getPendingAction,
|
|
321
325
|
getPrintCertificatePages: () => getPrintCertificatePages,
|
|
@@ -489,6 +493,10 @@ var scopeByEvent = z2.preprocess(
|
|
|
489
493
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
494
|
z2.array(z2.string()).optional()
|
|
491
495
|
).describe("Event type, e.g. birth, death");
|
|
496
|
+
var userRole = z2.preprocess(
|
|
497
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
498
|
+
z2.array(z2.string()).optional()
|
|
499
|
+
).describe("User role, e.g. admin, field agent");
|
|
492
500
|
var scopeOptionsPlaceEvent = z2.object({
|
|
493
501
|
event: scopeByEvent,
|
|
494
502
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -512,6 +520,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
512
520
|
var AccessLevelOptions = z2.object({
|
|
513
521
|
accessLevel: JurisdictionFilter.optional()
|
|
514
522
|
});
|
|
523
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
524
|
+
role: userRole.optional()
|
|
525
|
+
});
|
|
515
526
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
527
|
ids: z2.preprocess(
|
|
517
528
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -521,6 +532,7 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
521
532
|
var AllScopeOptions = z2.object({
|
|
522
533
|
...AllRecordScopeOptions.shape,
|
|
523
534
|
...AccessLevelOptions.shape,
|
|
535
|
+
...AllUserScopeOptions.shape,
|
|
524
536
|
...WorkqueueOrDashboardOptions.shape
|
|
525
537
|
});
|
|
526
538
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -593,6 +605,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
593
605
|
]).describe(
|
|
594
606
|
"Scopes used to check user's permission to perform actions on a record."
|
|
595
607
|
);
|
|
608
|
+
var SystemScopeType = z2.enum([
|
|
609
|
+
"organisation.read-locations",
|
|
610
|
+
"user.read",
|
|
611
|
+
"user.create",
|
|
612
|
+
"user.edit",
|
|
613
|
+
"user.search"
|
|
614
|
+
]);
|
|
615
|
+
var UserScopeType = SystemScopeType.extract([
|
|
616
|
+
"user.read",
|
|
617
|
+
"user.create",
|
|
618
|
+
"user.edit",
|
|
619
|
+
"user.search"
|
|
620
|
+
]);
|
|
621
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
622
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
623
|
+
z2.object({
|
|
624
|
+
type: ScopesWithRoleOption,
|
|
625
|
+
options: AllUserScopeOptions.optional()
|
|
626
|
+
}),
|
|
627
|
+
z2.object({
|
|
628
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
629
|
+
options: AccessLevelOptions.optional()
|
|
630
|
+
})
|
|
631
|
+
]);
|
|
632
|
+
function scopeUsesRoleOptions(scope) {
|
|
633
|
+
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
634
|
+
}
|
|
596
635
|
function scopeUsesDeclaredOptions(scope) {
|
|
597
636
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
637
|
}
|
|
@@ -625,16 +664,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
625
664
|
}).optional()
|
|
626
665
|
})
|
|
627
666
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
628
|
-
var SystemScopeType = z2.enum([
|
|
629
|
-
"organisation.read-locations",
|
|
630
|
-
"user.read",
|
|
631
|
-
"user.create",
|
|
632
|
-
"user.edit"
|
|
633
|
-
]);
|
|
634
667
|
var Scope = z2.discriminatedUnion("type", [
|
|
635
668
|
z2.object({ type: PlainScopeType }),
|
|
636
669
|
...RecordScopeV2.options,
|
|
637
|
-
|
|
670
|
+
...UserScopeV2.options,
|
|
671
|
+
z2.object({
|
|
672
|
+
type: z2.literal("organisation.read-locations"),
|
|
673
|
+
options: AccessLevelOptions.optional()
|
|
674
|
+
}),
|
|
638
675
|
z2.object({
|
|
639
676
|
type: z2.literal("workqueue"),
|
|
640
677
|
options: WorkqueueOrDashboardOptions
|
|
@@ -667,7 +704,9 @@ var decodeScope = (query) => {
|
|
|
667
704
|
};
|
|
668
705
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
669
706
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
670
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
707
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
708
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
709
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
671
710
|
};
|
|
672
711
|
function getAcceptedScopesByType({
|
|
673
712
|
acceptedScopes,
|
|
@@ -1040,7 +1079,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
1040
1079
|
ShowConditional,
|
|
1041
1080
|
// Action can be shown to the user in the list but as disabled
|
|
1042
1081
|
EnableConditional
|
|
1043
|
-
])
|
|
1082
|
+
]).meta({
|
|
1083
|
+
description: "Action conditional configuration",
|
|
1084
|
+
id: "ActionConditional"
|
|
1085
|
+
});
|
|
1044
1086
|
var DisplayOnReviewConditional = z7.object({
|
|
1045
1087
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
1046
1088
|
conditional: Conditional
|
|
@@ -1376,28 +1418,20 @@ function schemaPriority(schema) {
|
|
|
1376
1418
|
return idx === -1 ? 9999 : idx;
|
|
1377
1419
|
}
|
|
1378
1420
|
function safeUnion(schemas) {
|
|
1421
|
+
const sortedSchemas = [...schemas].sort(
|
|
1422
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
1423
|
+
);
|
|
1379
1424
|
return z12.any().superRefine((val, ctx) => {
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
if (successful.length === 0) {
|
|
1385
|
-
ctx.addIssue({
|
|
1386
|
-
code: "invalid_type",
|
|
1387
|
-
expected: "custom",
|
|
1388
|
-
message: "Value does not match any schema"
|
|
1389
|
-
});
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
1393
|
-
const best = successful[0];
|
|
1394
|
-
if (!best.safeParse(val).success) {
|
|
1395
|
-
ctx.addIssue({
|
|
1396
|
-
expected: "custom",
|
|
1397
|
-
code: "invalid_type",
|
|
1398
|
-
message: "Value did not match the best schema"
|
|
1399
|
-
});
|
|
1425
|
+
for (const schema of sortedSchemas) {
|
|
1426
|
+
if (schema.safeParse(val).success) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1400
1429
|
}
|
|
1430
|
+
ctx.addIssue({
|
|
1431
|
+
code: "invalid_type",
|
|
1432
|
+
expected: "custom",
|
|
1433
|
+
message: "Value does not match any schema"
|
|
1434
|
+
});
|
|
1401
1435
|
}).meta({
|
|
1402
1436
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1403
1437
|
});
|
|
@@ -1707,6 +1741,9 @@ var FlagConfig = z15.object({
|
|
|
1707
1741
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1708
1742
|
),
|
|
1709
1743
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1744
|
+
}).meta({
|
|
1745
|
+
description: "Flag configuration",
|
|
1746
|
+
id: "FlagConfig"
|
|
1710
1747
|
});
|
|
1711
1748
|
var ActionFlagConfig = z15.object({
|
|
1712
1749
|
id: Flag,
|
|
@@ -1714,6 +1751,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1714
1751
|
conditional: Conditional.optional().describe(
|
|
1715
1752
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1716
1753
|
)
|
|
1754
|
+
}).meta({
|
|
1755
|
+
description: "Action flag configuration",
|
|
1756
|
+
id: "ActionFlagConfig"
|
|
1717
1757
|
});
|
|
1718
1758
|
|
|
1719
1759
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1735,8 +1775,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1735
1775
|
),
|
|
1736
1776
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1737
1777
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1738
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1739
|
-
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.")
|
|
1740
1779
|
});
|
|
1741
1780
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1742
1781
|
registrationNumber: z16.string().describe(
|
|
@@ -1764,9 +1803,6 @@ var EventMetadata = z16.object({
|
|
|
1764
1803
|
createdAtLocation: UUID.nullish().describe(
|
|
1765
1804
|
"Location of the user who created the event."
|
|
1766
1805
|
),
|
|
1767
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1768
|
-
"Signature of the user who created the event."
|
|
1769
|
-
),
|
|
1770
1806
|
updatedAtLocation: UUID.nullish().describe(
|
|
1771
1807
|
"Location of the user who last changed the status."
|
|
1772
1808
|
),
|
|
@@ -2141,7 +2177,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
2141
2177
|
}
|
|
2142
2178
|
}).describe("Unique identifier for the field");
|
|
2143
2179
|
var FieldReference = import_v43.default.object({
|
|
2144
|
-
$$field: FieldId,
|
|
2180
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
2145
2181
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
2146
2182
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
2147
2183
|
)
|
|
@@ -2187,6 +2223,9 @@ var BaseField = import_v43.default.object({
|
|
|
2187
2223
|
}).describe("Common properties shared across all field types.");
|
|
2188
2224
|
var Divider = BaseField.extend({
|
|
2189
2225
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
2226
|
+
}).meta({
|
|
2227
|
+
description: "A horizontal line divider",
|
|
2228
|
+
id: "Divider"
|
|
2190
2229
|
});
|
|
2191
2230
|
var TextField = BaseField.extend({
|
|
2192
2231
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
@@ -2197,7 +2236,10 @@ var TextField = BaseField.extend({
|
|
|
2197
2236
|
prefix: TranslationConfig.optional(),
|
|
2198
2237
|
postfix: TranslationConfig.optional()
|
|
2199
2238
|
}).default({ type: "text" }).optional()
|
|
2200
|
-
}).
|
|
2239
|
+
}).meta({
|
|
2240
|
+
description: "A text input field",
|
|
2241
|
+
id: "TextField"
|
|
2242
|
+
});
|
|
2201
2243
|
var NumberField = BaseField.extend({
|
|
2202
2244
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
2203
2245
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2207,7 +2249,10 @@ var NumberField = BaseField.extend({
|
|
|
2207
2249
|
prefix: TranslationConfig.optional(),
|
|
2208
2250
|
postfix: TranslationConfig.optional()
|
|
2209
2251
|
}).optional()
|
|
2210
|
-
}).
|
|
2252
|
+
}).meta({
|
|
2253
|
+
description: "A number input field",
|
|
2254
|
+
id: "NumberField"
|
|
2255
|
+
});
|
|
2211
2256
|
var TextAreaField = BaseField.extend({
|
|
2212
2257
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
2213
2258
|
defaultValue: NonEmptyTextValue.optional(),
|
|
@@ -2218,7 +2263,10 @@ var TextAreaField = BaseField.extend({
|
|
|
2218
2263
|
prefix: TranslationConfig.optional(),
|
|
2219
2264
|
postfix: TranslationConfig.optional()
|
|
2220
2265
|
}).default({ rows: 4 }).optional()
|
|
2221
|
-
}).
|
|
2266
|
+
}).meta({
|
|
2267
|
+
description: "A multiline text input",
|
|
2268
|
+
id: "TextAreaField"
|
|
2269
|
+
});
|
|
2222
2270
|
var ImageMimeType = import_v43.default.enum([
|
|
2223
2271
|
"image/png",
|
|
2224
2272
|
"image/jpg",
|
|
@@ -2248,13 +2296,19 @@ var SignatureField = BaseField.extend({
|
|
|
2248
2296
|
}).default({
|
|
2249
2297
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2250
2298
|
})
|
|
2251
|
-
}).
|
|
2299
|
+
}).meta({
|
|
2300
|
+
description: "A signature input field",
|
|
2301
|
+
id: "SignatureField"
|
|
2302
|
+
});
|
|
2252
2303
|
var EmailField = BaseField.extend({
|
|
2253
2304
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
2254
2305
|
configuration: import_v43.default.object({
|
|
2255
2306
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
2256
2307
|
}).default({ maxLength: 255 }).optional(),
|
|
2257
2308
|
defaultValue: NonEmptyTextValue.optional()
|
|
2309
|
+
}).meta({
|
|
2310
|
+
description: "An email input field",
|
|
2311
|
+
id: "EmailField"
|
|
2258
2312
|
});
|
|
2259
2313
|
var DateField = BaseField.extend({
|
|
2260
2314
|
type: import_v43.default.literal(FieldType.DATE),
|
|
@@ -2264,7 +2318,10 @@ var DateField = BaseField.extend({
|
|
|
2264
2318
|
"Text to display above the date input"
|
|
2265
2319
|
).optional()
|
|
2266
2320
|
}).optional()
|
|
2267
|
-
}).
|
|
2321
|
+
}).meta({
|
|
2322
|
+
description: "A date input (yyyy-MM-dd)",
|
|
2323
|
+
id: "DateField"
|
|
2324
|
+
});
|
|
2268
2325
|
var AgeField = BaseField.extend({
|
|
2269
2326
|
type: import_v43.default.literal(FieldType.AGE),
|
|
2270
2327
|
defaultValue: NumberFieldValue.optional(),
|
|
@@ -2273,7 +2330,10 @@ var AgeField = BaseField.extend({
|
|
|
2273
2330
|
prefix: TranslationConfig.optional(),
|
|
2274
2331
|
postfix: TranslationConfig.optional()
|
|
2275
2332
|
})
|
|
2276
|
-
}).
|
|
2333
|
+
}).meta({
|
|
2334
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
2335
|
+
id: "AgeField"
|
|
2336
|
+
});
|
|
2277
2337
|
var TimeField = BaseField.extend({
|
|
2278
2338
|
type: import_v43.default.literal(FieldType.TIME),
|
|
2279
2339
|
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
@@ -2283,7 +2343,10 @@ var TimeField = BaseField.extend({
|
|
|
2283
2343
|
"Text to display above the time input"
|
|
2284
2344
|
).optional()
|
|
2285
2345
|
}).optional()
|
|
2286
|
-
}).
|
|
2346
|
+
}).meta({
|
|
2347
|
+
description: "A single time input (HH-mm)",
|
|
2348
|
+
id: "TimeField"
|
|
2349
|
+
});
|
|
2287
2350
|
var DateRangeField = BaseField.extend({
|
|
2288
2351
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
2289
2352
|
defaultValue: DateRangeFieldValue.optional(),
|
|
@@ -2292,7 +2355,10 @@ var DateRangeField = BaseField.extend({
|
|
|
2292
2355
|
"Text to display above the date input"
|
|
2293
2356
|
).optional()
|
|
2294
2357
|
}).optional()
|
|
2295
|
-
}).
|
|
2358
|
+
}).meta({
|
|
2359
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
2360
|
+
id: "DateRangeField"
|
|
2361
|
+
});
|
|
2296
2362
|
var HtmlFontVariant = import_v43.default.enum([
|
|
2297
2363
|
"reg12",
|
|
2298
2364
|
"reg14",
|
|
@@ -2336,18 +2402,30 @@ var ImageViewField = BaseField.extend({
|
|
|
2336
2402
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
2337
2403
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2338
2404
|
configuration: ImageConfiguration
|
|
2339
|
-
}).
|
|
2405
|
+
}).meta({
|
|
2406
|
+
description: "A read-only image component for form pages",
|
|
2407
|
+
id: "ImageViewField"
|
|
2408
|
+
});
|
|
2340
2409
|
var Paragraph = BaseField.extend({
|
|
2341
2410
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
2342
2411
|
configuration: ParagraphConfiguration
|
|
2343
|
-
}).
|
|
2412
|
+
}).meta({
|
|
2413
|
+
description: "A read-only HTML <p> paragraph",
|
|
2414
|
+
id: "Paragraph"
|
|
2415
|
+
});
|
|
2344
2416
|
var Heading = BaseField.extend({
|
|
2345
2417
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
2346
2418
|
configuration: HeadingConfiguration
|
|
2347
|
-
}).
|
|
2419
|
+
}).meta({
|
|
2420
|
+
description: "A read-only heading component for form pages",
|
|
2421
|
+
id: "Heading"
|
|
2422
|
+
});
|
|
2348
2423
|
var PageHeader = BaseField.extend({
|
|
2349
2424
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
2350
|
-
}).
|
|
2425
|
+
}).meta({
|
|
2426
|
+
description: "A read-only header component for form pages",
|
|
2427
|
+
id: "PageHeader"
|
|
2428
|
+
});
|
|
2351
2429
|
var File = BaseField.extend({
|
|
2352
2430
|
type: import_v43.default.literal(FieldType.FILE),
|
|
2353
2431
|
defaultValue: FileFieldValue.optional(),
|
|
@@ -2366,7 +2444,10 @@ var File = BaseField.extend({
|
|
|
2366
2444
|
}).default({
|
|
2367
2445
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2368
2446
|
})
|
|
2369
|
-
}).
|
|
2447
|
+
}).meta({
|
|
2448
|
+
description: "A file upload field",
|
|
2449
|
+
id: "File"
|
|
2450
|
+
});
|
|
2370
2451
|
var SelectOption = import_v43.default.object({
|
|
2371
2452
|
value: import_v43.default.string().describe("The value of the option"),
|
|
2372
2453
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -2383,7 +2464,10 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
2383
2464
|
"Placeholder for the number field"
|
|
2384
2465
|
)
|
|
2385
2466
|
}).optional()
|
|
2386
|
-
}).
|
|
2467
|
+
}).meta({
|
|
2468
|
+
description: "A number with unit input field",
|
|
2469
|
+
id: "NumberWithUnitField"
|
|
2470
|
+
});
|
|
2387
2471
|
var RadioGroup = BaseField.extend({
|
|
2388
2472
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
2389
2473
|
defaultValue: TextValue.optional(),
|
|
@@ -2393,7 +2477,10 @@ var RadioGroup = BaseField.extend({
|
|
|
2393
2477
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
2394
2478
|
}).optional()
|
|
2395
2479
|
}).optional()
|
|
2396
|
-
}).
|
|
2480
|
+
}).meta({
|
|
2481
|
+
description: "A grouped radio button field",
|
|
2482
|
+
id: "RadioGroup"
|
|
2483
|
+
});
|
|
2397
2484
|
var BulletList = BaseField.extend({
|
|
2398
2485
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
2399
2486
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -2402,7 +2489,10 @@ var BulletList = BaseField.extend({
|
|
|
2402
2489
|
fontVariant: HtmlFontVariant.optional()
|
|
2403
2490
|
}).optional()
|
|
2404
2491
|
}).default({})
|
|
2405
|
-
}).
|
|
2492
|
+
}).meta({
|
|
2493
|
+
description: "A list of bullet points",
|
|
2494
|
+
id: "BulletList"
|
|
2495
|
+
});
|
|
2406
2496
|
var Select = BaseField.extend({
|
|
2407
2497
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
2408
2498
|
defaultValue: TextValue.optional(),
|
|
@@ -2417,7 +2507,10 @@ var Select = BaseField.extend({
|
|
|
2417
2507
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
2418
2508
|
`
|
|
2419
2509
|
)
|
|
2420
|
-
}).
|
|
2510
|
+
}).meta({
|
|
2511
|
+
description: "A select input field",
|
|
2512
|
+
id: "Select"
|
|
2513
|
+
});
|
|
2421
2514
|
var SelectDateRangeOption = import_v43.default.object({
|
|
2422
2515
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
2423
2516
|
label: TranslationConfig.describe("The label of the option")
|
|
@@ -2426,7 +2519,10 @@ var SelectDateRangeField = BaseField.extend({
|
|
|
2426
2519
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2427
2520
|
defaultValue: SelectDateRangeValue.optional(),
|
|
2428
2521
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2429
|
-
}).
|
|
2522
|
+
}).meta({
|
|
2523
|
+
description: "A date range selection field",
|
|
2524
|
+
id: "SelectDateRangeField"
|
|
2525
|
+
});
|
|
2430
2526
|
var NameConfig = import_v43.default.object({
|
|
2431
2527
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
2432
2528
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -2457,26 +2553,41 @@ var NameField = BaseField.extend({
|
|
|
2457
2553
|
surname: { required: true }
|
|
2458
2554
|
}
|
|
2459
2555
|
}).optional()
|
|
2460
|
-
}).
|
|
2556
|
+
}).meta({
|
|
2557
|
+
description: "A field for entering a persons name",
|
|
2558
|
+
id: "NameField"
|
|
2559
|
+
});
|
|
2461
2560
|
var PhoneField = BaseField.extend({
|
|
2462
2561
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2463
2562
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2464
|
-
}).
|
|
2563
|
+
}).meta({
|
|
2564
|
+
description: "A field for entering a phone number",
|
|
2565
|
+
id: "PhoneField"
|
|
2566
|
+
});
|
|
2465
2567
|
var IdField = BaseField.extend({
|
|
2466
2568
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2467
2569
|
type: import_v43.default.literal(FieldType.ID)
|
|
2468
|
-
}).
|
|
2570
|
+
}).meta({
|
|
2571
|
+
description: "A field for entering an ID",
|
|
2572
|
+
id: "IdField"
|
|
2573
|
+
});
|
|
2469
2574
|
var Checkbox = BaseField.extend({
|
|
2470
2575
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2471
2576
|
defaultValue: CheckboxFieldValue.default(false)
|
|
2472
|
-
}).
|
|
2577
|
+
}).meta({
|
|
2578
|
+
description: "A boolean checkbox field",
|
|
2579
|
+
id: "Checkbox"
|
|
2580
|
+
});
|
|
2473
2581
|
var Country = BaseField.extend({
|
|
2474
2582
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2475
2583
|
defaultValue: NonEmptyTextValue.optional(),
|
|
2476
2584
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2477
2585
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2478
2586
|
)
|
|
2479
|
-
}).
|
|
2587
|
+
}).meta({
|
|
2588
|
+
description: "A field for selecting a country",
|
|
2589
|
+
id: "Country"
|
|
2590
|
+
});
|
|
2480
2591
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2481
2592
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2482
2593
|
);
|
|
@@ -2485,16 +2596,18 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2485
2596
|
"HEALTH_FACILITY",
|
|
2486
2597
|
"CRVS_OFFICE"
|
|
2487
2598
|
]);
|
|
2488
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2489
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2490
|
-
type: AdministrativeAreas,
|
|
2491
|
-
allowedLocations: AllowedLocations
|
|
2492
|
-
}).describe("Administrative area options");
|
|
2493
2599
|
var AdministrativeAreaField = BaseField.extend({
|
|
2494
2600
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2495
2601
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2496
|
-
configuration:
|
|
2497
|
-
|
|
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
|
+
});
|
|
2498
2611
|
var LocationInput = BaseField.extend({
|
|
2499
2612
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2500
2613
|
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
@@ -2502,7 +2615,10 @@ var LocationInput = BaseField.extend({
|
|
|
2502
2615
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2503
2616
|
allowedLocations: AllowedLocations
|
|
2504
2617
|
}).optional()
|
|
2505
|
-
}).
|
|
2618
|
+
}).meta({
|
|
2619
|
+
description: "A field for selecting a location",
|
|
2620
|
+
id: "LocationInput"
|
|
2621
|
+
});
|
|
2506
2622
|
var FileUploadWithOptions = BaseField.extend({
|
|
2507
2623
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2508
2624
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
@@ -2516,6 +2632,9 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2516
2632
|
}).default({
|
|
2517
2633
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2518
2634
|
})
|
|
2635
|
+
}).meta({
|
|
2636
|
+
description: "A field for uploading files with file type options",
|
|
2637
|
+
id: "FileUploadWithOptions"
|
|
2519
2638
|
});
|
|
2520
2639
|
var Facility = BaseField.extend({
|
|
2521
2640
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
@@ -2561,7 +2680,10 @@ var Address = BaseField.extend({
|
|
|
2561
2680
|
allowedLocations: AllowedLocations
|
|
2562
2681
|
}).optional(),
|
|
2563
2682
|
defaultValue: DefaultAddressFieldValue.optional()
|
|
2564
|
-
}).
|
|
2683
|
+
}).meta({
|
|
2684
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2685
|
+
id: "Address"
|
|
2686
|
+
});
|
|
2565
2687
|
var StaticDataEntry = import_v43.default.object({
|
|
2566
2688
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2567
2689
|
label: TranslationConfig,
|
|
@@ -2576,7 +2698,10 @@ var DataField = BaseField.extend({
|
|
|
2576
2698
|
subtitle: TranslationConfig.optional(),
|
|
2577
2699
|
data: import_v43.default.array(DataEntry)
|
|
2578
2700
|
})
|
|
2579
|
-
}).
|
|
2701
|
+
}).meta({
|
|
2702
|
+
description: "A field for displaying a table of read-only data",
|
|
2703
|
+
id: "DataField"
|
|
2704
|
+
});
|
|
2580
2705
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2581
2706
|
var ButtonType = import_v43.default.enum([
|
|
2582
2707
|
"primary",
|
|
@@ -2603,11 +2728,17 @@ var ButtonField = BaseField.extend({
|
|
|
2603
2728
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2604
2729
|
defaultValue: ButtonFieldValue.optional(),
|
|
2605
2730
|
configuration: ButtonConfiguration
|
|
2606
|
-
}).
|
|
2731
|
+
}).meta({
|
|
2732
|
+
description: "A generic button that can be used to trigger an action",
|
|
2733
|
+
id: "ButtonField"
|
|
2734
|
+
});
|
|
2607
2735
|
var FieldGroup = BaseField.extend({
|
|
2608
2736
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2609
2737
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2610
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"
|
|
2611
2742
|
});
|
|
2612
2743
|
var AlphaPrintButton = BaseField.extend({
|
|
2613
2744
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2617,7 +2748,10 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2617
2748
|
"Label for the print button"
|
|
2618
2749
|
)
|
|
2619
2750
|
})
|
|
2620
|
-
}).
|
|
2751
|
+
}).meta({
|
|
2752
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2753
|
+
id: "AlphaPrintButton"
|
|
2754
|
+
});
|
|
2621
2755
|
var HttpField = BaseField.extend({
|
|
2622
2756
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2623
2757
|
defaultValue: HttpFieldValue.optional(),
|
|
@@ -2633,20 +2767,30 @@ var HttpField = BaseField.extend({
|
|
|
2633
2767
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2634
2768
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2635
2769
|
})
|
|
2636
|
-
}).
|
|
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
|
+
});
|
|
2637
2774
|
var AutocompleteField = BaseField.extend({
|
|
2638
2775
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2639
2776
|
configuration: import_v43.default.object({
|
|
2640
|
-
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(),
|
|
2641
2780
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2642
2781
|
defaultOptions: import_v43.default.array(
|
|
2643
2782
|
import_v43.default.object({
|
|
2644
2783
|
label: import_v43.default.string(),
|
|
2645
2784
|
value: import_v43.default.string()
|
|
2646
2785
|
})
|
|
2647
|
-
).optional()
|
|
2786
|
+
).optional().describe(
|
|
2787
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2788
|
+
)
|
|
2648
2789
|
})
|
|
2649
|
-
}).
|
|
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
|
+
});
|
|
2650
2794
|
var SearchField = HttpField.extend({
|
|
2651
2795
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2652
2796
|
configuration: SearchQuery.pick({
|
|
@@ -2679,6 +2823,9 @@ var SearchField = HttpField.extend({
|
|
|
2679
2823
|
ok: TranslationConfig.optional()
|
|
2680
2824
|
}).optional()
|
|
2681
2825
|
})
|
|
2826
|
+
}).meta({
|
|
2827
|
+
description: "A search input field",
|
|
2828
|
+
id: "SearchField"
|
|
2682
2829
|
});
|
|
2683
2830
|
var LinkButtonField = BaseField.extend({
|
|
2684
2831
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2687,7 +2834,10 @@ var LinkButtonField = BaseField.extend({
|
|
|
2687
2834
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2688
2835
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2689
2836
|
})
|
|
2690
|
-
}).
|
|
2837
|
+
}).meta({
|
|
2838
|
+
description: "A button that opens a URL link",
|
|
2839
|
+
id: "LinkButtonField"
|
|
2840
|
+
});
|
|
2691
2841
|
var VerificationStatus = BaseField.extend({
|
|
2692
2842
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2693
2843
|
defaultValue: VerificationStatusValue.optional(),
|
|
@@ -2697,15 +2847,19 @@ var VerificationStatus = BaseField.extend({
|
|
|
2697
2847
|
"Explaining text on the banner in form."
|
|
2698
2848
|
)
|
|
2699
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"
|
|
2700
2853
|
});
|
|
2701
2854
|
var QueryParamReaderField = BaseField.extend({
|
|
2702
2855
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2703
2856
|
configuration: import_v43.default.object({
|
|
2704
2857
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2705
2858
|
})
|
|
2706
|
-
}).
|
|
2707
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2708
|
-
|
|
2859
|
+
}).meta({
|
|
2860
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2861
|
+
id: "QueryParamReaderField"
|
|
2862
|
+
});
|
|
2709
2863
|
var QrReaderField = BaseField.extend({
|
|
2710
2864
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2711
2865
|
defaultValue: QrReaderFieldValue.optional(),
|
|
@@ -2716,7 +2870,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2716
2870
|
})
|
|
2717
2871
|
}).optional()
|
|
2718
2872
|
}).meta({
|
|
2719
|
-
description: "
|
|
2873
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2720
2874
|
id: "QrReaderField"
|
|
2721
2875
|
});
|
|
2722
2876
|
var IdReaderField = BaseField.extend({
|
|
@@ -2725,12 +2879,18 @@ var IdReaderField = BaseField.extend({
|
|
|
2725
2879
|
methods: import_v43.default.array(
|
|
2726
2880
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2727
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"
|
|
2728
2885
|
});
|
|
2729
2886
|
var CustomField = BaseField.extend({
|
|
2730
2887
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2731
2888
|
defaultValue: CustomFieldValue.optional(),
|
|
2732
2889
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2733
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"
|
|
2734
2894
|
});
|
|
2735
2895
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2736
2896
|
var LoaderField = BaseField.extend({
|
|
@@ -2740,22 +2900,25 @@ var LoaderField = BaseField.extend({
|
|
|
2740
2900
|
configuration: import_v43.default.object({
|
|
2741
2901
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2742
2902
|
})
|
|
2743
|
-
}).
|
|
2744
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2745
|
-
|
|
2903
|
+
}).meta({
|
|
2904
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2905
|
+
id: "LoaderField"
|
|
2906
|
+
});
|
|
2746
2907
|
var HiddenField = BaseField.extend({
|
|
2747
2908
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2748
2909
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2749
2910
|
defaultValue: TextValue.optional()
|
|
2750
|
-
}).
|
|
2751
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2752
|
-
|
|
2911
|
+
}).meta({
|
|
2912
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2913
|
+
id: "HiddenField"
|
|
2914
|
+
});
|
|
2753
2915
|
var UserRoleField = BaseField.extend({
|
|
2754
2916
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2755
2917
|
defaultValue: TextValue.optional()
|
|
2756
|
-
}).
|
|
2757
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2758
|
-
|
|
2918
|
+
}).meta({
|
|
2919
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2920
|
+
id: "UserRoleField"
|
|
2921
|
+
});
|
|
2759
2922
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2760
2923
|
FieldGroup,
|
|
2761
2924
|
Address,
|
|
@@ -2854,10 +3017,10 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2854
3017
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2855
3018
|
actions: VerificationActionConfig
|
|
2856
3019
|
});
|
|
2857
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
3020
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
3021
|
+
description: "Page configuration",
|
|
3022
|
+
id: "PageConfig"
|
|
3023
|
+
});
|
|
2861
3024
|
|
|
2862
3025
|
// ../commons/src/events/FormConfig.ts
|
|
2863
3026
|
var DeclarationFormConfig = z22.object({
|
|
@@ -3080,17 +3243,39 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
3080
3243
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
3081
3244
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
3082
3245
|
*/
|
|
3083
|
-
ReadActionConfig.meta({
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3246
|
+
ReadActionConfig.meta({
|
|
3247
|
+
id: "ReadActionConfig",
|
|
3248
|
+
description: "Record-tab content displayed on the event overview page."
|
|
3249
|
+
}),
|
|
3250
|
+
DeclareConfig.meta({
|
|
3251
|
+
id: "DeclareActionConfig",
|
|
3252
|
+
description: "Submitting a new declaration (includes review fields). This config is also shared with ActionType.NOTIFY."
|
|
3253
|
+
}),
|
|
3254
|
+
RejectConfig.meta({
|
|
3255
|
+
id: "RejectActionConfig",
|
|
3256
|
+
description: "Rejecting a record before registration"
|
|
3257
|
+
}),
|
|
3258
|
+
RegisterConfig.meta({
|
|
3259
|
+
id: "RegisterActionConfig",
|
|
3260
|
+
description: "Registering a record"
|
|
3261
|
+
}),
|
|
3087
3262
|
PrintCertificateActionConfig.meta({
|
|
3088
|
-
id: "PrintCertificateActionConfig"
|
|
3263
|
+
id: "PrintCertificateActionConfig",
|
|
3264
|
+
description: "Printing a certificate"
|
|
3089
3265
|
}),
|
|
3090
3266
|
RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
|
|
3091
|
-
EditActionConfig.meta({
|
|
3092
|
-
|
|
3093
|
-
|
|
3267
|
+
EditActionConfig.meta({
|
|
3268
|
+
id: "EditActionConfig",
|
|
3269
|
+
description: "Editing a record before registration"
|
|
3270
|
+
}),
|
|
3271
|
+
ArchiveConfig.meta({
|
|
3272
|
+
id: "ArchiveActionConfig",
|
|
3273
|
+
description: "Archiving a record"
|
|
3274
|
+
}),
|
|
3275
|
+
CustomActionConfig.meta({
|
|
3276
|
+
id: "CustomActionConfig",
|
|
3277
|
+
description: "Custom action configuration"
|
|
3278
|
+
})
|
|
3094
3279
|
]).describe(
|
|
3095
3280
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
3096
3281
|
).meta({ id: "ActionConfig" });
|
|
@@ -3766,6 +3951,9 @@ function precompileActionSchemas(eventConfigurations) {
|
|
|
3766
3951
|
function isAgeValue(value) {
|
|
3767
3952
|
return typeof value === "object" && value !== null && "age" in value && typeof value.age === "number";
|
|
3768
3953
|
}
|
|
3954
|
+
function mergeWithBaseFormState(values, context) {
|
|
3955
|
+
return { ...context.baseFormState, ...values };
|
|
3956
|
+
}
|
|
3769
3957
|
function validate(schema, data) {
|
|
3770
3958
|
const validator = ajv.getSchema(schema.$id) || ajv.compile(schema);
|
|
3771
3959
|
if ("$form" in data) {
|
|
@@ -3804,7 +3992,7 @@ function isOnline() {
|
|
|
3804
3992
|
}
|
|
3805
3993
|
function isConditionMet(conditional, values, context, eventIndex) {
|
|
3806
3994
|
return validate(conditional, {
|
|
3807
|
-
$form: values,
|
|
3995
|
+
$form: mergeWithBaseFormState(values, context),
|
|
3808
3996
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3809
3997
|
$online: isOnline(),
|
|
3810
3998
|
$user: context.user,
|
|
@@ -3833,7 +4021,7 @@ function isFieldConditionMet(field3, form, conditionalType, context) {
|
|
|
3833
4021
|
return true;
|
|
3834
4022
|
}
|
|
3835
4023
|
const validConditionals = getConditionalActionsForField(field3, {
|
|
3836
|
-
$form: form,
|
|
4024
|
+
$form: mergeWithBaseFormState(form, context),
|
|
3837
4025
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
3838
4026
|
$online: isOnline(),
|
|
3839
4027
|
$user: context.user,
|
|
@@ -4025,7 +4213,7 @@ function runFieldValidations({
|
|
|
4025
4213
|
return [];
|
|
4026
4214
|
}
|
|
4027
4215
|
const conditionalParameters = {
|
|
4028
|
-
$form: form,
|
|
4216
|
+
$form: mergeWithBaseFormState(form, context),
|
|
4029
4217
|
$now: (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" }),
|
|
4030
4218
|
/**
|
|
4031
4219
|
* In real use cases, there can be hundreds of thousands of locations.
|
|
@@ -4269,17 +4457,16 @@ function isPageVisible(page, formValues, context) {
|
|
|
4269
4457
|
}
|
|
4270
4458
|
return isConditionMet(page.conditional, formValues, context);
|
|
4271
4459
|
}
|
|
4272
|
-
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false
|
|
4460
|
+
function omitHiddenFields(fields, formValues, validatorContext, includeHiddenFieldsWithNullValues = false) {
|
|
4273
4461
|
const base = (0, import_lodash.cloneDeep)(formValues);
|
|
4274
4462
|
function fn(prevVisibilityContext) {
|
|
4275
|
-
const visibilityForm = declarationContext ? { ...declarationContext, ...prevVisibilityContext } : prevVisibilityContext;
|
|
4276
4463
|
const cleaned = (0, import_lodash.omitBy)(base, (value, fieldId) => {
|
|
4277
4464
|
const fieldConfig = fields.filter((f) => f.id === fieldId);
|
|
4278
4465
|
if (!fieldConfig.length) {
|
|
4279
4466
|
return false;
|
|
4280
4467
|
}
|
|
4281
4468
|
const isHidden = fieldConfig.every(
|
|
4282
|
-
(f) => !isFieldVisible(f,
|
|
4469
|
+
(f) => !isFieldVisible(f, prevVisibilityContext, validatorContext)
|
|
4283
4470
|
);
|
|
4284
4471
|
if (!isHidden) {
|
|
4285
4472
|
return false;
|
|
@@ -4297,7 +4484,7 @@ function omitHiddenPaginatedFields(formConfig, values, validatorContext, include
|
|
|
4297
4484
|
const visibleFields = formConfig.pages.filter((p) => isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4298
4485
|
const hiddenFields = formConfig.pages.filter((p) => !isPageVisible(p, values, validatorContext)).flatMap((p) => p.fields);
|
|
4299
4486
|
const valuesExceptHiddenPage = (0, import_lodash.omitBy)(values, (_2, fieldId) => {
|
|
4300
|
-
return hiddenFields.some((f) => f.id === fieldId);
|
|
4487
|
+
return hiddenFields.some((f) => f.id === fieldId) && !visibleFields.some((f) => f.id === fieldId);
|
|
4301
4488
|
});
|
|
4302
4489
|
return omitHiddenFields(
|
|
4303
4490
|
visibleFields,
|
|
@@ -4344,13 +4531,10 @@ function getVisibleVerificationPageIds(pages, annotation, context) {
|
|
|
4344
4531
|
}
|
|
4345
4532
|
function omitHiddenAnnotationFields(actionConfig, declaration, annotation, context) {
|
|
4346
4533
|
const annotationFields = getActionAnnotationFields(actionConfig);
|
|
4347
|
-
return omitHiddenFields(
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
false,
|
|
4352
|
-
declaration
|
|
4353
|
-
);
|
|
4534
|
+
return omitHiddenFields(annotationFields, annotation, {
|
|
4535
|
+
...context,
|
|
4536
|
+
baseFormState: declaration
|
|
4537
|
+
});
|
|
4354
4538
|
}
|
|
4355
4539
|
function deepMerge(currentDocument, actionDocument) {
|
|
4356
4540
|
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
|
@@ -5339,7 +5523,7 @@ var _EventConfigBase = z33.object({
|
|
|
5339
5523
|
),
|
|
5340
5524
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
5341
5525
|
actions: z33.array(ActionConfig).describe(
|
|
5342
|
-
"Configuration of
|
|
5526
|
+
"Configuration of core and custom actions associated with the event."
|
|
5343
5527
|
),
|
|
5344
5528
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
5345
5529
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -5351,7 +5535,7 @@ var _EventConfigBase = z33.object({
|
|
|
5351
5535
|
"Configuration of fields available in the advanced search feature."
|
|
5352
5536
|
),
|
|
5353
5537
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
5354
|
-
"Configuration of flags associated with the actions of this event type."
|
|
5538
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
5355
5539
|
),
|
|
5356
5540
|
analytics: z33.boolean().optional().default(true).describe(
|
|
5357
5541
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -5790,18 +5974,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
5790
5974
|
query: true,
|
|
5791
5975
|
columns: true
|
|
5792
5976
|
});
|
|
5793
|
-
var WorkqueueConfigInput =
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
query: CountryConfigQueryInputType,
|
|
5799
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
5800
|
-
"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."
|
|
5801
|
-
),
|
|
5802
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
5803
|
-
icon: AvailableIcons,
|
|
5804
|
-
emptyMessage: TranslationConfig.optional()
|
|
5977
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
5978
|
+
query: CountryConfigQueryInputType
|
|
5979
|
+
}).meta({
|
|
5980
|
+
description: "Workqueue configuration",
|
|
5981
|
+
id: "WorkqueueConfig"
|
|
5805
5982
|
});
|
|
5806
5983
|
function defineWorkqueue(workqueueInput) {
|
|
5807
5984
|
const queryInput = workqueueInput.query;
|
|
@@ -5862,6 +6039,9 @@ var BaseActionInput = z38.object({
|
|
|
5862
6039
|
originalActionId: UUID.optional(),
|
|
5863
6040
|
// should not be part of base action.
|
|
5864
6041
|
keepAssignment: z38.boolean().optional(),
|
|
6042
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
6043
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
6044
|
+
waitFor: z38.boolean().optional(),
|
|
5865
6045
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
5866
6046
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
5867
6047
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -6115,7 +6295,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
|
6115
6295
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
|
6116
6296
|
acceptedAt: acceptAction.createdAt,
|
|
6117
6297
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
|
6118
|
-
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
|
6119
6298
|
registrationNumber
|
|
6120
6299
|
};
|
|
6121
6300
|
}
|
|
@@ -6329,17 +6508,6 @@ function getAssignedUserFromActions(actions) {
|
|
|
6329
6508
|
return user2;
|
|
6330
6509
|
}, null);
|
|
6331
6510
|
}
|
|
6332
|
-
function getAssignedUserSignatureFromActions(actions) {
|
|
6333
|
-
return actions.reduce((signature, action) => {
|
|
6334
|
-
if (action.type === ActionType.ASSIGN) {
|
|
6335
|
-
return action.createdBySignature || null;
|
|
6336
|
-
}
|
|
6337
|
-
if (action.type === ActionType.UNASSIGN) {
|
|
6338
|
-
return null;
|
|
6339
|
-
}
|
|
6340
|
-
return signature;
|
|
6341
|
-
}, null);
|
|
6342
|
-
}
|
|
6343
6511
|
function deepDropNulls(obj) {
|
|
6344
6512
|
if (Array.isArray(obj)) {
|
|
6345
6513
|
return obj.map(deepDropNulls);
|
|
@@ -6435,10 +6603,8 @@ function getCurrentEventState(event2, config) {
|
|
|
6435
6603
|
createdBy: creationAction.createdBy,
|
|
6436
6604
|
createdByUserType: creationAction.createdByUserType,
|
|
6437
6605
|
createdAtLocation: creationAction.createdAtLocation,
|
|
6438
|
-
createdBySignature: creationAction.createdBySignature,
|
|
6439
6606
|
updatedAt: acceptedActionMetadata.createdAt,
|
|
6440
6607
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
|
6441
|
-
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
|
6442
6608
|
updatedBy: requestActionMetadata.createdBy,
|
|
6443
6609
|
updatedAtLocation: requestActionMetadata.createdAtLocation,
|
|
6444
6610
|
declaration,
|
|
@@ -9697,7 +9863,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
|
9697
9863
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
|
9698
9864
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
|
9699
9865
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
|
9700
|
-
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
|
9701
9866
|
updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
|
|
9702
9867
|
assignedTo: overrides.assignedTo ?? null,
|
|
9703
9868
|
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
|
@@ -9930,11 +10095,77 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9930
10095
|
}
|
|
9931
10096
|
return true;
|
|
9932
10097
|
}
|
|
10098
|
+
function canAccessUserWithScope({
|
|
10099
|
+
userToAccess,
|
|
10100
|
+
scope,
|
|
10101
|
+
user: user2
|
|
10102
|
+
}) {
|
|
10103
|
+
const opts = scope.options;
|
|
10104
|
+
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
10105
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
10106
|
+
return false;
|
|
10107
|
+
}
|
|
10108
|
+
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
10109
|
+
(id) => user2.administrativeAreaId === id
|
|
10110
|
+
) || user2.administrativeAreaId === null;
|
|
10111
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
10112
|
+
return false;
|
|
10113
|
+
}
|
|
10114
|
+
if (scopeUsesRoleOptions(scope)) {
|
|
10115
|
+
const { options } = scope;
|
|
10116
|
+
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
10117
|
+
return false;
|
|
10118
|
+
}
|
|
10119
|
+
}
|
|
10120
|
+
return true;
|
|
10121
|
+
}
|
|
10122
|
+
function canAccessOtherUserWithScopes({
|
|
10123
|
+
scopes,
|
|
10124
|
+
userToAccess,
|
|
10125
|
+
user: user2
|
|
10126
|
+
}) {
|
|
10127
|
+
return scopes.some(
|
|
10128
|
+
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
10129
|
+
);
|
|
10130
|
+
}
|
|
9933
10131
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
9934
10132
|
return scopes.some(
|
|
9935
10133
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
9936
10134
|
);
|
|
9937
10135
|
}
|
|
10136
|
+
function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
|
|
10137
|
+
const collectedLocations = [];
|
|
10138
|
+
const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
|
|
10139
|
+
let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
|
|
10140
|
+
while (current) {
|
|
10141
|
+
collectedLocations.push(current);
|
|
10142
|
+
if (!current.parentId) {
|
|
10143
|
+
break;
|
|
10144
|
+
}
|
|
10145
|
+
const parentId = current.parentId;
|
|
10146
|
+
current = administrativeAreas.get(parentId);
|
|
10147
|
+
}
|
|
10148
|
+
return collectedLocations;
|
|
10149
|
+
}
|
|
10150
|
+
function getLocationHierarchy(selectedId, context) {
|
|
10151
|
+
const { administrativeAreas, locations } = context;
|
|
10152
|
+
const loc = locations.get(selectedId);
|
|
10153
|
+
if (loc) {
|
|
10154
|
+
if (loc.administrativeAreaId) {
|
|
10155
|
+
const hierarchy2 = getAdministrativeAreaHierarchy(
|
|
10156
|
+
loc.administrativeAreaId,
|
|
10157
|
+
administrativeAreas
|
|
10158
|
+
);
|
|
10159
|
+
return [...hierarchy2.reverse().map((area) => area.id), loc.id];
|
|
10160
|
+
}
|
|
10161
|
+
return [loc.id];
|
|
10162
|
+
}
|
|
10163
|
+
const hierarchy = getAdministrativeAreaHierarchy(
|
|
10164
|
+
selectedId,
|
|
10165
|
+
administrativeAreas
|
|
10166
|
+
);
|
|
10167
|
+
return hierarchy.reverse().map((area) => area.id);
|
|
10168
|
+
}
|
|
9938
10169
|
|
|
9939
10170
|
// ../commons/src/events/scopes.ts
|
|
9940
10171
|
var ACTION_SCOPE_MAP = {
|
|
@@ -10009,6 +10240,25 @@ function isActionInScope({
|
|
|
10009
10240
|
);
|
|
10010
10241
|
return canAccess;
|
|
10011
10242
|
}
|
|
10243
|
+
function getAvailableRolesForUserUpdatePayload({
|
|
10244
|
+
allRoles,
|
|
10245
|
+
userLocation,
|
|
10246
|
+
acceptedScopes,
|
|
10247
|
+
userRequesting
|
|
10248
|
+
}) {
|
|
10249
|
+
const availableRoles = allRoles.filter((role) => {
|
|
10250
|
+
const canAccess = canAccessOtherUserWithScopes({
|
|
10251
|
+
userToAccess: {
|
|
10252
|
+
...userLocation,
|
|
10253
|
+
role
|
|
10254
|
+
},
|
|
10255
|
+
user: userRequesting,
|
|
10256
|
+
scopes: acceptedScopes
|
|
10257
|
+
});
|
|
10258
|
+
return canAccess;
|
|
10259
|
+
});
|
|
10260
|
+
return availableRoles;
|
|
10261
|
+
}
|
|
10012
10262
|
|
|
10013
10263
|
// ../commons/src/events/serializers/user/deserializer.ts
|
|
10014
10264
|
function userDeserializer(serializedUserField, user2) {
|