@opencrvs/toolkit 1.8.0-rc.fa49ae3 → 1.8.0-rc.fa564ca
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 +381 -6649
- package/dist/commons/conditionals/conditionals.d.ts +0 -4
- package/dist/commons/conditionals/validate.d.ts +0 -6
- package/dist/commons/events/ActionConfig.d.ts +6326 -18678
- package/dist/commons/events/ActionDocument.d.ts +204 -1713
- package/dist/commons/events/ActionInput.d.ts +180 -1380
- package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -75
- package/dist/commons/events/CompositeFieldValue.d.ts +0 -28
- package/dist/commons/events/Constants.d.ts +0 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -26
- package/dist/commons/events/Draft.d.ts +16 -117
- package/dist/commons/events/EventConfig.d.ts +2487 -8364
- package/dist/commons/events/EventDocument.d.ts +152 -1096
- package/dist/commons/events/EventIndex.d.ts +17 -283
- package/dist/commons/events/EventMetadata.d.ts +35 -38
- package/dist/commons/events/FieldConfig.d.ts +771 -1597
- package/dist/commons/events/FieldType.d.ts +1 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +50 -89
- package/dist/commons/events/FieldValue.d.ts +5 -41
- package/dist/commons/events/FormConfig.d.ts +2444 -7640
- package/dist/commons/events/PageConfig.d.ts +1620 -2896
- package/dist/commons/events/SummaryConfig.d.ts +5 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
- package/dist/commons/events/WorkqueueConfig.d.ts +24 -346
- package/dist/commons/events/defineConfig.d.ts +14 -960
- package/dist/commons/events/field.d.ts +0 -4
- package/dist/commons/events/test.utils.d.ts +38 -124
- package/dist/commons/events/utils.d.ts +8 -9659
- package/dist/conditionals/index.js +1 -18
- package/dist/events/index.js +413 -691
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -56,7 +56,6 @@ __export(events_exports, {
|
|
56
56
|
ArchiveActionInput: () => ArchiveActionInput,
|
57
57
|
AssignActionInput: () => AssignActionInput,
|
58
58
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
59
|
-
BIRTH_EVENT: () => BIRTH_EVENT,
|
60
59
|
BaseActionInput: () => BaseActionInput,
|
61
60
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
62
61
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
@@ -102,6 +101,8 @@ __export(events_exports, {
|
|
102
101
|
EventSearchIndex: () => EventSearchIndex,
|
103
102
|
EventState: () => EventState,
|
104
103
|
EventStatus: () => EventStatus,
|
104
|
+
EventStatusEnum: () => EventStatusEnum,
|
105
|
+
EventStatuses: () => EventStatuses,
|
105
106
|
Exact: () => Exact,
|
106
107
|
ExactStatus: () => ExactStatus,
|
107
108
|
FieldConditional: () => FieldConditional,
|
@@ -126,8 +127,6 @@ __export(events_exports, {
|
|
126
127
|
LegalStatuses: () => LegalStatuses,
|
127
128
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
128
129
|
MimeType: () => MimeType,
|
129
|
-
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
130
|
-
NameFieldValue: () => NameFieldValue,
|
131
130
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
132
131
|
Not: () => Not,
|
133
132
|
NotifyActionInput: () => NotifyActionInput,
|
@@ -186,8 +185,9 @@ __export(events_exports, {
|
|
186
185
|
createEmptyDraft: () => createEmptyDraft,
|
187
186
|
createEventConditionals: () => createEventConditionals,
|
188
187
|
createFieldConditionals: () => createFieldConditionals,
|
189
|
-
|
188
|
+
createPseudoRandomNumberGenerator: () => createPseudoRandomNumberGenerator,
|
190
189
|
createValidationSchema: () => createValidationSchema,
|
190
|
+
dateOfEventColumn: () => dateOfEventColumn,
|
191
191
|
deepDropNulls: () => deepDropNulls,
|
192
192
|
deepMerge: () => deepMerge,
|
193
193
|
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
@@ -207,6 +207,7 @@ __export(events_exports, {
|
|
207
207
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
208
208
|
eventPayloadGenerator: () => eventPayloadGenerator,
|
209
209
|
eventQueryDataGenerator: () => eventQueryDataGenerator,
|
210
|
+
eventStatuses: () => eventStatuses,
|
210
211
|
field: () => field,
|
211
212
|
fieldTypes: () => fieldTypes,
|
212
213
|
filterUnallowedActions: () => filterUnallowedActions,
|
@@ -219,7 +220,6 @@ __export(events_exports, {
|
|
219
220
|
generateActionDocument: () => generateActionDocument,
|
220
221
|
generateEventDocument: () => generateEventDocument,
|
221
222
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
222
|
-
generateRandomName: () => generateRandomName,
|
223
223
|
generateRandomSignature: () => generateRandomSignature,
|
224
224
|
generateTransactionId: () => generateTransactionId,
|
225
225
|
generateTranslationConfig: () => generateTranslationConfig,
|
@@ -230,22 +230,17 @@ __export(events_exports, {
|
|
230
230
|
getActionReview: () => getActionReview,
|
231
231
|
getActionReviewFields: () => getActionReviewFields,
|
232
232
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
233
|
-
getAllUniqueFields: () => getAllUniqueFields,
|
234
233
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
235
234
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
236
235
|
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
237
236
|
getCurrentEventState: () => getCurrentEventState,
|
238
237
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
239
238
|
getDeclaration: () => getDeclaration,
|
240
|
-
getDeclarationFieldById: () => getDeclarationFieldById,
|
241
239
|
getDeclarationFields: () => getDeclarationFields,
|
242
240
|
getDeclarationPages: () => getDeclarationPages,
|
243
|
-
getEventConfigById: () => getEventConfigById,
|
244
241
|
getMixedPath: () => getMixedPath,
|
245
|
-
getRandomDate: () => getRandomDate,
|
246
242
|
getRandomDatetime: () => getRandomDatetime,
|
247
243
|
getStatusFromActions: () => getStatusFromActions,
|
248
|
-
getValidatorsForField: () => getValidatorsForField,
|
249
244
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
250
245
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
251
246
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -268,17 +263,14 @@ __export(events_exports, {
|
|
268
263
|
isFieldVisible: () => isFieldVisible,
|
269
264
|
isFileFieldType: () => isFileFieldType,
|
270
265
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
271
|
-
isIdFieldType: () => isIdFieldType,
|
272
266
|
isLocationFieldType: () => isLocationFieldType,
|
273
267
|
isMetaAction: () => isMetaAction,
|
274
|
-
isNameFieldType: () => isNameFieldType,
|
275
268
|
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
276
269
|
isNumberFieldType: () => isNumberFieldType,
|
277
270
|
isOfficeFieldType: () => isOfficeFieldType,
|
278
271
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
279
272
|
isPageVisible: () => isPageVisible,
|
280
273
|
isParagraphFieldType: () => isParagraphFieldType,
|
281
|
-
isPhoneFieldType: () => isPhoneFieldType,
|
282
274
|
isRadioGroupFieldType: () => isRadioGroupFieldType,
|
283
275
|
isSelectFieldType: () => isSelectFieldType,
|
284
276
|
isSignatureFieldType: () => isSignatureFieldType,
|
@@ -288,7 +280,6 @@ __export(events_exports, {
|
|
288
280
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
289
281
|
isVerificationPage: () => isVerificationPage,
|
290
282
|
isWriteAction: () => isWriteAction,
|
291
|
-
mandatoryColumns: () => mandatoryColumns,
|
292
283
|
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
293
284
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
294
285
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
@@ -309,7 +300,6 @@ module.exports = __toCommonJS(events_exports);
|
|
309
300
|
|
310
301
|
// ../commons/src/events/Constants.ts
|
311
302
|
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
312
|
-
var BIRTH_EVENT = "v2-birth";
|
313
303
|
|
314
304
|
// ../commons/src/events/ActionConfig.ts
|
315
305
|
var import_zod9 = require("zod");
|
@@ -388,9 +378,6 @@ var TranslationConfig = import_zod2.z.object({
|
|
388
378
|
|
389
379
|
// ../commons/src/events/FieldType.ts
|
390
380
|
var FieldType = {
|
391
|
-
NAME: "NAME",
|
392
|
-
PHONE: "PHONE",
|
393
|
-
ID: "ID",
|
394
381
|
ADDRESS: "ADDRESS",
|
395
382
|
TEXT: "TEXT",
|
396
383
|
NUMBER: "NUMBER",
|
@@ -467,16 +454,6 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
467
454
|
number: import_zod3.z.string().nullish(),
|
468
455
|
zipCode: import_zod3.z.string().nullish()
|
469
456
|
});
|
470
|
-
var NameFieldValue = import_zod3.z.object({
|
471
|
-
firstname: import_zod3.z.string(),
|
472
|
-
surname: import_zod3.z.string(),
|
473
|
-
middlename: import_zod3.z.string().optional()
|
474
|
-
});
|
475
|
-
var NameFieldUpdateValue = import_zod3.z.object({
|
476
|
-
firstname: import_zod3.z.string(),
|
477
|
-
surname: import_zod3.z.string(),
|
478
|
-
middlename: import_zod3.z.string().nullish()
|
479
|
-
}).or(import_zod3.z.null()).or(import_zod3.z.undefined());
|
480
457
|
var RuralAddressUpdateValue = AdminStructure.extend({
|
481
458
|
urbanOrRural: import_zod3.z.literal(GeographicalArea.RURAL),
|
482
459
|
village: import_zod3.z.string().nullish()
|
@@ -538,9 +515,7 @@ var FieldValue = import_zod4.z.union([
|
|
538
515
|
UrbanAddressValue,
|
539
516
|
RuralAddressValue,
|
540
517
|
DataFieldValue,
|
541
|
-
GenericAddressValue
|
542
|
-
NameFieldValue,
|
543
|
-
NameFieldUpdateValue
|
518
|
+
GenericAddressValue
|
544
519
|
]);
|
545
520
|
var FieldUpdateValue = import_zod4.z.union([
|
546
521
|
TextValue,
|
@@ -553,8 +528,7 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
553
528
|
UrbanAddressUpdateValue,
|
554
529
|
RuralAddressUpdateValue,
|
555
530
|
DataFieldValue,
|
556
|
-
GenericAddressUpdateValue
|
557
|
-
NameFieldUpdateValue
|
531
|
+
GenericAddressUpdateValue
|
558
532
|
]);
|
559
533
|
|
560
534
|
// ../commons/src/events/FieldConfig.ts
|
@@ -731,26 +705,6 @@ var Select = BaseField.extend({
|
|
731
705
|
defaultValue: TextValue.optional(),
|
732
706
|
options: import_zod5.z.array(SelectOption).describe("A list of options")
|
733
707
|
}).describe("Select input");
|
734
|
-
var NameField = BaseField.extend({
|
735
|
-
type: import_zod5.z.literal(FieldType.NAME),
|
736
|
-
defaultValue: import_zod5.z.object({
|
737
|
-
firstname: NonEmptyTextValue,
|
738
|
-
surname: NonEmptyTextValue
|
739
|
-
}).optional(),
|
740
|
-
configuration: import_zod5.z.object({
|
741
|
-
maxLength: import_zod5.z.number().optional().describe("Maximum length of the text"),
|
742
|
-
prefix: TranslationConfig.optional(),
|
743
|
-
postfix: TranslationConfig.optional()
|
744
|
-
}).optional()
|
745
|
-
}).describe("Name input field");
|
746
|
-
var PhoneField = BaseField.extend({
|
747
|
-
defaultValue: NonEmptyTextValue.optional(),
|
748
|
-
type: import_zod5.z.literal(FieldType.PHONE)
|
749
|
-
}).describe("Phone input field");
|
750
|
-
var IdField = BaseField.extend({
|
751
|
-
defaultValue: NonEmptyTextValue.optional(),
|
752
|
-
type: import_zod5.z.literal(FieldType.ID)
|
753
|
-
}).describe("ID input field");
|
754
708
|
var Checkbox = BaseField.extend({
|
755
709
|
type: import_zod5.z.literal(FieldType.CHECKBOX),
|
756
710
|
defaultValue: CheckboxFieldValue.optional()
|
@@ -830,9 +784,6 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
830
784
|
BulletList,
|
831
785
|
PageHeader,
|
832
786
|
Select,
|
833
|
-
NameField,
|
834
|
-
PhoneField,
|
835
|
-
IdField,
|
836
787
|
Checkbox,
|
837
788
|
File,
|
838
789
|
Country,
|
@@ -1238,7 +1189,8 @@ var Field = BaseField2.extend({
|
|
1238
1189
|
value: TranslationConfig.describe(
|
1239
1190
|
"Summary field value. Can utilise values defined in configuration and EventMetadata"
|
1240
1191
|
),
|
1241
|
-
label: TranslationConfig
|
1192
|
+
label: TranslationConfig,
|
1193
|
+
emptyValueMessage: TranslationConfig.optional()
|
1242
1194
|
}).describe("Custom configured field");
|
1243
1195
|
var SummaryConfig = import_zod13.z.object({
|
1244
1196
|
fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
@@ -1254,35 +1206,35 @@ var BaseField3 = import_zod14.z.object({
|
|
1254
1206
|
options: import_zod14.z.array(SelectOption).optional(),
|
1255
1207
|
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1256
1208
|
`
|
1257
|
-
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1209
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1258
1210
|
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1259
1211
|
|
1260
|
-
For example, a field config like { id: "child.
|
1212
|
+
For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1261
1213
|
|
1262
1214
|
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1263
1215
|
|
1264
|
-
So, if both child.
|
1216
|
+
So, if both child.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1265
1217
|
which is ambiguous.
|
1266
1218
|
|
1267
|
-
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1268
|
-
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1219
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1220
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1269
1221
|
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1270
1222
|
|
1271
|
-
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1223
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1272
1224
|
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1273
1225
|
`
|
1274
1226
|
),
|
1275
1227
|
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1276
1228
|
`
|
1277
1229
|
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1278
|
-
|
1279
|
-
For example, Informant fields in the declaration form may have conditional logic
|
1280
|
-
that hides them based on other field values. Since the advanced search form reuses
|
1230
|
+
|
1231
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1232
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1281
1233
|
the declaration form config, those same conditionals would apply by default.
|
1282
|
-
|
1234
|
+
|
1283
1235
|
However, in advanced search we often want to make all Informant fields searchable,
|
1284
|
-
regardless of their original visibility logic. To do this, we explicitly set their
|
1285
|
-
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1236
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1237
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1286
1238
|
are always rendered in the advanced search form.
|
1287
1239
|
`
|
1288
1240
|
)
|
@@ -1339,7 +1291,6 @@ var ActionStatus = {
|
|
1339
1291
|
var ActionBase = import_zod16.z.object({
|
1340
1292
|
id: import_zod16.z.string(),
|
1341
1293
|
transactionId: import_zod16.z.string(),
|
1342
|
-
creator: import_zod16.z.enum(["user", "system"]).optional(),
|
1343
1294
|
createdAt: import_zod16.z.string().datetime(),
|
1344
1295
|
createdBy: import_zod16.z.string(),
|
1345
1296
|
createdByRole: import_zod16.z.string(),
|
@@ -1514,8 +1465,6 @@ function mapFieldTypeToZod(type, required) {
|
|
1514
1465
|
case FieldType.ADMINISTRATIVE_AREA:
|
1515
1466
|
case FieldType.FACILITY:
|
1516
1467
|
case FieldType.OFFICE:
|
1517
|
-
case FieldType.PHONE:
|
1518
|
-
case FieldType.ID:
|
1519
1468
|
schema = required ? NonEmptyTextValue : TextValue;
|
1520
1469
|
break;
|
1521
1470
|
case FieldType.NUMBER:
|
@@ -1537,9 +1486,6 @@ function mapFieldTypeToZod(type, required) {
|
|
1537
1486
|
case FieldType.DATA:
|
1538
1487
|
schema = DataFieldValue;
|
1539
1488
|
break;
|
1540
|
-
case FieldType.NAME:
|
1541
|
-
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
1542
|
-
break;
|
1543
1489
|
}
|
1544
1490
|
return required ? schema : schema.nullish();
|
1545
1491
|
}
|
@@ -1550,6 +1496,58 @@ function createValidationSchema(config) {
|
|
1550
1496
|
}
|
1551
1497
|
return import_zod17.z.object(shape);
|
1552
1498
|
}
|
1499
|
+
function mapFieldTypeToMockValue(field2, i) {
|
1500
|
+
switch (field2.type) {
|
1501
|
+
case FieldType.DIVIDER:
|
1502
|
+
case FieldType.TEXT:
|
1503
|
+
case FieldType.TEXTAREA:
|
1504
|
+
case FieldType.BULLET_LIST:
|
1505
|
+
case FieldType.PAGE_HEADER:
|
1506
|
+
case FieldType.LOCATION:
|
1507
|
+
case FieldType.SELECT:
|
1508
|
+
case FieldType.COUNTRY:
|
1509
|
+
case FieldType.RADIO_GROUP:
|
1510
|
+
case FieldType.PARAGRAPH:
|
1511
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
1512
|
+
case FieldType.FACILITY:
|
1513
|
+
case FieldType.OFFICE:
|
1514
|
+
return `${field2.id}-${field2.type}-${i}`;
|
1515
|
+
case FieldType.NUMBER:
|
1516
|
+
return 19;
|
1517
|
+
case FieldType.EMAIL:
|
1518
|
+
return "test@opencrvs.org";
|
1519
|
+
case FieldType.ADDRESS:
|
1520
|
+
return {
|
1521
|
+
country: "FAR",
|
1522
|
+
addressType: AddressType.DOMESTIC,
|
1523
|
+
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
1524
|
+
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
1525
|
+
urbanOrRural: "URBAN",
|
1526
|
+
town: "Example Town",
|
1527
|
+
residentialArea: "Example Residential Area",
|
1528
|
+
street: "Example Street",
|
1529
|
+
number: "55",
|
1530
|
+
zipCode: "123456"
|
1531
|
+
};
|
1532
|
+
case FieldType.DATE:
|
1533
|
+
return "2021-01-01";
|
1534
|
+
case FieldType.DATE_RANGE:
|
1535
|
+
return ["2021-01-01", "2021-01-02"];
|
1536
|
+
case FieldType.CHECKBOX:
|
1537
|
+
return true;
|
1538
|
+
case FieldType.SIGNATURE:
|
1539
|
+
case FieldType.FILE:
|
1540
|
+
return {
|
1541
|
+
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
1542
|
+
originalFilename: "abcd.png",
|
1543
|
+
type: "image/png"
|
1544
|
+
};
|
1545
|
+
case FieldType.FILE_WITH_OPTIONS:
|
1546
|
+
return null;
|
1547
|
+
case FieldType.DATA:
|
1548
|
+
return {};
|
1549
|
+
}
|
1550
|
+
}
|
1553
1551
|
function mapFieldTypeToEmptyValue(field2) {
|
1554
1552
|
switch (field2.type) {
|
1555
1553
|
case FieldType.DIVIDER:
|
@@ -1571,9 +1569,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1571
1569
|
case FieldType.CHECKBOX:
|
1572
1570
|
case FieldType.DATE_RANGE:
|
1573
1571
|
case FieldType.DATA:
|
1574
|
-
case FieldType.NAME:
|
1575
|
-
case FieldType.PHONE:
|
1576
|
-
case FieldType.ID:
|
1577
1572
|
return null;
|
1578
1573
|
case FieldType.ADDRESS:
|
1579
1574
|
return {
|
@@ -1618,15 +1613,6 @@ var isTextFieldType = (field2) => {
|
|
1618
1613
|
var isNumberFieldType = (field2) => {
|
1619
1614
|
return field2.config.type === FieldType.NUMBER;
|
1620
1615
|
};
|
1621
|
-
var isNameFieldType = (field2) => {
|
1622
|
-
return field2.config.type === FieldType.NAME;
|
1623
|
-
};
|
1624
|
-
var isPhoneFieldType = (field2) => {
|
1625
|
-
return field2.config.type === FieldType.PHONE;
|
1626
|
-
};
|
1627
|
-
var isIdFieldType = (field2) => {
|
1628
|
-
return field2.config.type === FieldType.ID;
|
1629
|
-
};
|
1630
1616
|
var isTextAreaFieldType = (field2) => {
|
1631
1617
|
return field2.config.type === FieldType.TEXTAREA;
|
1632
1618
|
};
|
@@ -1761,11 +1747,6 @@ var errorMessages = {
|
|
1761
1747
|
defaultMessage: "Invalid input",
|
1762
1748
|
description: "Error message when generic field is invalid",
|
1763
1749
|
id: "v2.error.invalid"
|
1764
|
-
},
|
1765
|
-
unexpectedField: {
|
1766
|
-
defaultMessage: "Unexpected field",
|
1767
|
-
description: "Error message when field is not expected",
|
1768
|
-
id: "v2.error.unexpectedField"
|
1769
1750
|
}
|
1770
1751
|
};
|
1771
1752
|
function createIntlError(message) {
|
@@ -1861,45 +1842,6 @@ function runFieldValidations({
|
|
1861
1842
|
errors: [...fieldValidationResult, ...customValidationResults]
|
1862
1843
|
};
|
1863
1844
|
}
|
1864
|
-
function getValidatorsForField(fieldId, validations) {
|
1865
|
-
return validations.map(({ validator, message }) => {
|
1866
|
-
const jsonSchema = validator;
|
1867
|
-
const $form = jsonSchema.properties.$form;
|
1868
|
-
if ($form.properties?.[fieldId]?.type === "object") {
|
1869
|
-
return {
|
1870
|
-
message,
|
1871
|
-
validator: {
|
1872
|
-
...jsonSchema,
|
1873
|
-
properties: {
|
1874
|
-
$form: {
|
1875
|
-
type: "object",
|
1876
|
-
properties: $form.properties?.[fieldId]?.properties || {},
|
1877
|
-
required: $form.properties?.[fieldId]?.required || []
|
1878
|
-
}
|
1879
|
-
}
|
1880
|
-
}
|
1881
|
-
};
|
1882
|
-
}
|
1883
|
-
if (!$form.properties?.[fieldId]) {
|
1884
|
-
return null;
|
1885
|
-
}
|
1886
|
-
return {
|
1887
|
-
message,
|
1888
|
-
validator: {
|
1889
|
-
...jsonSchema,
|
1890
|
-
properties: {
|
1891
|
-
$form: {
|
1892
|
-
type: "object",
|
1893
|
-
properties: {
|
1894
|
-
[fieldId]: $form.properties?.[fieldId]
|
1895
|
-
},
|
1896
|
-
required: $form.required?.includes(fieldId) ? [fieldId] : []
|
1897
|
-
}
|
1898
|
-
}
|
1899
|
-
}
|
1900
|
-
};
|
1901
|
-
}).filter((x) => x !== null);
|
1902
|
-
}
|
1903
1845
|
|
1904
1846
|
// ../commons/src/uuid.ts
|
1905
1847
|
var import_uuid = require("uuid");
|
@@ -1946,13 +1888,6 @@ var getActionAnnotationFields = (actionConfig) => {
|
|
1946
1888
|
function getAllAnnotationFields(config) {
|
1947
1889
|
return (0, import_lodash.flattenDeep)(config.actions.map(getActionAnnotationFields));
|
1948
1890
|
}
|
1949
|
-
function getAllUniqueFields(eventConfig) {
|
1950
|
-
return (0, import_lodash.uniqBy)(getDeclarationFields(eventConfig), (field2) => field2.id);
|
1951
|
-
}
|
1952
|
-
function getDeclarationFieldById(config, fieldId) {
|
1953
|
-
const field2 = getAllUniqueFields(config).find((f) => f.id === fieldId);
|
1954
|
-
return getOrThrow(field2, `Field with id ${fieldId} not found in event config`);
|
1955
|
-
}
|
1956
1891
|
var findRecordActionPages = (config, actionType) => {
|
1957
1892
|
const action = config.actions.find((a) => a.type === actionType);
|
1958
1893
|
if (action?.type === ActionType.REQUEST_CORRECTION) {
|
@@ -2013,7 +1948,6 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
2013
1948
|
declaration: {},
|
2014
1949
|
annotation: {},
|
2015
1950
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
2016
|
-
creator: "user",
|
2017
1951
|
createdBy: "@todo",
|
2018
1952
|
createdAtLocation: "@todo",
|
2019
1953
|
status: ActionStatus.Accepted,
|
@@ -2059,9 +1993,8 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation) {
|
|
2059
1993
|
);
|
2060
1994
|
}
|
2061
1995
|
function deepMerge(currentDocument, actionDocument) {
|
2062
|
-
const currentDocumentClone = (0, import_lodash.cloneDeep)(currentDocument);
|
2063
1996
|
return (0, import_lodash.mergeWith)(
|
2064
|
-
|
1997
|
+
currentDocument,
|
2065
1998
|
actionDocument,
|
2066
1999
|
(previousValue, incomingValue) => {
|
2067
2000
|
if (incomingValue === void 0) {
|
@@ -2109,12 +2042,6 @@ function getMixedPath(obj, path, defaultValue) {
|
|
2109
2042
|
const result = resolve(obj, parts);
|
2110
2043
|
return (0, import_lodash.isNil)(result) ? defaultValue : result;
|
2111
2044
|
}
|
2112
|
-
function getEventConfigById(eventConfigs, id) {
|
2113
|
-
const eventConfig = eventConfigs.find(
|
2114
|
-
(eventConfiguration) => eventConfiguration.id === id
|
2115
|
-
);
|
2116
|
-
return getOrThrow(eventConfig, `Event config for ${id} not found`);
|
2117
|
-
}
|
2118
2045
|
|
2119
2046
|
// ../commons/src/events/EventConfig.ts
|
2120
2047
|
var import_zod_openapi8 = require("zod-openapi");
|
@@ -2401,7 +2328,7 @@ function createFieldConditionals(fieldId) {
|
|
2401
2328
|
properties: {
|
2402
2329
|
[fieldId]: {
|
2403
2330
|
type: ["string", "boolean"],
|
2404
|
-
const: { $data:
|
2331
|
+
const: { $data: `1/${comparedFieldId}` }
|
2405
2332
|
},
|
2406
2333
|
[comparedFieldId]: { type: ["string", "boolean"] }
|
2407
2334
|
},
|
@@ -2511,23 +2438,6 @@ function createFieldConditionals(fieldId) {
|
|
2511
2438
|
}
|
2512
2439
|
},
|
2513
2440
|
required: [fieldId]
|
2514
|
-
}),
|
2515
|
-
getId: () => ({ fieldId }),
|
2516
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2517
|
-
object: (options) => defineFormConditional({
|
2518
|
-
type: "object",
|
2519
|
-
properties: {
|
2520
|
-
[fieldId]: {
|
2521
|
-
type: "object",
|
2522
|
-
properties: Object.fromEntries(
|
2523
|
-
Object.entries(options).map(([key, value]) => {
|
2524
|
-
return [key, value.properties.$form.properties[key]];
|
2525
|
-
})
|
2526
|
-
),
|
2527
|
-
required: Object.keys(options)
|
2528
|
-
}
|
2529
|
-
},
|
2530
|
-
required: [fieldId]
|
2531
2441
|
})
|
2532
2442
|
};
|
2533
2443
|
}
|
@@ -2607,16 +2517,27 @@ var import_zod21 = require("zod");
|
|
2607
2517
|
|
2608
2518
|
// ../commons/src/events/EventMetadata.ts
|
2609
2519
|
var import_zod20 = require("zod");
|
2610
|
-
var EventStatus =
|
2611
|
-
"CREATED",
|
2612
|
-
"NOTIFIED",
|
2613
|
-
"DECLARED",
|
2614
|
-
"VALIDATED",
|
2615
|
-
"REGISTERED",
|
2616
|
-
"CERTIFIED",
|
2617
|
-
"REJECTED",
|
2618
|
-
"ARCHIVED"
|
2619
|
-
|
2520
|
+
var EventStatus = {
|
2521
|
+
CREATED: "CREATED",
|
2522
|
+
NOTIFIED: "NOTIFIED",
|
2523
|
+
DECLARED: "DECLARED",
|
2524
|
+
VALIDATED: "VALIDATED",
|
2525
|
+
REGISTERED: "REGISTERED",
|
2526
|
+
CERTIFIED: "CERTIFIED",
|
2527
|
+
REJECTED: "REJECTED",
|
2528
|
+
ARCHIVED: "ARCHIVED"
|
2529
|
+
};
|
2530
|
+
var eventStatusValues = [
|
2531
|
+
EventStatus.CREATED,
|
2532
|
+
EventStatus.NOTIFIED,
|
2533
|
+
EventStatus.DECLARED,
|
2534
|
+
EventStatus.VALIDATED,
|
2535
|
+
EventStatus.REGISTERED,
|
2536
|
+
EventStatus.CERTIFIED,
|
2537
|
+
EventStatus.REJECTED,
|
2538
|
+
EventStatus.ARCHIVED
|
2539
|
+
];
|
2540
|
+
var EventStatusEnum = import_zod20.z.enum(eventStatusValues);
|
2620
2541
|
var CustomFlags = {
|
2621
2542
|
CERTIFICATE_PRINTED: "certificate-printed"
|
2622
2543
|
};
|
@@ -2628,6 +2549,8 @@ var Flag = import_zod20.z.string().regex(
|
|
2628
2549
|
),
|
2629
2550
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2630
2551
|
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2552
|
+
var eventStatuses = Object.values(EventStatus);
|
2553
|
+
var EventStatuses = import_zod20.z.nativeEnum(EventStatus);
|
2631
2554
|
var ZodDate = import_zod20.z.string().date();
|
2632
2555
|
var ActionCreationMetadata = import_zod20.z.object({
|
2633
2556
|
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -2635,7 +2558,6 @@ var ActionCreationMetadata = import_zod20.z.object({
|
|
2635
2558
|
createdAtLocation: CreatedAtLocation.describe(
|
2636
2559
|
"Location of the user who created the action request."
|
2637
2560
|
),
|
2638
|
-
creator: import_zod20.z.enum(["user", "system"]).nullish().describe("Whether the user us a normal user or a system."),
|
2639
2561
|
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2640
2562
|
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
|
2641
2563
|
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
|
@@ -2646,20 +2568,19 @@ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
2646
2568
|
)
|
2647
2569
|
});
|
2648
2570
|
var LegalStatuses = import_zod20.z.object({
|
2649
|
-
[EventStatus.
|
2650
|
-
[EventStatus.
|
2571
|
+
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2572
|
+
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2651
2573
|
});
|
2652
2574
|
var EventMetadata = import_zod20.z.object({
|
2653
2575
|
id: import_zod20.z.string(),
|
2654
2576
|
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2655
|
-
status:
|
2577
|
+
status: EventStatuses,
|
2656
2578
|
legalStatuses: LegalStatuses.describe(
|
2657
2579
|
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2658
2580
|
),
|
2659
2581
|
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2660
2582
|
dateOfEvent: ZodDate.nullish(),
|
2661
2583
|
createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
|
2662
|
-
creator: import_zod20.z.enum(["user", "system"]).nullish().describe("Whether the user us a normal user or a system."),
|
2663
2584
|
updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
|
2664
2585
|
createdAtLocation: CreatedAtLocation.describe(
|
2665
2586
|
"Location of the user who created the event."
|
@@ -2681,7 +2602,6 @@ var EventMetadataKeysArray = [
|
|
2681
2602
|
"createdAt",
|
2682
2603
|
"dateOfEvent",
|
2683
2604
|
"createdBy",
|
2684
|
-
"creator",
|
2685
2605
|
"updatedByUserRole",
|
2686
2606
|
"createdAtLocation",
|
2687
2607
|
"updatedAtLocation",
|
@@ -2704,11 +2624,6 @@ var eventMetadataLabelMap = {
|
|
2704
2624
|
defaultMessage: "Created",
|
2705
2625
|
description: "Created At"
|
2706
2626
|
},
|
2707
|
-
"event.creator": {
|
2708
|
-
id: "event.creator.label",
|
2709
|
-
defaultMessage: "Creator",
|
2710
|
-
description: "Creator:user or system"
|
2711
|
-
},
|
2712
2627
|
"event.dateOfEvent": {
|
2713
2628
|
id: "event.dateOfEvent.label",
|
2714
2629
|
defaultMessage: "Date of Event",
|
@@ -2824,13 +2739,13 @@ var AnyOf = import_zod22.z.object({
|
|
2824
2739
|
});
|
2825
2740
|
var ExactStatus = import_zod22.z.object({
|
2826
2741
|
type: import_zod22.z.literal("exact"),
|
2827
|
-
term:
|
2742
|
+
term: EventStatusEnum
|
2828
2743
|
}).openapi({
|
2829
2744
|
ref: "ExactStatus"
|
2830
2745
|
});
|
2831
2746
|
var AnyOfStatus = import_zod22.z.object({
|
2832
2747
|
type: import_zod22.z.literal("anyOf"),
|
2833
|
-
terms: import_zod22.z.array(
|
2748
|
+
terms: import_zod22.z.array(EventStatusEnum)
|
2834
2749
|
}).openapi({
|
2835
2750
|
ref: "AnyOfStatus"
|
2836
2751
|
});
|
@@ -2867,11 +2782,9 @@ var QueryExpression = import_zod22.z.object({
|
|
2867
2782
|
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2868
2783
|
import_zod22.z.union([Within, Exact])
|
2869
2784
|
),
|
2870
|
-
"legalStatus.REGISTERED.registrationNumber": import_zod22.z.optional(Exact),
|
2871
2785
|
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2872
2786
|
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2873
2787
|
assignedTo: import_zod22.z.optional(Exact),
|
2874
|
-
creator: import_zod22.z.enum(["user", "system"]).optional(),
|
2875
2788
|
createdBy: import_zod22.z.optional(Exact),
|
2876
2789
|
updatedBy: import_zod22.z.optional(Exact),
|
2877
2790
|
trackingId: import_zod22.z.optional(Exact),
|
@@ -2892,13 +2805,22 @@ var QueryType = import_zod22.z.object({
|
|
2892
2805
|
}
|
2893
2806
|
return val;
|
2894
2807
|
},
|
2895
|
-
import_zod22.z.array(QueryExpression).
|
2808
|
+
import_zod22.z.array(QueryExpression).openapi({
|
2896
2809
|
default: [
|
2897
2810
|
{
|
2898
2811
|
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2899
2812
|
status: {
|
2900
2813
|
type: "anyOf",
|
2901
|
-
terms:
|
2814
|
+
terms: [
|
2815
|
+
"CREATED",
|
2816
|
+
"NOTIFIED",
|
2817
|
+
"DECLARED",
|
2818
|
+
"VALIDATED",
|
2819
|
+
"REGISTERED",
|
2820
|
+
"CERTIFIED",
|
2821
|
+
"REJECTED",
|
2822
|
+
"ARCHIVED"
|
2823
|
+
]
|
2902
2824
|
},
|
2903
2825
|
updatedAt: {
|
2904
2826
|
type: "range",
|
@@ -2936,7 +2858,6 @@ var SerializedQueryExpression = import_zod23.z.object({
|
|
2936
2858
|
),
|
2937
2859
|
assignedTo: import_zod23.z.optional(SerializableExact),
|
2938
2860
|
createdBy: import_zod23.z.optional(SerializableExact),
|
2939
|
-
creator: import_zod23.z.enum(["user", "system"]).optional(),
|
2940
2861
|
updatedBy: import_zod23.z.optional(SerializableExact),
|
2941
2862
|
trackingId: import_zod23.z.optional(Exact),
|
2942
2863
|
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
@@ -3063,7 +2984,7 @@ var AvailableIcons = import_zod24.z.enum([
|
|
3063
2984
|
]);
|
3064
2985
|
|
3065
2986
|
// ../commons/src/events/WorkqueueConfig.ts
|
3066
|
-
var
|
2987
|
+
var dateOfEventColumn = defineWorkqueuesColumns([
|
3067
2988
|
{
|
3068
2989
|
label: {
|
3069
2990
|
id: "workqueues.dateOfEvent",
|
@@ -3097,7 +3018,7 @@ var WorkqueueConfig = import_zod25.z.object({
|
|
3097
3018
|
conditionals: import_zod25.z.array(Conditional).optional()
|
3098
3019
|
})
|
3099
3020
|
),
|
3100
|
-
columns: import_zod25.z.array(WorkqueueColumn).default(
|
3021
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
3101
3022
|
icon: AvailableIcons
|
3102
3023
|
}).describe("Configuration for workqueue.");
|
3103
3024
|
var WorkqueueConfigInput = import_zod25.z.object({
|
@@ -3112,7 +3033,7 @@ var WorkqueueConfigInput = import_zod25.z.object({
|
|
3112
3033
|
conditionals: import_zod25.z.array(Conditional).optional()
|
3113
3034
|
})
|
3114
3035
|
),
|
3115
|
-
columns: import_zod25.z.array(WorkqueueColumn).default(
|
3036
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
3116
3037
|
icon: AvailableIcons
|
3117
3038
|
});
|
3118
3039
|
function defineWorkqueue(workqueueInput) {
|
@@ -3356,7 +3277,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
3356
3277
|
// When 3rd party API returns 200 OK, we assume that the request was accepted, and persist single 'accepted' action.
|
3357
3278
|
createdAt: requestAction?.createdAt ?? acceptAction.createdAt,
|
3358
3279
|
createdBy: requestAction?.createdBy ?? acceptAction.createdBy,
|
3359
|
-
creator: requestAction?.creator ?? acceptAction.creator,
|
3360
3280
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
3361
3281
|
acceptedAt: acceptAction.createdAt,
|
3362
3282
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
@@ -3375,7 +3295,6 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
3375
3295
|
return {
|
3376
3296
|
createdAt: request?.createdAt ?? accept?.createdAt ?? metadata.createdAt,
|
3377
3297
|
createdBy: request?.createdBy ?? accept?.createdBy ?? metadata.createdBy,
|
3378
|
-
creator: request?.creator ?? accept?.creator ?? metadata.creator,
|
3379
3298
|
createdAtLocation: request?.createdAtLocation ?? accept?.createdAtLocation ?? metadata.createdAtLocation,
|
3380
3299
|
createdByRole: request?.createdByRole ?? accept?.createdByRole ?? metadata.createdByRole
|
3381
3300
|
};
|
@@ -3383,7 +3302,6 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
3383
3302
|
{
|
3384
3303
|
createdAt: createAction.createdAt,
|
3385
3304
|
createdBy: createAction.createdBy,
|
3386
|
-
creator: createAction.creator,
|
3387
3305
|
createdAtLocation: createAction.createdAtLocation,
|
3388
3306
|
createdByRole: createAction.createdByRole
|
3389
3307
|
}
|
@@ -3391,11 +3309,11 @@ function getDeclarationActionUpdateMetadata(actions) {
|
|
3391
3309
|
}
|
3392
3310
|
function getLegalStatuses(actions) {
|
3393
3311
|
return {
|
3394
|
-
[EventStatus.
|
3312
|
+
[EventStatus.DECLARED]: getDeclarationActionCreationMetadata(
|
3395
3313
|
ActionType.DECLARE,
|
3396
3314
|
actions
|
3397
3315
|
),
|
3398
|
-
[EventStatus.
|
3316
|
+
[EventStatus.REGISTERED]: getDeclarationActionCreationMetadata(
|
3399
3317
|
ActionType.REGISTER,
|
3400
3318
|
actions
|
3401
3319
|
)
|
@@ -3408,26 +3326,26 @@ function getStatusFromActions(actions) {
|
|
3408
3326
|
(a) => a.status === ActionStatus.Rejected
|
3409
3327
|
);
|
3410
3328
|
if (hasRejectedAction) {
|
3411
|
-
return EventStatus.
|
3329
|
+
return EventStatus.REJECTED;
|
3412
3330
|
}
|
3413
3331
|
return actions.reduce((status, action) => {
|
3414
3332
|
switch (action.type) {
|
3415
3333
|
case ActionType.CREATE:
|
3416
|
-
return EventStatus.
|
3334
|
+
return EventStatus.CREATED;
|
3417
3335
|
case ActionType.DECLARE:
|
3418
|
-
return EventStatus.
|
3336
|
+
return EventStatus.DECLARED;
|
3419
3337
|
case ActionType.VALIDATE:
|
3420
|
-
return EventStatus.
|
3338
|
+
return EventStatus.VALIDATED;
|
3421
3339
|
case ActionType.REGISTER:
|
3422
|
-
return EventStatus.
|
3340
|
+
return EventStatus.REGISTERED;
|
3423
3341
|
case ActionType.REJECT:
|
3424
|
-
return EventStatus.
|
3342
|
+
return EventStatus.REJECTED;
|
3425
3343
|
case ActionType.ARCHIVE:
|
3426
|
-
return EventStatus.
|
3344
|
+
return EventStatus.ARCHIVED;
|
3427
3345
|
case ActionType.NOTIFY:
|
3428
|
-
return EventStatus.
|
3346
|
+
return EventStatus.NOTIFIED;
|
3429
3347
|
case ActionType.PRINT_CERTIFICATE:
|
3430
|
-
return EventStatus.
|
3348
|
+
return EventStatus.CERTIFIED;
|
3431
3349
|
case ActionType.ASSIGN:
|
3432
3350
|
case ActionType.UNASSIGN:
|
3433
3351
|
case ActionType.REQUEST_CORRECTION:
|
@@ -3438,7 +3356,7 @@ function getStatusFromActions(actions) {
|
|
3438
3356
|
default:
|
3439
3357
|
return status;
|
3440
3358
|
}
|
3441
|
-
}, EventStatus.
|
3359
|
+
}, EventStatus.CREATED);
|
3442
3360
|
}
|
3443
3361
|
function getFlagsFromActions(actions) {
|
3444
3362
|
const sortedactions = actions.sort(
|
@@ -3530,7 +3448,7 @@ function deepDropNulls(obj) {
|
|
3530
3448
|
return obj;
|
3531
3449
|
}
|
3532
3450
|
function isUndeclaredDraft(status) {
|
3533
|
-
return status === EventStatus.
|
3451
|
+
return status === EventStatus.CREATED;
|
3534
3452
|
}
|
3535
3453
|
function getAcceptedActions(event2) {
|
3536
3454
|
return event2.actions.filter(
|
@@ -3568,7 +3486,6 @@ function getCurrentEventState(event2, config) {
|
|
3568
3486
|
legalStatuses: getLegalStatuses(event2.actions),
|
3569
3487
|
createdAt: creationAction.createdAt,
|
3570
3488
|
createdBy: creationAction.createdBy,
|
3571
|
-
creator: creationAction.creator,
|
3572
3489
|
createdAtLocation: creationAction.createdAtLocation,
|
3573
3490
|
createdBySignature: creationAction.createdBySignature,
|
3574
3491
|
updatedAt: declarationUpdateMetadata.createdAt,
|
@@ -4357,7 +4274,7 @@ var PRINT_CERTIFICATE_FORM = defineActionForm({
|
|
4357
4274
|
var TENNIS_CLUB_DECLARATION_REVIEW = {
|
4358
4275
|
title: {
|
4359
4276
|
id: "v2.event.tennis-club-membership.action.declare.form.review.title",
|
4360
|
-
defaultMessage: "{applicant.
|
4277
|
+
defaultMessage: "{applicant.firstname, select, __EMPTY__ {Member declaration} other {{applicant.surname, select, __EMPTY__ {Member declaration} other {Member declaration for {applicant.firstname} {applicant.surname}}}}}",
|
4361
4278
|
description: "Title of the review page"
|
4362
4279
|
},
|
4363
4280
|
fields: [
|
@@ -4402,17 +4319,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4402
4319
|
},
|
4403
4320
|
fields: [
|
4404
4321
|
{
|
4405
|
-
id: "applicant.
|
4406
|
-
type: FieldType.
|
4322
|
+
id: "applicant.firstname",
|
4323
|
+
type: FieldType.TEXT,
|
4407
4324
|
required: true,
|
4408
|
-
hideLabel: true,
|
4409
4325
|
conditionals: [],
|
4410
4326
|
label: {
|
4411
|
-
defaultMessage: "Applicant's name",
|
4327
|
+
defaultMessage: "Applicant's first name",
|
4412
4328
|
description: "This is the label for the field",
|
4413
4329
|
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
|
4414
4330
|
}
|
4415
4331
|
},
|
4332
|
+
{
|
4333
|
+
id: "applicant.surname",
|
4334
|
+
type: FieldType.TEXT,
|
4335
|
+
required: true,
|
4336
|
+
conditionals: [],
|
4337
|
+
label: {
|
4338
|
+
defaultMessage: "Applicant's surname",
|
4339
|
+
description: "This is the label for the field",
|
4340
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
|
4341
|
+
}
|
4342
|
+
},
|
4416
4343
|
{
|
4417
4344
|
id: "applicant.email",
|
4418
4345
|
type: "EMAIL",
|
@@ -4546,9 +4473,8 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4546
4473
|
}
|
4547
4474
|
},
|
4548
4475
|
{
|
4549
|
-
id: "recommender.
|
4550
|
-
type: FieldType.
|
4551
|
-
hideLabel: true,
|
4476
|
+
id: "recommender.firstname",
|
4477
|
+
type: FieldType.TEXT,
|
4552
4478
|
required: true,
|
4553
4479
|
conditionals: [
|
4554
4480
|
{
|
@@ -4557,11 +4483,27 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
4557
4483
|
}
|
4558
4484
|
],
|
4559
4485
|
label: {
|
4560
|
-
defaultMessage: "Recommender's name",
|
4486
|
+
defaultMessage: "Recommender's first name",
|
4561
4487
|
description: "This is the label for the field",
|
4562
4488
|
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
4563
4489
|
}
|
4564
4490
|
},
|
4491
|
+
{
|
4492
|
+
id: "recommender.surname",
|
4493
|
+
type: FieldType.TEXT,
|
4494
|
+
required: true,
|
4495
|
+
conditionals: [
|
4496
|
+
{
|
4497
|
+
type: ConditionalType.SHOW,
|
4498
|
+
conditional: field("recommender.none").isFalsy()
|
4499
|
+
}
|
4500
|
+
],
|
4501
|
+
label: {
|
4502
|
+
defaultMessage: "Recommender's surname",
|
4503
|
+
description: "This is the label for the field",
|
4504
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
4505
|
+
}
|
4506
|
+
},
|
4565
4507
|
{
|
4566
4508
|
id: "recommender.id",
|
4567
4509
|
type: FieldType.TEXT,
|
@@ -4592,7 +4534,7 @@ var statusOptions = [
|
|
4592
4534
|
}
|
4593
4535
|
},
|
4594
4536
|
{
|
4595
|
-
value: EventStatus.
|
4537
|
+
value: EventStatus.CREATED,
|
4596
4538
|
label: {
|
4597
4539
|
defaultMessage: "Draft",
|
4598
4540
|
description: "Option for form field: status of record",
|
@@ -4600,7 +4542,7 @@ var statusOptions = [
|
|
4600
4542
|
}
|
4601
4543
|
},
|
4602
4544
|
{
|
4603
|
-
value: EventStatus.
|
4545
|
+
value: EventStatus.NOTIFIED,
|
4604
4546
|
label: {
|
4605
4547
|
defaultMessage: "Notified",
|
4606
4548
|
description: "Option for form field: status of record",
|
@@ -4608,7 +4550,7 @@ var statusOptions = [
|
|
4608
4550
|
}
|
4609
4551
|
},
|
4610
4552
|
{
|
4611
|
-
value: EventStatus.
|
4553
|
+
value: EventStatus.DECLARED,
|
4612
4554
|
label: {
|
4613
4555
|
defaultMessage: "Declared",
|
4614
4556
|
description: "Option for form field: status of record",
|
@@ -4616,7 +4558,7 @@ var statusOptions = [
|
|
4616
4558
|
}
|
4617
4559
|
},
|
4618
4560
|
{
|
4619
|
-
value: EventStatus.
|
4561
|
+
value: EventStatus.VALIDATED,
|
4620
4562
|
label: {
|
4621
4563
|
defaultMessage: "Validated",
|
4622
4564
|
description: "Option for form field: status of record",
|
@@ -4624,7 +4566,7 @@ var statusOptions = [
|
|
4624
4566
|
}
|
4625
4567
|
},
|
4626
4568
|
{
|
4627
|
-
value: EventStatus.
|
4569
|
+
value: EventStatus.REGISTERED,
|
4628
4570
|
label: {
|
4629
4571
|
defaultMessage: "Registered",
|
4630
4572
|
description: "Option for form field: status of record",
|
@@ -4632,7 +4574,7 @@ var statusOptions = [
|
|
4632
4574
|
}
|
4633
4575
|
},
|
4634
4576
|
{
|
4635
|
-
value: EventStatus.
|
4577
|
+
value: EventStatus.CERTIFIED,
|
4636
4578
|
label: {
|
4637
4579
|
defaultMessage: "Certified",
|
4638
4580
|
description: "Option for form field: status of record",
|
@@ -4640,7 +4582,7 @@ var statusOptions = [
|
|
4640
4582
|
}
|
4641
4583
|
},
|
4642
4584
|
{
|
4643
|
-
value: EventStatus.
|
4585
|
+
value: EventStatus.REJECTED,
|
4644
4586
|
label: {
|
4645
4587
|
defaultMessage: "Rejected",
|
4646
4588
|
description: "Option for form field: status of record",
|
@@ -4648,7 +4590,7 @@ var statusOptions = [
|
|
4648
4590
|
}
|
4649
4591
|
},
|
4650
4592
|
{
|
4651
|
-
value: EventStatus.
|
4593
|
+
value: EventStatus.ARCHIVED,
|
4652
4594
|
label: {
|
4653
4595
|
defaultMessage: "Archived",
|
4654
4596
|
description: "Option for form field: status of record",
|
@@ -4712,25 +4654,38 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4712
4654
|
id: "v2.event.tennis-club-membership.label"
|
4713
4655
|
},
|
4714
4656
|
title: {
|
4715
|
-
defaultMessage: "{applicant.
|
4657
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
4716
4658
|
description: "This is the title of the summary",
|
4717
4659
|
id: "v2.event.tennis-club-membership.title"
|
4718
4660
|
},
|
4719
4661
|
summary: {
|
4720
4662
|
fields: [
|
4721
4663
|
{
|
4722
|
-
|
4664
|
+
id: "applicant.firstname",
|
4723
4665
|
label: {
|
4724
|
-
defaultMessage: "Applicant's name",
|
4666
|
+
defaultMessage: "Applicant's first name",
|
4725
4667
|
description: "This is the label for the field",
|
4726
4668
|
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4727
4669
|
},
|
4670
|
+
value: {
|
4671
|
+
defaultMessage: "{applicant.firstname}",
|
4672
|
+
description: "This is the value to show in the summary",
|
4673
|
+
id: "event.tennis-club-membership.summary.field.firstname"
|
4674
|
+
},
|
4728
4675
|
emptyValueMessage: {
|
4729
4676
|
defaultMessage: "First name is not provided",
|
4730
4677
|
description: "This is the message to show when the field is empty",
|
4731
4678
|
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4732
4679
|
}
|
4733
4680
|
},
|
4681
|
+
{
|
4682
|
+
fieldId: "applicant.surname",
|
4683
|
+
label: {
|
4684
|
+
defaultMessage: "Applicant's last name",
|
4685
|
+
description: "Label for surname",
|
4686
|
+
id: "v2.event.tennis-club-membership.summary.field.surname.label"
|
4687
|
+
}
|
4688
|
+
},
|
4734
4689
|
{
|
4735
4690
|
fieldId: "applicant.email"
|
4736
4691
|
}
|
@@ -5066,7 +5021,8 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5066
5021
|
id: "v2.event.tennis-club-membership.search.applicants"
|
5067
5022
|
},
|
5068
5023
|
fields: [
|
5069
|
-
field("applicant.
|
5024
|
+
field("applicant.firstname").fuzzy(),
|
5025
|
+
field("applicant.surname").fuzzy(),
|
5070
5026
|
field("applicant.dob").range(),
|
5071
5027
|
field("applicant.email").exact()
|
5072
5028
|
]
|
@@ -5077,7 +5033,10 @@ var tennisClubMembershipEvent = defineConfig({
|
|
5077
5033
|
description: "Recommender details search field section title",
|
5078
5034
|
id: "v2.event.tennis-club-membership.search.recommender"
|
5079
5035
|
},
|
5080
|
-
fields: [
|
5036
|
+
fields: [
|
5037
|
+
field("recommender.firstname").fuzzy(),
|
5038
|
+
field("recommender.surname").fuzzy()
|
5039
|
+
]
|
5081
5040
|
}
|
5082
5041
|
],
|
5083
5042
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
@@ -5092,21 +5051,21 @@ var footballClubMembershipEvent = defineConfig({
|
|
5092
5051
|
id: "event.football-club-membership.label"
|
5093
5052
|
},
|
5094
5053
|
title: {
|
5095
|
-
defaultMessage: "{applicant.
|
5054
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
5096
5055
|
description: "This is the title of the summary",
|
5097
5056
|
id: "v2.event.football-club-membership.title"
|
5098
5057
|
},
|
5099
5058
|
summary: {
|
5100
5059
|
fields: [
|
5101
5060
|
{
|
5102
|
-
id: "applicant.
|
5061
|
+
id: "applicant.firstname",
|
5103
5062
|
label: {
|
5104
5063
|
defaultMessage: "Applicant's first name",
|
5105
5064
|
description: "This is the label for the field",
|
5106
5065
|
id: "event.football-club-membership.summary.field.firstname.label"
|
5107
5066
|
},
|
5108
5067
|
value: {
|
5109
|
-
defaultMessage: "{applicant.
|
5068
|
+
defaultMessage: "{applicant.firstname}",
|
5110
5069
|
description: "This is the value to show in the summary",
|
5111
5070
|
id: "event.football-club-membership.summary.field.firstname"
|
5112
5071
|
},
|
@@ -5117,7 +5076,7 @@ var footballClubMembershipEvent = defineConfig({
|
|
5117
5076
|
}
|
5118
5077
|
},
|
5119
5078
|
{
|
5120
|
-
fieldId: "applicant.
|
5079
|
+
fieldId: "applicant.surname",
|
5121
5080
|
label: {
|
5122
5081
|
defaultMessage: "Applicant's last name",
|
5123
5082
|
description: "Label for surname",
|
@@ -5459,7 +5418,8 @@ var footballClubMembershipEvent = defineConfig({
|
|
5459
5418
|
id: "v2.event.football-club-membership.search.applicants"
|
5460
5419
|
},
|
5461
5420
|
fields: [
|
5462
|
-
field("applicant.
|
5421
|
+
field("applicant.firstname").fuzzy(),
|
5422
|
+
field("applicant.surname").fuzzy(),
|
5463
5423
|
field("applicant.dob").range(),
|
5464
5424
|
field("applicant.email").exact()
|
5465
5425
|
]
|
@@ -5470,7 +5430,10 @@ var footballClubMembershipEvent = defineConfig({
|
|
5470
5430
|
description: "Recommender details search field section title",
|
5471
5431
|
id: "v2.event.football-club-membership.search.recommender"
|
5472
5432
|
},
|
5473
|
-
fields: [
|
5433
|
+
fields: [
|
5434
|
+
field("recommender.firstname").fuzzy(),
|
5435
|
+
field("recommender.surname").fuzzy()
|
5436
|
+
]
|
5474
5437
|
}
|
5475
5438
|
],
|
5476
5439
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
@@ -5535,253 +5498,33 @@ var libraryMembershipEvent = defineConfig({
|
|
5535
5498
|
declaration: libraryMembershipForm
|
5536
5499
|
});
|
5537
5500
|
|
5538
|
-
// ../commons/src/fixtures/v2-birth-event.ts
|
5539
|
-
var child = defineFormPage({
|
5540
|
-
id: "child",
|
5541
|
-
type: PageTypes.enum.FORM,
|
5542
|
-
title: {
|
5543
|
-
defaultMessage: "Child's details",
|
5544
|
-
description: "Form section title for Child",
|
5545
|
-
id: "v2.form.birth.child.title"
|
5546
|
-
},
|
5547
|
-
fields: [
|
5548
|
-
{
|
5549
|
-
id: "child.firstNames",
|
5550
|
-
type: FieldType.TEXT,
|
5551
|
-
required: true,
|
5552
|
-
configuration: { maxLength: 32 },
|
5553
|
-
hideLabel: true,
|
5554
|
-
label: {
|
5555
|
-
defaultMessage: "Child's first name",
|
5556
|
-
description: "This is the label for the field",
|
5557
|
-
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5558
|
-
}
|
5559
|
-
},
|
5560
|
-
{
|
5561
|
-
id: "child.familyName",
|
5562
|
-
type: FieldType.TEXT,
|
5563
|
-
required: true,
|
5564
|
-
configuration: { maxLength: 32 },
|
5565
|
-
hideLabel: true,
|
5566
|
-
label: {
|
5567
|
-
defaultMessage: "Child's last name",
|
5568
|
-
description: "This is the label for the field",
|
5569
|
-
id: "v2.event.birth.action.declare.form.section.child.field.name.label"
|
5570
|
-
}
|
5571
|
-
},
|
5572
|
-
{
|
5573
|
-
id: "child.DoB",
|
5574
|
-
type: "DATE",
|
5575
|
-
required: true,
|
5576
|
-
label: {
|
5577
|
-
defaultMessage: "Date of birth",
|
5578
|
-
description: "This is the label for the field",
|
5579
|
-
id: "v2.event.birth.action.declare.form.section.child.field.dob.label"
|
5580
|
-
}
|
5581
|
-
}
|
5582
|
-
]
|
5583
|
-
});
|
5584
|
-
var mother = defineFormPage({
|
5585
|
-
id: "mother",
|
5586
|
-
type: PageTypes.enum.FORM,
|
5587
|
-
title: {
|
5588
|
-
defaultMessage: "Mother's details",
|
5589
|
-
description: "Form section title for mothers details",
|
5590
|
-
id: "v2.form.section.mother.title"
|
5591
|
-
},
|
5592
|
-
fields: [
|
5593
|
-
{
|
5594
|
-
id: "mother.firstNames",
|
5595
|
-
configuration: { maxLength: 32 },
|
5596
|
-
type: FieldType.TEXT,
|
5597
|
-
required: true,
|
5598
|
-
label: {
|
5599
|
-
defaultMessage: "First name(s)",
|
5600
|
-
description: "This is the label for the field",
|
5601
|
-
id: `v2.event.birth.action.declare.form.section.person.field.firstname.label`
|
5602
|
-
}
|
5603
|
-
},
|
5604
|
-
{
|
5605
|
-
id: `mother.familyName`,
|
5606
|
-
configuration: { maxLength: 32 },
|
5607
|
-
type: FieldType.TEXT,
|
5608
|
-
required: true,
|
5609
|
-
label: {
|
5610
|
-
defaultMessage: "Last name",
|
5611
|
-
description: "This is the label for the field",
|
5612
|
-
id: `v2.event.birth.action.declare.form.section.person.field.surname.label`
|
5613
|
-
}
|
5614
|
-
},
|
5615
|
-
{
|
5616
|
-
id: `mother.DoB`,
|
5617
|
-
type: "DATE",
|
5618
|
-
required: true,
|
5619
|
-
label: {
|
5620
|
-
defaultMessage: "Date of birth",
|
5621
|
-
description: "This is the label for the field",
|
5622
|
-
id: `v2.event.birth.action.declare.form.section.person.field.dob.label`
|
5623
|
-
}
|
5624
|
-
},
|
5625
|
-
{
|
5626
|
-
id: "mother.identifier",
|
5627
|
-
type: FieldType.ID,
|
5628
|
-
required: true,
|
5629
|
-
label: {
|
5630
|
-
defaultMessage: "ID Number",
|
5631
|
-
description: "This is the label for the field",
|
5632
|
-
id: `v2.event.birth.action.declare.form.section.person.field.nid.label`
|
5633
|
-
}
|
5634
|
-
}
|
5635
|
-
]
|
5636
|
-
});
|
5637
|
-
var BIRTH_DECLARATION_FORM = defineDeclarationForm({
|
5638
|
-
label: {
|
5639
|
-
defaultMessage: "Birth decalration form",
|
5640
|
-
id: "v2.event.birth.action.declare.form.label",
|
5641
|
-
description: "This is what this form is referred as in the system"
|
5642
|
-
},
|
5643
|
-
pages: [child, mother]
|
5644
|
-
});
|
5645
|
-
var v2BirthEvent = defineConfig({
|
5646
|
-
id: BIRTH_EVENT,
|
5647
|
-
title: {
|
5648
|
-
defaultMessage: "{child.name.firstname} {child.name.surname}",
|
5649
|
-
description: "This is the title of the summary",
|
5650
|
-
id: "v2.event.birth.title"
|
5651
|
-
},
|
5652
|
-
label: {
|
5653
|
-
defaultMessage: "Birth",
|
5654
|
-
description: "This is what this event is referred as in the system",
|
5655
|
-
id: "v2.event.birth.label"
|
5656
|
-
},
|
5657
|
-
summary: {
|
5658
|
-
fields: []
|
5659
|
-
},
|
5660
|
-
actions: [],
|
5661
|
-
declaration: BIRTH_DECLARATION_FORM
|
5662
|
-
});
|
5663
|
-
|
5664
5501
|
// ../commons/src/events/test.utils.ts
|
5665
|
-
function
|
5666
|
-
return items[Math.floor(rng() * items.length)];
|
5667
|
-
}
|
5668
|
-
function generateRandomName(rng) {
|
5669
|
-
const firstnames = [
|
5670
|
-
"Danny",
|
5671
|
-
"John",
|
5672
|
-
"Jane",
|
5673
|
-
"Emily",
|
5674
|
-
"Michael",
|
5675
|
-
"Sarah",
|
5676
|
-
"Chris",
|
5677
|
-
"Jessica",
|
5678
|
-
"Sara",
|
5679
|
-
"Sarachella",
|
5680
|
-
"Sarandera",
|
5681
|
-
"Zara"
|
5682
|
-
];
|
5683
|
-
const surnames = [
|
5684
|
-
"Doe",
|
5685
|
-
"Smith",
|
5686
|
-
"Johnson",
|
5687
|
-
"Brown",
|
5688
|
-
"Williams",
|
5689
|
-
"Jones",
|
5690
|
-
"Garcia",
|
5691
|
-
"Miller",
|
5692
|
-
"Saranen",
|
5693
|
-
"Sarajanen",
|
5694
|
-
"Sarthua",
|
5695
|
-
"Tsarakovski",
|
5696
|
-
"Salamander",
|
5697
|
-
"Zarathustra"
|
5698
|
-
];
|
5699
|
-
return {
|
5700
|
-
firstname: pickRandom(rng, firstnames),
|
5701
|
-
surname: pickRandom(rng, surnames)
|
5702
|
-
};
|
5703
|
-
}
|
5704
|
-
function mapFieldTypeToMockValue(field2, i, rng) {
|
5705
|
-
switch (field2.type) {
|
5706
|
-
case FieldType.DIVIDER:
|
5707
|
-
case FieldType.TEXT:
|
5708
|
-
case FieldType.TEXTAREA:
|
5709
|
-
case FieldType.BULLET_LIST:
|
5710
|
-
case FieldType.PAGE_HEADER:
|
5711
|
-
case FieldType.LOCATION:
|
5712
|
-
case FieldType.SELECT:
|
5713
|
-
case FieldType.COUNTRY:
|
5714
|
-
case FieldType.RADIO_GROUP:
|
5715
|
-
case FieldType.PARAGRAPH:
|
5716
|
-
case FieldType.ADMINISTRATIVE_AREA:
|
5717
|
-
case FieldType.FACILITY:
|
5718
|
-
case FieldType.PHONE:
|
5719
|
-
case FieldType.ID:
|
5720
|
-
case FieldType.OFFICE:
|
5721
|
-
return `${field2.id}-${field2.type}-${i}`;
|
5722
|
-
case FieldType.NAME:
|
5723
|
-
return generateRandomName(rng);
|
5724
|
-
case FieldType.NUMBER:
|
5725
|
-
return 19;
|
5726
|
-
case FieldType.EMAIL:
|
5727
|
-
return "test@opencrvs.org";
|
5728
|
-
case FieldType.ADDRESS:
|
5729
|
-
return {
|
5730
|
-
country: "FAR",
|
5731
|
-
addressType: AddressType.DOMESTIC,
|
5732
|
-
province: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
5733
|
-
district: "5ef450bc-712d-48ad-93f3-8da0fa453baa",
|
5734
|
-
urbanOrRural: "URBAN",
|
5735
|
-
town: "Example Town",
|
5736
|
-
residentialArea: "Example Residential Area",
|
5737
|
-
street: "Example Street",
|
5738
|
-
number: "55",
|
5739
|
-
zipCode: "123456"
|
5740
|
-
};
|
5741
|
-
case FieldType.DATE:
|
5742
|
-
return "2021-01-01";
|
5743
|
-
case FieldType.DATE_RANGE:
|
5744
|
-
return ["2021-01-01", "2021-01-02"];
|
5745
|
-
case FieldType.CHECKBOX:
|
5746
|
-
return true;
|
5747
|
-
case FieldType.SIGNATURE:
|
5748
|
-
case FieldType.FILE:
|
5749
|
-
return {
|
5750
|
-
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
5751
|
-
originalFilename: "abcd.png",
|
5752
|
-
type: "image/png"
|
5753
|
-
};
|
5754
|
-
case FieldType.FILE_WITH_OPTIONS:
|
5755
|
-
case FieldType.DATA:
|
5756
|
-
return void 0;
|
5757
|
-
}
|
5758
|
-
}
|
5759
|
-
function fieldConfigsToActionPayload(fields, rng) {
|
5502
|
+
function fieldConfigsToActionPayload(fields) {
|
5760
5503
|
return fields.reduce(
|
5761
5504
|
(acc, field2, i) => ({
|
5762
5505
|
...acc,
|
5763
|
-
[field2.id]: mapFieldTypeToMockValue(field2, i
|
5506
|
+
[field2.id]: mapFieldTypeToMockValue(field2, i)
|
5764
5507
|
}),
|
5765
5508
|
{}
|
5766
5509
|
);
|
5767
5510
|
}
|
5768
|
-
function generateActionDeclarationInput(configuration, action
|
5511
|
+
function generateActionDeclarationInput(configuration, action) {
|
5769
5512
|
const parsed = DeclarationUpdateActions.safeParse(action);
|
5770
5513
|
if (parsed.success) {
|
5771
5514
|
const fields = getDeclarationFields(configuration);
|
5772
5515
|
const declarationConfig = getDeclaration(configuration);
|
5773
|
-
const declaration = fieldConfigsToActionPayload(fields
|
5516
|
+
const declaration = fieldConfigsToActionPayload(fields);
|
5774
5517
|
return omitHiddenPaginatedFields(declarationConfig, declaration);
|
5775
5518
|
}
|
5776
5519
|
console.warn(`${action} is not a declaration action. Setting data as {}.`);
|
5777
5520
|
return {};
|
5778
5521
|
}
|
5779
|
-
function generateActionAnnotationInput(configuration, action
|
5522
|
+
function generateActionAnnotationInput(configuration, action) {
|
5780
5523
|
const actionConfig = configuration.actions.find(
|
5781
5524
|
(ac) => ac.type === action
|
5782
5525
|
);
|
5783
5526
|
const annotationFields = actionConfig ? getActionAnnotationFields(actionConfig) : [];
|
5784
|
-
const annotation = fieldConfigsToActionPayload(annotationFields
|
5527
|
+
const annotation = fieldConfigsToActionPayload(annotationFields);
|
5785
5528
|
const visibleVerificationPageIds = getVisibleVerificationPageIds(
|
5786
5529
|
findRecordActionPages(configuration, action),
|
5787
5530
|
annotation
|
@@ -5799,227 +5542,198 @@ function generateActionAnnotationInput(configuration, action, rng) {
|
|
5799
5542
|
...visiblePageVerificationMap
|
5800
5543
|
};
|
5801
5544
|
}
|
5802
|
-
|
5803
|
-
|
5804
|
-
|
5545
|
+
var eventPayloadGenerator = {
|
5546
|
+
create: (input = {}) => ({
|
5547
|
+
transactionId: input.transactionId ?? getUUID(),
|
5548
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
5549
|
+
}),
|
5550
|
+
patch: (id, input = {}) => ({
|
5551
|
+
transactionId: input.transactionId ?? getUUID(),
|
5552
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5553
|
+
id
|
5554
|
+
}),
|
5555
|
+
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
5556
|
+
{
|
5557
|
+
id: getUUID(),
|
5558
|
+
eventId,
|
5559
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5560
|
+
transactionId: getUUID(),
|
5561
|
+
action: {
|
5562
|
+
transactionId: getUUID(),
|
5563
|
+
type: actionType,
|
5564
|
+
status: ActionStatus.Accepted,
|
5565
|
+
declaration: {
|
5566
|
+
"applicant.firstname": "Max",
|
5567
|
+
"applicant.surname": "McLaren",
|
5568
|
+
"applicant.dob": "2020-01-02",
|
5569
|
+
"recommender.none": true
|
5570
|
+
},
|
5571
|
+
annotation: {
|
5572
|
+
"correction.requester.relationship": "ANOTHER_AGENT",
|
5573
|
+
"correction.request.reason": "Child's name was incorrect"
|
5574
|
+
},
|
5575
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
5576
|
+
createdBy: "@todo",
|
5577
|
+
createdByRole: "@todo",
|
5578
|
+
createdAtLocation: "@todo"
|
5579
|
+
}
|
5580
|
+
},
|
5581
|
+
input
|
5582
|
+
),
|
5583
|
+
actions: {
|
5584
|
+
declare: (eventId, input = {}) => ({
|
5585
|
+
type: ActionType.DECLARE,
|
5805
5586
|
transactionId: input.transactionId ?? getUUID(),
|
5806
|
-
|
5587
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5588
|
+
tennisClubMembershipEvent,
|
5589
|
+
ActionType.DECLARE
|
5590
|
+
),
|
5591
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5592
|
+
tennisClubMembershipEvent,
|
5593
|
+
ActionType.DECLARE
|
5594
|
+
),
|
5595
|
+
eventId
|
5807
5596
|
}),
|
5808
|
-
|
5597
|
+
/**
|
5598
|
+
* Notify allows sending incomplete data. Think it as 'partial declare' for now.
|
5599
|
+
*/
|
5600
|
+
notify: (eventId, input = {}) => {
|
5601
|
+
let declaration = input.declaration;
|
5602
|
+
if (!declaration) {
|
5603
|
+
const partialDeclaration = (0, import_lodash2.omitBy)(
|
5604
|
+
generateActionDeclarationInput(
|
5605
|
+
tennisClubMembershipEvent,
|
5606
|
+
ActionType.DECLARE
|
5607
|
+
),
|
5608
|
+
import_lodash2.isString
|
5609
|
+
);
|
5610
|
+
declaration = partialDeclaration;
|
5611
|
+
}
|
5612
|
+
return {
|
5613
|
+
type: ActionType.NOTIFY,
|
5614
|
+
transactionId: input.transactionId ?? getUUID(),
|
5615
|
+
declaration,
|
5616
|
+
eventId
|
5617
|
+
};
|
5618
|
+
},
|
5619
|
+
validate: (eventId, input = {}) => ({
|
5620
|
+
type: ActionType.VALIDATE,
|
5809
5621
|
transactionId: input.transactionId ?? getUUID(),
|
5810
|
-
|
5811
|
-
|
5622
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5623
|
+
tennisClubMembershipEvent,
|
5624
|
+
ActionType.VALIDATE
|
5625
|
+
),
|
5626
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5627
|
+
tennisClubMembershipEvent,
|
5628
|
+
ActionType.VALIDATE
|
5629
|
+
),
|
5630
|
+
duplicates: [],
|
5631
|
+
eventId
|
5812
5632
|
}),
|
5813
|
-
|
5814
|
-
|
5815
|
-
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5820
|
-
|
5821
|
-
|
5822
|
-
|
5823
|
-
|
5824
|
-
|
5825
|
-
|
5826
|
-
|
5827
|
-
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5831
|
-
|
5832
|
-
|
5833
|
-
|
5834
|
-
|
5835
|
-
|
5836
|
-
|
5837
|
-
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
input
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
5850
|
-
|
5851
|
-
|
5852
|
-
|
5853
|
-
|
5854
|
-
|
5855
|
-
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5860
|
-
|
5861
|
-
|
5862
|
-
|
5863
|
-
|
5864
|
-
|
5865
|
-
|
5866
|
-
|
5867
|
-
|
5868
|
-
|
5869
|
-
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
|
5874
|
-
|
5875
|
-
|
5876
|
-
|
5877
|
-
|
5878
|
-
type: ActionType.NOTIFY,
|
5879
|
-
transactionId: input.transactionId ?? getUUID(),
|
5880
|
-
declaration,
|
5881
|
-
eventId,
|
5882
|
-
keepAssignment: input.keepAssignment
|
5883
|
-
};
|
5884
|
-
},
|
5885
|
-
validate: (eventId, input = {}) => ({
|
5886
|
-
type: ActionType.VALIDATE,
|
5633
|
+
assign: (eventId, input = {}) => ({
|
5634
|
+
type: ActionType.ASSIGN,
|
5635
|
+
transactionId: input.transactionId ?? getUUID(),
|
5636
|
+
declaration: {},
|
5637
|
+
assignedTo: input.assignedTo ?? getUUID(),
|
5638
|
+
eventId
|
5639
|
+
}),
|
5640
|
+
unassign: (eventId, input = {}) => ({
|
5641
|
+
type: ActionType.UNASSIGN,
|
5642
|
+
transactionId: input.transactionId ?? getUUID(),
|
5643
|
+
declaration: {},
|
5644
|
+
assignedTo: null,
|
5645
|
+
eventId
|
5646
|
+
}),
|
5647
|
+
archive: (eventId, input = {}, isDuplicate) => ({
|
5648
|
+
type: ActionType.ARCHIVE,
|
5649
|
+
transactionId: input.transactionId ?? getUUID(),
|
5650
|
+
declaration: {},
|
5651
|
+
// @TODO: Check whether generator is needed?
|
5652
|
+
annotation: {},
|
5653
|
+
duplicates: [],
|
5654
|
+
eventId,
|
5655
|
+
reason: {
|
5656
|
+
message: `${ActionType.ARCHIVE}`,
|
5657
|
+
isDuplicate: isDuplicate ?? false
|
5658
|
+
}
|
5659
|
+
}),
|
5660
|
+
reject: (eventId, input = {}) => ({
|
5661
|
+
type: ActionType.REJECT,
|
5662
|
+
transactionId: input.transactionId ?? getUUID(),
|
5663
|
+
declaration: {},
|
5664
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5665
|
+
tennisClubMembershipEvent,
|
5666
|
+
ActionType.REJECT
|
5667
|
+
),
|
5668
|
+
duplicates: [],
|
5669
|
+
eventId,
|
5670
|
+
reason: { message: `${ActionType.REJECT}` }
|
5671
|
+
}),
|
5672
|
+
register: (eventId, input = {}) => ({
|
5673
|
+
type: ActionType.REGISTER,
|
5674
|
+
transactionId: input.transactionId ?? getUUID(),
|
5675
|
+
declaration: input.declaration ?? generateActionDeclarationInput(
|
5676
|
+
tennisClubMembershipEvent,
|
5677
|
+
ActionType.REGISTER
|
5678
|
+
),
|
5679
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5680
|
+
tennisClubMembershipEvent,
|
5681
|
+
ActionType.REGISTER
|
5682
|
+
),
|
5683
|
+
eventId
|
5684
|
+
}),
|
5685
|
+
printCertificate: (eventId, input = {}) => ({
|
5686
|
+
type: ActionType.PRINT_CERTIFICATE,
|
5687
|
+
transactionId: input.transactionId ?? getUUID(),
|
5688
|
+
declaration: {},
|
5689
|
+
annotation: input.annotation ?? generateActionAnnotationInput(
|
5690
|
+
tennisClubMembershipEvent,
|
5691
|
+
ActionType.PRINT_CERTIFICATE
|
5692
|
+
),
|
5693
|
+
eventId
|
5694
|
+
}),
|
5695
|
+
correction: {
|
5696
|
+
request: (eventId, input = {}) => ({
|
5697
|
+
type: ActionType.REQUEST_CORRECTION,
|
5887
5698
|
transactionId: input.transactionId ?? getUUID(),
|
5888
5699
|
declaration: input.declaration ?? generateActionDeclarationInput(
|
5889
5700
|
tennisClubMembershipEvent,
|
5890
|
-
ActionType.
|
5891
|
-
rng
|
5701
|
+
ActionType.REQUEST_CORRECTION
|
5892
5702
|
),
|
5893
5703
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5894
5704
|
tennisClubMembershipEvent,
|
5895
|
-
ActionType.
|
5896
|
-
rng
|
5705
|
+
ActionType.REQUEST_CORRECTION
|
5897
5706
|
),
|
5898
|
-
duplicates: [],
|
5899
|
-
eventId,
|
5900
|
-
...input
|
5901
|
-
}),
|
5902
|
-
assign: (eventId, input = {}) => ({
|
5903
|
-
type: ActionType.ASSIGN,
|
5904
|
-
transactionId: input.transactionId ?? getUUID(),
|
5905
|
-
declaration: {},
|
5906
|
-
assignedTo: input.assignedTo ?? getUUID(),
|
5907
|
-
eventId
|
5908
|
-
}),
|
5909
|
-
unassign: (eventId, input = {}) => ({
|
5910
|
-
type: ActionType.UNASSIGN,
|
5911
|
-
transactionId: input.transactionId ?? getUUID(),
|
5912
|
-
declaration: {},
|
5913
|
-
assignedTo: null,
|
5914
5707
|
eventId
|
5915
5708
|
}),
|
5916
|
-
|
5917
|
-
type: ActionType.
|
5918
|
-
transactionId: input.transactionId ?? getUUID(),
|
5919
|
-
declaration: {},
|
5920
|
-
// @TODO: Check whether generator is needed?
|
5921
|
-
annotation: {},
|
5922
|
-
duplicates: [],
|
5923
|
-
eventId,
|
5924
|
-
reason: {
|
5925
|
-
message: `${ActionType.ARCHIVE}`,
|
5926
|
-
isDuplicate: isDuplicate ?? false
|
5927
|
-
},
|
5928
|
-
...input
|
5929
|
-
}),
|
5930
|
-
reject: (eventId, input = {}) => ({
|
5931
|
-
type: ActionType.REJECT,
|
5709
|
+
approve: (eventId, requestId, input = {}) => ({
|
5710
|
+
type: ActionType.APPROVE_CORRECTION,
|
5932
5711
|
transactionId: input.transactionId ?? getUUID(),
|
5933
5712
|
declaration: {},
|
5934
5713
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5935
5714
|
tennisClubMembershipEvent,
|
5936
|
-
ActionType.
|
5937
|
-
rng
|
5715
|
+
ActionType.APPROVE_CORRECTION
|
5938
5716
|
),
|
5939
|
-
duplicates: [],
|
5940
5717
|
eventId,
|
5941
|
-
|
5942
|
-
...input
|
5718
|
+
requestId
|
5943
5719
|
}),
|
5944
|
-
|
5945
|
-
type: ActionType.
|
5946
|
-
transactionId: input.transactionId ?? getUUID(),
|
5947
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
5948
|
-
tennisClubMembershipEvent,
|
5949
|
-
ActionType.REGISTER,
|
5950
|
-
rng
|
5951
|
-
),
|
5952
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5953
|
-
tennisClubMembershipEvent,
|
5954
|
-
ActionType.REGISTER,
|
5955
|
-
rng
|
5956
|
-
),
|
5957
|
-
eventId,
|
5958
|
-
...input
|
5959
|
-
}),
|
5960
|
-
printCertificate: (eventId, input = {}) => ({
|
5961
|
-
type: ActionType.PRINT_CERTIFICATE,
|
5720
|
+
reject: (eventId, requestId, input = {}) => ({
|
5721
|
+
type: ActionType.REJECT_CORRECTION,
|
5962
5722
|
transactionId: input.transactionId ?? getUUID(),
|
5963
5723
|
declaration: {},
|
5964
5724
|
annotation: input.annotation ?? generateActionAnnotationInput(
|
5965
5725
|
tennisClubMembershipEvent,
|
5966
|
-
ActionType.
|
5967
|
-
rng
|
5726
|
+
ActionType.REJECT_CORRECTION
|
5968
5727
|
),
|
5969
5728
|
eventId,
|
5970
|
-
|
5971
|
-
})
|
5972
|
-
correction: {
|
5973
|
-
request: (eventId, input = {}) => ({
|
5974
|
-
type: ActionType.REQUEST_CORRECTION,
|
5975
|
-
transactionId: input.transactionId ?? getUUID(),
|
5976
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
5977
|
-
tennisClubMembershipEvent,
|
5978
|
-
ActionType.REQUEST_CORRECTION,
|
5979
|
-
rng
|
5980
|
-
),
|
5981
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5982
|
-
tennisClubMembershipEvent,
|
5983
|
-
ActionType.REQUEST_CORRECTION,
|
5984
|
-
rng
|
5985
|
-
),
|
5986
|
-
eventId,
|
5987
|
-
keepAssignment: input.keepAssignment
|
5988
|
-
}),
|
5989
|
-
approve: (eventId, requestId, input = {}) => ({
|
5990
|
-
type: ActionType.APPROVE_CORRECTION,
|
5991
|
-
transactionId: input.transactionId ?? getUUID(),
|
5992
|
-
declaration: {},
|
5993
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
5994
|
-
tennisClubMembershipEvent,
|
5995
|
-
ActionType.APPROVE_CORRECTION,
|
5996
|
-
rng
|
5997
|
-
),
|
5998
|
-
eventId,
|
5999
|
-
requestId,
|
6000
|
-
keepAssignment: input.keepAssignment
|
6001
|
-
}),
|
6002
|
-
reject: (eventId, requestId, input = {}) => ({
|
6003
|
-
type: ActionType.REJECT_CORRECTION,
|
6004
|
-
transactionId: input.transactionId ?? getUUID(),
|
6005
|
-
declaration: {},
|
6006
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
6007
|
-
tennisClubMembershipEvent,
|
6008
|
-
ActionType.REJECT_CORRECTION,
|
6009
|
-
rng
|
6010
|
-
),
|
6011
|
-
eventId,
|
6012
|
-
requestId,
|
6013
|
-
keepAssignment: input.keepAssignment
|
6014
|
-
})
|
6015
|
-
}
|
5729
|
+
requestId
|
5730
|
+
})
|
6016
5731
|
}
|
6017
|
-
}
|
6018
|
-
}
|
5732
|
+
}
|
5733
|
+
};
|
6019
5734
|
function generateActionDocument({
|
6020
5735
|
configuration,
|
6021
5736
|
action,
|
6022
|
-
rng = () => 0.1,
|
6023
5737
|
defaults = {}
|
6024
5738
|
}) {
|
6025
5739
|
const actionBase = {
|
@@ -6027,11 +5741,10 @@ function generateActionDocument({
|
|
6027
5741
|
// @TODO: This should be fixed in the future.
|
6028
5742
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
6029
5743
|
createdBy: getUUID(),
|
6030
|
-
creator: "user",
|
6031
5744
|
createdByRole: "FIELD_AGENT",
|
6032
5745
|
id: getUUID(),
|
6033
5746
|
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c",
|
6034
|
-
declaration: generateActionDeclarationInput(configuration, action
|
5747
|
+
declaration: generateActionDeclarationInput(configuration, action),
|
6035
5748
|
annotation: {},
|
6036
5749
|
status: ActionStatus.Accepted,
|
6037
5750
|
transactionId: getUUID(),
|
@@ -6083,14 +5796,13 @@ function generateActionDocument({
|
|
6083
5796
|
}
|
6084
5797
|
function generateEventDocument({
|
6085
5798
|
configuration,
|
6086
|
-
actions
|
6087
|
-
rng = () => 0.1
|
5799
|
+
actions
|
6088
5800
|
}) {
|
6089
5801
|
return {
|
6090
5802
|
trackingId: getUUID(),
|
6091
5803
|
type: configuration.id,
|
6092
5804
|
actions: actions.map(
|
6093
|
-
(action) => generateActionDocument({ configuration, action
|
5805
|
+
(action) => generateActionDocument({ configuration, action })
|
6094
5806
|
),
|
6095
5807
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
6096
5808
|
// @TODO: This should be fixed in the future.
|
@@ -6101,16 +5813,10 @@ function generateEventDocument({
|
|
6101
5813
|
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
6102
5814
|
};
|
6103
5815
|
}
|
6104
|
-
function generateEventDraftDocument({
|
6105
|
-
eventId,
|
6106
|
-
actionType,
|
6107
|
-
rng = () => 0.1,
|
6108
|
-
declaration = {}
|
6109
|
-
}) {
|
5816
|
+
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
6110
5817
|
const action = generateActionDocument({
|
6111
5818
|
configuration: tennisClubMembershipEvent,
|
6112
|
-
action: actionType
|
6113
|
-
rng
|
5819
|
+
action: actionType
|
6114
5820
|
});
|
6115
5821
|
return {
|
6116
5822
|
id: getUUID(),
|
@@ -6126,29 +5832,51 @@ function generateEventDraftDocument({
|
|
6126
5832
|
eventId
|
6127
5833
|
};
|
6128
5834
|
}
|
5835
|
+
function pickRandom(rng, items) {
|
5836
|
+
return items[Math.floor(rng() * items.length)];
|
5837
|
+
}
|
6129
5838
|
function getRandomDatetime(rng, start, end) {
|
6130
5839
|
const range = end.getTime() - start.getTime();
|
6131
5840
|
const offset = Math.floor(rng() * range);
|
6132
5841
|
const randomDate = new Date(start.getTime() + offset);
|
6133
5842
|
return randomDate.toISOString();
|
6134
5843
|
}
|
6135
|
-
function getRandomDate(rng, start, end) {
|
6136
|
-
const datetime = getRandomDatetime(rng, new Date(start), new Date(end));
|
6137
|
-
return datetime.split("T")[0];
|
6138
|
-
}
|
6139
5844
|
function generateRandomApplicant(rng) {
|
6140
|
-
const
|
6141
|
-
|
5845
|
+
const firstNames = [
|
5846
|
+
"Danny",
|
5847
|
+
"John",
|
5848
|
+
"Jane",
|
5849
|
+
"Emily",
|
5850
|
+
"Michael",
|
5851
|
+
"Sarah",
|
5852
|
+
"Chris",
|
5853
|
+
"Jessica"
|
5854
|
+
];
|
5855
|
+
const surnames = [
|
5856
|
+
"Doe",
|
5857
|
+
"Smith",
|
5858
|
+
"Johnson",
|
5859
|
+
"Brown",
|
5860
|
+
"Williams",
|
5861
|
+
"Jones",
|
5862
|
+
"Garcia",
|
5863
|
+
"Miller"
|
5864
|
+
];
|
5865
|
+
const randomFirstName = pickRandom(rng, firstNames);
|
5866
|
+
const randomSurname = pickRandom(rng, surnames);
|
5867
|
+
const randomDob = getRandomDatetime(
|
5868
|
+
rng,
|
5869
|
+
/* @__PURE__ */ new Date("1990-01-01"),
|
5870
|
+
/* @__PURE__ */ new Date("2010-12-31")
|
5871
|
+
).split("T")[0];
|
6142
5872
|
return {
|
6143
5873
|
"recommender.none": true,
|
6144
|
-
"applicant.
|
6145
|
-
|
6146
|
-
surname
|
6147
|
-
},
|
5874
|
+
"applicant.firstname": randomFirstName,
|
5875
|
+
"applicant.surname": randomSurname,
|
6148
5876
|
"applicant.dob": randomDob
|
6149
5877
|
};
|
6150
5878
|
}
|
6151
|
-
function
|
5879
|
+
function createPseudoRandomNumberGenerator(seed) {
|
6152
5880
|
const MODULUS = 2 ** 32;
|
6153
5881
|
const MULTIPLIER = 1664525;
|
6154
5882
|
const INCREMENT = 1013904223;
|
@@ -6174,7 +5902,7 @@ function generateRandomSignature(rng) {
|
|
6174
5902
|
return `/random-bucket/${generateUuid(rng)}.png`;
|
6175
5903
|
}
|
6176
5904
|
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
6177
|
-
const rng =
|
5905
|
+
const rng = createPseudoRandomNumberGenerator(seed);
|
6178
5906
|
const createdAt = getRandomDatetime(
|
6179
5907
|
rng,
|
6180
5908
|
/* @__PURE__ */ new Date("2024-01-01"),
|
@@ -6183,9 +5911,8 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
6183
5911
|
return {
|
6184
5912
|
id: overrides.id ?? generateUuid(rng),
|
6185
5913
|
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
6186
|
-
status: overrides.status ?? pickRandom(rng,
|
5914
|
+
status: overrides.status ?? pickRandom(rng, eventStatuses),
|
6187
5915
|
createdAt: overrides.createdAt ?? createdAt,
|
6188
|
-
creator: overrides.creator ?? "user",
|
6189
5916
|
createdBy: overrides.createdBy ?? generateUuid(rng),
|
6190
5917
|
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
6191
5918
|
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
@@ -6238,9 +5965,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
6238
5965
|
if (isTemplateVariable(value)) {
|
6239
5966
|
return false;
|
6240
5967
|
}
|
6241
|
-
if (typeof value === "object" &&
|
6242
|
-
//@ts-ignore
|
6243
|
-
Object.values(value).some((val) => isTemplateVariable(val))) {
|
5968
|
+
if (typeof value === "object" && Object.values(value).some((val) => isTemplateVariable(val))) {
|
6244
5969
|
return false;
|
6245
5970
|
}
|
6246
5971
|
return true;
|
@@ -6610,7 +6335,6 @@ function deserializeQueryExpression(expression, user2) {
|
|
6610
6335
|
...expression.assignedTo,
|
6611
6336
|
term: userDeserializer(expression.assignedTo.term, user2)
|
6612
6337
|
},
|
6613
|
-
creator: expression.creator,
|
6614
6338
|
createdBy: expression.createdBy && {
|
6615
6339
|
...expression.createdBy,
|
6616
6340
|
term: userDeserializer(expression.createdBy.term, user2)
|
@@ -6646,8 +6370,6 @@ function deserializeQuery(query, user2) {
|
|
6646
6370
|
...query,
|
6647
6371
|
clauses: query.clauses.map(
|
6648
6372
|
(clause) => deserializeQueryExpression(clause, user2)
|
6649
|
-
// SAFETY: This cast should be safe because `query.clauses` has already been validated as non-empty by the Zod schema.
|
6650
|
-
// Without the cast, TypeScript cannot infer the tuple type required by the target interface.
|
6651
6373
|
)
|
6652
6374
|
};
|
6653
6375
|
}
|