@opencrvs/toolkit 2.0.0-rc.e12607f → 2.0.0-rc.e142328
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 +103 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/application-config/index.js +282 -127
- package/dist/cli.js +516 -174
- package/dist/commons/api/router.d.ts +3392 -241
- package/dist/commons/application-config/index.d.ts +17 -4
- package/dist/commons/conditionals/conditionals.d.ts +357 -7
- package/dist/commons/conditionals/validate.d.ts +52 -2
- package/dist/commons/events/ActionConfig.d.ts +204 -2
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +114 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/Draft.d.ts +4 -2
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +14 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/FieldConfig.d.ts +383 -50
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/FieldValue.d.ts +6 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +189 -150
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/index.d.ts +2 -0
- 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/flags.d.ts +16 -0
- package/dist/commons/events/state/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +12 -289
- package/dist/commons/events/utils.d.ts +13 -2
- package/dist/conditionals/index.js +60 -5
- package/dist/events/index.js +1229 -295
- 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 +514 -172
- 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 +997 -162
- package/dist/scopes/index.d.ts +10 -7
- package/dist/scopes/index.js +17 -7
- package/opencrvs-toolkit-2.0.0-rc.e142328.tgz +0 -0
- package/package.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.e12607f.tgz +0 -0
|
@@ -226,12 +226,14 @@ var SystemScopeType = z2.enum([
|
|
|
226
226
|
"organisation.read-locations",
|
|
227
227
|
"user.read",
|
|
228
228
|
"user.create",
|
|
229
|
-
"user.edit"
|
|
229
|
+
"user.edit",
|
|
230
|
+
"user.search"
|
|
230
231
|
]);
|
|
231
232
|
var UserScopeType = SystemScopeType.extract([
|
|
232
233
|
"user.read",
|
|
233
234
|
"user.create",
|
|
234
|
-
"user.edit"
|
|
235
|
+
"user.edit",
|
|
236
|
+
"user.search"
|
|
235
237
|
]);
|
|
236
238
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
237
239
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -240,7 +242,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
240
242
|
options: AllUserScopeOptions.optional()
|
|
241
243
|
}),
|
|
242
244
|
z2.object({
|
|
243
|
-
type: UserScopeType.extract(["user.read"]),
|
|
245
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
244
246
|
options: AccessLevelOptions.optional()
|
|
245
247
|
})
|
|
246
248
|
]);
|
|
@@ -291,7 +293,9 @@ var ScopeType = z2.enum([
|
|
|
291
293
|
var EncodedScope = z2.string().brand("EncodedScope");
|
|
292
294
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
293
295
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
294
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
296
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
297
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
298
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
295
299
|
};
|
|
296
300
|
|
|
297
301
|
// ../commons/src/authentication.ts
|
|
@@ -650,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
650
654
|
ShowConditional,
|
|
651
655
|
// Action can be shown to the user in the list but as disabled
|
|
652
656
|
EnableConditional
|
|
653
|
-
])
|
|
657
|
+
]).meta({
|
|
658
|
+
id: "ActionConditional",
|
|
659
|
+
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
660
|
+
});
|
|
654
661
|
var DisplayOnReviewConditional = z7.object({
|
|
655
662
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
656
663
|
conditional: Conditional
|
|
@@ -665,8 +672,8 @@ var FieldConditional = z7.discriminatedUnion("type", [
|
|
|
665
672
|
// Field output can be shown / hidden on the review page
|
|
666
673
|
DisplayOnReviewConditional
|
|
667
674
|
]).meta({
|
|
668
|
-
|
|
669
|
-
|
|
675
|
+
id: "FieldConditional",
|
|
676
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
670
677
|
});
|
|
671
678
|
|
|
672
679
|
// ../commons/src/events/FieldType.ts
|
|
@@ -763,6 +770,11 @@ var FieldTypesToHideInReview = [
|
|
|
763
770
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
764
771
|
FieldType.ALPHA_HIDDEN
|
|
765
772
|
];
|
|
773
|
+
var HiddenFieldTypes = [
|
|
774
|
+
FieldType.HTTP,
|
|
775
|
+
FieldType.QUERY_PARAM_READER,
|
|
776
|
+
FieldType.ALPHA_HIDDEN
|
|
777
|
+
];
|
|
766
778
|
|
|
767
779
|
// ../commons/src/events/FieldValue.ts
|
|
768
780
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -881,7 +893,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
|
|
|
881
893
|
// ../commons/src/events/FieldValue.ts
|
|
882
894
|
var TextValue = z12.string();
|
|
883
895
|
var HiddenFieldValue = z12.string();
|
|
884
|
-
var NonEmptyTextValue =
|
|
896
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
885
897
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
886
898
|
var AgeValue = z12.object({
|
|
887
899
|
age: z12.number(),
|
|
@@ -910,6 +922,7 @@ var DateRangeFieldValue = z12.object({
|
|
|
910
922
|
var EmailValue = z12.email();
|
|
911
923
|
var CheckboxFieldValue = z12.boolean();
|
|
912
924
|
var NumberFieldValue = z12.number();
|
|
925
|
+
var SignatureFieldValue = FileFieldValue;
|
|
913
926
|
var ButtonFieldValue = z12.number();
|
|
914
927
|
var VerificationStatusValue = z12.enum([
|
|
915
928
|
"verified",
|
|
@@ -978,28 +991,20 @@ function schemaPriority(schema) {
|
|
|
978
991
|
return idx === -1 ? 9999 : idx;
|
|
979
992
|
}
|
|
980
993
|
function safeUnion(schemas) {
|
|
994
|
+
const sortedSchemas = [...schemas].sort(
|
|
995
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
996
|
+
);
|
|
981
997
|
return z12.any().superRefine((val, ctx) => {
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
if (successful.length === 0) {
|
|
987
|
-
ctx.addIssue({
|
|
988
|
-
code: "invalid_type",
|
|
989
|
-
expected: "custom",
|
|
990
|
-
message: "Value does not match any schema"
|
|
991
|
-
});
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
995
|
-
const best = successful[0];
|
|
996
|
-
if (!best.safeParse(val).success) {
|
|
997
|
-
ctx.addIssue({
|
|
998
|
-
expected: "custom",
|
|
999
|
-
code: "invalid_type",
|
|
1000
|
-
message: "Value did not match the best schema"
|
|
1001
|
-
});
|
|
998
|
+
for (const schema of sortedSchemas) {
|
|
999
|
+
if (schema.safeParse(val).success) {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
1002
|
}
|
|
1003
|
+
ctx.addIssue({
|
|
1004
|
+
code: "invalid_type",
|
|
1005
|
+
expected: "custom",
|
|
1006
|
+
message: "Value does not match any schema"
|
|
1007
|
+
});
|
|
1003
1008
|
}).meta({
|
|
1004
1009
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1005
1010
|
});
|
|
@@ -1216,8 +1221,9 @@ var RequestedCorrectionAction = ActionBase.extend(
|
|
|
1216
1221
|
var ApprovedCorrectionAction = ActionBase.extend(
|
|
1217
1222
|
z14.object({
|
|
1218
1223
|
type: z14.literal(ActionType.APPROVE_CORRECTION),
|
|
1219
|
-
requestId: z14.string()
|
|
1224
|
+
requestId: z14.string(),
|
|
1220
1225
|
// TODO move into 'content' property
|
|
1226
|
+
content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
|
|
1221
1227
|
}).shape
|
|
1222
1228
|
);
|
|
1223
1229
|
var RejectedCorrectionAction = ActionBase.extend(
|
|
@@ -1309,6 +1315,9 @@ var FlagConfig = z15.object({
|
|
|
1309
1315
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1310
1316
|
),
|
|
1311
1317
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1318
|
+
}).meta({
|
|
1319
|
+
id: "FlagConfig",
|
|
1320
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
1312
1321
|
});
|
|
1313
1322
|
var ActionFlagConfig = z15.object({
|
|
1314
1323
|
id: Flag,
|
|
@@ -1316,6 +1325,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1316
1325
|
conditional: Conditional.optional().describe(
|
|
1317
1326
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1318
1327
|
)
|
|
1328
|
+
}).meta({
|
|
1329
|
+
id: "ActionFlagConfig",
|
|
1330
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
1319
1331
|
});
|
|
1320
1332
|
|
|
1321
1333
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1337,8 +1349,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1337
1349
|
),
|
|
1338
1350
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1339
1351
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1340
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1341
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1352
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1342
1353
|
});
|
|
1343
1354
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1344
1355
|
registrationNumber: z16.string().describe(
|
|
@@ -1366,9 +1377,6 @@ var EventMetadata = z16.object({
|
|
|
1366
1377
|
createdAtLocation: UUID.nullish().describe(
|
|
1367
1378
|
"Location of the user who created the event."
|
|
1368
1379
|
),
|
|
1369
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1370
|
-
"Signature of the user who created the event."
|
|
1371
|
-
),
|
|
1372
1380
|
updatedAtLocation: UUID.nullish().describe(
|
|
1373
1381
|
"Location of the user who last changed the status."
|
|
1374
1382
|
),
|
|
@@ -1475,7 +1483,8 @@ var Range = import_v4.z.object({
|
|
|
1475
1483
|
});
|
|
1476
1484
|
var ContainsFlags = import_v4.z.object({
|
|
1477
1485
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1478
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
1486
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1487
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1479
1488
|
}).meta({
|
|
1480
1489
|
id: "ContainsFlags"
|
|
1481
1490
|
});
|
|
@@ -1661,14 +1670,31 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
1661
1670
|
}
|
|
1662
1671
|
}).describe("Unique identifier for the field");
|
|
1663
1672
|
var FieldReference = import_v43.default.object({
|
|
1664
|
-
$$field: FieldId,
|
|
1673
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
1665
1674
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1666
1675
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1676
|
+
),
|
|
1677
|
+
$$code: import_v43.default.string().optional().describe(
|
|
1678
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
1667
1679
|
)
|
|
1668
|
-
}).describe(
|
|
1680
|
+
}).describe(
|
|
1681
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
1682
|
+
);
|
|
1683
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
1684
|
+
$$code: import_v43.default.string().describe(
|
|
1685
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
1686
|
+
)
|
|
1687
|
+
}).describe("A context-only computation used as a field default value.");
|
|
1669
1688
|
var ValidationConfig = import_v43.default.object({
|
|
1670
|
-
validator: Conditional
|
|
1671
|
-
|
|
1689
|
+
validator: Conditional.describe(
|
|
1690
|
+
"Conditional expression that must hold for the field value to be considered valid."
|
|
1691
|
+
),
|
|
1692
|
+
message: TranslationConfig.describe(
|
|
1693
|
+
"Error message displayed when the validator does not hold."
|
|
1694
|
+
)
|
|
1695
|
+
}).meta({
|
|
1696
|
+
id: "ValidationConfig",
|
|
1697
|
+
description: "Validation rule applied to a form field. The validator is a conditional expression that must hold for the field value to be considered valid."
|
|
1672
1698
|
});
|
|
1673
1699
|
var requiredSchema = import_v43.default.union([
|
|
1674
1700
|
import_v43.default.boolean(),
|
|
@@ -1699,7 +1725,7 @@ var BaseField = import_v43.default.object({
|
|
|
1699
1725
|
"Indicates whether the field can be modified during record correction."
|
|
1700
1726
|
),
|
|
1701
1727
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1702
|
-
"Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
|
|
1728
|
+
"Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used. A FieldReference with $$code computes the value via a custom client-side function."
|
|
1703
1729
|
),
|
|
1704
1730
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1705
1731
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -1707,30 +1733,40 @@ var BaseField = import_v43.default.object({
|
|
|
1707
1733
|
}).describe("Common properties shared across all field types.");
|
|
1708
1734
|
var Divider = BaseField.extend({
|
|
1709
1735
|
type: import_v43.default.literal(FieldType.DIVIDER)
|
|
1736
|
+
}).meta({
|
|
1737
|
+
description: "A horizontal line divider",
|
|
1738
|
+
id: "Divider"
|
|
1710
1739
|
});
|
|
1711
1740
|
var TextField = BaseField.extend({
|
|
1712
1741
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
1713
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1742
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1714
1743
|
configuration: import_v43.default.object({
|
|
1715
1744
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1716
1745
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
1717
1746
|
prefix: TranslationConfig.optional(),
|
|
1718
1747
|
postfix: TranslationConfig.optional()
|
|
1719
1748
|
}).default({ type: "text" }).optional()
|
|
1720
|
-
}).
|
|
1749
|
+
}).meta({
|
|
1750
|
+
description: "A text input field",
|
|
1751
|
+
id: "TextField"
|
|
1752
|
+
});
|
|
1721
1753
|
var NumberField = BaseField.extend({
|
|
1722
1754
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1723
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1755
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1724
1756
|
configuration: import_v43.default.object({
|
|
1725
1757
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1726
1758
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1759
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1727
1760
|
prefix: TranslationConfig.optional(),
|
|
1728
1761
|
postfix: TranslationConfig.optional()
|
|
1729
1762
|
}).optional()
|
|
1730
|
-
}).
|
|
1763
|
+
}).meta({
|
|
1764
|
+
description: "A number input field",
|
|
1765
|
+
id: "NumberField"
|
|
1766
|
+
});
|
|
1731
1767
|
var TextAreaField = BaseField.extend({
|
|
1732
1768
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1733
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1769
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1734
1770
|
configuration: import_v43.default.object({
|
|
1735
1771
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1736
1772
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -1738,7 +1774,10 @@ var TextAreaField = BaseField.extend({
|
|
|
1738
1774
|
prefix: TranslationConfig.optional(),
|
|
1739
1775
|
postfix: TranslationConfig.optional()
|
|
1740
1776
|
}).default({ rows: 4 }).optional()
|
|
1741
|
-
}).
|
|
1777
|
+
}).meta({
|
|
1778
|
+
description: "A multiline text input",
|
|
1779
|
+
id: "TextAreaField"
|
|
1780
|
+
});
|
|
1742
1781
|
var ImageMimeType = import_v43.default.enum([
|
|
1743
1782
|
"image/png",
|
|
1744
1783
|
"image/jpg",
|
|
@@ -1761,58 +1800,76 @@ var SignatureField = BaseField.extend({
|
|
|
1761
1800
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1762
1801
|
"Title of the signature modal"
|
|
1763
1802
|
),
|
|
1764
|
-
defaultValue:
|
|
1803
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
1765
1804
|
configuration: import_v43.default.object({
|
|
1766
1805
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1767
1806
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
1768
1807
|
}).default({
|
|
1769
1808
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1770
1809
|
})
|
|
1771
|
-
}).
|
|
1810
|
+
}).meta({
|
|
1811
|
+
description: "A signature input field",
|
|
1812
|
+
id: "SignatureField"
|
|
1813
|
+
});
|
|
1772
1814
|
var EmailField = BaseField.extend({
|
|
1773
1815
|
type: import_v43.default.literal(FieldType.EMAIL),
|
|
1774
1816
|
configuration: import_v43.default.object({
|
|
1775
1817
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1776
1818
|
}).default({ maxLength: 255 }).optional(),
|
|
1777
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1819
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
1820
|
+
}).meta({
|
|
1821
|
+
description: "An email input field",
|
|
1822
|
+
id: "EmailField"
|
|
1778
1823
|
});
|
|
1779
1824
|
var DateField = BaseField.extend({
|
|
1780
1825
|
type: import_v43.default.literal(FieldType.DATE),
|
|
1781
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1826
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1782
1827
|
configuration: import_v43.default.object({
|
|
1783
1828
|
notice: TranslationConfig.describe(
|
|
1784
1829
|
"Text to display above the date input"
|
|
1785
1830
|
).optional()
|
|
1786
1831
|
}).optional()
|
|
1787
|
-
}).
|
|
1832
|
+
}).meta({
|
|
1833
|
+
description: "A date input (yyyy-MM-dd)",
|
|
1834
|
+
id: "DateField"
|
|
1835
|
+
});
|
|
1788
1836
|
var AgeField = BaseField.extend({
|
|
1789
1837
|
type: import_v43.default.literal(FieldType.AGE),
|
|
1790
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1838
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1791
1839
|
configuration: import_v43.default.object({
|
|
1792
1840
|
asOfDate: FieldReference,
|
|
1793
1841
|
prefix: TranslationConfig.optional(),
|
|
1794
1842
|
postfix: TranslationConfig.optional()
|
|
1795
1843
|
})
|
|
1796
|
-
}).
|
|
1844
|
+
}).meta({
|
|
1845
|
+
description: "An age input field which uses the current date as the asOfDate",
|
|
1846
|
+
id: "AgeField"
|
|
1847
|
+
});
|
|
1797
1848
|
var TimeField = BaseField.extend({
|
|
1798
1849
|
type: import_v43.default.literal(FieldType.TIME),
|
|
1799
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1850
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
1800
1851
|
configuration: import_v43.default.object({
|
|
1801
1852
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1802
1853
|
notice: TranslationConfig.describe(
|
|
1803
1854
|
"Text to display above the time input"
|
|
1804
1855
|
).optional()
|
|
1805
1856
|
}).optional()
|
|
1806
|
-
}).
|
|
1857
|
+
}).meta({
|
|
1858
|
+
description: "A single time input (HH-mm)",
|
|
1859
|
+
id: "TimeField"
|
|
1860
|
+
});
|
|
1807
1861
|
var DateRangeField = BaseField.extend({
|
|
1808
1862
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1809
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
1863
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
1810
1864
|
configuration: import_v43.default.object({
|
|
1811
1865
|
notice: TranslationConfig.describe(
|
|
1812
1866
|
"Text to display above the date input"
|
|
1813
1867
|
).optional()
|
|
1814
1868
|
}).optional()
|
|
1815
|
-
}).
|
|
1869
|
+
}).meta({
|
|
1870
|
+
description: "A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })",
|
|
1871
|
+
id: "DateRangeField"
|
|
1872
|
+
});
|
|
1816
1873
|
var HtmlFontVariant = import_v43.default.enum([
|
|
1817
1874
|
"reg12",
|
|
1818
1875
|
"reg14",
|
|
@@ -1856,21 +1913,33 @@ var ImageViewField = BaseField.extend({
|
|
|
1856
1913
|
type: import_v43.default.literal(FieldType.IMAGE_VIEW),
|
|
1857
1914
|
defaultValue: NonEmptyTextValue.optional(),
|
|
1858
1915
|
configuration: ImageConfiguration
|
|
1859
|
-
}).
|
|
1916
|
+
}).meta({
|
|
1917
|
+
description: "A read-only image component for form pages",
|
|
1918
|
+
id: "ImageViewField"
|
|
1919
|
+
});
|
|
1860
1920
|
var Paragraph = BaseField.extend({
|
|
1861
1921
|
type: import_v43.default.literal(FieldType.PARAGRAPH),
|
|
1862
1922
|
configuration: ParagraphConfiguration
|
|
1863
|
-
}).
|
|
1923
|
+
}).meta({
|
|
1924
|
+
description: "A read-only HTML <p> paragraph",
|
|
1925
|
+
id: "Paragraph"
|
|
1926
|
+
});
|
|
1864
1927
|
var Heading = BaseField.extend({
|
|
1865
1928
|
type: import_v43.default.literal(FieldType.HEADING),
|
|
1866
1929
|
configuration: HeadingConfiguration
|
|
1867
|
-
}).
|
|
1930
|
+
}).meta({
|
|
1931
|
+
description: "A read-only heading component for form pages",
|
|
1932
|
+
id: "Heading"
|
|
1933
|
+
});
|
|
1868
1934
|
var PageHeader = BaseField.extend({
|
|
1869
1935
|
type: import_v43.default.literal(FieldType.PAGE_HEADER)
|
|
1870
|
-
}).
|
|
1936
|
+
}).meta({
|
|
1937
|
+
description: "A read-only header component for form pages",
|
|
1938
|
+
id: "PageHeader"
|
|
1939
|
+
});
|
|
1871
1940
|
var File = BaseField.extend({
|
|
1872
1941
|
type: import_v43.default.literal(FieldType.FILE),
|
|
1873
|
-
defaultValue: FileFieldValue.optional(),
|
|
1942
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
1874
1943
|
configuration: import_v43.default.object({
|
|
1875
1944
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1876
1945
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -1886,7 +1955,10 @@ var File = BaseField.extend({
|
|
|
1886
1955
|
}).default({
|
|
1887
1956
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
1888
1957
|
})
|
|
1889
|
-
}).
|
|
1958
|
+
}).meta({
|
|
1959
|
+
description: "A file upload field",
|
|
1960
|
+
id: "File"
|
|
1961
|
+
});
|
|
1890
1962
|
var SelectOption = import_v43.default.object({
|
|
1891
1963
|
value: import_v43.default.string().describe("The value of the option"),
|
|
1892
1964
|
label: import_v43.default.union([import_v43.default.string(), TranslationConfig]).describe("The label of the option"),
|
|
@@ -1894,7 +1966,7 @@ var SelectOption = import_v43.default.object({
|
|
|
1894
1966
|
});
|
|
1895
1967
|
var NumberWithUnitField = BaseField.extend({
|
|
1896
1968
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1897
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1969
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
1898
1970
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1899
1971
|
configuration: import_v43.default.object({
|
|
1900
1972
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -1903,17 +1975,23 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
1903
1975
|
"Placeholder for the number field"
|
|
1904
1976
|
)
|
|
1905
1977
|
}).optional()
|
|
1906
|
-
}).
|
|
1978
|
+
}).meta({
|
|
1979
|
+
description: "A number with unit input field",
|
|
1980
|
+
id: "NumberWithUnitField"
|
|
1981
|
+
});
|
|
1907
1982
|
var RadioGroup = BaseField.extend({
|
|
1908
1983
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1909
|
-
defaultValue: TextValue.optional(),
|
|
1984
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1910
1985
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1911
1986
|
configuration: import_v43.default.object({
|
|
1912
1987
|
styles: import_v43.default.object({
|
|
1913
1988
|
size: import_v43.default.enum(["NORMAL", "LARGE"]).optional()
|
|
1914
1989
|
}).optional()
|
|
1915
1990
|
}).optional()
|
|
1916
|
-
}).
|
|
1991
|
+
}).meta({
|
|
1992
|
+
description: "A grouped radio button field",
|
|
1993
|
+
id: "RadioGroup"
|
|
1994
|
+
});
|
|
1917
1995
|
var BulletList = BaseField.extend({
|
|
1918
1996
|
type: import_v43.default.literal(FieldType.BULLET_LIST),
|
|
1919
1997
|
items: import_v43.default.array(TranslationConfig).describe("A list of items"),
|
|
@@ -1922,10 +2000,13 @@ var BulletList = BaseField.extend({
|
|
|
1922
2000
|
fontVariant: HtmlFontVariant.optional()
|
|
1923
2001
|
}).optional()
|
|
1924
2002
|
}).default({})
|
|
1925
|
-
}).
|
|
2003
|
+
}).meta({
|
|
2004
|
+
description: "A list of bullet points",
|
|
2005
|
+
id: "BulletList"
|
|
2006
|
+
});
|
|
1926
2007
|
var Select = BaseField.extend({
|
|
1927
2008
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
1928
|
-
defaultValue: TextValue.optional(),
|
|
2009
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1929
2010
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1930
2011
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1931
2012
|
`
|
|
@@ -1937,16 +2018,22 @@ var Select = BaseField.extend({
|
|
|
1937
2018
|
{ ..., defaultMessage: "'{input}' is not listed among the health facilities." }
|
|
1938
2019
|
`
|
|
1939
2020
|
)
|
|
1940
|
-
}).
|
|
2021
|
+
}).meta({
|
|
2022
|
+
description: "A select input field",
|
|
2023
|
+
id: "Select"
|
|
2024
|
+
});
|
|
1941
2025
|
var SelectDateRangeOption = import_v43.default.object({
|
|
1942
2026
|
value: SelectDateRangeValue.describe("The value of the option"),
|
|
1943
2027
|
label: TranslationConfig.describe("The label of the option")
|
|
1944
2028
|
});
|
|
1945
2029
|
var SelectDateRangeField = BaseField.extend({
|
|
1946
2030
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
1947
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
2031
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
1948
2032
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
1949
|
-
}).
|
|
2033
|
+
}).meta({
|
|
2034
|
+
description: "A date range selection field",
|
|
2035
|
+
id: "SelectDateRangeField"
|
|
2036
|
+
});
|
|
1950
2037
|
var NameConfig = import_v43.default.object({
|
|
1951
2038
|
firstname: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
1952
2039
|
middlename: import_v43.default.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
|
|
@@ -1958,7 +2045,7 @@ var NameField = BaseField.extend({
|
|
|
1958
2045
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1959
2046
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
1960
2047
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
1961
|
-
}).optional(),
|
|
2048
|
+
}).or(ComputedDefaultValue).optional(),
|
|
1962
2049
|
configuration: import_v43.default.object({
|
|
1963
2050
|
name: NameConfig.default({
|
|
1964
2051
|
firstname: { required: true },
|
|
@@ -1977,26 +2064,41 @@ var NameField = BaseField.extend({
|
|
|
1977
2064
|
surname: { required: true }
|
|
1978
2065
|
}
|
|
1979
2066
|
}).optional()
|
|
1980
|
-
}).
|
|
2067
|
+
}).meta({
|
|
2068
|
+
description: "A field for entering a persons name",
|
|
2069
|
+
id: "NameField"
|
|
2070
|
+
});
|
|
1981
2071
|
var PhoneField = BaseField.extend({
|
|
1982
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2072
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1983
2073
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
1984
|
-
}).
|
|
2074
|
+
}).meta({
|
|
2075
|
+
description: "A field for entering a phone number",
|
|
2076
|
+
id: "PhoneField"
|
|
2077
|
+
});
|
|
1985
2078
|
var IdField = BaseField.extend({
|
|
1986
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2079
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1987
2080
|
type: import_v43.default.literal(FieldType.ID)
|
|
1988
|
-
}).
|
|
2081
|
+
}).meta({
|
|
2082
|
+
description: "A field for entering an ID",
|
|
2083
|
+
id: "IdField"
|
|
2084
|
+
});
|
|
1989
2085
|
var Checkbox = BaseField.extend({
|
|
1990
2086
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
1991
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
1992
|
-
}).
|
|
2087
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
2088
|
+
}).meta({
|
|
2089
|
+
description: "A boolean checkbox field",
|
|
2090
|
+
id: "Checkbox"
|
|
2091
|
+
});
|
|
1993
2092
|
var Country = BaseField.extend({
|
|
1994
2093
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
1995
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2094
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1996
2095
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
1997
2096
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
1998
2097
|
)
|
|
1999
|
-
}).
|
|
2098
|
+
}).meta({
|
|
2099
|
+
description: "A field for selecting a country",
|
|
2100
|
+
id: "Country"
|
|
2101
|
+
});
|
|
2000
2102
|
var AllowedLocations = JurisdictionReference.optional().describe(
|
|
2001
2103
|
"Limits which location options are selectable depending on user jurisdiction and location."
|
|
2002
2104
|
);
|
|
@@ -2005,28 +2107,33 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2005
2107
|
"HEALTH_FACILITY",
|
|
2006
2108
|
"CRVS_OFFICE"
|
|
2007
2109
|
]);
|
|
2008
|
-
var AdministrativeAreaConfiguration = import_v43.default.object({
|
|
2009
|
-
partOf: FieldReference.optional().describe("Parent location"),
|
|
2010
|
-
type: AdministrativeAreas,
|
|
2011
|
-
allowedLocations: AllowedLocations
|
|
2012
|
-
}).describe("Administrative area options");
|
|
2013
2110
|
var AdministrativeAreaField = BaseField.extend({
|
|
2014
2111
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2015
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2016
|
-
configuration:
|
|
2017
|
-
|
|
2112
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2113
|
+
configuration: import_v43.default.object({
|
|
2114
|
+
partOf: FieldReference.optional().describe("Parent location"),
|
|
2115
|
+
type: AdministrativeAreas,
|
|
2116
|
+
allowedLocations: AllowedLocations
|
|
2117
|
+
}).describe("Administrative area options")
|
|
2118
|
+
}).meta({
|
|
2119
|
+
description: "Administrative area input field",
|
|
2120
|
+
id: "AdministrativeAreaField"
|
|
2121
|
+
});
|
|
2018
2122
|
var LocationInput = BaseField.extend({
|
|
2019
2123
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2020
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2124
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2021
2125
|
configuration: import_v43.default.object({
|
|
2022
2126
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2023
2127
|
allowedLocations: AllowedLocations
|
|
2024
2128
|
}).optional()
|
|
2025
|
-
}).
|
|
2129
|
+
}).meta({
|
|
2130
|
+
description: "A field for selecting a location",
|
|
2131
|
+
id: "LocationInput"
|
|
2132
|
+
});
|
|
2026
2133
|
var FileUploadWithOptions = BaseField.extend({
|
|
2027
2134
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2028
2135
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
2029
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
2136
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
2030
2137
|
configuration: import_v43.default.object({
|
|
2031
2138
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2032
2139
|
maxImageSize: import_v43.default.object({
|
|
@@ -2036,15 +2143,18 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2036
2143
|
}).default({
|
|
2037
2144
|
maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
|
|
2038
2145
|
})
|
|
2146
|
+
}).meta({
|
|
2147
|
+
description: "A field for uploading files with file type options",
|
|
2148
|
+
id: "FileUploadWithOptions"
|
|
2039
2149
|
});
|
|
2040
2150
|
var Facility = BaseField.extend({
|
|
2041
2151
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2042
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2152
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2043
2153
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2044
2154
|
}).describe("Input field for a facility");
|
|
2045
2155
|
var Office = BaseField.extend({
|
|
2046
2156
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2047
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2157
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2048
2158
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2049
2159
|
}).describe("Input field for an office");
|
|
2050
2160
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -2080,8 +2190,11 @@ var Address = BaseField.extend({
|
|
|
2080
2190
|
).optional(),
|
|
2081
2191
|
allowedLocations: AllowedLocations
|
|
2082
2192
|
}).optional(),
|
|
2083
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
2084
|
-
}).
|
|
2193
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2194
|
+
}).meta({
|
|
2195
|
+
description: "Address input field \u2013 a combination of location and text fields",
|
|
2196
|
+
id: "Address"
|
|
2197
|
+
});
|
|
2085
2198
|
var StaticDataEntry = import_v43.default.object({
|
|
2086
2199
|
id: import_v43.default.string().describe("ID for the data entry."),
|
|
2087
2200
|
label: TranslationConfig,
|
|
@@ -2096,7 +2209,10 @@ var DataField = BaseField.extend({
|
|
|
2096
2209
|
subtitle: TranslationConfig.optional(),
|
|
2097
2210
|
data: import_v43.default.array(DataEntry)
|
|
2098
2211
|
})
|
|
2099
|
-
}).
|
|
2212
|
+
}).meta({
|
|
2213
|
+
description: "A field for displaying a table of read-only data",
|
|
2214
|
+
id: "DataField"
|
|
2215
|
+
});
|
|
2100
2216
|
var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
|
|
2101
2217
|
var ButtonType = import_v43.default.enum([
|
|
2102
2218
|
"primary",
|
|
@@ -2121,13 +2237,19 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
2121
2237
|
});
|
|
2122
2238
|
var ButtonField = BaseField.extend({
|
|
2123
2239
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2124
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
2240
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
2125
2241
|
configuration: ButtonConfiguration
|
|
2126
|
-
}).
|
|
2242
|
+
}).meta({
|
|
2243
|
+
description: "A generic button that can be used to trigger an action",
|
|
2244
|
+
id: "ButtonField"
|
|
2245
|
+
});
|
|
2127
2246
|
var FieldGroup = BaseField.extend({
|
|
2128
2247
|
type: import_v43.default.literal(FieldType.FIELD_GROUP),
|
|
2129
2248
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
2130
2249
|
fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
|
|
2250
|
+
}).meta({
|
|
2251
|
+
description: "A group of fields that are displayed together",
|
|
2252
|
+
id: "FieldGroup"
|
|
2131
2253
|
});
|
|
2132
2254
|
var AlphaPrintButton = BaseField.extend({
|
|
2133
2255
|
type: import_v43.default.literal(FieldType.ALPHA_PRINT_BUTTON),
|
|
@@ -2137,10 +2259,13 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2137
2259
|
"Label for the print button"
|
|
2138
2260
|
)
|
|
2139
2261
|
})
|
|
2140
|
-
}).
|
|
2262
|
+
}).meta({
|
|
2263
|
+
description: "An experimental print button field for printing certificates during the declaration process",
|
|
2264
|
+
id: "AlphaPrintButton"
|
|
2265
|
+
});
|
|
2141
2266
|
var HttpField = BaseField.extend({
|
|
2142
2267
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2143
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2268
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
2144
2269
|
configuration: import_v43.default.object({
|
|
2145
2270
|
trigger: FieldReference.optional().describe(
|
|
2146
2271
|
"Reference to the field that triggers the HTTP request when its value changes. If not provided, the HTTP request is triggered once on component mount."
|
|
@@ -2153,20 +2278,30 @@ var HttpField = BaseField.extend({
|
|
|
2153
2278
|
params: import_v43.default.record(import_v43.default.string(), import_v43.default.union([import_v43.default.string(), FieldReference])).optional(),
|
|
2154
2279
|
timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
|
|
2155
2280
|
})
|
|
2156
|
-
}).
|
|
2281
|
+
}).meta({
|
|
2282
|
+
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.",
|
|
2283
|
+
id: "HttpField"
|
|
2284
|
+
});
|
|
2157
2285
|
var AutocompleteField = BaseField.extend({
|
|
2158
2286
|
type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
|
|
2159
2287
|
configuration: import_v43.default.object({
|
|
2160
|
-
url: import_v43.default.string().describe(
|
|
2288
|
+
url: import_v43.default.string().describe(
|
|
2289
|
+
"URL to fetch autocomplete suggestions from. This should be a country config server endpoint."
|
|
2290
|
+
).optional(),
|
|
2161
2291
|
method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
|
|
2162
2292
|
defaultOptions: import_v43.default.array(
|
|
2163
2293
|
import_v43.default.object({
|
|
2164
2294
|
label: import_v43.default.string(),
|
|
2165
2295
|
value: import_v43.default.string()
|
|
2166
2296
|
})
|
|
2167
|
-
).optional()
|
|
2297
|
+
).optional().describe(
|
|
2298
|
+
"Manual entry is supported through configuration, allowing users to provide values not currently represented in the dataset."
|
|
2299
|
+
)
|
|
2168
2300
|
})
|
|
2169
|
-
}).
|
|
2301
|
+
}).meta({
|
|
2302
|
+
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.",
|
|
2303
|
+
id: "AutocompleteField"
|
|
2304
|
+
});
|
|
2170
2305
|
var SearchField = HttpField.extend({
|
|
2171
2306
|
type: import_v43.default.literal(FieldType.SEARCH),
|
|
2172
2307
|
configuration: SearchQuery.pick({
|
|
@@ -2199,6 +2334,9 @@ var SearchField = HttpField.extend({
|
|
|
2199
2334
|
ok: TranslationConfig.optional()
|
|
2200
2335
|
}).optional()
|
|
2201
2336
|
})
|
|
2337
|
+
}).meta({
|
|
2338
|
+
description: "A search input field",
|
|
2339
|
+
id: "SearchField"
|
|
2202
2340
|
});
|
|
2203
2341
|
var LinkButtonField = BaseField.extend({
|
|
2204
2342
|
type: import_v43.default.literal(FieldType.LINK_BUTTON),
|
|
@@ -2207,28 +2345,35 @@ var LinkButtonField = BaseField.extend({
|
|
|
2207
2345
|
text: TranslationConfig.describe("Text to display on the button"),
|
|
2208
2346
|
icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
|
|
2209
2347
|
})
|
|
2210
|
-
}).
|
|
2348
|
+
}).meta({
|
|
2349
|
+
description: "A button that opens a URL link",
|
|
2350
|
+
id: "LinkButtonField"
|
|
2351
|
+
});
|
|
2211
2352
|
var VerificationStatus = BaseField.extend({
|
|
2212
2353
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2213
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2354
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2214
2355
|
configuration: import_v43.default.object({
|
|
2215
2356
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2216
2357
|
description: TranslationConfig.describe(
|
|
2217
2358
|
"Explaining text on the banner in form."
|
|
2218
2359
|
)
|
|
2219
2360
|
})
|
|
2361
|
+
}).meta({
|
|
2362
|
+
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.",
|
|
2363
|
+
id: "VerificationStatus"
|
|
2220
2364
|
});
|
|
2221
2365
|
var QueryParamReaderField = BaseField.extend({
|
|
2222
2366
|
type: import_v43.default.literal(FieldType.QUERY_PARAM_READER),
|
|
2223
2367
|
configuration: import_v43.default.object({
|
|
2224
2368
|
pickParams: import_v43.default.array(import_v43.default.string()).describe("List of query parameters to read from the URL")
|
|
2225
2369
|
})
|
|
2226
|
-
}).
|
|
2227
|
-
"A field that maps URL query params into form values and clears them afterward"
|
|
2228
|
-
|
|
2370
|
+
}).meta({
|
|
2371
|
+
description: "A field that maps URL query params into form values and clears them afterward",
|
|
2372
|
+
id: "QueryParamReaderField"
|
|
2373
|
+
});
|
|
2229
2374
|
var QrReaderField = BaseField.extend({
|
|
2230
2375
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2231
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2376
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2232
2377
|
configuration: import_v43.default.object({
|
|
2233
2378
|
validator: import_v43.default.any().meta({
|
|
2234
2379
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2236,21 +2381,27 @@ var QrReaderField = BaseField.extend({
|
|
|
2236
2381
|
})
|
|
2237
2382
|
}).optional()
|
|
2238
2383
|
}).meta({
|
|
2239
|
-
description: "
|
|
2384
|
+
description: "QR code reader field, including optional JSON Schema validator.",
|
|
2240
2385
|
id: "QrReaderField"
|
|
2241
2386
|
});
|
|
2242
2387
|
var IdReaderField = BaseField.extend({
|
|
2243
2388
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2244
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2389
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2245
2390
|
methods: import_v43.default.array(
|
|
2246
2391
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2247
2392
|
)
|
|
2393
|
+
}).meta({
|
|
2394
|
+
description: "A wrapper around nested form fields, specifically QR_READER and LINK_BUTTON. It can hold the QR_READERs value.",
|
|
2395
|
+
id: "IdReaderField"
|
|
2248
2396
|
});
|
|
2249
2397
|
var CustomField = BaseField.extend({
|
|
2250
2398
|
type: import_v43.default.literal(FieldType._EXPERIMENTAL_CUSTOM),
|
|
2251
2399
|
defaultValue: CustomFieldValue.optional(),
|
|
2252
2400
|
src: import_v43.default.string().describe("Module source path for the custom field component"),
|
|
2253
2401
|
configuration: import_v43.default.unknown().optional()
|
|
2402
|
+
}).meta({
|
|
2403
|
+
description: "An expiremental custom field that is defined by a module source path",
|
|
2404
|
+
id: "CustomField"
|
|
2254
2405
|
});
|
|
2255
2406
|
var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
|
|
2256
2407
|
var LoaderField = BaseField.extend({
|
|
@@ -2260,22 +2411,25 @@ var LoaderField = BaseField.extend({
|
|
|
2260
2411
|
configuration: import_v43.default.object({
|
|
2261
2412
|
text: TranslationConfig.describe("Display text above the loading spinner")
|
|
2262
2413
|
})
|
|
2263
|
-
}).
|
|
2264
|
-
"A non-interactive field that indicates an in progress operation in form"
|
|
2265
|
-
|
|
2414
|
+
}).meta({
|
|
2415
|
+
description: "A non-interactive field that indicates an in progress operation in form",
|
|
2416
|
+
id: "LoaderField"
|
|
2417
|
+
});
|
|
2266
2418
|
var HiddenField = BaseField.extend({
|
|
2267
2419
|
type: import_v43.default.literal(FieldType.ALPHA_HIDDEN),
|
|
2268
2420
|
required: import_v43.default.boolean().default(false).optional(),
|
|
2269
2421
|
defaultValue: TextValue.optional()
|
|
2270
|
-
}).
|
|
2271
|
-
"A non-interactive, hidden field that only hold a value in the form"
|
|
2272
|
-
|
|
2422
|
+
}).meta({
|
|
2423
|
+
description: "A non-interactive, hidden field that only hold a value in the form",
|
|
2424
|
+
id: "HiddenField"
|
|
2425
|
+
});
|
|
2273
2426
|
var UserRoleField = BaseField.extend({
|
|
2274
2427
|
type: import_v43.default.literal(FieldType.USER_ROLE),
|
|
2275
2428
|
defaultValue: TextValue.optional()
|
|
2276
|
-
}).
|
|
2277
|
-
"A select dropdown that is automatically populated with available user roles"
|
|
2278
|
-
|
|
2429
|
+
}).meta({
|
|
2430
|
+
description: "A select dropdown that is automatically populated with available user roles",
|
|
2431
|
+
id: "UserRoleField"
|
|
2432
|
+
});
|
|
2279
2433
|
var FieldConfig = import_v43.default.discriminatedUnion("type", [
|
|
2280
2434
|
FieldGroup,
|
|
2281
2435
|
Address,
|
|
@@ -2374,16 +2528,19 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2374
2528
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2375
2529
|
actions: VerificationActionConfig
|
|
2376
2530
|
});
|
|
2377
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2531
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2532
|
+
id: "PageConfig",
|
|
2533
|
+
description: "Configuration for a single page in a form. Either a form page with fields and a continue button, or a verification page with verify/cancel options."
|
|
2534
|
+
});
|
|
2381
2535
|
|
|
2382
2536
|
// ../commons/src/events/FormConfig.ts
|
|
2383
2537
|
var DeclarationFormConfig = z22.object({
|
|
2384
2538
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2385
2539
|
pages: z22.array(FormPageConfig)
|
|
2386
|
-
}).
|
|
2540
|
+
}).meta({
|
|
2541
|
+
id: "DeclarationFormConfig",
|
|
2542
|
+
description: "Configuration of the declaration form."
|
|
2543
|
+
});
|
|
2387
2544
|
var ActionFormConfig = z22.object({
|
|
2388
2545
|
label: TranslationConfig.describe("Human readable description of the form"),
|
|
2389
2546
|
pages: z22.array(PageConfig)
|
|
@@ -2483,6 +2640,9 @@ var DeduplicationConfig = z23.object({
|
|
|
2483
2640
|
id: z23.string(),
|
|
2484
2641
|
label: TranslationConfig,
|
|
2485
2642
|
query: Clause
|
|
2643
|
+
}).meta({
|
|
2644
|
+
id: "DeduplicationConfig",
|
|
2645
|
+
description: "Configuration for duplicate detection on a declare or register action. The query is built from fuzzy / strict / date-range matchers combined with and/or/not."
|
|
2486
2646
|
});
|
|
2487
2647
|
|
|
2488
2648
|
// ../commons/src/events/ActionConfig.ts
|
|
@@ -2520,6 +2680,57 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
2520
2680
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2521
2681
|
}).shape
|
|
2522
2682
|
);
|
|
2683
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
2684
|
+
z24.object({
|
|
2685
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
2686
|
+
}).shape
|
|
2687
|
+
);
|
|
2688
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2689
|
+
z24.object({
|
|
2690
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
2691
|
+
label: z24.never().optional().describe(
|
|
2692
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2693
|
+
),
|
|
2694
|
+
supportingCopy: z24.never().optional(),
|
|
2695
|
+
icon: z24.never().optional().describe(
|
|
2696
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2697
|
+
),
|
|
2698
|
+
conditionals: z24.never().optional().describe(
|
|
2699
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2700
|
+
)
|
|
2701
|
+
}).shape
|
|
2702
|
+
);
|
|
2703
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2704
|
+
z24.object({
|
|
2705
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2706
|
+
}).shape
|
|
2707
|
+
);
|
|
2708
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2709
|
+
z24.object({
|
|
2710
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2711
|
+
}).shape
|
|
2712
|
+
);
|
|
2713
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
2714
|
+
z24.object({
|
|
2715
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
2716
|
+
flags: z24.never().optional().describe(
|
|
2717
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2718
|
+
)
|
|
2719
|
+
}).shape
|
|
2720
|
+
);
|
|
2721
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
2722
|
+
z24.object({
|
|
2723
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
2724
|
+
flags: z24.never().optional().describe(
|
|
2725
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2726
|
+
)
|
|
2727
|
+
}).shape
|
|
2728
|
+
);
|
|
2729
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
2730
|
+
z24.object({
|
|
2731
|
+
type: z24.literal(ActionType.DELETE)
|
|
2732
|
+
}).shape
|
|
2733
|
+
);
|
|
2523
2734
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2524
2735
|
z24.object({
|
|
2525
2736
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -2582,7 +2793,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
2582
2793
|
correctionForm: ActionFormConfig
|
|
2583
2794
|
}).shape
|
|
2584
2795
|
);
|
|
2585
|
-
var
|
|
2796
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2797
|
+
z24.object({
|
|
2798
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
2799
|
+
}).shape
|
|
2800
|
+
);
|
|
2801
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2802
|
+
z24.object({
|
|
2803
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
2804
|
+
}).shape
|
|
2805
|
+
);
|
|
2806
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
2586
2807
|
z24.object({
|
|
2587
2808
|
type: z24.literal(ActionType.CUSTOM),
|
|
2588
2809
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -2593,24 +2814,85 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
2593
2814
|
auditHistoryLabel: TranslationConfig.describe(
|
|
2594
2815
|
'The label to show in audit history for this action. For example "Approved".'
|
|
2595
2816
|
)
|
|
2596
|
-
})
|
|
2817
|
+
}).shape
|
|
2597
2818
|
);
|
|
2598
2819
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
2599
2820
|
/*
|
|
2600
2821
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
|
2601
2822
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
|
2602
2823
|
*/
|
|
2603
|
-
ReadActionConfig.meta({
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2824
|
+
ReadActionConfig.meta({
|
|
2825
|
+
id: "ReadActionConfig",
|
|
2826
|
+
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
2827
|
+
}),
|
|
2828
|
+
AssignConfig.meta({
|
|
2829
|
+
id: "AssignActionConfig",
|
|
2830
|
+
description: "Configuration for assigning a record to the current user."
|
|
2831
|
+
}),
|
|
2832
|
+
UnassignConfig.meta({
|
|
2833
|
+
id: "UnassignActionConfig",
|
|
2834
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
2835
|
+
}),
|
|
2836
|
+
DeleteConfig.meta({
|
|
2837
|
+
id: "DeleteActionConfig",
|
|
2838
|
+
description: "Configuration for deleting a draft record."
|
|
2839
|
+
}),
|
|
2840
|
+
NotifyConfig.meta({
|
|
2841
|
+
id: "NotifyActionConfig",
|
|
2842
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
2843
|
+
}),
|
|
2844
|
+
DeclareConfig.meta({
|
|
2845
|
+
id: "DeclareActionConfig",
|
|
2846
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
2847
|
+
}),
|
|
2848
|
+
DuplicateDetectedConfig.meta({
|
|
2849
|
+
id: "DuplicateDetectedActionConfig",
|
|
2850
|
+
description: "Configuration for the system-generated duplicate-detection action. Never shown as a button, so it only supports flags \u2014 not label, icon, or conditionals."
|
|
2851
|
+
}),
|
|
2852
|
+
MarkAsDuplicateConfig.meta({
|
|
2853
|
+
id: "MarkAsDuplicateActionConfig",
|
|
2854
|
+
description: "Configuration for marking a record as a duplicate."
|
|
2855
|
+
}),
|
|
2856
|
+
MarkAsNotDuplicateConfig.meta({
|
|
2857
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
2858
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
2859
|
+
}),
|
|
2860
|
+
RejectConfig.meta({
|
|
2861
|
+
id: "RejectActionConfig",
|
|
2862
|
+
description: "Configuration for rejecting a record before registration."
|
|
2863
|
+
}),
|
|
2864
|
+
RegisterConfig.meta({
|
|
2865
|
+
id: "RegisterActionConfig",
|
|
2866
|
+
description: "Configuration for registering a record."
|
|
2867
|
+
}),
|
|
2607
2868
|
PrintCertificateActionConfig.meta({
|
|
2608
|
-
id: "PrintCertificateActionConfig"
|
|
2869
|
+
id: "PrintCertificateActionConfig",
|
|
2870
|
+
description: "Configuration for printing a certificate of a registered record."
|
|
2871
|
+
}),
|
|
2872
|
+
RequestCorrectionConfig.meta({
|
|
2873
|
+
id: "RequestCorrectionActionConfig",
|
|
2874
|
+
description: "Configuration for requesting a correction on a registered record."
|
|
2875
|
+
}),
|
|
2876
|
+
ApproveCorrectionConfig.meta({
|
|
2877
|
+
id: "ApproveCorrectionActionConfig",
|
|
2878
|
+
description: "Configuration for approving a requested correction."
|
|
2879
|
+
}),
|
|
2880
|
+
RejectCorrectionConfig.meta({
|
|
2881
|
+
id: "RejectCorrectionActionConfig",
|
|
2882
|
+
description: "Configuration for rejecting a requested correction."
|
|
2883
|
+
}),
|
|
2884
|
+
EditActionConfig.meta({
|
|
2885
|
+
id: "EditActionConfig",
|
|
2886
|
+
description: "Configuration for editing a record before registration."
|
|
2609
2887
|
}),
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2888
|
+
ArchiveConfig.meta({
|
|
2889
|
+
id: "ArchiveActionConfig",
|
|
2890
|
+
description: "Configuration for archiving a record."
|
|
2891
|
+
}),
|
|
2892
|
+
CustomActionConfig.meta({
|
|
2893
|
+
id: "CustomActionConfig",
|
|
2894
|
+
description: "Configuration for a country-defined custom action. An event may include any number of these."
|
|
2895
|
+
})
|
|
2614
2896
|
]).describe(
|
|
2615
2897
|
"Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
|
|
2616
2898
|
).meta({ id: "ActionConfig" });
|
|
@@ -2686,7 +2968,10 @@ var Field = BaseField2.extend({
|
|
|
2686
2968
|
}).describe("Custom field defined for the summary view.");
|
|
2687
2969
|
var SummaryConfig = z27.object({
|
|
2688
2970
|
fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
|
|
2689
|
-
}).
|
|
2971
|
+
}).meta({
|
|
2972
|
+
id: "SummaryConfig",
|
|
2973
|
+
description: "Configuration of the event overview page. Defines which declaration fields appear in the record summary, optionally with custom labels, empty-value messages, and templated values."
|
|
2974
|
+
});
|
|
2690
2975
|
|
|
2691
2976
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
|
2692
2977
|
var z28 = __toESM(require("zod/v4"));
|
|
@@ -2757,6 +3042,9 @@ var BaseField3 = z28.object({
|
|
|
2757
3042
|
),
|
|
2758
3043
|
validations: z28.array(ValidationConfig).optional().describe(
|
|
2759
3044
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3045
|
+
),
|
|
3046
|
+
allowedLocations: JurisdictionReference.optional().describe(
|
|
3047
|
+
`Override the allowedLocations for a location field in advanced search. Use this when the declaration form's allowedLocations references a scope (e.g. record.create) that search-only users don't have \u2014 specify record.search scope instead.`
|
|
2760
3048
|
)
|
|
2761
3049
|
});
|
|
2762
3050
|
var SearchQueryParams = z28.object({
|
|
@@ -2810,6 +3098,9 @@ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema
|
|
|
2810
3098
|
var AdvancedSearchConfig = z28.object({
|
|
2811
3099
|
title: TranslationConfig.describe("Advanced search tab title"),
|
|
2812
3100
|
fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
|
|
3101
|
+
}).meta({
|
|
3102
|
+
id: "AdvancedSearchConfig",
|
|
3103
|
+
description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
|
|
2813
3104
|
});
|
|
2814
3105
|
|
|
2815
3106
|
// ../commons/src/events/utils.ts
|
|
@@ -2860,7 +3151,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
|
|
|
2860
3151
|
}
|
|
2861
3152
|
return current;
|
|
2862
3153
|
}
|
|
3154
|
+
function todayISO() {
|
|
3155
|
+
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3156
|
+
}
|
|
3157
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3158
|
+
function compileClientFunction(code) {
|
|
3159
|
+
let fn = compiledFunctionCache.get(code);
|
|
3160
|
+
if (!fn) {
|
|
3161
|
+
fn = new Function(`return (${code})`)();
|
|
3162
|
+
compiledFunctionCache.set(code, fn);
|
|
3163
|
+
}
|
|
3164
|
+
return fn;
|
|
3165
|
+
}
|
|
2863
3166
|
(0, import_ajv_formats.default)(ajv);
|
|
3167
|
+
function buildClientFunctionContext(input) {
|
|
3168
|
+
return {
|
|
3169
|
+
$form: input.form,
|
|
3170
|
+
$now: todayISO(),
|
|
3171
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3172
|
+
$online: isOnline(),
|
|
3173
|
+
$user: input.validatorContext?.user,
|
|
3174
|
+
$event: input.validatorContext?.event,
|
|
3175
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3176
|
+
user: input.systemVariables?.user,
|
|
3177
|
+
$window: input.systemVariables?.$window,
|
|
3178
|
+
locations: input.locations,
|
|
3179
|
+
adminLevelIds: input.adminLevelIds
|
|
3180
|
+
};
|
|
3181
|
+
}
|
|
3182
|
+
function runClientFunction(code, data, context) {
|
|
3183
|
+
return compileClientFunction(code)(data, context);
|
|
3184
|
+
}
|
|
2864
3185
|
ajv.addKeyword({
|
|
2865
3186
|
keyword: "daysFromDate",
|
|
2866
3187
|
type: "string",
|
|
@@ -2905,12 +3226,35 @@ ajv.addKeyword({
|
|
|
2905
3226
|
$data: true,
|
|
2906
3227
|
errors: true,
|
|
2907
3228
|
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
2908
|
-
validate(
|
|
3229
|
+
validate(_schema, data, _2, dataContext) {
|
|
2909
3230
|
const locationIdInput = data;
|
|
2910
3231
|
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
2911
3232
|
return locations.some((location) => location.id === locationIdInput);
|
|
2912
3233
|
}
|
|
2913
3234
|
});
|
|
3235
|
+
ajv.addKeyword({
|
|
3236
|
+
keyword: "customClientValidator",
|
|
3237
|
+
schemaType: "object",
|
|
3238
|
+
errors: true,
|
|
3239
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3240
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3241
|
+
// so the cast holds.
|
|
3242
|
+
validate(schema, data, _2, dataContext) {
|
|
3243
|
+
return Boolean(
|
|
3244
|
+
runClientFunction(
|
|
3245
|
+
schema.code,
|
|
3246
|
+
data,
|
|
3247
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3248
|
+
)
|
|
3249
|
+
);
|
|
3250
|
+
}
|
|
3251
|
+
});
|
|
3252
|
+
function isOnline() {
|
|
3253
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3254
|
+
return navigator.onLine;
|
|
3255
|
+
}
|
|
3256
|
+
return true;
|
|
3257
|
+
}
|
|
2914
3258
|
|
|
2915
3259
|
// ../commons/src/utils.ts
|
|
2916
3260
|
var z32 = __toESM(require("zod/v4"));
|
|
@@ -2953,7 +3297,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
2953
3297
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
2954
3298
|
return actionConfig.form;
|
|
2955
3299
|
}
|
|
2956
|
-
if ("review" in actionConfig) {
|
|
3300
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
2957
3301
|
return actionConfig.review.fields;
|
|
2958
3302
|
}
|
|
2959
3303
|
return [];
|
|
@@ -3529,7 +3873,54 @@ function createFieldConditionals(fieldId) {
|
|
|
3529
3873
|
}
|
|
3530
3874
|
},
|
|
3531
3875
|
required: [fieldId]
|
|
3532
|
-
})
|
|
3876
|
+
}),
|
|
3877
|
+
/**
|
|
3878
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
3879
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
3880
|
+
* available inside the function body — all logic must be self-contained.
|
|
3881
|
+
*
|
|
3882
|
+
* @example
|
|
3883
|
+
* field('nid').customClientValidator((value) => {
|
|
3884
|
+
* // LUHN check — all logic must be inline
|
|
3885
|
+
* const digits = String(value).split('').map(Number)
|
|
3886
|
+
* // ...
|
|
3887
|
+
* return isValid
|
|
3888
|
+
* })
|
|
3889
|
+
*/
|
|
3890
|
+
customClientValidator(validationFn) {
|
|
3891
|
+
const code = validationFn.toString();
|
|
3892
|
+
return defineFormConditional({
|
|
3893
|
+
type: "object",
|
|
3894
|
+
properties: wrapToPath(
|
|
3895
|
+
{ [fieldId]: { customClientValidator: { code } } },
|
|
3896
|
+
this.$$subfield
|
|
3897
|
+
),
|
|
3898
|
+
required: [fieldId]
|
|
3899
|
+
});
|
|
3900
|
+
},
|
|
3901
|
+
/**
|
|
3902
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
3903
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
3904
|
+
* The function receives the referenced field's value as the first argument and
|
|
3905
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
3906
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
3907
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
3908
|
+
*
|
|
3909
|
+
* For computing a default value without referencing a specific field, use
|
|
3910
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
3911
|
+
*
|
|
3912
|
+
* @example
|
|
3913
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
3914
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
3915
|
+
* )
|
|
3916
|
+
*/
|
|
3917
|
+
customClientEvaluation(computationFn) {
|
|
3918
|
+
return {
|
|
3919
|
+
$$code: computationFn.toString(),
|
|
3920
|
+
$$field: fieldId,
|
|
3921
|
+
$$subfield: this.$$subfield
|
|
3922
|
+
};
|
|
3923
|
+
}
|
|
3533
3924
|
};
|
|
3534
3925
|
}
|
|
3535
3926
|
|
|
@@ -3617,7 +4008,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
3617
4008
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
3618
4009
|
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
3619
4010
|
const actionFlagIds = event2.actions.flatMap(
|
|
3620
|
-
(action) => action.flags.map((flag) => flag.id)
|
|
4011
|
+
(action) => (action.flags ?? []).map((flag) => flag.id)
|
|
3621
4012
|
);
|
|
3622
4013
|
for (const actionFlagId of actionFlagIds) {
|
|
3623
4014
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -3677,7 +4068,7 @@ var _EventConfigBase = z33.object({
|
|
|
3677
4068
|
),
|
|
3678
4069
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
3679
4070
|
actions: z33.array(ActionConfig).describe(
|
|
3680
|
-
"Configuration of
|
|
4071
|
+
"Configuration of core and custom actions associated with the event."
|
|
3681
4072
|
),
|
|
3682
4073
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
3683
4074
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -3689,7 +4080,7 @@ var _EventConfigBase = z33.object({
|
|
|
3689
4080
|
"Configuration of fields available in the advanced search feature."
|
|
3690
4081
|
),
|
|
3691
4082
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
3692
|
-
"Configuration of flags associated with the actions of this event type."
|
|
4083
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
3693
4084
|
),
|
|
3694
4085
|
analytics: z33.boolean().optional().default(true).describe(
|
|
3695
4086
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -3702,8 +4093,9 @@ var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
|
|
|
3702
4093
|
validateActionFlags(event2, ctx);
|
|
3703
4094
|
validateActionOrder(event2, ctx);
|
|
3704
4095
|
}).meta({
|
|
3705
|
-
id: "EventConfig"
|
|
3706
|
-
|
|
4096
|
+
id: "EventConfig",
|
|
4097
|
+
description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
|
|
4098
|
+
});
|
|
3707
4099
|
|
|
3708
4100
|
// ../commons/src/events/EventConfigInput.ts
|
|
3709
4101
|
var defineDeclarationForm = (form) => DeclarationFormConfig.parse(form);
|
|
@@ -3925,6 +4317,9 @@ var WorkqueueColumnValue = z34.object({
|
|
|
3925
4317
|
var WorkqueueColumn = z34.object({
|
|
3926
4318
|
label: TranslationConfig,
|
|
3927
4319
|
value: WorkqueueColumnValue
|
|
4320
|
+
}).meta({
|
|
4321
|
+
id: "WorkqueueColumn",
|
|
4322
|
+
description: "Configuration for a single workqueue column. The value references an event metadata key (e.g. `dateOfEvent`, `status`, `trackingId`)."
|
|
3928
4323
|
});
|
|
3929
4324
|
function defineWorkqueuesColumns(workqueueColumns) {
|
|
3930
4325
|
return workqueueColumns.map(
|
|
@@ -4127,18 +4522,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
4127
4522
|
query: true,
|
|
4128
4523
|
columns: true
|
|
4129
4524
|
});
|
|
4130
|
-
var WorkqueueConfigInput =
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
query: CountryConfigQueryInputType,
|
|
4136
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
4137
|
-
"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."
|
|
4138
|
-
),
|
|
4139
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
4140
|
-
icon: AvailableIcons,
|
|
4141
|
-
emptyMessage: TranslationConfig.optional()
|
|
4525
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
4526
|
+
query: CountryConfigQueryInputType
|
|
4527
|
+
}).meta({
|
|
4528
|
+
id: "WorkqueueConfig",
|
|
4529
|
+
description: "Configuration for a single workqueue. Defines the filter applied to the event index, the quick-action button, the columns shown on each row, and the message rendered when the queue is empty."
|
|
4142
4530
|
});
|
|
4143
4531
|
var WorkqueueCountInput = z37.array(
|
|
4144
4532
|
z37.object({ slug: z37.string(), query: QueryType })
|
|
@@ -4178,6 +4566,11 @@ var BaseActionInput = z38.object({
|
|
|
4178
4566
|
originalActionId: UUID.optional(),
|
|
4179
4567
|
// should not be part of base action.
|
|
4180
4568
|
keepAssignment: z38.boolean().optional(),
|
|
4569
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
4570
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
4571
|
+
waitFor: z38.boolean().default(true).describe(
|
|
4572
|
+
"Whether action waits for the indexing before returning. Defaults to true. Setting this to to false completes faster but might lead to stale data in the client if the client tries to read the event immediately after performing the action. Use with care."
|
|
4573
|
+
),
|
|
4181
4574
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4182
4575
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
4183
4576
|
createdAtLocation: UUID.nullish().describe(
|
|
@@ -4295,7 +4688,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
|
|
|
4295
4688
|
var ApproveCorrectionActionInput = BaseActionInput.extend(
|
|
4296
4689
|
z38.object({
|
|
4297
4690
|
requestId: z38.string(),
|
|
4298
|
-
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
|
4691
|
+
type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
|
|
4692
|
+
content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
|
|
4299
4693
|
}).shape
|
|
4300
4694
|
);
|
|
4301
4695
|
var ReadActionInput = BaseActionInput.extend(
|
|
@@ -4357,7 +4751,7 @@ var Draft = z39.object({
|
|
|
4357
4751
|
}).describe(
|
|
4358
4752
|
"A temporary storage for an action. Stored with details of the event, creator and creation time."
|
|
4359
4753
|
);
|
|
4360
|
-
var DraftInput = BaseActionInput.extend({
|
|
4754
|
+
var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
|
|
4361
4755
|
type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
|
|
4362
4756
|
status: z39.enum([
|
|
4363
4757
|
ActionStatus.Requested,
|
|
@@ -4407,12 +4801,53 @@ var updateActions = ActionTypes.extract([
|
|
|
4407
4801
|
ActionType.ARCHIVE,
|
|
4408
4802
|
ActionType.PRINT_CERTIFICATE,
|
|
4409
4803
|
ActionType.REQUEST_CORRECTION,
|
|
4804
|
+
ActionType.APPROVE_CORRECTION,
|
|
4805
|
+
ActionType.REJECT_CORRECTION,
|
|
4410
4806
|
ActionType.CUSTOM
|
|
4411
4807
|
]);
|
|
4412
4808
|
|
|
4413
4809
|
// ../commons/src/events/state/flags.ts
|
|
4414
4810
|
var import_lodash3 = require("lodash");
|
|
4415
4811
|
var import_date_fns3 = require("date-fns");
|
|
4812
|
+
var INHERENT_FLAG_RULES = [
|
|
4813
|
+
{
|
|
4814
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4815
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4816
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4817
|
+
},
|
|
4818
|
+
{
|
|
4819
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4820
|
+
// other status-changing action (see getStatusFromActions).
|
|
4821
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4822
|
+
setOn: [ActionType.NOTIFY],
|
|
4823
|
+
resetOn: [
|
|
4824
|
+
ActionType.CREATE,
|
|
4825
|
+
ActionType.DECLARE,
|
|
4826
|
+
ActionType.REGISTER,
|
|
4827
|
+
ActionType.ARCHIVE
|
|
4828
|
+
]
|
|
4829
|
+
},
|
|
4830
|
+
{
|
|
4831
|
+
flag: InherentFlags.REJECTED,
|
|
4832
|
+
setOn: [ActionType.REJECT],
|
|
4833
|
+
resetOn: [
|
|
4834
|
+
ActionType.NOTIFY,
|
|
4835
|
+
ActionType.DECLARE,
|
|
4836
|
+
ActionType.EDIT,
|
|
4837
|
+
ActionType.REGISTER
|
|
4838
|
+
]
|
|
4839
|
+
},
|
|
4840
|
+
{
|
|
4841
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4842
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4843
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4844
|
+
},
|
|
4845
|
+
{
|
|
4846
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4847
|
+
setOn: [ActionType.EDIT],
|
|
4848
|
+
resetOnAnyOtherAction: true
|
|
4849
|
+
}
|
|
4850
|
+
];
|
|
4416
4851
|
|
|
4417
4852
|
// ../commons/src/events/defineConfig.ts
|
|
4418
4853
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5158,6 +5593,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5158
5593
|
id: "signature.upload.modal.title",
|
|
5159
5594
|
defaultMessage: "Draw signature",
|
|
5160
5595
|
description: "Title for the modal to draw signature"
|
|
5596
|
+
},
|
|
5597
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
5598
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
5599
|
+
configuration: {
|
|
5600
|
+
maxFileSize: 5 * 1024 * 1024
|
|
5161
5601
|
}
|
|
5162
5602
|
}
|
|
5163
5603
|
]
|
|
@@ -5714,6 +6154,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5714
6154
|
},
|
|
5715
6155
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5716
6156
|
},
|
|
6157
|
+
{
|
|
6158
|
+
type: ActionType.NOTIFY,
|
|
6159
|
+
label: {
|
|
6160
|
+
defaultMessage: "Notify health worker",
|
|
6161
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
6162
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
6163
|
+
},
|
|
6164
|
+
flags: [
|
|
6165
|
+
{
|
|
6166
|
+
id: "health-worker-notified",
|
|
6167
|
+
operation: "add"
|
|
6168
|
+
}
|
|
6169
|
+
]
|
|
6170
|
+
},
|
|
5717
6171
|
{
|
|
5718
6172
|
type: ActionType.REJECT,
|
|
5719
6173
|
label: {
|
|
@@ -5956,6 +6410,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5956
6410
|
}
|
|
5957
6411
|
}
|
|
5958
6412
|
],
|
|
6413
|
+
flags: [
|
|
6414
|
+
{
|
|
6415
|
+
id: "health-worker-notified",
|
|
6416
|
+
requiresAction: false,
|
|
6417
|
+
label: {
|
|
6418
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
6419
|
+
defaultMessage: "Health worker notified",
|
|
6420
|
+
description: "Label for the health-worker-notified flag"
|
|
6421
|
+
}
|
|
6422
|
+
}
|
|
6423
|
+
],
|
|
5959
6424
|
advancedSearch: [
|
|
5960
6425
|
{
|
|
5961
6426
|
title: {
|
|
@@ -6951,10 +7416,380 @@ var ACTION_FILTERS = {
|
|
|
6951
7416
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
6952
7417
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
6953
7418
|
};
|
|
7419
|
+
var REJECTED_ACTIONS = [
|
|
7420
|
+
ActionType.READ,
|
|
7421
|
+
ActionType.NOTIFY,
|
|
7422
|
+
ActionType.CUSTOM,
|
|
7423
|
+
ActionType.EDIT,
|
|
7424
|
+
ActionType.ARCHIVE
|
|
7425
|
+
];
|
|
6954
7426
|
|
|
6955
7427
|
// ../commons/src/events/FileUtils.ts
|
|
6956
7428
|
var import_lodash7 = require("lodash");
|
|
6957
7429
|
|
|
7430
|
+
// ../commons/src/events/mocks.test.utils.ts
|
|
7431
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS = [
|
|
7432
|
+
{
|
|
7433
|
+
id: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7434
|
+
name: "Central",
|
|
7435
|
+
parentId: null,
|
|
7436
|
+
validUntil: null,
|
|
7437
|
+
externalId: "ydyJb1RAy4U1"
|
|
7438
|
+
},
|
|
7439
|
+
{
|
|
7440
|
+
id: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7441
|
+
name: "Sulaka",
|
|
7442
|
+
parentId: null,
|
|
7443
|
+
validUntil: null,
|
|
7444
|
+
externalId: "pQ8nGxWmZ2Q3"
|
|
7445
|
+
},
|
|
7446
|
+
{
|
|
7447
|
+
id: "7ef2b9c7-5e6d-49f6-ae05-656207d0fc64",
|
|
7448
|
+
name: "Pualula",
|
|
7449
|
+
parentId: null,
|
|
7450
|
+
validUntil: null,
|
|
7451
|
+
externalId: "Aq91DweLmT8k"
|
|
7452
|
+
},
|
|
7453
|
+
{
|
|
7454
|
+
id: "6d1a59df-988c-4021-a846-ccbc021931a7",
|
|
7455
|
+
name: "Chuminga",
|
|
7456
|
+
parentId: null,
|
|
7457
|
+
validUntil: null,
|
|
7458
|
+
externalId: "Rw0fYNh2Xk9a"
|
|
7459
|
+
},
|
|
7460
|
+
{
|
|
7461
|
+
id: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7462
|
+
name: "Ibombo",
|
|
7463
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7464
|
+
validUntil: null,
|
|
7465
|
+
externalId: "k7DsP4vbN1Qe"
|
|
7466
|
+
},
|
|
7467
|
+
{
|
|
7468
|
+
id: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7469
|
+
name: "Isango",
|
|
7470
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7471
|
+
validUntil: null,
|
|
7472
|
+
externalId: "Gm3Z9eQpHw4L"
|
|
7473
|
+
},
|
|
7474
|
+
{
|
|
7475
|
+
id: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7476
|
+
name: "Isamba",
|
|
7477
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7478
|
+
validUntil: null,
|
|
7479
|
+
externalId: "sT0xVu1KqJ7r"
|
|
7480
|
+
},
|
|
7481
|
+
{
|
|
7482
|
+
id: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7483
|
+
name: "Itambo",
|
|
7484
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7485
|
+
validUntil: null,
|
|
7486
|
+
externalId: "Nq6Bv2HpL9Te"
|
|
7487
|
+
},
|
|
7488
|
+
{
|
|
7489
|
+
id: "d42ab2fe-e7ed-470e-8b31-4fb27f9b8250",
|
|
7490
|
+
name: "Ezhi",
|
|
7491
|
+
parentId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7492
|
+
validUntil: null,
|
|
7493
|
+
externalId: "xK8cQ0ZRy5Wd"
|
|
7494
|
+
},
|
|
7495
|
+
{
|
|
7496
|
+
id: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7497
|
+
name: "Ilanga",
|
|
7498
|
+
parentId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7499
|
+
validUntil: null,
|
|
7500
|
+
externalId: "Cq4Jm1XvN8Ls"
|
|
7501
|
+
},
|
|
7502
|
+
// Villages under Ibombo (62a0ccb4-880d-4f30-8882-f256007dfff9)
|
|
7503
|
+
{
|
|
7504
|
+
id: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7505
|
+
name: "Klow",
|
|
7506
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7507
|
+
validUntil: null,
|
|
7508
|
+
externalId: "IkYcYBUcyY2"
|
|
7509
|
+
},
|
|
7510
|
+
{
|
|
7511
|
+
id: "2e5f6a7b-8c9d-4a23-8fab-456789012345",
|
|
7512
|
+
name: "Mbondo",
|
|
7513
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7514
|
+
validUntil: null,
|
|
7515
|
+
externalId: "Qhvv5hvo3mY"
|
|
7516
|
+
},
|
|
7517
|
+
{
|
|
7518
|
+
id: "3f6a7b8c-9d0e-4b34-8abc-567890123456",
|
|
7519
|
+
name: "Ndara",
|
|
7520
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7521
|
+
validUntil: null,
|
|
7522
|
+
externalId: "crXh068O9TR"
|
|
7523
|
+
},
|
|
7524
|
+
{
|
|
7525
|
+
id: "4a7b8c9d-0e1f-4c45-abcd-678901234567",
|
|
7526
|
+
name: "Olani",
|
|
7527
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7528
|
+
validUntil: null,
|
|
7529
|
+
externalId: "r00It8Tvvp7"
|
|
7530
|
+
},
|
|
7531
|
+
{
|
|
7532
|
+
id: "5b8c9d0e-1f2a-4d56-bcde-789012345678",
|
|
7533
|
+
name: "Pemba",
|
|
7534
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7535
|
+
validUntil: null,
|
|
7536
|
+
externalId: "ZnUWsbONIaH"
|
|
7537
|
+
},
|
|
7538
|
+
{
|
|
7539
|
+
id: "6c9d0e1f-2a3b-4e67-8def-890123456789",
|
|
7540
|
+
name: "Quanza",
|
|
7541
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7542
|
+
validUntil: null,
|
|
7543
|
+
externalId: "fDZycvQTa7l"
|
|
7544
|
+
},
|
|
7545
|
+
{
|
|
7546
|
+
id: "7d0e1f2a-3b4c-4f78-8efa-901234567890",
|
|
7547
|
+
name: "Rivka",
|
|
7548
|
+
parentId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7549
|
+
validUntil: null,
|
|
7550
|
+
externalId: "KqswxCGTELa"
|
|
7551
|
+
},
|
|
7552
|
+
// Villages under Isamba (967032fd-3f81-478a-826c-30cb8fe121bd)
|
|
7553
|
+
{
|
|
7554
|
+
id: "8e1f2a3b-4c5d-4089-8fab-012345678901",
|
|
7555
|
+
name: "Mbula",
|
|
7556
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7557
|
+
validUntil: null,
|
|
7558
|
+
externalId: "osEbKjRc9Kg"
|
|
7559
|
+
},
|
|
7560
|
+
{
|
|
7561
|
+
id: "9f2a3b4c-5d6e-4190-8abf-123456789012",
|
|
7562
|
+
name: "Ndoki",
|
|
7563
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7564
|
+
validUntil: null,
|
|
7565
|
+
externalId: "aq4daBUAGr3"
|
|
7566
|
+
},
|
|
7567
|
+
{
|
|
7568
|
+
id: "0a3b4c5d-6e7f-4201-abcd-234567890123",
|
|
7569
|
+
name: "Tsanga",
|
|
7570
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7571
|
+
validUntil: null,
|
|
7572
|
+
externalId: "cqis6Y8trbJ"
|
|
7573
|
+
},
|
|
7574
|
+
{
|
|
7575
|
+
id: "1b4c5d6e-7f8a-4312-bcde-345678901234",
|
|
7576
|
+
name: "Waziri",
|
|
7577
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7578
|
+
validUntil: null,
|
|
7579
|
+
externalId: "LMijHPyyx6d"
|
|
7580
|
+
},
|
|
7581
|
+
{
|
|
7582
|
+
id: "2c5d6e7f-8a9b-4423-8def-456789012345",
|
|
7583
|
+
name: "Zimbi",
|
|
7584
|
+
parentId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7585
|
+
validUntil: null,
|
|
7586
|
+
externalId: "pcQYbPuKGZ7"
|
|
7587
|
+
},
|
|
7588
|
+
// Villages under Itambo (89a33893-b17d-481d-a26d-6461e7ac1651)
|
|
7589
|
+
{
|
|
7590
|
+
id: "3d6e7f8a-9b0c-4534-8efa-567890123456",
|
|
7591
|
+
name: "Felani",
|
|
7592
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7593
|
+
validUntil: null,
|
|
7594
|
+
externalId: "gSqpoCGdMXp"
|
|
7595
|
+
},
|
|
7596
|
+
{
|
|
7597
|
+
id: "4e7f8a9b-0c1d-4645-8fab-678901234567",
|
|
7598
|
+
name: "Goroma",
|
|
7599
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7600
|
+
validUntil: null,
|
|
7601
|
+
externalId: "KvAAIaNqVrp"
|
|
7602
|
+
},
|
|
7603
|
+
{
|
|
7604
|
+
id: "5f8a9b0c-1d2e-4756-8abc-789012345678",
|
|
7605
|
+
name: "Halifu",
|
|
7606
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7607
|
+
validUntil: null,
|
|
7608
|
+
externalId: "qe4UnEVt1hv"
|
|
7609
|
+
},
|
|
7610
|
+
{
|
|
7611
|
+
id: "6a9b0c1d-2e3f-4867-abcd-890123456789",
|
|
7612
|
+
name: "Jabari",
|
|
7613
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7614
|
+
validUntil: null,
|
|
7615
|
+
externalId: "yHH9Nz4rLOt"
|
|
7616
|
+
},
|
|
7617
|
+
{
|
|
7618
|
+
id: "7b0c1d2e-3f4a-4978-bcde-901234567890",
|
|
7619
|
+
name: "Kifani",
|
|
7620
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7621
|
+
validUntil: null,
|
|
7622
|
+
externalId: "eSWmXIGeu1I"
|
|
7623
|
+
},
|
|
7624
|
+
{
|
|
7625
|
+
id: "8c1d2e3f-4a5b-4089-8def-012345678901",
|
|
7626
|
+
name: "Lumela",
|
|
7627
|
+
parentId: "89a33893-b17d-481d-a26d-6461e7ac1651",
|
|
7628
|
+
validUntil: null,
|
|
7629
|
+
externalId: "bh0b3aI1uP3"
|
|
7630
|
+
}
|
|
7631
|
+
];
|
|
7632
|
+
var V2_DEFAULT_MOCK_LOCATIONS = [
|
|
7633
|
+
{
|
|
7634
|
+
id: "6f6186ce-cd5f-4a5f-810a-2d99e7c4ba12",
|
|
7635
|
+
name: "Central Provincial Office",
|
|
7636
|
+
locationType: "CRVS_OFFICE",
|
|
7637
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7638
|
+
validUntil: null,
|
|
7639
|
+
externalId: "Xr3Df8WpK6Ys"
|
|
7640
|
+
},
|
|
7641
|
+
{
|
|
7642
|
+
id: "b1c2d3e4-f5a6-7890-bcde-f12345678901",
|
|
7643
|
+
name: "Central Health Post",
|
|
7644
|
+
locationType: "HEALTH_FACILITY",
|
|
7645
|
+
administrativeAreaId: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
|
7646
|
+
validUntil: null
|
|
7647
|
+
},
|
|
7648
|
+
{
|
|
7649
|
+
id: "028d2c85-ca31-426d-b5d1-2cef545a4902",
|
|
7650
|
+
name: "Ibombo District Office",
|
|
7651
|
+
locationType: "CRVS_OFFICE",
|
|
7652
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7653
|
+
validUntil: null,
|
|
7654
|
+
externalId: "Sm4Nw7GrD2Vy"
|
|
7655
|
+
},
|
|
7656
|
+
{
|
|
7657
|
+
id: "62a0ccb4-4f30-4f30-8882-f256007dff9f",
|
|
7658
|
+
name: "Isamba District Office",
|
|
7659
|
+
locationType: "CRVS_OFFICE",
|
|
7660
|
+
administrativeAreaId: "967032fd-3f81-478a-826c-30cb8fe121bd",
|
|
7661
|
+
validUntil: null,
|
|
7662
|
+
externalId: "Vg1Bq5XeH9Lt"
|
|
7663
|
+
},
|
|
7664
|
+
{
|
|
7665
|
+
id: "954c93e1-13f7-4435-bb82-35e0e215e07d",
|
|
7666
|
+
name: "Isango District Office",
|
|
7667
|
+
locationType: "CRVS_OFFICE",
|
|
7668
|
+
administrativeAreaId: "27160bbd-32d1-4625-812f-860226bfb92a",
|
|
7669
|
+
validUntil: null,
|
|
7670
|
+
externalId: "Je7Lm2XqN9Vz"
|
|
7671
|
+
},
|
|
7672
|
+
{
|
|
7673
|
+
id: "2884f5b9-17b4-49ce-bf4d-f538228935df",
|
|
7674
|
+
name: "Sulaka Provincial Office",
|
|
7675
|
+
locationType: "CRVS_OFFICE",
|
|
7676
|
+
administrativeAreaId: "c599b691-fd2d-45e1-abf4-d185de727fb5",
|
|
7677
|
+
validUntil: null,
|
|
7678
|
+
externalId: "Ht2Wp9KcX5Qv"
|
|
7679
|
+
},
|
|
7680
|
+
{
|
|
7681
|
+
id: "030358c6-54af-44be-821b-8e4af963a49c",
|
|
7682
|
+
name: "Ilanga District Office",
|
|
7683
|
+
locationType: "CRVS_OFFICE",
|
|
7684
|
+
administrativeAreaId: "8fbd09d2-212b-47f4-beb3-5e1694931d9f",
|
|
7685
|
+
validUntil: null,
|
|
7686
|
+
externalId: "Yp6Ds1WqN3Xz"
|
|
7687
|
+
},
|
|
7688
|
+
{
|
|
7689
|
+
id: "423d000f-101b-47c0-8b86-21a908067cee",
|
|
7690
|
+
name: "Chamakubi Health Post",
|
|
7691
|
+
locationType: "HEALTH_FACILITY",
|
|
7692
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7693
|
+
validUntil: null,
|
|
7694
|
+
externalId: "M1nFr8LbC2Qy"
|
|
7695
|
+
},
|
|
7696
|
+
{
|
|
7697
|
+
id: "4d3279be-d026-420c-88f7-f0a4ae986973",
|
|
7698
|
+
name: "Ibombo Rural Health Centre",
|
|
7699
|
+
locationType: "HEALTH_FACILITY",
|
|
7700
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7701
|
+
validUntil: null,
|
|
7702
|
+
externalId: "bT7pV6YrW0Xc"
|
|
7703
|
+
},
|
|
7704
|
+
{
|
|
7705
|
+
id: "190902f4-1d77-476a-8947-41145af1db7d",
|
|
7706
|
+
name: "Chikobo Rural Health Centre",
|
|
7707
|
+
locationType: "HEALTH_FACILITY",
|
|
7708
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7709
|
+
validUntil: null,
|
|
7710
|
+
externalId: "zE4qPn2SgJ5d"
|
|
7711
|
+
},
|
|
7712
|
+
{
|
|
7713
|
+
id: "f5ecbd9b-a01e-4a65-910e-70e86ab41b71",
|
|
7714
|
+
name: "Chilochabalenje Health Post",
|
|
7715
|
+
locationType: "HEALTH_FACILITY",
|
|
7716
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7717
|
+
validUntil: null,
|
|
7718
|
+
externalId: "H8vDs1MqR4Uf"
|
|
7719
|
+
},
|
|
7720
|
+
{
|
|
7721
|
+
id: "dbfc178f-7295-4b90-b28d-111c95b03127",
|
|
7722
|
+
name: "Chipeso Rural Health Centre",
|
|
7723
|
+
locationType: "HEALTH_FACILITY",
|
|
7724
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7725
|
+
validUntil: null,
|
|
7726
|
+
externalId: "Qw3uZ9KfX6Lm"
|
|
7727
|
+
},
|
|
7728
|
+
{
|
|
7729
|
+
id: "09862bfe-c7ac-46cd-987b-668681533c80",
|
|
7730
|
+
name: "Chisamba Rural Health Centre",
|
|
7731
|
+
locationType: "HEALTH_FACILITY",
|
|
7732
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7733
|
+
validUntil: null,
|
|
7734
|
+
externalId: "Yr0pCg8LdM2s"
|
|
7735
|
+
},
|
|
7736
|
+
{
|
|
7737
|
+
id: "834ce389-e95b-4fb0-96a0-33e9ab323059",
|
|
7738
|
+
name: "Chitanda Rural Health Centre",
|
|
7739
|
+
locationType: "HEALTH_FACILITY",
|
|
7740
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7741
|
+
validUntil: null,
|
|
7742
|
+
externalId: "tS9gJ4PwB1Qx"
|
|
7743
|
+
},
|
|
7744
|
+
{
|
|
7745
|
+
id: "0431c433-6062-4a4c-aee9-25271aec61ee",
|
|
7746
|
+
name: "Golden Valley Rural Health Centre",
|
|
7747
|
+
locationType: "HEALTH_FACILITY",
|
|
7748
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7749
|
+
validUntil: null,
|
|
7750
|
+
externalId: "Ld7Qm3XsA8Vr"
|
|
7751
|
+
},
|
|
7752
|
+
{
|
|
7753
|
+
id: "bc84d0b6-7ba7-480d-a339-5d9920d90eb2",
|
|
7754
|
+
name: "Ipongo Rural Health Centre",
|
|
7755
|
+
locationType: "HEALTH_FACILITY",
|
|
7756
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7757
|
+
validUntil: null,
|
|
7758
|
+
externalId: "kF2sW9DmH0Bt"
|
|
7759
|
+
},
|
|
7760
|
+
{
|
|
7761
|
+
id: "4cf1f53b-b730-41d2-8649-dff7eeed970d",
|
|
7762
|
+
name: "Itumbwe Health Post",
|
|
7763
|
+
locationType: "HEALTH_FACILITY",
|
|
7764
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7765
|
+
validUntil: null,
|
|
7766
|
+
externalId: "Ue5Xb3VaC7Pq"
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
id: "4b3676cb-9355-4942-9eb9-2ce46acaf0e0",
|
|
7770
|
+
name: "Kabangalala Rural Health Centre",
|
|
7771
|
+
locationType: "HEALTH_FACILITY",
|
|
7772
|
+
administrativeAreaId: "62a0ccb4-880d-4f30-8882-f256007dfff9",
|
|
7773
|
+
validUntil: null,
|
|
7774
|
+
externalId: "Pz8Kc1TqH6Jn"
|
|
7775
|
+
},
|
|
7776
|
+
// Village offices
|
|
7777
|
+
{
|
|
7778
|
+
id: "1f4a5b6c-7d8e-4312-8abc-345678901234",
|
|
7779
|
+
name: "Klow Village Office",
|
|
7780
|
+
locationType: "CRVS_OFFICE",
|
|
7781
|
+
administrativeAreaId: "1d4e5f6a-7b8c-4912-8efa-345678901234",
|
|
7782
|
+
validUntil: null,
|
|
7783
|
+
externalId: "PmAyxAJkxiJ"
|
|
7784
|
+
}
|
|
7785
|
+
];
|
|
7786
|
+
var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
7787
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, l])
|
|
7788
|
+
);
|
|
7789
|
+
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7790
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7791
|
+
);
|
|
7792
|
+
|
|
6958
7793
|
// ../commons/src/notification/UserNotifications.ts
|
|
6959
7794
|
var z44 = __toESM(require("zod/v4"));
|
|
6960
7795
|
var TriggerEvent = {
|