@opencrvs/toolkit 2.0.0-rc.0735aa3 → 2.0.0-rc.076ef94
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/README.md +15 -0
- package/build.sh +5 -4
- package/dist/application-config/index.js +68 -39
- package/dist/cli.js +3186 -4915
- package/dist/commons/api/router.d.ts +36 -17
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +351 -7
- package/dist/commons/conditionals/validate.d.ts +51 -2
- package/dist/commons/events/ActionConfig.d.ts +204 -2
- package/dist/commons/events/AdvancedSearchConfig.d.ts +354 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventIndex.d.ts +25 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +388 -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 +39 -0
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/locations.d.ts +1 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +21 -290
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +58 -6
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +134 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +169 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +5 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +71 -0
- package/dist/environment/logger.d.ts +15 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +497 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +199 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +412 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +794 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +173 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +163 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +169 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +112 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +100 -0
- package/dist/events/index.js +489 -158
- 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 -1
- package/dist/migrations/v2.0/index.js +88 -5133
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +352 -46
- package/dist/scopes/index.d.ts +93 -7
- package/dist/scopes/index.js +19 -8
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +83 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +81 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +115 -0
- package/dist/templates/inventory/inventory.template.yml +100 -0
- package/dist/templates/inventory/production.example.yml +77 -0
- package/dist/templates/inventory/qa.example.yml +48 -0
- package/opencrvs-toolkit-2.0.0-rc.076ef94.tgz +0 -0
- package/package.json +15 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.0735aa3.tgz +0 -0
|
@@ -118,11 +118,13 @@ var scopeOptionsPlaceEvent = z2.object({
|
|
|
118
118
|
event: scopeByEvent,
|
|
119
119
|
placeOfEvent: JurisdictionFilter.optional()
|
|
120
120
|
}).describe("Options applicable to all record scopes.");
|
|
121
|
-
var
|
|
121
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
122
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
123
|
+
notifiedBy: UserFilter.optional(),
|
|
122
124
|
declaredIn: JurisdictionFilter.optional(),
|
|
123
125
|
declaredBy: UserFilter.optional()
|
|
124
126
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
125
|
-
var AllRecordScopeOptions =
|
|
127
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
126
128
|
registeredIn: JurisdictionFilter.optional(),
|
|
127
129
|
registeredBy: UserFilter.optional()
|
|
128
130
|
}).describe(
|
|
@@ -160,6 +162,8 @@ var ResolvedScopeOptionsPlaceEvent = z2.object({
|
|
|
160
162
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
161
163
|
);
|
|
162
164
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
165
|
+
notifiedIn: UUID.nullish(),
|
|
166
|
+
notifiedBy: z2.string().optional(),
|
|
163
167
|
declaredIn: UUID.nullish(),
|
|
164
168
|
declaredBy: z2.string().optional()
|
|
165
169
|
}).describe(
|
|
@@ -205,7 +209,7 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
205
209
|
}),
|
|
206
210
|
z2.object({
|
|
207
211
|
type: ScopesWithDeclaredOptions,
|
|
208
|
-
options:
|
|
212
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
209
213
|
}),
|
|
210
214
|
z2.object({
|
|
211
215
|
type: ScopesWithFullOptions,
|
|
@@ -294,8 +298,9 @@ var EncodedScope = z2.string().brand("EncodedScope");
|
|
|
294
298
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
295
299
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
296
300
|
accessLevel: JurisdictionFilter.enum.all,
|
|
297
|
-
|
|
298
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
301
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
302
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
303
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
299
304
|
};
|
|
300
305
|
|
|
301
306
|
// ../commons/src/authentication.ts
|
|
@@ -770,6 +775,11 @@ var FieldTypesToHideInReview = [
|
|
|
770
775
|
FieldType.ALPHA_PRINT_BUTTON,
|
|
771
776
|
FieldType.ALPHA_HIDDEN
|
|
772
777
|
];
|
|
778
|
+
var HiddenFieldTypes = [
|
|
779
|
+
FieldType.HTTP,
|
|
780
|
+
FieldType.QUERY_PARAM_READER,
|
|
781
|
+
FieldType.ALPHA_HIDDEN
|
|
782
|
+
];
|
|
773
783
|
|
|
774
784
|
// ../commons/src/events/FieldValue.ts
|
|
775
785
|
var z12 = __toESM(require("zod/v4"));
|
|
@@ -888,7 +898,7 @@ var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date i
|
|
|
888
898
|
// ../commons/src/events/FieldValue.ts
|
|
889
899
|
var TextValue = z12.string();
|
|
890
900
|
var HiddenFieldValue = z12.string();
|
|
891
|
-
var NonEmptyTextValue =
|
|
901
|
+
var NonEmptyTextValue = z12.string().trim().min(1);
|
|
892
902
|
var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
893
903
|
var AgeValue = z12.object({
|
|
894
904
|
age: z12.number(),
|
|
@@ -917,6 +927,7 @@ var DateRangeFieldValue = z12.object({
|
|
|
917
927
|
var EmailValue = z12.email();
|
|
918
928
|
var CheckboxFieldValue = z12.boolean();
|
|
919
929
|
var NumberFieldValue = z12.number();
|
|
930
|
+
var SignatureFieldValue = FileFieldValue;
|
|
920
931
|
var ButtonFieldValue = z12.number();
|
|
921
932
|
var VerificationStatusValue = z12.enum([
|
|
922
933
|
"verified",
|
|
@@ -1351,6 +1362,7 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
|
1351
1362
|
)
|
|
1352
1363
|
});
|
|
1353
1364
|
var LegalStatuses = z16.object({
|
|
1365
|
+
[EventStatus.enum.NOTIFIED]: ActionCreationMetadata.nullish(),
|
|
1354
1366
|
[EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
|
|
1355
1367
|
[EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
|
|
1356
1368
|
});
|
|
@@ -1410,6 +1422,8 @@ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
|
|
|
1410
1422
|
var EventMetadataDateFieldIdInput = z16.enum([
|
|
1411
1423
|
"createdAt",
|
|
1412
1424
|
"updatedAt",
|
|
1425
|
+
"legalStatuses.NOTIFIED.createdAt",
|
|
1426
|
+
"legalStatuses.NOTIFIED.acceptedAt",
|
|
1413
1427
|
"legalStatuses.DECLARED.createdAt",
|
|
1414
1428
|
"legalStatuses.DECLARED.acceptedAt",
|
|
1415
1429
|
"legalStatuses.REGISTERED.createdAt",
|
|
@@ -1418,6 +1432,8 @@ var EventMetadataDateFieldIdInput = z16.enum([
|
|
|
1418
1432
|
var EventMetadataDateFieldId = z16.enum([
|
|
1419
1433
|
"event.createdAt",
|
|
1420
1434
|
"event.updatedAt",
|
|
1435
|
+
"event.legalStatuses.NOTIFIED.createdAt",
|
|
1436
|
+
"event.legalStatuses.NOTIFIED.acceptedAt",
|
|
1421
1437
|
"event.legalStatuses.DECLARED.createdAt",
|
|
1422
1438
|
"event.legalStatuses.DECLARED.acceptedAt",
|
|
1423
1439
|
"event.legalStatuses.REGISTERED.createdAt",
|
|
@@ -1477,7 +1493,8 @@ var Range = import_v4.z.object({
|
|
|
1477
1493
|
});
|
|
1478
1494
|
var ContainsFlags = import_v4.z.object({
|
|
1479
1495
|
anyOf: import_v4.z.array(Flag).optional(),
|
|
1480
|
-
noneOf: import_v4.z.array(Flag).optional()
|
|
1496
|
+
noneOf: import_v4.z.array(Flag).optional(),
|
|
1497
|
+
allOf: import_v4.z.array(Flag).optional()
|
|
1481
1498
|
}).meta({
|
|
1482
1499
|
id: "ContainsFlags"
|
|
1483
1500
|
});
|
|
@@ -1666,8 +1683,18 @@ var FieldReference = import_v43.default.object({
|
|
|
1666
1683
|
$$field: FieldId.describe("Id of the field to reference"),
|
|
1667
1684
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1668
1685
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1686
|
+
),
|
|
1687
|
+
$$code: import_v43.default.string().optional().describe(
|
|
1688
|
+
"Serialised client-side function body. When present the expression is evaluated rather than dereferenced."
|
|
1669
1689
|
)
|
|
1670
|
-
}).describe(
|
|
1690
|
+
}).describe(
|
|
1691
|
+
"Reference to a field value, with an optional client-side computation applied."
|
|
1692
|
+
);
|
|
1693
|
+
var ComputedDefaultValue = import_v43.default.object({
|
|
1694
|
+
$$code: import_v43.default.string().describe(
|
|
1695
|
+
"Serialised client-side function body. Receives (undefined, context) where context includes $now, $online, and system variables."
|
|
1696
|
+
)
|
|
1697
|
+
}).describe("A context-only computation used as a field default value.");
|
|
1671
1698
|
var ValidationConfig = import_v43.default.object({
|
|
1672
1699
|
validator: Conditional.describe(
|
|
1673
1700
|
"Conditional expression that must hold for the field value to be considered valid."
|
|
@@ -1708,7 +1735,7 @@ var BaseField = import_v43.default.object({
|
|
|
1708
1735
|
"Indicates whether the field can be modified during record correction."
|
|
1709
1736
|
),
|
|
1710
1737
|
value: FieldReference.or(import_v43.default.array(FieldReference)).optional().describe(
|
|
1711
|
-
"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."
|
|
1738
|
+
"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."
|
|
1712
1739
|
),
|
|
1713
1740
|
analytics: import_v43.default.boolean().default(false).optional().describe(
|
|
1714
1741
|
"Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
|
|
@@ -1722,7 +1749,7 @@ var Divider = BaseField.extend({
|
|
|
1722
1749
|
});
|
|
1723
1750
|
var TextField = BaseField.extend({
|
|
1724
1751
|
type: import_v43.default.literal(FieldType.TEXT),
|
|
1725
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
1752
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
1726
1753
|
configuration: import_v43.default.object({
|
|
1727
1754
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1728
1755
|
type: import_v43.default.enum(["text", "password"]).optional(),
|
|
@@ -1735,10 +1762,11 @@ var TextField = BaseField.extend({
|
|
|
1735
1762
|
});
|
|
1736
1763
|
var NumberField = BaseField.extend({
|
|
1737
1764
|
type: import_v43.default.literal(FieldType.NUMBER),
|
|
1738
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1765
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1739
1766
|
configuration: import_v43.default.object({
|
|
1740
1767
|
min: import_v43.default.number().optional().describe("Minimum value"),
|
|
1741
1768
|
max: import_v43.default.number().optional().describe("Maximum value"),
|
|
1769
|
+
integer: import_v43.default.boolean().optional().describe("When true, only whole numbers are allowed"),
|
|
1742
1770
|
prefix: TranslationConfig.optional(),
|
|
1743
1771
|
postfix: TranslationConfig.optional()
|
|
1744
1772
|
}).optional()
|
|
@@ -1748,7 +1776,7 @@ var NumberField = BaseField.extend({
|
|
|
1748
1776
|
});
|
|
1749
1777
|
var TextAreaField = BaseField.extend({
|
|
1750
1778
|
type: import_v43.default.literal(FieldType.TEXTAREA),
|
|
1751
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
1779
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
1752
1780
|
configuration: import_v43.default.object({
|
|
1753
1781
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text"),
|
|
1754
1782
|
rows: import_v43.default.number().optional().describe("Number of visible text lines"),
|
|
@@ -1782,7 +1810,7 @@ var SignatureField = BaseField.extend({
|
|
|
1782
1810
|
signaturePromptLabel: TranslationConfig.describe(
|
|
1783
1811
|
"Title of the signature modal"
|
|
1784
1812
|
),
|
|
1785
|
-
defaultValue:
|
|
1813
|
+
defaultValue: SignatureFieldValue.or(ComputedDefaultValue).optional(),
|
|
1786
1814
|
configuration: import_v43.default.object({
|
|
1787
1815
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1788
1816
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
|
@@ -1798,14 +1826,14 @@ var EmailField = BaseField.extend({
|
|
|
1798
1826
|
configuration: import_v43.default.object({
|
|
1799
1827
|
maxLength: import_v43.default.number().optional().describe("Maximum length of the text")
|
|
1800
1828
|
}).default({ maxLength: 255 }).optional(),
|
|
1801
|
-
defaultValue: NonEmptyTextValue.optional()
|
|
1829
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional()
|
|
1802
1830
|
}).meta({
|
|
1803
1831
|
description: "An email input field",
|
|
1804
1832
|
id: "EmailField"
|
|
1805
1833
|
});
|
|
1806
1834
|
var DateField = BaseField.extend({
|
|
1807
1835
|
type: import_v43.default.literal(FieldType.DATE),
|
|
1808
|
-
defaultValue: SerializedNowDateTime.or(PlainDate).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1836
|
+
defaultValue: SerializedNowDateTime.or(PlainDate).or(ComputedDefaultValue).optional().describe("Default date value(yyyy-MM-dd)"),
|
|
1809
1837
|
configuration: import_v43.default.object({
|
|
1810
1838
|
notice: TranslationConfig.describe(
|
|
1811
1839
|
"Text to display above the date input"
|
|
@@ -1817,7 +1845,7 @@ var DateField = BaseField.extend({
|
|
|
1817
1845
|
});
|
|
1818
1846
|
var AgeField = BaseField.extend({
|
|
1819
1847
|
type: import_v43.default.literal(FieldType.AGE),
|
|
1820
|
-
defaultValue: NumberFieldValue.optional(),
|
|
1848
|
+
defaultValue: NumberFieldValue.or(ComputedDefaultValue).optional(),
|
|
1821
1849
|
configuration: import_v43.default.object({
|
|
1822
1850
|
asOfDate: FieldReference,
|
|
1823
1851
|
prefix: TranslationConfig.optional(),
|
|
@@ -1829,7 +1857,7 @@ var AgeField = BaseField.extend({
|
|
|
1829
1857
|
});
|
|
1830
1858
|
var TimeField = BaseField.extend({
|
|
1831
1859
|
type: import_v43.default.literal(FieldType.TIME),
|
|
1832
|
-
defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
|
|
1860
|
+
defaultValue: SerializedNowDateTime.or(TimeValue).or(ComputedDefaultValue).optional().describe("Default time value (HH-mm)"),
|
|
1833
1861
|
configuration: import_v43.default.object({
|
|
1834
1862
|
use12HourFormat: import_v43.default.boolean().optional().describe("Whether to use 12-hour format"),
|
|
1835
1863
|
notice: TranslationConfig.describe(
|
|
@@ -1842,7 +1870,7 @@ var TimeField = BaseField.extend({
|
|
|
1842
1870
|
});
|
|
1843
1871
|
var DateRangeField = BaseField.extend({
|
|
1844
1872
|
type: import_v43.default.literal(FieldType.DATE_RANGE),
|
|
1845
|
-
defaultValue: DateRangeFieldValue.optional(),
|
|
1873
|
+
defaultValue: DateRangeFieldValue.or(ComputedDefaultValue).optional(),
|
|
1846
1874
|
configuration: import_v43.default.object({
|
|
1847
1875
|
notice: TranslationConfig.describe(
|
|
1848
1876
|
"Text to display above the date input"
|
|
@@ -1921,7 +1949,7 @@ var PageHeader = BaseField.extend({
|
|
|
1921
1949
|
});
|
|
1922
1950
|
var File = BaseField.extend({
|
|
1923
1951
|
type: import_v43.default.literal(FieldType.FILE),
|
|
1924
|
-
defaultValue: FileFieldValue.optional(),
|
|
1952
|
+
defaultValue: FileFieldValue.or(ComputedDefaultValue).optional(),
|
|
1925
1953
|
configuration: import_v43.default.object({
|
|
1926
1954
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
1927
1955
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
|
@@ -1948,7 +1976,7 @@ var SelectOption = import_v43.default.object({
|
|
|
1948
1976
|
});
|
|
1949
1977
|
var NumberWithUnitField = BaseField.extend({
|
|
1950
1978
|
type: import_v43.default.literal(FieldType.NUMBER_WITH_UNIT),
|
|
1951
|
-
defaultValue: NumberWithUnitFieldValue.optional(),
|
|
1979
|
+
defaultValue: NumberWithUnitFieldValue.or(ComputedDefaultValue).optional(),
|
|
1952
1980
|
options: import_v43.default.array(SelectOption).describe("A list of options for the unit select"),
|
|
1953
1981
|
configuration: import_v43.default.object({
|
|
1954
1982
|
min: import_v43.default.number().optional().describe("Minimum value of the number field"),
|
|
@@ -1963,7 +1991,7 @@ var NumberWithUnitField = BaseField.extend({
|
|
|
1963
1991
|
});
|
|
1964
1992
|
var RadioGroup = BaseField.extend({
|
|
1965
1993
|
type: import_v43.default.literal(FieldType.RADIO_GROUP),
|
|
1966
|
-
defaultValue: TextValue.optional(),
|
|
1994
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1967
1995
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1968
1996
|
configuration: import_v43.default.object({
|
|
1969
1997
|
styles: import_v43.default.object({
|
|
@@ -1988,7 +2016,7 @@ var BulletList = BaseField.extend({
|
|
|
1988
2016
|
});
|
|
1989
2017
|
var Select = BaseField.extend({
|
|
1990
2018
|
type: import_v43.default.literal(FieldType.SELECT),
|
|
1991
|
-
defaultValue: TextValue.optional(),
|
|
2019
|
+
defaultValue: TextValue.or(ComputedDefaultValue).optional(),
|
|
1992
2020
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
1993
2021
|
noOptionsMessage: TranslationConfig.optional().describe(
|
|
1994
2022
|
`
|
|
@@ -2010,7 +2038,7 @@ var SelectDateRangeOption = import_v43.default.object({
|
|
|
2010
2038
|
});
|
|
2011
2039
|
var SelectDateRangeField = BaseField.extend({
|
|
2012
2040
|
type: import_v43.default.literal(FieldType.SELECT_DATE_RANGE),
|
|
2013
|
-
defaultValue: SelectDateRangeValue.optional(),
|
|
2041
|
+
defaultValue: SelectDateRangeValue.or(ComputedDefaultValue).optional(),
|
|
2014
2042
|
options: import_v43.default.array(SelectDateRangeOption).describe("A list of options")
|
|
2015
2043
|
}).meta({
|
|
2016
2044
|
description: "A date range selection field",
|
|
@@ -2027,7 +2055,7 @@ var NameField = BaseField.extend({
|
|
|
2027
2055
|
firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
2028
2056
|
middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
|
|
2029
2057
|
surname: SerializedUserField.or(NonEmptyTextValue).optional()
|
|
2030
|
-
}).optional(),
|
|
2058
|
+
}).or(ComputedDefaultValue).optional(),
|
|
2031
2059
|
configuration: import_v43.default.object({
|
|
2032
2060
|
name: NameConfig.default({
|
|
2033
2061
|
firstname: { required: true },
|
|
@@ -2051,14 +2079,14 @@ var NameField = BaseField.extend({
|
|
|
2051
2079
|
id: "NameField"
|
|
2052
2080
|
});
|
|
2053
2081
|
var PhoneField = BaseField.extend({
|
|
2054
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2082
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2055
2083
|
type: import_v43.default.literal(FieldType.PHONE)
|
|
2056
2084
|
}).meta({
|
|
2057
2085
|
description: "A field for entering a phone number",
|
|
2058
2086
|
id: "PhoneField"
|
|
2059
2087
|
});
|
|
2060
2088
|
var IdField = BaseField.extend({
|
|
2061
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2089
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2062
2090
|
type: import_v43.default.literal(FieldType.ID)
|
|
2063
2091
|
}).meta({
|
|
2064
2092
|
description: "A field for entering an ID",
|
|
@@ -2066,14 +2094,14 @@ var IdField = BaseField.extend({
|
|
|
2066
2094
|
});
|
|
2067
2095
|
var Checkbox = BaseField.extend({
|
|
2068
2096
|
type: import_v43.default.literal(FieldType.CHECKBOX),
|
|
2069
|
-
defaultValue: CheckboxFieldValue.default(false)
|
|
2097
|
+
defaultValue: CheckboxFieldValue.or(ComputedDefaultValue).default(false)
|
|
2070
2098
|
}).meta({
|
|
2071
2099
|
description: "A boolean checkbox field",
|
|
2072
2100
|
id: "Checkbox"
|
|
2073
2101
|
});
|
|
2074
2102
|
var Country = BaseField.extend({
|
|
2075
2103
|
type: import_v43.default.literal(FieldType.COUNTRY),
|
|
2076
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2104
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2077
2105
|
optionOverrides: import_v43.default.array(SelectOption.omit({ label: true })).optional().describe(
|
|
2078
2106
|
"Conditionals for specific countries. Countries not listed are always shown and enabled."
|
|
2079
2107
|
)
|
|
@@ -2091,7 +2119,7 @@ var AdministrativeAreas = import_v43.default.enum([
|
|
|
2091
2119
|
]);
|
|
2092
2120
|
var AdministrativeAreaField = BaseField.extend({
|
|
2093
2121
|
type: import_v43.default.literal(FieldType.ADMINISTRATIVE_AREA),
|
|
2094
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2122
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2095
2123
|
configuration: import_v43.default.object({
|
|
2096
2124
|
partOf: FieldReference.optional().describe("Parent location"),
|
|
2097
2125
|
type: AdministrativeAreas,
|
|
@@ -2103,7 +2131,7 @@ var AdministrativeAreaField = BaseField.extend({
|
|
|
2103
2131
|
});
|
|
2104
2132
|
var LocationInput = BaseField.extend({
|
|
2105
2133
|
type: import_v43.default.literal(FieldType.LOCATION),
|
|
2106
|
-
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField]).optional(),
|
|
2134
|
+
defaultValue: import_v43.default.union([NonEmptyTextValue, SerializedUserField, ComputedDefaultValue]).optional(),
|
|
2107
2135
|
configuration: import_v43.default.object({
|
|
2108
2136
|
locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
|
|
2109
2137
|
allowedLocations: AllowedLocations
|
|
@@ -2115,7 +2143,7 @@ var LocationInput = BaseField.extend({
|
|
|
2115
2143
|
var FileUploadWithOptions = BaseField.extend({
|
|
2116
2144
|
type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
|
|
2117
2145
|
options: import_v43.default.array(SelectOption).describe("A list of options"),
|
|
2118
|
-
defaultValue: FileFieldWithOptionValue.optional(),
|
|
2146
|
+
defaultValue: FileFieldWithOptionValue.or(ComputedDefaultValue).optional(),
|
|
2119
2147
|
configuration: import_v43.default.object({
|
|
2120
2148
|
maxFileSize: import_v43.default.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
|
2121
2149
|
maxImageSize: import_v43.default.object({
|
|
@@ -2131,12 +2159,12 @@ var FileUploadWithOptions = BaseField.extend({
|
|
|
2131
2159
|
});
|
|
2132
2160
|
var Facility = BaseField.extend({
|
|
2133
2161
|
type: import_v43.default.literal(FieldType.FACILITY),
|
|
2134
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2162
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2135
2163
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2136
2164
|
}).describe("Input field for a facility");
|
|
2137
2165
|
var Office = BaseField.extend({
|
|
2138
2166
|
type: import_v43.default.literal(FieldType.OFFICE),
|
|
2139
|
-
defaultValue: NonEmptyTextValue.optional(),
|
|
2167
|
+
defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
|
|
2140
2168
|
configuration: import_v43.default.object({ allowedLocations: AllowedLocations }).optional()
|
|
2141
2169
|
}).describe("Input field for an office");
|
|
2142
2170
|
var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
|
|
@@ -2172,7 +2200,7 @@ var Address = BaseField.extend({
|
|
|
2172
2200
|
).optional(),
|
|
2173
2201
|
allowedLocations: AllowedLocations
|
|
2174
2202
|
}).optional(),
|
|
2175
|
-
defaultValue: DefaultAddressFieldValue.optional()
|
|
2203
|
+
defaultValue: DefaultAddressFieldValue.or(ComputedDefaultValue).optional()
|
|
2176
2204
|
}).meta({
|
|
2177
2205
|
description: "Address input field \u2013 a combination of location and text fields",
|
|
2178
2206
|
id: "Address"
|
|
@@ -2219,7 +2247,7 @@ var ButtonConfiguration = import_v43.default.object({
|
|
|
2219
2247
|
});
|
|
2220
2248
|
var ButtonField = BaseField.extend({
|
|
2221
2249
|
type: import_v43.default.literal(FieldType.BUTTON),
|
|
2222
|
-
defaultValue: ButtonFieldValue.optional(),
|
|
2250
|
+
defaultValue: ButtonFieldValue.or(ComputedDefaultValue).optional(),
|
|
2223
2251
|
configuration: ButtonConfiguration
|
|
2224
2252
|
}).meta({
|
|
2225
2253
|
description: "A generic button that can be used to trigger an action",
|
|
@@ -2247,7 +2275,7 @@ var AlphaPrintButton = BaseField.extend({
|
|
|
2247
2275
|
});
|
|
2248
2276
|
var HttpField = BaseField.extend({
|
|
2249
2277
|
type: import_v43.default.literal(FieldType.HTTP),
|
|
2250
|
-
defaultValue: HttpFieldValue.optional(),
|
|
2278
|
+
defaultValue: HttpFieldValue.or(ComputedDefaultValue).optional(),
|
|
2251
2279
|
configuration: import_v43.default.object({
|
|
2252
2280
|
trigger: FieldReference.optional().describe(
|
|
2253
2281
|
"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."
|
|
@@ -2333,7 +2361,7 @@ var LinkButtonField = BaseField.extend({
|
|
|
2333
2361
|
});
|
|
2334
2362
|
var VerificationStatus = BaseField.extend({
|
|
2335
2363
|
type: import_v43.default.literal(FieldType.VERIFICATION_STATUS),
|
|
2336
|
-
defaultValue: VerificationStatusValue.optional(),
|
|
2364
|
+
defaultValue: VerificationStatusValue.or(ComputedDefaultValue).optional(),
|
|
2337
2365
|
configuration: import_v43.default.object({
|
|
2338
2366
|
status: TranslationConfig.describe("Text to display on the status pill."),
|
|
2339
2367
|
description: TranslationConfig.describe(
|
|
@@ -2355,7 +2383,7 @@ var QueryParamReaderField = BaseField.extend({
|
|
|
2355
2383
|
});
|
|
2356
2384
|
var QrReaderField = BaseField.extend({
|
|
2357
2385
|
type: import_v43.default.literal(FieldType.QR_READER),
|
|
2358
|
-
defaultValue: QrReaderFieldValue.optional(),
|
|
2386
|
+
defaultValue: QrReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2359
2387
|
configuration: import_v43.default.object({
|
|
2360
2388
|
validator: import_v43.default.any().meta({
|
|
2361
2389
|
description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
|
|
@@ -2368,7 +2396,7 @@ var QrReaderField = BaseField.extend({
|
|
|
2368
2396
|
});
|
|
2369
2397
|
var IdReaderField = BaseField.extend({
|
|
2370
2398
|
type: import_v43.default.literal(FieldType.ID_READER),
|
|
2371
|
-
defaultValue: IdReaderFieldValue.optional(),
|
|
2399
|
+
defaultValue: IdReaderFieldValue.or(ComputedDefaultValue).optional(),
|
|
2372
2400
|
methods: import_v43.default.array(
|
|
2373
2401
|
import_v43.default.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2374
2402
|
)
|
|
@@ -2662,6 +2690,57 @@ var ReadActionConfig = ActionConfigBase.extend(
|
|
|
2662
2690
|
conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
|
|
2663
2691
|
}).shape
|
|
2664
2692
|
);
|
|
2693
|
+
var NotifyConfig = ActionConfigBase.extend(
|
|
2694
|
+
z24.object({
|
|
2695
|
+
type: z24.literal(ActionType.NOTIFY)
|
|
2696
|
+
}).shape
|
|
2697
|
+
);
|
|
2698
|
+
var DuplicateDetectedConfig = ActionConfigBase.extend(
|
|
2699
|
+
z24.object({
|
|
2700
|
+
type: z24.literal(ActionType.DUPLICATE_DETECTED),
|
|
2701
|
+
label: z24.never().optional().describe(
|
|
2702
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no label."
|
|
2703
|
+
),
|
|
2704
|
+
supportingCopy: z24.never().optional(),
|
|
2705
|
+
icon: z24.never().optional().describe(
|
|
2706
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it has no icon."
|
|
2707
|
+
),
|
|
2708
|
+
conditionals: z24.never().optional().describe(
|
|
2709
|
+
"DUPLICATE_DETECTED is system-generated and never shown as a button, so it cannot be disabled or hidden with conditionals."
|
|
2710
|
+
)
|
|
2711
|
+
}).shape
|
|
2712
|
+
);
|
|
2713
|
+
var MarkAsDuplicateConfig = ActionConfigBase.extend(
|
|
2714
|
+
z24.object({
|
|
2715
|
+
type: z24.literal(ActionType.MARK_AS_DUPLICATE)
|
|
2716
|
+
}).shape
|
|
2717
|
+
);
|
|
2718
|
+
var MarkAsNotDuplicateConfig = ActionConfigBase.extend(
|
|
2719
|
+
z24.object({
|
|
2720
|
+
type: z24.literal(ActionType.MARK_AS_NOT_DUPLICATE)
|
|
2721
|
+
}).shape
|
|
2722
|
+
);
|
|
2723
|
+
var AssignConfig = ActionConfigBase.extend(
|
|
2724
|
+
z24.object({
|
|
2725
|
+
type: z24.literal(ActionType.ASSIGN),
|
|
2726
|
+
flags: z24.never().optional().describe(
|
|
2727
|
+
"ASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2728
|
+
)
|
|
2729
|
+
}).shape
|
|
2730
|
+
);
|
|
2731
|
+
var UnassignConfig = ActionConfigBase.extend(
|
|
2732
|
+
z24.object({
|
|
2733
|
+
type: z24.literal(ActionType.UNASSIGN),
|
|
2734
|
+
flags: z24.never().optional().describe(
|
|
2735
|
+
"UNASSIGN is a meta action excluded from flag resolution, so flags configured here would never apply."
|
|
2736
|
+
)
|
|
2737
|
+
}).shape
|
|
2738
|
+
);
|
|
2739
|
+
var DeleteConfig = ActionConfigBase.extend(
|
|
2740
|
+
z24.object({
|
|
2741
|
+
type: z24.literal(ActionType.DELETE)
|
|
2742
|
+
}).shape
|
|
2743
|
+
);
|
|
2665
2744
|
var DeclareConfig = DeclarationActionBase.extend(
|
|
2666
2745
|
z24.object({
|
|
2667
2746
|
type: z24.literal(ActionType.DECLARE),
|
|
@@ -2724,7 +2803,17 @@ var RequestCorrectionConfig = ActionConfigBase.extend(
|
|
|
2724
2803
|
correctionForm: ActionFormConfig
|
|
2725
2804
|
}).shape
|
|
2726
2805
|
);
|
|
2727
|
-
var
|
|
2806
|
+
var ApproveCorrectionConfig = ActionConfigBase.extend(
|
|
2807
|
+
z24.object({
|
|
2808
|
+
type: z24.literal(ActionType.APPROVE_CORRECTION)
|
|
2809
|
+
}).shape
|
|
2810
|
+
);
|
|
2811
|
+
var RejectCorrectionConfig = ActionConfigBase.extend(
|
|
2812
|
+
z24.object({
|
|
2813
|
+
type: z24.literal(ActionType.REJECT_CORRECTION)
|
|
2814
|
+
}).shape
|
|
2815
|
+
);
|
|
2816
|
+
var CustomActionConfig = ActionConfigBase.extend(
|
|
2728
2817
|
z24.object({
|
|
2729
2818
|
type: z24.literal(ActionType.CUSTOM),
|
|
2730
2819
|
customActionType: z24.string().describe("Type identifier of the custom action."),
|
|
@@ -2735,7 +2824,7 @@ var CustomActionConfig = ActionConfigBase.merge(
|
|
|
2735
2824
|
auditHistoryLabel: TranslationConfig.describe(
|
|
2736
2825
|
'The label to show in audit history for this action. For example "Approved".'
|
|
2737
2826
|
)
|
|
2738
|
-
})
|
|
2827
|
+
}).shape
|
|
2739
2828
|
);
|
|
2740
2829
|
var ActionConfig = z24.discriminatedUnion("type", [
|
|
2741
2830
|
/*
|
|
@@ -2746,9 +2835,37 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2746
2835
|
id: "ReadActionConfig",
|
|
2747
2836
|
description: "Configuration for the read action \u2014 defines the record-tab content displayed on the event overview page."
|
|
2748
2837
|
}),
|
|
2838
|
+
AssignConfig.meta({
|
|
2839
|
+
id: "AssignActionConfig",
|
|
2840
|
+
description: "Configuration for assigning a record to the current user."
|
|
2841
|
+
}),
|
|
2842
|
+
UnassignConfig.meta({
|
|
2843
|
+
id: "UnassignActionConfig",
|
|
2844
|
+
description: "Configuration for unassigning a record from its current assignee."
|
|
2845
|
+
}),
|
|
2846
|
+
DeleteConfig.meta({
|
|
2847
|
+
id: "DeleteActionConfig",
|
|
2848
|
+
description: "Configuration for deleting a draft record."
|
|
2849
|
+
}),
|
|
2850
|
+
NotifyConfig.meta({
|
|
2851
|
+
id: "NotifyActionConfig",
|
|
2852
|
+
description: "Configuration for the notify action. When present, NOTIFY uses this config independently from DECLARE. When absent, NOTIFY falls back to the DeclareActionConfig."
|
|
2853
|
+
}),
|
|
2749
2854
|
DeclareConfig.meta({
|
|
2750
2855
|
id: "DeclareActionConfig",
|
|
2751
|
-
description: "Configuration for the declare action. Includes review-page fields.
|
|
2856
|
+
description: "Configuration for the declare action. Includes review-page fields. NOTIFY falls back to this config when no dedicated NotifyActionConfig is provided."
|
|
2857
|
+
}),
|
|
2858
|
+
DuplicateDetectedConfig.meta({
|
|
2859
|
+
id: "DuplicateDetectedActionConfig",
|
|
2860
|
+
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."
|
|
2861
|
+
}),
|
|
2862
|
+
MarkAsDuplicateConfig.meta({
|
|
2863
|
+
id: "MarkAsDuplicateActionConfig",
|
|
2864
|
+
description: "Configuration for marking a record as a duplicate."
|
|
2865
|
+
}),
|
|
2866
|
+
MarkAsNotDuplicateConfig.meta({
|
|
2867
|
+
id: "MarkAsNotDuplicateActionConfig",
|
|
2868
|
+
description: "Configuration for marking a record as not a duplicate, after it was previously flagged as one."
|
|
2752
2869
|
}),
|
|
2753
2870
|
RejectConfig.meta({
|
|
2754
2871
|
id: "RejectActionConfig",
|
|
@@ -2766,6 +2883,14 @@ var ActionConfig = z24.discriminatedUnion("type", [
|
|
|
2766
2883
|
id: "RequestCorrectionActionConfig",
|
|
2767
2884
|
description: "Configuration for requesting a correction on a registered record."
|
|
2768
2885
|
}),
|
|
2886
|
+
ApproveCorrectionConfig.meta({
|
|
2887
|
+
id: "ApproveCorrectionActionConfig",
|
|
2888
|
+
description: "Configuration for approving a requested correction."
|
|
2889
|
+
}),
|
|
2890
|
+
RejectCorrectionConfig.meta({
|
|
2891
|
+
id: "RejectCorrectionActionConfig",
|
|
2892
|
+
description: "Configuration for rejecting a requested correction."
|
|
2893
|
+
}),
|
|
2769
2894
|
EditActionConfig.meta({
|
|
2770
2895
|
id: "EditActionConfig",
|
|
2771
2896
|
description: "Configuration for editing a record before registration."
|
|
@@ -2927,6 +3052,9 @@ var BaseField3 = z28.object({
|
|
|
2927
3052
|
),
|
|
2928
3053
|
validations: z28.array(ValidationConfig).optional().describe(
|
|
2929
3054
|
`Option for overriding the field validations specifically for advanced search form.`
|
|
3055
|
+
),
|
|
3056
|
+
allowedLocations: JurisdictionReference.optional().describe(
|
|
3057
|
+
`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.`
|
|
2930
3058
|
)
|
|
2931
3059
|
});
|
|
2932
3060
|
var SearchQueryParams = z28.object({
|
|
@@ -3033,7 +3161,37 @@ function resolveDataPath(rootData, dataPath, instancePath) {
|
|
|
3033
3161
|
}
|
|
3034
3162
|
return current;
|
|
3035
3163
|
}
|
|
3164
|
+
function todayISO() {
|
|
3165
|
+
return (0, import_date_fns.formatISO)(/* @__PURE__ */ new Date(), { representation: "date" });
|
|
3166
|
+
}
|
|
3167
|
+
var compiledFunctionCache = /* @__PURE__ */ new Map();
|
|
3168
|
+
function compileClientFunction(code) {
|
|
3169
|
+
let fn = compiledFunctionCache.get(code);
|
|
3170
|
+
if (!fn) {
|
|
3171
|
+
fn = new Function(`return (${code})`)();
|
|
3172
|
+
compiledFunctionCache.set(code, fn);
|
|
3173
|
+
}
|
|
3174
|
+
return fn;
|
|
3175
|
+
}
|
|
3036
3176
|
(0, import_ajv_formats.default)(ajv);
|
|
3177
|
+
function buildClientFunctionContext(input) {
|
|
3178
|
+
return {
|
|
3179
|
+
$form: input.form,
|
|
3180
|
+
$now: todayISO(),
|
|
3181
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
3182
|
+
$online: isOnline(),
|
|
3183
|
+
$user: input.validatorContext?.user,
|
|
3184
|
+
$event: input.validatorContext?.event,
|
|
3185
|
+
$leafAdminStructureLocationIds: input.validatorContext?.leafAdminStructureLocationIds ?? [],
|
|
3186
|
+
user: input.systemVariables?.user,
|
|
3187
|
+
$window: input.systemVariables?.$window,
|
|
3188
|
+
locations: input.locations,
|
|
3189
|
+
adminLevelIds: input.adminLevelIds
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
function runClientFunction(code, data, context) {
|
|
3193
|
+
return compileClientFunction(code)(data, context);
|
|
3194
|
+
}
|
|
3037
3195
|
ajv.addKeyword({
|
|
3038
3196
|
keyword: "daysFromDate",
|
|
3039
3197
|
type: "string",
|
|
@@ -3078,12 +3236,35 @@ ajv.addKeyword({
|
|
|
3078
3236
|
$data: true,
|
|
3079
3237
|
errors: true,
|
|
3080
3238
|
// @ts-ignore -- Force type. We will move this away from AJV next. Parsing the array will take seconds and is only called by core.
|
|
3081
|
-
validate(
|
|
3239
|
+
validate(_schema, data, _2, dataContext) {
|
|
3082
3240
|
const locationIdInput = data;
|
|
3083
3241
|
const locations = dataContext?.rootData.$leafAdminStructureLocationIds ?? [];
|
|
3084
3242
|
return locations.some((location) => location.id === locationIdInput);
|
|
3085
3243
|
}
|
|
3086
3244
|
});
|
|
3245
|
+
ajv.addKeyword({
|
|
3246
|
+
keyword: "customClientValidator",
|
|
3247
|
+
schemaType: "object",
|
|
3248
|
+
errors: true,
|
|
3249
|
+
// @ts-expect-error -- AJV's public types don't expose `rootData`. All
|
|
3250
|
+
// `validate()` callers build root data via `buildClientFunctionContext`,
|
|
3251
|
+
// so the cast holds.
|
|
3252
|
+
validate(schema, data, _2, dataContext) {
|
|
3253
|
+
return Boolean(
|
|
3254
|
+
runClientFunction(
|
|
3255
|
+
schema.code,
|
|
3256
|
+
data,
|
|
3257
|
+
dataContext?.rootData ?? buildClientFunctionContext({ form: {} })
|
|
3258
|
+
)
|
|
3259
|
+
);
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3262
|
+
function isOnline() {
|
|
3263
|
+
if (typeof window !== "undefined" && typeof navigator !== "undefined") {
|
|
3264
|
+
return navigator.onLine;
|
|
3265
|
+
}
|
|
3266
|
+
return true;
|
|
3267
|
+
}
|
|
3087
3268
|
|
|
3088
3269
|
// ../commons/src/utils.ts
|
|
3089
3270
|
var z32 = __toESM(require("zod/v4"));
|
|
@@ -3126,7 +3307,7 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
|
3126
3307
|
if (actionConfig.type === ActionType.CUSTOM) {
|
|
3127
3308
|
return actionConfig.form;
|
|
3128
3309
|
}
|
|
3129
|
-
if ("review" in actionConfig) {
|
|
3310
|
+
if ("review" in actionConfig && actionConfig.review != null) {
|
|
3130
3311
|
return actionConfig.review.fields;
|
|
3131
3312
|
}
|
|
3132
3313
|
return [];
|
|
@@ -3702,7 +3883,54 @@ function createFieldConditionals(fieldId) {
|
|
|
3702
3883
|
}
|
|
3703
3884
|
},
|
|
3704
3885
|
required: [fieldId]
|
|
3705
|
-
})
|
|
3886
|
+
}),
|
|
3887
|
+
/**
|
|
3888
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
3889
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
3890
|
+
* available inside the function body — all logic must be self-contained.
|
|
3891
|
+
*
|
|
3892
|
+
* @example
|
|
3893
|
+
* field('nid').customClientValidator((value) => {
|
|
3894
|
+
* // LUHN check — all logic must be inline
|
|
3895
|
+
* const digits = String(value).split('').map(Number)
|
|
3896
|
+
* // ...
|
|
3897
|
+
* return isValid
|
|
3898
|
+
* })
|
|
3899
|
+
*/
|
|
3900
|
+
customClientValidator(validationFn) {
|
|
3901
|
+
const code = validationFn.toString();
|
|
3902
|
+
return defineFormConditional({
|
|
3903
|
+
type: "object",
|
|
3904
|
+
properties: wrapToPath(
|
|
3905
|
+
{ [fieldId]: { customClientValidator: { code } } },
|
|
3906
|
+
this.$$subfield
|
|
3907
|
+
),
|
|
3908
|
+
required: [fieldId]
|
|
3909
|
+
});
|
|
3910
|
+
},
|
|
3911
|
+
/**
|
|
3912
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
3913
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
3914
|
+
* The function receives the referenced field's value as the first argument and
|
|
3915
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
3916
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
3917
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
3918
|
+
*
|
|
3919
|
+
* For computing a default value without referencing a specific field, use
|
|
3920
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
3921
|
+
*
|
|
3922
|
+
* @example
|
|
3923
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
3924
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
3925
|
+
* )
|
|
3926
|
+
*/
|
|
3927
|
+
customClientEvaluation(computationFn) {
|
|
3928
|
+
return {
|
|
3929
|
+
$$code: computationFn.toString(),
|
|
3930
|
+
$$field: fieldId,
|
|
3931
|
+
$$subfield: this.$$subfield
|
|
3932
|
+
};
|
|
3933
|
+
}
|
|
3706
3934
|
};
|
|
3707
3935
|
}
|
|
3708
3936
|
|
|
@@ -3790,7 +4018,7 @@ function validateActionFlags(event2, ctx) {
|
|
|
3790
4018
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
3791
4019
|
const configuredFlagIds = event2.flags.map((flag) => flag.id);
|
|
3792
4020
|
const actionFlagIds = event2.actions.flatMap(
|
|
3793
|
-
(action) => action.flags.map((flag) => flag.id)
|
|
4021
|
+
(action) => (action.flags ?? []).map((flag) => flag.id)
|
|
3794
4022
|
);
|
|
3795
4023
|
for (const actionFlagId of actionFlagIds) {
|
|
3796
4024
|
const isConfigured = configuredFlagIds.includes(actionFlagId);
|
|
@@ -4583,12 +4811,53 @@ var updateActions = ActionTypes.extract([
|
|
|
4583
4811
|
ActionType.ARCHIVE,
|
|
4584
4812
|
ActionType.PRINT_CERTIFICATE,
|
|
4585
4813
|
ActionType.REQUEST_CORRECTION,
|
|
4814
|
+
ActionType.APPROVE_CORRECTION,
|
|
4815
|
+
ActionType.REJECT_CORRECTION,
|
|
4586
4816
|
ActionType.CUSTOM
|
|
4587
4817
|
]);
|
|
4588
4818
|
|
|
4589
4819
|
// ../commons/src/events/state/flags.ts
|
|
4590
4820
|
var import_lodash3 = require("lodash");
|
|
4591
4821
|
var import_date_fns3 = require("date-fns");
|
|
4822
|
+
var INHERENT_FLAG_RULES = [
|
|
4823
|
+
{
|
|
4824
|
+
flag: InherentFlags.CORRECTION_REQUESTED,
|
|
4825
|
+
setOn: [ActionType.REQUEST_CORRECTION],
|
|
4826
|
+
resetOn: [ActionType.APPROVE_CORRECTION, ActionType.REJECT_CORRECTION]
|
|
4827
|
+
},
|
|
4828
|
+
{
|
|
4829
|
+
// INCOMPLETE mirrors the NOTIFIED status: set by NOTIFY, cleared by any
|
|
4830
|
+
// other status-changing action (see getStatusFromActions).
|
|
4831
|
+
flag: InherentFlags.INCOMPLETE,
|
|
4832
|
+
setOn: [ActionType.NOTIFY],
|
|
4833
|
+
resetOn: [
|
|
4834
|
+
ActionType.CREATE,
|
|
4835
|
+
ActionType.DECLARE,
|
|
4836
|
+
ActionType.REGISTER,
|
|
4837
|
+
ActionType.ARCHIVE
|
|
4838
|
+
]
|
|
4839
|
+
},
|
|
4840
|
+
{
|
|
4841
|
+
flag: InherentFlags.REJECTED,
|
|
4842
|
+
setOn: [ActionType.REJECT],
|
|
4843
|
+
resetOn: [
|
|
4844
|
+
ActionType.NOTIFY,
|
|
4845
|
+
ActionType.DECLARE,
|
|
4846
|
+
ActionType.EDIT,
|
|
4847
|
+
ActionType.REGISTER
|
|
4848
|
+
]
|
|
4849
|
+
},
|
|
4850
|
+
{
|
|
4851
|
+
flag: InherentFlags.POTENTIAL_DUPLICATE,
|
|
4852
|
+
setOn: [ActionType.DUPLICATE_DETECTED],
|
|
4853
|
+
resetOn: [ActionType.MARK_AS_DUPLICATE, ActionType.MARK_AS_NOT_DUPLICATE]
|
|
4854
|
+
},
|
|
4855
|
+
{
|
|
4856
|
+
flag: InherentFlags.EDIT_IN_PROGRESS,
|
|
4857
|
+
setOn: [ActionType.EDIT],
|
|
4858
|
+
resetOnAnyOtherAction: true
|
|
4859
|
+
}
|
|
4860
|
+
];
|
|
4592
4861
|
|
|
4593
4862
|
// ../commons/src/events/defineConfig.ts
|
|
4594
4863
|
var IGNORED_EVENT_TYPES = [
|
|
@@ -5334,6 +5603,11 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
|
|
|
5334
5603
|
id: "signature.upload.modal.title",
|
|
5335
5604
|
defaultMessage: "Draw signature",
|
|
5336
5605
|
description: "Title for the modal to draw signature"
|
|
5606
|
+
},
|
|
5607
|
+
// Zod applies the schema default at parse time, but this fixture bypasses
|
|
5608
|
+
// parsing — GeneratedInputField accesses configuration.maxFileSize directly.
|
|
5609
|
+
configuration: {
|
|
5610
|
+
maxFileSize: 5 * 1024 * 1024
|
|
5337
5611
|
}
|
|
5338
5612
|
}
|
|
5339
5613
|
]
|
|
@@ -5890,6 +6164,20 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
5890
6164
|
},
|
|
5891
6165
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
5892
6166
|
},
|
|
6167
|
+
{
|
|
6168
|
+
type: ActionType.NOTIFY,
|
|
6169
|
+
label: {
|
|
6170
|
+
defaultMessage: "Notify health worker",
|
|
6171
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
6172
|
+
id: "event.tennis-club-membership.action.notify.label"
|
|
6173
|
+
},
|
|
6174
|
+
flags: [
|
|
6175
|
+
{
|
|
6176
|
+
id: "health-worker-notified",
|
|
6177
|
+
operation: "add"
|
|
6178
|
+
}
|
|
6179
|
+
]
|
|
6180
|
+
},
|
|
5893
6181
|
{
|
|
5894
6182
|
type: ActionType.REJECT,
|
|
5895
6183
|
label: {
|
|
@@ -6132,6 +6420,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
6132
6420
|
}
|
|
6133
6421
|
}
|
|
6134
6422
|
],
|
|
6423
|
+
flags: [
|
|
6424
|
+
{
|
|
6425
|
+
id: "health-worker-notified",
|
|
6426
|
+
requiresAction: false,
|
|
6427
|
+
label: {
|
|
6428
|
+
id: "event.tennis-club-membership.flag.health-worker-notified.label",
|
|
6429
|
+
defaultMessage: "Health worker notified",
|
|
6430
|
+
description: "Label for the health-worker-notified flag"
|
|
6431
|
+
}
|
|
6432
|
+
}
|
|
6433
|
+
],
|
|
6135
6434
|
advancedSearch: [
|
|
6136
6435
|
{
|
|
6137
6436
|
title: {
|
|
@@ -7127,6 +7426,13 @@ var ACTION_FILTERS = {
|
|
|
7127
7426
|
[ActionType.UNASSIGN]: (flags) => !flags.some((flag) => flag.endsWith(":requested")),
|
|
7128
7427
|
[ActionType.CUSTOM]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
|
|
7129
7428
|
};
|
|
7429
|
+
var REJECTED_ACTIONS = [
|
|
7430
|
+
ActionType.READ,
|
|
7431
|
+
ActionType.NOTIFY,
|
|
7432
|
+
ActionType.CUSTOM,
|
|
7433
|
+
ActionType.EDIT,
|
|
7434
|
+
ActionType.ARCHIVE
|
|
7435
|
+
];
|
|
7130
7436
|
|
|
7131
7437
|
// ../commons/src/events/FileUtils.ts
|
|
7132
7438
|
var import_lodash7 = require("lodash");
|