@opencrvs/toolkit 1.9.2-rc.cb144d0 → 1.9.2-rc.f1d7235
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/dist/commons/api/router.d.ts +495 -50
- package/dist/commons/events/ActionConfig.d.ts +390 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +11 -0
- package/dist/commons/events/EventConfig.d.ts +319 -0
- package/dist/commons/events/EventIndex.d.ts +1 -0
- package/dist/commons/events/EventMetadata.d.ts +3 -1
- package/dist/commons/events/FieldConfig.d.ts +80 -0
- package/dist/commons/events/FieldType.d.ts +2 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +8 -1
- package/dist/commons/events/FieldValue.d.ts +2 -1
- package/dist/commons/events/FormConfig.d.ts +234 -0
- package/dist/commons/events/PageConfig.d.ts +156 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +5 -2
- package/dist/commons/events/WorkqueueConfig.d.ts +5 -3
- package/dist/commons/events/defineConfig.d.ts +447 -3
- package/dist/commons/events/event.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +6 -0
- package/dist/commons/events/utils.d.ts +888 -3
- package/dist/events/index.js +93 -4
- package/dist/notification/index.js +34 -3
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
|
@@ -77,6 +77,7 @@ __export(events_exports, {
|
|
|
77
77
|
CustomActionInput: () => CustomActionInput,
|
|
78
78
|
CustomFlag: () => CustomFlag,
|
|
79
79
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
|
80
|
+
DEFAULT_PLACE_OF_EVENT_PROPERTY: () => DEFAULT_PLACE_OF_EVENT_PROPERTY,
|
|
80
81
|
DataEntry: () => DataEntry,
|
|
81
82
|
DataFieldValue: () => DataFieldValue,
|
|
82
83
|
DateCondition: () => DateCondition,
|
|
@@ -137,6 +138,7 @@ __export(events_exports, {
|
|
|
137
138
|
FormPageConfig: () => FormPageConfig,
|
|
138
139
|
Fuzzy: () => Fuzzy,
|
|
139
140
|
GeographicalArea: () => GeographicalArea,
|
|
141
|
+
HiddenFieldValue: () => HiddenFieldValue,
|
|
140
142
|
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
|
141
143
|
HttpFieldValue: () => HttpFieldValue,
|
|
142
144
|
IdReaderFieldValue: () => IdReaderFieldValue,
|
|
@@ -216,6 +218,7 @@ __export(events_exports, {
|
|
|
216
218
|
ZodDate: () => ZodDate,
|
|
217
219
|
actionConfigTypes: () => actionConfigTypes,
|
|
218
220
|
ageToDate: () => ageToDate,
|
|
221
|
+
aggregateActionAnnotations: () => aggregateActionAnnotations,
|
|
219
222
|
aggregateActionDeclarations: () => aggregateActionDeclarations,
|
|
220
223
|
alwaysTrue: () => alwaysTrue,
|
|
221
224
|
and: () => and,
|
|
@@ -331,6 +334,7 @@ __export(events_exports, {
|
|
|
331
334
|
isFieldVisible: () => isFieldVisible,
|
|
332
335
|
isFileFieldType: () => isFileFieldType,
|
|
333
336
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
|
337
|
+
isHiddenFieldType: () => isHiddenFieldType,
|
|
334
338
|
isHttpFieldType: () => isHttpFieldType,
|
|
335
339
|
isIdFieldType: () => isIdFieldType,
|
|
336
340
|
isIdReaderFieldType: () => isIdReaderFieldType,
|
|
@@ -375,6 +379,7 @@ __export(events_exports, {
|
|
|
375
379
|
or: () => or,
|
|
376
380
|
pickRandom: () => pickRandom,
|
|
377
381
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
382
|
+
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
378
383
|
runFieldValidations: () => runFieldValidations,
|
|
379
384
|
runStructuralValidations: () => runStructuralValidations,
|
|
380
385
|
safeUnion: () => safeUnion,
|
|
@@ -613,7 +618,8 @@ var FieldType = {
|
|
|
613
618
|
QUERY_PARAM_READER: "QUERY_PARAM_READER",
|
|
614
619
|
QR_READER: "QR_READER",
|
|
615
620
|
ID_READER: "ID_READER",
|
|
616
|
-
LOADER: "LOADER"
|
|
621
|
+
LOADER: "LOADER",
|
|
622
|
+
HIDDEN: "HIDDEN"
|
|
617
623
|
};
|
|
618
624
|
var FileFieldType = z4.enum([
|
|
619
625
|
FieldType.FILE,
|
|
@@ -747,6 +753,7 @@ var IdReaderFieldValue = ReadDataValue;
|
|
|
747
753
|
|
|
748
754
|
// ../commons/src/events/FieldValue.ts
|
|
749
755
|
var TextValue = z7.string();
|
|
756
|
+
var HiddenFieldValue = z7.string();
|
|
750
757
|
var NonEmptyTextValue = TextValue.min(1);
|
|
751
758
|
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
752
759
|
var AgeValue = z7.object({
|
|
@@ -872,7 +879,8 @@ var FieldUpdateValue = safeUnion([
|
|
|
872
879
|
DataFieldValue.describe("DataFieldValue"),
|
|
873
880
|
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
874
881
|
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
875
|
-
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
|
|
882
|
+
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
883
|
+
HiddenFieldValue.describe("HiddenFieldValue")
|
|
876
884
|
]);
|
|
877
885
|
|
|
878
886
|
// ../commons/src/uuid.ts
|
|
@@ -1641,6 +1649,7 @@ var EventMetadata = z14.object({
|
|
|
1641
1649
|
),
|
|
1642
1650
|
createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1643
1651
|
dateOfEvent: ZodDate.nullish(),
|
|
1652
|
+
placeOfEvent: CreatedAtLocation,
|
|
1644
1653
|
createdBy: z14.string().describe("ID of the user who created the event."),
|
|
1645
1654
|
createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1646
1655
|
updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
|
|
@@ -1670,6 +1679,7 @@ var EventMetadataKeysArray = [
|
|
|
1670
1679
|
"status",
|
|
1671
1680
|
"createdAt",
|
|
1672
1681
|
"dateOfEvent",
|
|
1682
|
+
"placeOfEvent",
|
|
1673
1683
|
"createdBy",
|
|
1674
1684
|
"createdByUserType",
|
|
1675
1685
|
"updatedByUserRole",
|
|
@@ -1704,6 +1714,11 @@ var eventMetadataLabelMap = {
|
|
|
1704
1714
|
defaultMessage: "Date of Event",
|
|
1705
1715
|
description: "Date of Event"
|
|
1706
1716
|
},
|
|
1717
|
+
"event.placeOfEvent": {
|
|
1718
|
+
id: "event.placeOfEvent.label",
|
|
1719
|
+
defaultMessage: "Place of Event",
|
|
1720
|
+
description: "Place of Event"
|
|
1721
|
+
},
|
|
1707
1722
|
"event.createdAtLocation": {
|
|
1708
1723
|
id: "event.createdAtLocation.label",
|
|
1709
1724
|
defaultMessage: "Location",
|
|
@@ -2444,6 +2459,13 @@ var LoaderField = BaseField.extend({
|
|
|
2444
2459
|
}).describe(
|
|
2445
2460
|
"A non-interactive field that indicates an in progress operation in form"
|
|
2446
2461
|
);
|
|
2462
|
+
var HiddenField = BaseField.extend({
|
|
2463
|
+
type: z16.literal(FieldType.HIDDEN),
|
|
2464
|
+
required: z16.literal(false).optional()
|
|
2465
|
+
// Hidden fields cannot be required
|
|
2466
|
+
}).describe(
|
|
2467
|
+
"A non-interactive, hidden field that only hold a value in the form"
|
|
2468
|
+
);
|
|
2447
2469
|
var FieldConfig = z16.discriminatedUnion("type", [
|
|
2448
2470
|
Address,
|
|
2449
2471
|
TextField,
|
|
@@ -2483,7 +2505,8 @@ var FieldConfig = z16.discriminatedUnion("type", [
|
|
|
2483
2505
|
IdReaderField,
|
|
2484
2506
|
QueryParamReaderField,
|
|
2485
2507
|
LoaderField,
|
|
2486
|
-
SearchField
|
|
2508
|
+
SearchField,
|
|
2509
|
+
HiddenField
|
|
2487
2510
|
]).meta({
|
|
2488
2511
|
description: "Form field configuration",
|
|
2489
2512
|
id: "FieldConfig"
|
|
@@ -2997,6 +3020,7 @@ var EventFieldIdInput = z25.enum([
|
|
|
2997
3020
|
"status",
|
|
2998
3021
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
2999
3022
|
"legalStatuses.REGISTERED.createdAtLocation",
|
|
3023
|
+
"legalStatuses.REGISTERED.registrationNumber",
|
|
3000
3024
|
"updatedAt"
|
|
3001
3025
|
]);
|
|
3002
3026
|
var METADATA_FIELD_PREFIX = "event.";
|
|
@@ -3005,6 +3029,7 @@ var EventFieldId = z25.enum([
|
|
|
3005
3029
|
`${METADATA_FIELD_PREFIX}status`,
|
|
3006
3030
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
3007
3031
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
|
3032
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.registrationNumber`,
|
|
3008
3033
|
`${METADATA_FIELD_PREFIX}updatedAt`
|
|
3009
3034
|
]);
|
|
3010
3035
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
@@ -3113,6 +3138,7 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3113
3138
|
case FieldType.VERIFICATION_STATUS:
|
|
3114
3139
|
case FieldType.ID:
|
|
3115
3140
|
case FieldType.LOADER:
|
|
3141
|
+
case FieldType.HIDDEN:
|
|
3116
3142
|
schema = field3.required ? NonEmptyTextValue : TextValue;
|
|
3117
3143
|
break;
|
|
3118
3144
|
case FieldType.NUMBER:
|
|
@@ -3196,6 +3222,7 @@ function mapFieldTypeToEmptyValue(field3) {
|
|
|
3196
3222
|
case FieldType.QR_READER:
|
|
3197
3223
|
case FieldType.ID_READER:
|
|
3198
3224
|
case FieldType.LOADER:
|
|
3225
|
+
case FieldType.HIDDEN:
|
|
3199
3226
|
return null;
|
|
3200
3227
|
case FieldType.ADDRESS:
|
|
3201
3228
|
return {
|
|
@@ -3332,6 +3359,9 @@ var isIdReaderFieldType = (field3) => {
|
|
|
3332
3359
|
var isLoaderFieldType = (field3) => {
|
|
3333
3360
|
return field3.config.type === FieldType.LOADER;
|
|
3334
3361
|
};
|
|
3362
|
+
var isHiddenFieldType = (field3) => {
|
|
3363
|
+
return field3.config.type === FieldType.HIDDEN;
|
|
3364
|
+
};
|
|
3335
3365
|
var isNonInteractiveFieldType = (field3) => {
|
|
3336
3366
|
return field3.type === FieldType.DIVIDER || field3.type === FieldType.PAGE_HEADER || field3.type === FieldType.PARAGRAPH || field3.type === FieldType.BULLET_LIST || field3.type === FieldType.DATA || field3.type === FieldType.ALPHA_PRINT_BUTTON || field3.type === FieldType.HTTP || field3.type === FieldType.LINK_BUTTON || field3.type === FieldType.QUERY_PARAM_READER || field3.type === FieldType.LOADER;
|
|
3337
3367
|
};
|
|
@@ -4106,6 +4136,11 @@ function aggregateActionDeclarations(event2) {
|
|
|
4106
4136
|
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4107
4137
|
}, {});
|
|
4108
4138
|
}
|
|
4139
|
+
function aggregateActionAnnotations(actions) {
|
|
4140
|
+
return actions.reduce((ann, sortedAction) => {
|
|
4141
|
+
return deepMerge(ann, sortedAction.annotation ?? {});
|
|
4142
|
+
}, {});
|
|
4143
|
+
}
|
|
4109
4144
|
|
|
4110
4145
|
// ../commons/src/events/EventConfig.ts
|
|
4111
4146
|
var EventConfig = z29.object({
|
|
@@ -4115,6 +4150,9 @@ var EventConfig = z29.object({
|
|
|
4115
4150
|
dateOfEvent: FieldReference.optional().describe(
|
|
4116
4151
|
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
4117
4152
|
),
|
|
4153
|
+
placeOfEvent: FieldReference.optional().describe(
|
|
4154
|
+
"Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
|
|
4155
|
+
),
|
|
4118
4156
|
title: TranslationConfig.describe(
|
|
4119
4157
|
'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
|
|
4120
4158
|
),
|
|
@@ -4189,6 +4227,19 @@ var EventConfig = z29.object({
|
|
|
4189
4227
|
});
|
|
4190
4228
|
}
|
|
4191
4229
|
}
|
|
4230
|
+
if (event2.placeOfEvent) {
|
|
4231
|
+
const eventPlaceFieldId = getDeclarationFields(event2).find(
|
|
4232
|
+
({ id }) => id === event2.placeOfEvent?.$$field
|
|
4233
|
+
);
|
|
4234
|
+
if (!eventPlaceFieldId) {
|
|
4235
|
+
ctx.addIssue({
|
|
4236
|
+
code: "custom",
|
|
4237
|
+
message: `Place of event field id must match a field id in the event.declaration fields.
|
|
4238
|
+
Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
|
|
4239
|
+
path: ["placeOfEvent"]
|
|
4240
|
+
});
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4192
4243
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4193
4244
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4194
4245
|
const actionFlagIds = event2.actions.flatMap(
|
|
@@ -5487,7 +5538,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
5487
5538
|
actions: actions.slice(0, idx + 1)
|
|
5488
5539
|
};
|
|
5489
5540
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
5490
|
-
const annotation =
|
|
5541
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction.actions);
|
|
5491
5542
|
const form = { ...declaration, ...annotation };
|
|
5492
5543
|
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
5493
5544
|
({ conditional }) => (
|
|
@@ -5616,6 +5667,33 @@ function resolveDateOfEvent(eventMetadata, declaration, config) {
|
|
|
5616
5667
|
const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
|
|
5617
5668
|
return parsedDate.success ? parsedDate.data : void 0;
|
|
5618
5669
|
}
|
|
5670
|
+
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
5671
|
+
function getParsedUUID(value, oldValue) {
|
|
5672
|
+
const parsed = UUID.safeParse(value);
|
|
5673
|
+
return parsed.success ? parsed.data : oldValue;
|
|
5674
|
+
}
|
|
5675
|
+
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
5676
|
+
let placeOfEvent = getParsedUUID(
|
|
5677
|
+
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
5678
|
+
);
|
|
5679
|
+
if (config.placeOfEvent) {
|
|
5680
|
+
const addressFieldValue = AddressFieldValue.safeParse(
|
|
5681
|
+
declaration[config.placeOfEvent.$$field]
|
|
5682
|
+
);
|
|
5683
|
+
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
5684
|
+
placeOfEvent = getParsedUUID(
|
|
5685
|
+
addressFieldValue.data.administrativeArea,
|
|
5686
|
+
placeOfEvent
|
|
5687
|
+
);
|
|
5688
|
+
} else {
|
|
5689
|
+
placeOfEvent = getParsedUUID(
|
|
5690
|
+
declaration[config.placeOfEvent.$$field],
|
|
5691
|
+
placeOfEvent
|
|
5692
|
+
);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
return placeOfEvent;
|
|
5696
|
+
}
|
|
5619
5697
|
function extractPotentialDuplicatesFromActions(actions) {
|
|
5620
5698
|
return actions.reduce((duplicates, action) => {
|
|
5621
5699
|
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -5660,6 +5738,11 @@ function getCurrentEventState(event2, config) {
|
|
|
5660
5738
|
trackingId: event2.trackingId,
|
|
5661
5739
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
5662
5740
|
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
|
5741
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
5742
|
+
{ createdAtLocation: creationAction.createdAtLocation },
|
|
5743
|
+
declaration,
|
|
5744
|
+
config
|
|
5745
|
+
),
|
|
5663
5746
|
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
5664
5747
|
flags: getEventFlags(event2, config)
|
|
5665
5748
|
});
|
|
@@ -5704,6 +5787,11 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
|
5704
5787
|
updatedDeclaration,
|
|
5705
5788
|
eventConfiguration
|
|
5706
5789
|
),
|
|
5790
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
5791
|
+
eventIndex,
|
|
5792
|
+
updatedDeclaration,
|
|
5793
|
+
eventConfiguration
|
|
5794
|
+
),
|
|
5707
5795
|
declaration: updatedDeclaration
|
|
5708
5796
|
};
|
|
5709
5797
|
}
|
|
@@ -8011,6 +8099,7 @@ function mapFieldTypeToMockValue(field3, i, rng) {
|
|
|
8011
8099
|
case FieldType.OFFICE:
|
|
8012
8100
|
case FieldType.LINK_BUTTON:
|
|
8013
8101
|
case FieldType.LOADER:
|
|
8102
|
+
case FieldType.HIDDEN:
|
|
8014
8103
|
return `${field3.id}-${field3.type}-${i}`;
|
|
8015
8104
|
case FieldType.VERIFICATION_STATUS:
|
|
8016
8105
|
return "verified";
|
|
@@ -266,7 +266,8 @@ var FieldType = {
|
|
|
266
266
|
QUERY_PARAM_READER: "QUERY_PARAM_READER",
|
|
267
267
|
QR_READER: "QR_READER",
|
|
268
268
|
ID_READER: "ID_READER",
|
|
269
|
-
LOADER: "LOADER"
|
|
269
|
+
LOADER: "LOADER",
|
|
270
|
+
HIDDEN: "HIDDEN"
|
|
270
271
|
};
|
|
271
272
|
var FileFieldType = z4.enum([
|
|
272
273
|
FieldType.FILE,
|
|
@@ -396,6 +397,7 @@ var IdReaderFieldValue = ReadDataValue;
|
|
|
396
397
|
|
|
397
398
|
// ../commons/src/events/FieldValue.ts
|
|
398
399
|
var TextValue = z7.string();
|
|
400
|
+
var HiddenFieldValue = z7.string();
|
|
399
401
|
var NonEmptyTextValue = TextValue.min(1);
|
|
400
402
|
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
401
403
|
var AgeValue = z7.object({
|
|
@@ -521,7 +523,8 @@ var FieldUpdateValue = safeUnion([
|
|
|
521
523
|
DataFieldValue.describe("DataFieldValue"),
|
|
522
524
|
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
523
525
|
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
524
|
-
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
|
|
526
|
+
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
527
|
+
HiddenFieldValue.describe("HiddenFieldValue")
|
|
525
528
|
]);
|
|
526
529
|
|
|
527
530
|
// ../commons/src/uuid.ts
|
|
@@ -1236,6 +1239,7 @@ var EventMetadata = z14.object({
|
|
|
1236
1239
|
),
|
|
1237
1240
|
createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1238
1241
|
dateOfEvent: ZodDate.nullish(),
|
|
1242
|
+
placeOfEvent: CreatedAtLocation,
|
|
1239
1243
|
createdBy: z14.string().describe("ID of the user who created the event."),
|
|
1240
1244
|
createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1241
1245
|
updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
|
|
@@ -1265,6 +1269,7 @@ var EventMetadataKeysArray = [
|
|
|
1265
1269
|
"status",
|
|
1266
1270
|
"createdAt",
|
|
1267
1271
|
"dateOfEvent",
|
|
1272
|
+
"placeOfEvent",
|
|
1268
1273
|
"createdBy",
|
|
1269
1274
|
"createdByUserType",
|
|
1270
1275
|
"updatedByUserRole",
|
|
@@ -1958,6 +1963,13 @@ var LoaderField = BaseField.extend({
|
|
|
1958
1963
|
}).describe(
|
|
1959
1964
|
"A non-interactive field that indicates an in progress operation in form"
|
|
1960
1965
|
);
|
|
1966
|
+
var HiddenField = BaseField.extend({
|
|
1967
|
+
type: z16.literal(FieldType.HIDDEN),
|
|
1968
|
+
required: z16.literal(false).optional()
|
|
1969
|
+
// Hidden fields cannot be required
|
|
1970
|
+
}).describe(
|
|
1971
|
+
"A non-interactive, hidden field that only hold a value in the form"
|
|
1972
|
+
);
|
|
1961
1973
|
var FieldConfig = z16.discriminatedUnion("type", [
|
|
1962
1974
|
Address,
|
|
1963
1975
|
TextField,
|
|
@@ -1997,7 +2009,8 @@ var FieldConfig = z16.discriminatedUnion("type", [
|
|
|
1997
2009
|
IdReaderField,
|
|
1998
2010
|
QueryParamReaderField,
|
|
1999
2011
|
LoaderField,
|
|
2000
|
-
SearchField
|
|
2012
|
+
SearchField,
|
|
2013
|
+
HiddenField
|
|
2001
2014
|
]).meta({
|
|
2002
2015
|
description: "Form field configuration",
|
|
2003
2016
|
id: "FieldConfig"
|
|
@@ -2511,6 +2524,7 @@ var EventFieldIdInput = z25.enum([
|
|
|
2511
2524
|
"status",
|
|
2512
2525
|
"legalStatuses.REGISTERED.acceptedAt",
|
|
2513
2526
|
"legalStatuses.REGISTERED.createdAtLocation",
|
|
2527
|
+
"legalStatuses.REGISTERED.registrationNumber",
|
|
2514
2528
|
"updatedAt"
|
|
2515
2529
|
]);
|
|
2516
2530
|
var METADATA_FIELD_PREFIX = "event.";
|
|
@@ -2519,6 +2533,7 @@ var EventFieldId = z25.enum([
|
|
|
2519
2533
|
`${METADATA_FIELD_PREFIX}status`,
|
|
2520
2534
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
|
2521
2535
|
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
|
2536
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.registrationNumber`,
|
|
2522
2537
|
`${METADATA_FIELD_PREFIX}updatedAt`
|
|
2523
2538
|
]);
|
|
2524
2539
|
var EventFieldConfigSchema = BaseField3.extend({
|
|
@@ -2675,6 +2690,9 @@ var EventConfig = z29.object({
|
|
|
2675
2690
|
dateOfEvent: FieldReference.optional().describe(
|
|
2676
2691
|
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
2677
2692
|
),
|
|
2693
|
+
placeOfEvent: FieldReference.optional().describe(
|
|
2694
|
+
"Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
|
|
2695
|
+
),
|
|
2678
2696
|
title: TranslationConfig.describe(
|
|
2679
2697
|
'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
|
|
2680
2698
|
),
|
|
@@ -2749,6 +2767,19 @@ var EventConfig = z29.object({
|
|
|
2749
2767
|
});
|
|
2750
2768
|
}
|
|
2751
2769
|
}
|
|
2770
|
+
if (event2.placeOfEvent) {
|
|
2771
|
+
const eventPlaceFieldId = getDeclarationFields(event2).find(
|
|
2772
|
+
({ id }) => id === event2.placeOfEvent?.$$field
|
|
2773
|
+
);
|
|
2774
|
+
if (!eventPlaceFieldId) {
|
|
2775
|
+
ctx.addIssue({
|
|
2776
|
+
code: "custom",
|
|
2777
|
+
message: `Place of event field id must match a field id in the event.declaration fields.
|
|
2778
|
+
Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
|
|
2779
|
+
path: ["placeOfEvent"]
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2752
2783
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
2753
2784
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
2754
2785
|
const actionFlagIds = event2.actions.flatMap(
|