@opencrvs/toolkit 1.9.2-rc.ebb7011 → 1.9.2-rc.f0b9560
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 +537 -605
- package/dist/commons/events/ActionConfig.d.ts +52 -336
- package/dist/commons/events/ActionDocument.d.ts +163 -130
- package/dist/commons/events/ActionInput.d.ts +93 -87
- package/dist/commons/events/ActionType.d.ts +7 -7
- package/dist/commons/events/AdvancedSearchConfig.d.ts +8 -7
- package/dist/commons/events/CompositeFieldValue.d.ts +0 -2
- package/dist/commons/events/CountryConfigQueryInput.d.ts +12 -0
- package/dist/commons/events/Draft.d.ts +6 -6
- package/dist/commons/events/EventConfig.d.ts +44 -191
- package/dist/commons/events/EventDocument.d.ts +59 -56
- package/dist/commons/events/EventIndex.d.ts +7 -1
- package/dist/commons/events/EventMetadata.d.ts +4 -1
- package/dist/commons/events/FieldConfig.d.ts +14 -22
- package/dist/commons/events/FieldType.d.ts +3 -3
- package/dist/commons/events/FieldTypeMapping.d.ts +8 -8
- package/dist/commons/events/FieldValue.d.ts +6 -5
- package/dist/commons/events/Flag.d.ts +21 -0
- package/dist/commons/events/FormConfig.d.ts +18 -42
- package/dist/commons/events/PageConfig.d.ts +12 -28
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +5 -2
- package/dist/commons/events/WorkqueueConfig.d.ts +26 -11
- package/dist/commons/events/defineConfig.d.ts +101 -200
- package/dist/commons/events/scopes.d.ts +4 -4
- package/dist/commons/events/state/index.d.ts +7 -1
- package/dist/commons/events/state/utils.d.ts +49 -46
- package/dist/commons/events/test.utils.d.ts +14 -11
- package/dist/commons/events/utils.d.ts +441 -495
- package/dist/events/index.js +206 -152
- package/dist/notification/index.js +82 -112
- package/dist/scopes/index.d.ts +46 -7
- package/dist/scopes/index.js +11 -1
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
|
@@ -75,9 +75,9 @@ __export(events_exports, {
|
|
|
75
75
|
ConfirmableActions: () => ConfirmableActions,
|
|
76
76
|
ContainsFlags: () => ContainsFlags,
|
|
77
77
|
CustomActionInput: () => CustomActionInput,
|
|
78
|
-
CustomFieldValue: () => CustomFieldValue,
|
|
79
78
|
CustomFlag: () => CustomFlag,
|
|
80
79
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
|
80
|
+
DEFAULT_PLACE_OF_EVENT_PROPERTY: () => DEFAULT_PLACE_OF_EVENT_PROPERTY,
|
|
81
81
|
DataEntry: () => DataEntry,
|
|
82
82
|
DataFieldValue: () => DataFieldValue,
|
|
83
83
|
DateCondition: () => DateCondition,
|
|
@@ -100,6 +100,7 @@ __export(events_exports, {
|
|
|
100
100
|
DraftInput: () => DraftInput,
|
|
101
101
|
DuplicateDetectedAction: () => DuplicateDetectedAction,
|
|
102
102
|
DuplicateDetectedActionInput: () => DuplicateDetectedActionInput,
|
|
103
|
+
EditActionInput: () => EditActionInput,
|
|
103
104
|
EmailField: () => EmailField,
|
|
104
105
|
EmailValue: () => EmailValue,
|
|
105
106
|
EnableConditional: () => EnableConditional,
|
|
@@ -138,6 +139,7 @@ __export(events_exports, {
|
|
|
138
139
|
FormPageConfig: () => FormPageConfig,
|
|
139
140
|
Fuzzy: () => Fuzzy,
|
|
140
141
|
GeographicalArea: () => GeographicalArea,
|
|
142
|
+
HiddenFieldValue: () => HiddenFieldValue,
|
|
141
143
|
HttpFieldUpdateValue: () => HttpFieldUpdateValue,
|
|
142
144
|
HttpFieldValue: () => HttpFieldValue,
|
|
143
145
|
IdReaderFieldValue: () => IdReaderFieldValue,
|
|
@@ -198,7 +200,6 @@ __export(events_exports, {
|
|
|
198
200
|
TranslationConfig: () => TranslationConfig,
|
|
199
201
|
UUID: () => UUID,
|
|
200
202
|
UnassignActionInput: () => UnassignActionInput,
|
|
201
|
-
ValidateActionInput: () => ValidateActionInput,
|
|
202
203
|
ValidationConfig: () => ValidationConfig,
|
|
203
204
|
VerificationActionConfig: () => VerificationActionConfig,
|
|
204
205
|
VerificationPageConfig: () => VerificationPageConfig,
|
|
@@ -318,7 +319,6 @@ __export(events_exports, {
|
|
|
318
319
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
|
319
320
|
isConditionMet: () => isConditionMet,
|
|
320
321
|
isCountryFieldType: () => isCountryFieldType,
|
|
321
|
-
isCustomFieldType: () => isCustomFieldType,
|
|
322
322
|
isDataFieldType: () => isDataFieldType,
|
|
323
323
|
isDateFieldType: () => isDateFieldType,
|
|
324
324
|
isDateRangeFieldType: () => isDateRangeFieldType,
|
|
@@ -334,6 +334,7 @@ __export(events_exports, {
|
|
|
334
334
|
isFieldVisible: () => isFieldVisible,
|
|
335
335
|
isFileFieldType: () => isFileFieldType,
|
|
336
336
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
|
337
|
+
isHiddenFieldType: () => isHiddenFieldType,
|
|
337
338
|
isHttpFieldType: () => isHttpFieldType,
|
|
338
339
|
isIdFieldType: () => isIdFieldType,
|
|
339
340
|
isIdReaderFieldType: () => isIdReaderFieldType,
|
|
@@ -378,6 +379,7 @@ __export(events_exports, {
|
|
|
378
379
|
or: () => or,
|
|
379
380
|
pickRandom: () => pickRandom,
|
|
380
381
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
382
|
+
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
381
383
|
runFieldValidations: () => runFieldValidations,
|
|
382
384
|
runStructuralValidations: () => runStructuralValidations,
|
|
383
385
|
safeUnion: () => safeUnion,
|
|
@@ -424,8 +426,8 @@ var ActionType = {
|
|
|
424
426
|
NOTIFY: "NOTIFY",
|
|
425
427
|
// Declaration actions
|
|
426
428
|
DECLARE: "DECLARE",
|
|
427
|
-
VALIDATE: "VALIDATE",
|
|
428
429
|
REGISTER: "REGISTER",
|
|
430
|
+
EDIT: "EDIT",
|
|
429
431
|
// Declaration system actions. Non-configurable.
|
|
430
432
|
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
431
433
|
REJECT: "REJECT",
|
|
@@ -448,7 +450,7 @@ var ActionType = {
|
|
|
448
450
|
var ConfirmableActions = [
|
|
449
451
|
ActionType.NOTIFY,
|
|
450
452
|
ActionType.DECLARE,
|
|
451
|
-
ActionType.
|
|
453
|
+
ActionType.EDIT,
|
|
452
454
|
ActionType.REGISTER,
|
|
453
455
|
ActionType.REJECT,
|
|
454
456
|
ActionType.ARCHIVE,
|
|
@@ -463,7 +465,7 @@ var ActionTypes = z2.enum([
|
|
|
463
465
|
"CREATE",
|
|
464
466
|
"NOTIFY",
|
|
465
467
|
"DECLARE",
|
|
466
|
-
"
|
|
468
|
+
"EDIT",
|
|
467
469
|
"REGISTER",
|
|
468
470
|
"DUPLICATE_DETECTED",
|
|
469
471
|
"REJECT",
|
|
@@ -484,7 +486,7 @@ var ClientSpecificAction = {
|
|
|
484
486
|
};
|
|
485
487
|
var declarationActionValues = [
|
|
486
488
|
ActionTypes.enum.DECLARE,
|
|
487
|
-
ActionTypes.enum.
|
|
489
|
+
ActionTypes.enum.EDIT,
|
|
488
490
|
ActionTypes.enum.REGISTER,
|
|
489
491
|
ActionTypes.enum.NOTIFY,
|
|
490
492
|
ActionTypes.enum.DUPLICATE_DETECTED
|
|
@@ -617,7 +619,7 @@ var FieldType = {
|
|
|
617
619
|
QR_READER: "QR_READER",
|
|
618
620
|
ID_READER: "ID_READER",
|
|
619
621
|
LOADER: "LOADER",
|
|
620
|
-
|
|
622
|
+
ALPHA_HIDDEN: "ALPHA_HIDDEN"
|
|
621
623
|
};
|
|
622
624
|
var FileFieldType = z4.enum([
|
|
623
625
|
FieldType.FILE,
|
|
@@ -642,7 +644,8 @@ var FieldTypesToHideInReview = [
|
|
|
642
644
|
FieldType.LOADER,
|
|
643
645
|
FieldType.HTTP,
|
|
644
646
|
FieldType.QUERY_PARAM_READER,
|
|
645
|
-
FieldType.DATA
|
|
647
|
+
FieldType.DATA,
|
|
648
|
+
FieldType.ALPHA_HIDDEN
|
|
646
649
|
];
|
|
647
650
|
|
|
648
651
|
// ../commons/src/events/FieldValue.ts
|
|
@@ -748,10 +751,10 @@ var ReadDataValue = z6.object({
|
|
|
748
751
|
});
|
|
749
752
|
var QrReaderFieldValue = ReadDataValue;
|
|
750
753
|
var IdReaderFieldValue = ReadDataValue;
|
|
751
|
-
var CustomFieldValue = z6.unknown();
|
|
752
754
|
|
|
753
755
|
// ../commons/src/events/FieldValue.ts
|
|
754
756
|
var TextValue = z7.string();
|
|
757
|
+
var HiddenFieldValue = z7.string();
|
|
755
758
|
var NonEmptyTextValue = TextValue.min(1);
|
|
756
759
|
var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
|
|
757
760
|
var AgeValue = z7.object({
|
|
@@ -803,8 +806,7 @@ var FieldValuesWithoutDataField = z7.union([
|
|
|
803
806
|
VerificationStatusValue,
|
|
804
807
|
QueryParamReaderFieldValue,
|
|
805
808
|
QrReaderFieldValue,
|
|
806
|
-
IdReaderFieldValue
|
|
807
|
-
CustomFieldValue
|
|
809
|
+
IdReaderFieldValue
|
|
808
810
|
]);
|
|
809
811
|
var DataFieldValue = z7.object({
|
|
810
812
|
data: z7.record(z7.string(), FieldValuesWithoutDataField)
|
|
@@ -879,7 +881,7 @@ var FieldUpdateValue = safeUnion([
|
|
|
879
881
|
NameFieldUpdateValue.describe("NameFieldUpdateValue"),
|
|
880
882
|
HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
|
|
881
883
|
QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
|
|
882
|
-
|
|
884
|
+
HiddenFieldValue.describe("HiddenFieldValue")
|
|
883
885
|
]);
|
|
884
886
|
|
|
885
887
|
// ../commons/src/uuid.ts
|
|
@@ -1140,7 +1142,7 @@ var RecordScopeType = z10.enum([
|
|
|
1140
1142
|
"record.read",
|
|
1141
1143
|
"record.declare",
|
|
1142
1144
|
"record.notify",
|
|
1143
|
-
"record.declared.
|
|
1145
|
+
"record.declared.edit",
|
|
1144
1146
|
"record.declared.reject",
|
|
1145
1147
|
"record.declared.archive",
|
|
1146
1148
|
"record.declared.review-duplicates",
|
|
@@ -1193,12 +1195,12 @@ function flattenAndMergeScopes(scopes2) {
|
|
|
1193
1195
|
}
|
|
1194
1196
|
return { type, options: mergedOptions };
|
|
1195
1197
|
}
|
|
1196
|
-
function
|
|
1198
|
+
function findScopes(scopes2, scopeType) {
|
|
1197
1199
|
const parsedScopes = scopes2.map(parseConfigurableScope);
|
|
1198
1200
|
const searchScopes = parsedScopes.filter((scope) => scope?.type === "search");
|
|
1199
1201
|
const otherScopes = parsedScopes.filter((scope) => scope?.type !== "search");
|
|
1200
1202
|
const mergedSearchScope = flattenAndMergeScopes(searchScopes);
|
|
1201
|
-
return [...otherScopes, mergedSearchScope].
|
|
1203
|
+
return [...otherScopes, mergedSearchScope].filter(
|
|
1202
1204
|
(scope) => scope?.type === scopeType
|
|
1203
1205
|
);
|
|
1204
1206
|
}
|
|
@@ -1440,11 +1442,6 @@ var DeclareAction = ActionBase.extend(
|
|
|
1440
1442
|
type: z12.literal(ActionType.DECLARE)
|
|
1441
1443
|
}).shape
|
|
1442
1444
|
);
|
|
1443
|
-
var ValidateAction = ActionBase.extend(
|
|
1444
|
-
z12.object({
|
|
1445
|
-
type: z12.literal(ActionType.VALIDATE)
|
|
1446
|
-
}).shape
|
|
1447
|
-
);
|
|
1448
1445
|
var ReasonContent = z12.object({
|
|
1449
1446
|
reason: z12.string().min(1, { error: "Message cannot be empty" }).describe(
|
|
1450
1447
|
"Message describing the reason for rejecting or archiving the event."
|
|
@@ -1497,6 +1494,14 @@ var NotifiedAction = ActionBase.extend(
|
|
|
1497
1494
|
type: z12.literal(ActionType.NOTIFY)
|
|
1498
1495
|
}).shape
|
|
1499
1496
|
);
|
|
1497
|
+
var EditAction = ActionBase.extend(
|
|
1498
|
+
z12.object({
|
|
1499
|
+
type: z12.literal(ActionType.EDIT),
|
|
1500
|
+
content: z12.object({
|
|
1501
|
+
comment: z12.string().describe("Comment for the edit action.").optional()
|
|
1502
|
+
})
|
|
1503
|
+
}).shape
|
|
1504
|
+
);
|
|
1500
1505
|
var PrintContent = z12.object({
|
|
1501
1506
|
templateId: z12.string().optional()
|
|
1502
1507
|
});
|
|
@@ -1539,7 +1544,6 @@ var CustomAction = ActionBase.merge(
|
|
|
1539
1544
|
);
|
|
1540
1545
|
var ActionDocument = z12.discriminatedUnion("type", [
|
|
1541
1546
|
CreatedAction.meta({ id: "CreatedAction" }),
|
|
1542
|
-
ValidateAction.meta({ id: "ValidateAction" }),
|
|
1543
1547
|
RejectAction.meta({ id: "RejectAction" }),
|
|
1544
1548
|
DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
|
|
1545
1549
|
MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
|
|
@@ -1555,6 +1559,7 @@ var ActionDocument = z12.discriminatedUnion("type", [
|
|
|
1555
1559
|
UnassignedAction.meta({ id: "UnassignedAction" }),
|
|
1556
1560
|
PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
|
|
1557
1561
|
ReadAction.meta({ id: "ReadAction" }),
|
|
1562
|
+
EditAction.meta({ id: "EditAction" }),
|
|
1558
1563
|
CustomAction.meta({ id: "CustomAction" })
|
|
1559
1564
|
]).meta({
|
|
1560
1565
|
id: "ActionDocument"
|
|
@@ -1577,7 +1582,14 @@ var InherentFlags = {
|
|
|
1577
1582
|
INCOMPLETE: "incomplete",
|
|
1578
1583
|
REJECTED: "rejected",
|
|
1579
1584
|
CORRECTION_REQUESTED: "correction-requested",
|
|
1580
|
-
POTENTIAL_DUPLICATE: "potential-duplicate"
|
|
1585
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
1586
|
+
/**
|
|
1587
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
1588
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
1589
|
+
*
|
|
1590
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
1591
|
+
*/
|
|
1592
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
1581
1593
|
};
|
|
1582
1594
|
var ActionFlag = z13.string().regex(
|
|
1583
1595
|
new RegExp(
|
|
@@ -1648,6 +1660,7 @@ var EventMetadata = z14.object({
|
|
|
1648
1660
|
),
|
|
1649
1661
|
createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
|
|
1650
1662
|
dateOfEvent: ZodDate.nullish(),
|
|
1663
|
+
placeOfEvent: CreatedAtLocation,
|
|
1651
1664
|
createdBy: z14.string().describe("ID of the user who created the event."),
|
|
1652
1665
|
createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1653
1666
|
updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
|
|
@@ -1677,6 +1690,7 @@ var EventMetadataKeysArray = [
|
|
|
1677
1690
|
"status",
|
|
1678
1691
|
"createdAt",
|
|
1679
1692
|
"dateOfEvent",
|
|
1693
|
+
"placeOfEvent",
|
|
1680
1694
|
"createdBy",
|
|
1681
1695
|
"createdByUserType",
|
|
1682
1696
|
"updatedByUserRole",
|
|
@@ -1711,6 +1725,11 @@ var eventMetadataLabelMap = {
|
|
|
1711
1725
|
defaultMessage: "Date of Event",
|
|
1712
1726
|
description: "Date of Event"
|
|
1713
1727
|
},
|
|
1728
|
+
"event.placeOfEvent": {
|
|
1729
|
+
id: "event.placeOfEvent.label",
|
|
1730
|
+
defaultMessage: "Place of Event",
|
|
1731
|
+
description: "Place of Event"
|
|
1732
|
+
},
|
|
1714
1733
|
"event.createdAtLocation": {
|
|
1715
1734
|
id: "event.createdAtLocation.label",
|
|
1716
1735
|
defaultMessage: "Location",
|
|
@@ -2443,12 +2462,6 @@ var IdReaderField = BaseField.extend({
|
|
|
2443
2462
|
z16.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
|
|
2444
2463
|
)
|
|
2445
2464
|
});
|
|
2446
|
-
var CustomField = BaseField.extend({
|
|
2447
|
-
type: z16.literal(FieldType.CUSTOM),
|
|
2448
|
-
defaultValue: CustomFieldValue.optional(),
|
|
2449
|
-
src: z16.string().describe("Module source path for the custom field component"),
|
|
2450
|
-
configuration: z16.unknown().optional()
|
|
2451
|
-
});
|
|
2452
2465
|
var LoaderField = BaseField.extend({
|
|
2453
2466
|
type: z16.literal(FieldType.LOADER),
|
|
2454
2467
|
configuration: z16.object({
|
|
@@ -2457,6 +2470,13 @@ var LoaderField = BaseField.extend({
|
|
|
2457
2470
|
}).describe(
|
|
2458
2471
|
"A non-interactive field that indicates an in progress operation in form"
|
|
2459
2472
|
);
|
|
2473
|
+
var HiddenField = BaseField.extend({
|
|
2474
|
+
type: z16.literal(FieldType.ALPHA_HIDDEN),
|
|
2475
|
+
required: z16.boolean().default(false).optional(),
|
|
2476
|
+
defaultValue: TextValue.optional()
|
|
2477
|
+
}).describe(
|
|
2478
|
+
"A non-interactive, hidden field that only hold a value in the form"
|
|
2479
|
+
);
|
|
2460
2480
|
var FieldConfig = z16.discriminatedUnion("type", [
|
|
2461
2481
|
Address,
|
|
2462
2482
|
TextField,
|
|
@@ -2497,7 +2517,7 @@ var FieldConfig = z16.discriminatedUnion("type", [
|
|
|
2497
2517
|
QueryParamReaderField,
|
|
2498
2518
|
LoaderField,
|
|
2499
2519
|
SearchField,
|
|
2500
|
-
|
|
2520
|
+
HiddenField
|
|
2501
2521
|
]).meta({
|
|
2502
2522
|
description: "Form field configuration",
|
|
2503
2523
|
id: "FieldConfig"
|
|
@@ -2736,6 +2756,7 @@ var AvailableIcons = z20.enum([
|
|
|
2736
2756
|
"Users",
|
|
2737
2757
|
"WarningCircle",
|
|
2738
2758
|
"X",
|
|
2759
|
+
"ChatText",
|
|
2739
2760
|
"CircleWavyCheck",
|
|
2740
2761
|
"CircleWavyQuestion",
|
|
2741
2762
|
"ArchiveBox",
|
|
@@ -2801,11 +2822,6 @@ var RejectConfig = ActionConfigBase.extend(
|
|
|
2801
2822
|
type: z21.literal(ActionType.REJECT)
|
|
2802
2823
|
}).shape
|
|
2803
2824
|
);
|
|
2804
|
-
var ValidateConfig = DeclarationActionBase.extend(
|
|
2805
|
-
z21.object({
|
|
2806
|
-
type: z21.literal(ActionType.VALIDATE)
|
|
2807
|
-
}).shape
|
|
2808
|
-
);
|
|
2809
2825
|
var RegisterConfig = DeclarationActionBase.extend(
|
|
2810
2826
|
z21.object({
|
|
2811
2827
|
type: z21.literal(ActionType.REGISTER)
|
|
@@ -2841,7 +2857,6 @@ var ActionConfig = z21.discriminatedUnion("type", [
|
|
|
2841
2857
|
ReadActionConfig.meta({ id: "ReadActionConfig" }),
|
|
2842
2858
|
DeclareConfig.meta({ id: "DeclareActionConfig" }),
|
|
2843
2859
|
RejectConfig.meta({ id: "RejectActionConfig" }),
|
|
2844
|
-
ValidateConfig.meta({ id: "ValidateActionConfig" }),
|
|
2845
2860
|
RegisterConfig.meta({ id: "RegisterActionConfig" }),
|
|
2846
2861
|
PrintCertificateActionConfig.meta({
|
|
2847
2862
|
id: "PrintCertificateActionConfig"
|
|
@@ -2856,7 +2871,6 @@ var actionConfigTypes = new Set(
|
|
|
2856
2871
|
);
|
|
2857
2872
|
var DeclarationActionConfig = z21.discriminatedUnion("type", [
|
|
2858
2873
|
DeclareConfig,
|
|
2859
|
-
ValidateConfig,
|
|
2860
2874
|
RegisterConfig
|
|
2861
2875
|
]);
|
|
2862
2876
|
|
|
@@ -3129,6 +3143,7 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3129
3143
|
case FieldType.VERIFICATION_STATUS:
|
|
3130
3144
|
case FieldType.ID:
|
|
3131
3145
|
case FieldType.LOADER:
|
|
3146
|
+
case FieldType.ALPHA_HIDDEN:
|
|
3132
3147
|
schema = field3.required ? NonEmptyTextValue : TextValue;
|
|
3133
3148
|
break;
|
|
3134
3149
|
case FieldType.NUMBER:
|
|
@@ -3172,9 +3187,6 @@ function mapFieldTypeToZod(field3, actionType) {
|
|
|
3172
3187
|
case FieldType.ID_READER:
|
|
3173
3188
|
schema = IdReaderFieldValue;
|
|
3174
3189
|
break;
|
|
3175
|
-
case FieldType.CUSTOM:
|
|
3176
|
-
schema = CustomFieldValue;
|
|
3177
|
-
break;
|
|
3178
3190
|
}
|
|
3179
3191
|
return field3.required ? schema : schema.nullish();
|
|
3180
3192
|
}
|
|
@@ -3215,6 +3227,7 @@ function mapFieldTypeToEmptyValue(field3) {
|
|
|
3215
3227
|
case FieldType.QR_READER:
|
|
3216
3228
|
case FieldType.ID_READER:
|
|
3217
3229
|
case FieldType.LOADER:
|
|
3230
|
+
case FieldType.ALPHA_HIDDEN:
|
|
3218
3231
|
return null;
|
|
3219
3232
|
case FieldType.ADDRESS:
|
|
3220
3233
|
return {
|
|
@@ -3232,8 +3245,6 @@ function mapFieldTypeToEmptyValue(field3) {
|
|
|
3232
3245
|
};
|
|
3233
3246
|
case FieldType.FILE_WITH_OPTIONS:
|
|
3234
3247
|
return [];
|
|
3235
|
-
case FieldType.CUSTOM:
|
|
3236
|
-
return void 0;
|
|
3237
3248
|
}
|
|
3238
3249
|
}
|
|
3239
3250
|
var isParagraphFieldType = (field3) => {
|
|
@@ -3353,8 +3364,8 @@ var isIdReaderFieldType = (field3) => {
|
|
|
3353
3364
|
var isLoaderFieldType = (field3) => {
|
|
3354
3365
|
return field3.config.type === FieldType.LOADER;
|
|
3355
3366
|
};
|
|
3356
|
-
var
|
|
3357
|
-
return field3.config.type === FieldType.
|
|
3367
|
+
var isHiddenFieldType = (field3) => {
|
|
3368
|
+
return field3.config.type === FieldType.ALPHA_HIDDEN;
|
|
3358
3369
|
};
|
|
3359
3370
|
var isNonInteractiveFieldType = (field3) => {
|
|
3360
3371
|
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;
|
|
@@ -3800,7 +3811,7 @@ function getActionConfig({
|
|
|
3800
3811
|
if (a.type === ActionType.CUSTOM && customActionType) {
|
|
3801
3812
|
return a.customActionType === customActionType;
|
|
3802
3813
|
}
|
|
3803
|
-
if (actionType === ActionType.NOTIFY) {
|
|
3814
|
+
if (actionType === ActionType.NOTIFY || actionType === ActionType.EDIT) {
|
|
3804
3815
|
return a.type === ActionType.DECLARE;
|
|
3805
3816
|
}
|
|
3806
3817
|
if (actionType === ActionType.APPROVE_CORRECTION || actionType === ActionType.REJECT_CORRECTION) {
|
|
@@ -3862,9 +3873,13 @@ var findRecordActionPages = (config, actionType) => {
|
|
|
3862
3873
|
return [];
|
|
3863
3874
|
};
|
|
3864
3875
|
function getActionReview(configuration, actionType) {
|
|
3865
|
-
const
|
|
3866
|
-
|
|
3867
|
-
|
|
3876
|
+
const actionConfig = getActionConfig({
|
|
3877
|
+
eventConfiguration: configuration,
|
|
3878
|
+
actionType
|
|
3879
|
+
});
|
|
3880
|
+
if (!actionConfig) {
|
|
3881
|
+
throw "Tried to get action review for an action that is not a declaration action";
|
|
3882
|
+
}
|
|
3868
3883
|
if ("review" in actionConfig) {
|
|
3869
3884
|
return actionConfig.review;
|
|
3870
3885
|
}
|
|
@@ -4130,9 +4145,12 @@ function aggregateActionDeclarations(event2) {
|
|
|
4130
4145
|
return getCompleteActionDeclaration(declaration, event2, action);
|
|
4131
4146
|
}, {});
|
|
4132
4147
|
}
|
|
4133
|
-
function aggregateActionAnnotations(
|
|
4134
|
-
return actions.reduce((ann, sortedAction) => {
|
|
4135
|
-
|
|
4148
|
+
function aggregateActionAnnotations(event2) {
|
|
4149
|
+
return event2.actions.reduce((ann, sortedAction) => {
|
|
4150
|
+
if (!("annotation" in sortedAction) || !sortedAction.annotation) {
|
|
4151
|
+
return ann;
|
|
4152
|
+
}
|
|
4153
|
+
return deepMerge(ann, sortedAction.annotation);
|
|
4136
4154
|
}, {});
|
|
4137
4155
|
}
|
|
4138
4156
|
|
|
@@ -4144,6 +4162,9 @@ var EventConfig = z29.object({
|
|
|
4144
4162
|
dateOfEvent: FieldReference.optional().describe(
|
|
4145
4163
|
"Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
|
|
4146
4164
|
),
|
|
4165
|
+
placeOfEvent: FieldReference.optional().describe(
|
|
4166
|
+
"Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
|
|
4167
|
+
),
|
|
4147
4168
|
title: TranslationConfig.describe(
|
|
4148
4169
|
'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
|
|
4149
4170
|
),
|
|
@@ -4218,6 +4239,19 @@ var EventConfig = z29.object({
|
|
|
4218
4239
|
});
|
|
4219
4240
|
}
|
|
4220
4241
|
}
|
|
4242
|
+
if (event2.placeOfEvent) {
|
|
4243
|
+
const eventPlaceFieldId = getDeclarationFields(event2).find(
|
|
4244
|
+
({ id }) => id === event2.placeOfEvent?.$$field
|
|
4245
|
+
);
|
|
4246
|
+
if (!eventPlaceFieldId) {
|
|
4247
|
+
ctx.addIssue({
|
|
4248
|
+
code: "custom",
|
|
4249
|
+
message: `Place of event field id must match a field id in the event.declaration fields.
|
|
4250
|
+
Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
|
|
4251
|
+
path: ["placeOfEvent"]
|
|
4252
|
+
});
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4221
4255
|
const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
|
|
4222
4256
|
const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
|
|
4223
4257
|
const actionFlagIds = event2.actions.flatMap(
|
|
@@ -5158,11 +5192,6 @@ var RegisterActionInput = BaseActionInput.extend(
|
|
|
5158
5192
|
registrationNumber: z33.string().optional()
|
|
5159
5193
|
}).shape
|
|
5160
5194
|
);
|
|
5161
|
-
var ValidateActionInput = BaseActionInput.extend(
|
|
5162
|
-
z33.object({
|
|
5163
|
-
type: z33.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
|
|
5164
|
-
}).shape
|
|
5165
|
-
);
|
|
5166
5195
|
var NotifyActionInput = BaseActionInput.extend(
|
|
5167
5196
|
z33.object({
|
|
5168
5197
|
type: z33.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
|
@@ -5181,6 +5210,14 @@ var DeclareActionInput = BaseActionInput.extend(
|
|
|
5181
5210
|
type: z33.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
|
5182
5211
|
}).shape
|
|
5183
5212
|
);
|
|
5213
|
+
var EditActionInput = BaseActionInput.extend(
|
|
5214
|
+
z33.object({
|
|
5215
|
+
type: z33.literal(ActionType.EDIT).default(ActionType.EDIT),
|
|
5216
|
+
content: z33.object({
|
|
5217
|
+
comment: z33.string().describe("Comment for the edit action.").optional()
|
|
5218
|
+
})
|
|
5219
|
+
}).shape
|
|
5220
|
+
);
|
|
5184
5221
|
var PrintCertificateActionInput = BaseActionInput.extend(
|
|
5185
5222
|
z33.object({
|
|
5186
5223
|
type: z33.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
|
@@ -5264,7 +5301,6 @@ var CustomActionInput = BaseActionInput.extend(
|
|
|
5264
5301
|
);
|
|
5265
5302
|
var ActionInput = z33.discriminatedUnion("type", [
|
|
5266
5303
|
CreateActionInput.meta({ id: "CreateActionInput" }),
|
|
5267
|
-
ValidateActionInput.meta({ id: "ValidateActionInput" }),
|
|
5268
5304
|
RegisterActionInput.meta({ id: "RegisterActionInput" }),
|
|
5269
5305
|
NotifyActionInput.meta({ id: "NotifyActionInput" }),
|
|
5270
5306
|
DeclareActionInput.meta({ id: "DeclareActionInput" }),
|
|
@@ -5292,7 +5328,8 @@ var ActionInput = z33.discriminatedUnion("type", [
|
|
|
5292
5328
|
id: "ApproveCorrectionActionInput"
|
|
5293
5329
|
}),
|
|
5294
5330
|
ReadActionInput.meta({ id: "ReadActionInput" }),
|
|
5295
|
-
CustomActionInput.meta({ id: "CustomActionInput" })
|
|
5331
|
+
CustomActionInput.meta({ id: "CustomActionInput" }),
|
|
5332
|
+
EditActionInput.meta({ id: "EditActionInput" })
|
|
5296
5333
|
]).meta({
|
|
5297
5334
|
id: "ActionInput"
|
|
5298
5335
|
});
|
|
@@ -5347,7 +5384,7 @@ var import_lodash4 = require("lodash");
|
|
|
5347
5384
|
// ../commons/src/events/state/utils.ts
|
|
5348
5385
|
var import_lodash2 = require("lodash");
|
|
5349
5386
|
function getActionRequests(actionType, actions) {
|
|
5350
|
-
const filtered = actions.filter((action) => action.type === actionType);
|
|
5387
|
+
const filtered = actions.filter((action) => action.type === actionType).reverse();
|
|
5351
5388
|
const accept = filtered.find(
|
|
5352
5389
|
(action) => action.status === ActionStatus.Accepted
|
|
5353
5390
|
);
|
|
@@ -5388,7 +5425,6 @@ var updateActions = ActionTypes.extract([
|
|
|
5388
5425
|
ActionType.CREATE,
|
|
5389
5426
|
ActionType.NOTIFY,
|
|
5390
5427
|
ActionType.DECLARE,
|
|
5391
|
-
ActionType.VALIDATE,
|
|
5392
5428
|
ActionType.REGISTER,
|
|
5393
5429
|
ActionType.REJECT,
|
|
5394
5430
|
ActionType.ARCHIVE,
|
|
@@ -5435,6 +5471,9 @@ function getLegalStatuses(actions) {
|
|
|
5435
5471
|
// ../commons/src/events/state/flags.ts
|
|
5436
5472
|
var import_lodash3 = require("lodash");
|
|
5437
5473
|
var import_date_fns3 = require("date-fns");
|
|
5474
|
+
function isEditInProgress(actions) {
|
|
5475
|
+
return actions.at(-1)?.type === ActionType.EDIT;
|
|
5476
|
+
}
|
|
5438
5477
|
function isPendingCertification(actions) {
|
|
5439
5478
|
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
|
5440
5479
|
return false;
|
|
@@ -5496,9 +5535,23 @@ function isFlagConditionMet(conditional, form, action) {
|
|
|
5496
5535
|
}
|
|
5497
5536
|
});
|
|
5498
5537
|
}
|
|
5538
|
+
function omitOverwrittenActions(sortedActions) {
|
|
5539
|
+
const declareIndexes = sortedActions.map((a, i) => a.type === ActionType.DECLARE ? i : -1).filter((i) => i !== -1);
|
|
5540
|
+
if (declareIndexes.length < 2) {
|
|
5541
|
+
return sortedActions;
|
|
5542
|
+
}
|
|
5543
|
+
const secondLastDeclareIndex = declareIndexes[declareIndexes.length - 2];
|
|
5544
|
+
const editActionIndex = sortedActions.findIndex(
|
|
5545
|
+
(a, index) => a.type === ActionType.EDIT && index > secondLastDeclareIndex
|
|
5546
|
+
);
|
|
5547
|
+
return [
|
|
5548
|
+
...sortedActions.slice(0, secondLastDeclareIndex),
|
|
5549
|
+
...sortedActions.slice(editActionIndex)
|
|
5550
|
+
];
|
|
5551
|
+
}
|
|
5499
5552
|
function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
5500
|
-
const
|
|
5501
|
-
const actions =
|
|
5553
|
+
const sortedActions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
5554
|
+
const actions = omitOverwrittenActions(sortedActions);
|
|
5502
5555
|
return actions.reduce((acc, action, idx) => {
|
|
5503
5556
|
let actionConfig;
|
|
5504
5557
|
if (isActionConfigType(action.type)) {
|
|
@@ -5516,7 +5569,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
|
|
|
5516
5569
|
actions: actions.slice(0, idx + 1)
|
|
5517
5570
|
};
|
|
5518
5571
|
const declaration = aggregateActionDeclarations(eventUpToThisAction);
|
|
5519
|
-
const annotation = aggregateActionAnnotations(eventUpToThisAction
|
|
5572
|
+
const annotation = aggregateActionAnnotations(eventUpToThisAction);
|
|
5520
5573
|
const form = { ...declaration, ...annotation };
|
|
5521
5574
|
const flagsWithMetConditions = actionConfig.flags.filter(
|
|
5522
5575
|
({ conditional }) => (
|
|
@@ -5560,6 +5613,9 @@ function getEventFlags(event2, config) {
|
|
|
5560
5613
|
if (isPotentialDuplicate(sortedActions)) {
|
|
5561
5614
|
flags.push(InherentFlags.POTENTIAL_DUPLICATE);
|
|
5562
5615
|
}
|
|
5616
|
+
if (isEditInProgress(sortedActions)) {
|
|
5617
|
+
flags.push(InherentFlags.EDIT_IN_PROGRESS);
|
|
5618
|
+
}
|
|
5563
5619
|
return [...flags, ...resolveEventCustomFlags(event2, config)];
|
|
5564
5620
|
}
|
|
5565
5621
|
|
|
@@ -5589,8 +5645,7 @@ function getStatusFromActions(actions) {
|
|
|
5589
5645
|
case ActionType.MARK_AS_DUPLICATE:
|
|
5590
5646
|
case ActionType.REJECT_CORRECTION:
|
|
5591
5647
|
case ActionType.READ:
|
|
5592
|
-
case ActionType.
|
|
5593
|
-
case ActionType.VALIDATE:
|
|
5648
|
+
case ActionType.EDIT:
|
|
5594
5649
|
default:
|
|
5595
5650
|
return status2;
|
|
5596
5651
|
}
|
|
@@ -5645,6 +5700,33 @@ function resolveDateOfEvent(eventMetadata, declaration, config) {
|
|
|
5645
5700
|
const parsedDate = ZodDate.safeParse(declaration[config.dateOfEvent.$$field]);
|
|
5646
5701
|
return parsedDate.success ? parsedDate.data : void 0;
|
|
5647
5702
|
}
|
|
5703
|
+
var DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
|
|
5704
|
+
function getParsedUUID(value, oldValue) {
|
|
5705
|
+
const parsed = UUID.safeParse(value);
|
|
5706
|
+
return parsed.success ? parsed.data : oldValue;
|
|
5707
|
+
}
|
|
5708
|
+
function resolvePlaceOfEvent(eventMetadata, declaration, config) {
|
|
5709
|
+
let placeOfEvent = getParsedUUID(
|
|
5710
|
+
eventMetadata[DEFAULT_PLACE_OF_EVENT_PROPERTY]
|
|
5711
|
+
);
|
|
5712
|
+
if (config.placeOfEvent) {
|
|
5713
|
+
const addressFieldValue = AddressFieldValue.safeParse(
|
|
5714
|
+
declaration[config.placeOfEvent.$$field]
|
|
5715
|
+
);
|
|
5716
|
+
if (addressFieldValue.success && addressFieldValue.data.addressType === AddressType.DOMESTIC && addressFieldValue.data.administrativeArea) {
|
|
5717
|
+
placeOfEvent = getParsedUUID(
|
|
5718
|
+
addressFieldValue.data.administrativeArea,
|
|
5719
|
+
placeOfEvent
|
|
5720
|
+
);
|
|
5721
|
+
} else {
|
|
5722
|
+
placeOfEvent = getParsedUUID(
|
|
5723
|
+
declaration[config.placeOfEvent.$$field],
|
|
5724
|
+
placeOfEvent
|
|
5725
|
+
);
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
return placeOfEvent;
|
|
5729
|
+
}
|
|
5648
5730
|
function extractPotentialDuplicatesFromActions(actions) {
|
|
5649
5731
|
return actions.reduce((duplicates, action) => {
|
|
5650
5732
|
if (action.type === ActionType.DUPLICATE_DETECTED) {
|
|
@@ -5689,6 +5771,11 @@ function getCurrentEventState(event2, config) {
|
|
|
5689
5771
|
trackingId: event2.trackingId,
|
|
5690
5772
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
|
5691
5773
|
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
|
5774
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
5775
|
+
{ createdAtLocation: creationAction.createdAtLocation },
|
|
5776
|
+
declaration,
|
|
5777
|
+
config
|
|
5778
|
+
),
|
|
5692
5779
|
potentialDuplicates: extractPotentialDuplicatesFromActions(sortedActions),
|
|
5693
5780
|
flags: getEventFlags(event2, config)
|
|
5694
5781
|
});
|
|
@@ -5733,6 +5820,11 @@ function applyDeclarationToEventIndex(eventIndex, declaration, eventConfiguratio
|
|
|
5733
5820
|
updatedDeclaration,
|
|
5734
5821
|
eventConfiguration
|
|
5735
5822
|
),
|
|
5823
|
+
placeOfEvent: resolvePlaceOfEvent(
|
|
5824
|
+
eventIndex,
|
|
5825
|
+
updatedDeclaration,
|
|
5826
|
+
eventConfiguration
|
|
5827
|
+
),
|
|
5736
5828
|
declaration: updatedDeclaration
|
|
5737
5829
|
};
|
|
5738
5830
|
}
|
|
@@ -7032,17 +7124,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7032
7124
|
}
|
|
7033
7125
|
]
|
|
7034
7126
|
},
|
|
7035
|
-
flags: [
|
|
7036
|
-
{
|
|
7037
|
-
id: "validated",
|
|
7038
|
-
label: {
|
|
7039
|
-
id: "event.tennis-club-membership.flag.validated",
|
|
7040
|
-
defaultMessage: "Validated",
|
|
7041
|
-
description: "Flag label for validated"
|
|
7042
|
-
},
|
|
7043
|
-
requiresAction: true
|
|
7044
|
-
}
|
|
7045
|
-
],
|
|
7046
7127
|
actions: [
|
|
7047
7128
|
{
|
|
7048
7129
|
type: ActionType.READ,
|
|
@@ -7062,26 +7143,13 @@ var tennisClubMembershipEvent = defineConfig({
|
|
|
7062
7143
|
},
|
|
7063
7144
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7064
7145
|
},
|
|
7065
|
-
{
|
|
7066
|
-
type: ActionType.VALIDATE,
|
|
7067
|
-
label: {
|
|
7068
|
-
defaultMessage: "Validate",
|
|
7069
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7070
|
-
id: "event.tennis-club-membership.action.validate.label"
|
|
7071
|
-
},
|
|
7072
|
-
flags: [{ id: "validated", operation: "add" }],
|
|
7073
|
-
conditionals: [
|
|
7074
|
-
{ type: ConditionalType.SHOW, conditional: not(flag("validated")) }
|
|
7075
|
-
]
|
|
7076
|
-
},
|
|
7077
7146
|
{
|
|
7078
7147
|
type: ActionType.REJECT,
|
|
7079
7148
|
label: {
|
|
7080
7149
|
defaultMessage: "Reject",
|
|
7081
7150
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7082
7151
|
id: "event.tennis-club-membership.action.reject.label"
|
|
7083
|
-
}
|
|
7084
|
-
flags: [{ id: "validated", operation: "remove" }]
|
|
7152
|
+
}
|
|
7085
7153
|
},
|
|
7086
7154
|
{
|
|
7087
7155
|
type: ActionType.REGISTER,
|
|
@@ -7404,14 +7472,6 @@ var footballClubMembershipEvent = defineConfig({
|
|
|
7404
7472
|
},
|
|
7405
7473
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
|
7406
7474
|
},
|
|
7407
|
-
{
|
|
7408
|
-
type: ActionType.VALIDATE,
|
|
7409
|
-
label: {
|
|
7410
|
-
defaultMessage: "Validate",
|
|
7411
|
-
description: "This is shown as the action name anywhere the user can trigger the action from",
|
|
7412
|
-
id: "event.football-club-membership.action.validate.label"
|
|
7413
|
-
}
|
|
7414
|
-
},
|
|
7415
7475
|
{
|
|
7416
7476
|
type: ActionType.REGISTER,
|
|
7417
7477
|
label: {
|
|
@@ -7936,10 +7996,6 @@ var ChildOnboardingEvent = defineConfig({
|
|
|
7936
7996
|
label: generateTranslationConfig("Declare"),
|
|
7937
7997
|
review: CHILD_ONBOARDING_DECLARATION_REVIEW
|
|
7938
7998
|
},
|
|
7939
|
-
{
|
|
7940
|
-
type: ActionType.VALIDATE,
|
|
7941
|
-
label: generateTranslationConfig("Validate")
|
|
7942
|
-
},
|
|
7943
7999
|
{
|
|
7944
8000
|
type: ActionType.REGISTER,
|
|
7945
8001
|
label: generateTranslationConfig("Register")
|
|
@@ -8040,6 +8096,7 @@ function mapFieldTypeToMockValue(field3, i, rng) {
|
|
|
8040
8096
|
case FieldType.OFFICE:
|
|
8041
8097
|
case FieldType.LINK_BUTTON:
|
|
8042
8098
|
case FieldType.LOADER:
|
|
8099
|
+
case FieldType.ALPHA_HIDDEN:
|
|
8043
8100
|
return `${field3.id}-${field3.type}-${i}`;
|
|
8044
8101
|
case FieldType.VERIFICATION_STATUS:
|
|
8045
8102
|
return "verified";
|
|
@@ -8102,7 +8159,6 @@ function mapFieldTypeToMockValue(field3, i, rng) {
|
|
|
8102
8159
|
};
|
|
8103
8160
|
case FieldType.FILE_WITH_OPTIONS:
|
|
8104
8161
|
case FieldType.DATA:
|
|
8105
|
-
case FieldType.CUSTOM:
|
|
8106
8162
|
return void 0;
|
|
8107
8163
|
case FieldType.QR_READER:
|
|
8108
8164
|
return /* @__PURE__ */ Object.create(null);
|
|
@@ -8267,19 +8323,12 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
|
|
|
8267
8323
|
keepAssignment: input.keepAssignment
|
|
8268
8324
|
};
|
|
8269
8325
|
},
|
|
8270
|
-
|
|
8271
|
-
type: ActionType.
|
|
8326
|
+
edit: (eventId, input = {}) => ({
|
|
8327
|
+
type: ActionType.EDIT,
|
|
8328
|
+
content: { comment: "Test comment" },
|
|
8272
8329
|
transactionId: input.transactionId ?? getUUID(),
|
|
8273
|
-
declaration: input.declaration ?? generateActionDeclarationInput(
|
|
8274
|
-
|
|
8275
|
-
ActionType.VALIDATE,
|
|
8276
|
-
rng
|
|
8277
|
-
),
|
|
8278
|
-
annotation: input.annotation ?? generateActionAnnotationInput(
|
|
8279
|
-
configuration,
|
|
8280
|
-
ActionType.VALIDATE,
|
|
8281
|
-
rng
|
|
8282
|
-
),
|
|
8330
|
+
declaration: input.declaration ?? generateActionDeclarationInput(configuration, ActionType.EDIT, rng),
|
|
8331
|
+
annotation: input.annotation ?? generateActionAnnotationInput(configuration, ActionType.EDIT, rng),
|
|
8283
8332
|
eventId,
|
|
8284
8333
|
...input
|
|
8285
8334
|
}),
|
|
@@ -8458,22 +8507,29 @@ function generateActionDocument({
|
|
|
8458
8507
|
...defaults
|
|
8459
8508
|
};
|
|
8460
8509
|
switch (action) {
|
|
8510
|
+
case ActionType.READ:
|
|
8511
|
+
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
8512
|
+
case ActionType.DECLARE:
|
|
8513
|
+
case ActionType.UNASSIGN:
|
|
8514
|
+
case ActionType.CREATE:
|
|
8515
|
+
case ActionType.NOTIFY:
|
|
8516
|
+
case ActionType.REGISTER:
|
|
8517
|
+
case ActionType.REQUEST_CORRECTION:
|
|
8518
|
+
return { ...actionBase, type: action };
|
|
8519
|
+
case ActionType.EDIT:
|
|
8520
|
+
return {
|
|
8521
|
+
...actionBase,
|
|
8522
|
+
type: action,
|
|
8523
|
+
content: { comment: "Test comment" }
|
|
8524
|
+
};
|
|
8461
8525
|
case ActionType.CUSTOM:
|
|
8462
8526
|
return {
|
|
8463
8527
|
...actionBase,
|
|
8464
8528
|
type: action,
|
|
8465
8529
|
customActionType: "CUSTOM_ACTION_TYPE"
|
|
8466
8530
|
};
|
|
8467
|
-
case ActionType.READ:
|
|
8468
|
-
return { ...actionBase, type: action };
|
|
8469
|
-
case ActionType.MARK_AS_NOT_DUPLICATE:
|
|
8470
|
-
return { ...actionBase, type: action };
|
|
8471
8531
|
case ActionType.MARK_AS_DUPLICATE:
|
|
8472
8532
|
return { ...actionBase, type: action, content: void 0 };
|
|
8473
|
-
case ActionType.DECLARE:
|
|
8474
|
-
return { ...actionBase, type: action };
|
|
8475
|
-
case ActionType.UNASSIGN:
|
|
8476
|
-
return { ...actionBase, type: action };
|
|
8477
8533
|
case ActionType.ASSIGN: {
|
|
8478
8534
|
const assignActionDefaults = defaults;
|
|
8479
8535
|
return {
|
|
@@ -8482,16 +8538,10 @@ function generateActionDocument({
|
|
|
8482
8538
|
type: action
|
|
8483
8539
|
};
|
|
8484
8540
|
}
|
|
8485
|
-
case ActionType.VALIDATE:
|
|
8486
|
-
return { ...actionBase, type: action };
|
|
8487
8541
|
case ActionType.ARCHIVE:
|
|
8488
8542
|
return { ...actionBase, type: action, content: { reason: "Archive" } };
|
|
8489
8543
|
case ActionType.REJECT:
|
|
8490
8544
|
return { ...actionBase, type: action, content: { reason: "Reject" } };
|
|
8491
|
-
case ActionType.CREATE:
|
|
8492
|
-
return { ...actionBase, type: action };
|
|
8493
|
-
case ActionType.NOTIFY:
|
|
8494
|
-
return { ...actionBase, type: action };
|
|
8495
8545
|
case ActionType.PRINT_CERTIFICATE: {
|
|
8496
8546
|
const printActionDefaults = defaults;
|
|
8497
8547
|
return {
|
|
@@ -8500,8 +8550,6 @@ function generateActionDocument({
|
|
|
8500
8550
|
content: printActionDefaults?.content
|
|
8501
8551
|
};
|
|
8502
8552
|
}
|
|
8503
|
-
case ActionType.REQUEST_CORRECTION:
|
|
8504
|
-
return { ...actionBase, type: action };
|
|
8505
8553
|
case ActionType.APPROVE_CORRECTION:
|
|
8506
8554
|
return { ...actionBase, requestId: getUUID(), type: action };
|
|
8507
8555
|
case ActionType.REJECT_CORRECTION:
|
|
@@ -8511,11 +8559,6 @@ function generateActionDocument({
|
|
|
8511
8559
|
type: action,
|
|
8512
8560
|
content: { reason: "Correction rejection" }
|
|
8513
8561
|
};
|
|
8514
|
-
case ActionType.REGISTER:
|
|
8515
|
-
return {
|
|
8516
|
-
...actionBase,
|
|
8517
|
-
type: action
|
|
8518
|
-
};
|
|
8519
8562
|
case ActionType.DUPLICATE_DETECTED: {
|
|
8520
8563
|
const duplicateActionDefaults = defaults;
|
|
8521
8564
|
return {
|
|
@@ -8736,13 +8779,9 @@ var ACTION_SCOPE_MAP = {
|
|
|
8736
8779
|
[ActionType.READ]: ["record.read"],
|
|
8737
8780
|
[ActionType.CREATE]: ["record.create"],
|
|
8738
8781
|
[ActionType.NOTIFY]: ["record.notify"],
|
|
8739
|
-
[ActionType.DECLARE]: [
|
|
8740
|
-
|
|
8741
|
-
"record.declared.validate",
|
|
8742
|
-
"record.register"
|
|
8743
|
-
],
|
|
8782
|
+
[ActionType.DECLARE]: ["record.declare", "record.register"],
|
|
8783
|
+
[ActionType.EDIT]: ["record.declared.edit"],
|
|
8744
8784
|
[ActionType.DELETE]: ["record.declare"],
|
|
8745
|
-
[ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
|
|
8746
8785
|
[ActionType.REGISTER]: ["record.register"],
|
|
8747
8786
|
[ActionType.PRINT_CERTIFICATE]: ["record.registered.print-certified-copies"],
|
|
8748
8787
|
[ActionType.REQUEST_CORRECTION]: [
|
|
@@ -8766,12 +8805,23 @@ var ACTION_SCOPE_MAP = {
|
|
|
8766
8805
|
function hasAnyOfScopes(a, b) {
|
|
8767
8806
|
return (0, import_lodash6.intersection)(a, b).length > 0;
|
|
8768
8807
|
}
|
|
8769
|
-
function configurableEventScopeAllowed(scopes2, allowedConfigurableScopes, eventType) {
|
|
8770
|
-
const parsedScopes = allowedConfigurableScopes.
|
|
8771
|
-
|
|
8808
|
+
function configurableEventScopeAllowed(scopes2, allowedConfigurableScopes, eventType, customActionType) {
|
|
8809
|
+
const parsedScopes = allowedConfigurableScopes.flatMap(
|
|
8810
|
+
(scope) => findScopes(scopes2, scope)
|
|
8811
|
+
);
|
|
8812
|
+
if (!customActionType) {
|
|
8813
|
+
const authorizedEvents2 = getAuthorizedEventsFromScopes(parsedScopes);
|
|
8814
|
+
return authorizedEvents2.includes(eventType);
|
|
8815
|
+
}
|
|
8816
|
+
const scopesWithCorrectCustomActionType = parsedScopes.filter(
|
|
8817
|
+
({ options }) => "customActionType" in options && options.customActionType.includes(customActionType)
|
|
8818
|
+
);
|
|
8819
|
+
const authorizedEvents = getAuthorizedEventsFromScopes(
|
|
8820
|
+
scopesWithCorrectCustomActionType
|
|
8821
|
+
);
|
|
8772
8822
|
return authorizedEvents.includes(eventType);
|
|
8773
8823
|
}
|
|
8774
|
-
function isActionInScope(scopes2, action, eventType) {
|
|
8824
|
+
function isActionInScope(scopes2, action, eventType, customActionType) {
|
|
8775
8825
|
const allowedConfigurableScopes = ACTION_SCOPE_MAP[action];
|
|
8776
8826
|
if (allowedConfigurableScopes === null) {
|
|
8777
8827
|
return true;
|
|
@@ -8782,7 +8832,8 @@ function isActionInScope(scopes2, action, eventType) {
|
|
|
8782
8832
|
return configurableEventScopeAllowed(
|
|
8783
8833
|
scopes2,
|
|
8784
8834
|
allowedConfigurableScopes,
|
|
8785
|
-
eventType
|
|
8835
|
+
eventType,
|
|
8836
|
+
customActionType
|
|
8786
8837
|
);
|
|
8787
8838
|
}
|
|
8788
8839
|
function canUserReadEvent(event2, {
|
|
@@ -8876,12 +8927,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
|
8876
8927
|
],
|
|
8877
8928
|
[EventStatus.enum.DECLARED]: [
|
|
8878
8929
|
ActionType.READ,
|
|
8879
|
-
ActionType.VALIDATE,
|
|
8880
8930
|
ActionType.REGISTER,
|
|
8881
8931
|
ActionType.MARK_AS_DUPLICATE,
|
|
8882
8932
|
ActionType.ARCHIVE,
|
|
8883
8933
|
ActionType.REJECT,
|
|
8884
|
-
ActionType.CUSTOM
|
|
8934
|
+
ActionType.CUSTOM,
|
|
8935
|
+
ActionType.EDIT
|
|
8885
8936
|
],
|
|
8886
8937
|
[EventStatus.enum.REGISTERED]: [
|
|
8887
8938
|
ActionType.READ,
|
|
@@ -8906,7 +8957,7 @@ var ACTION_FILTERS = {
|
|
|
8906
8957
|
[ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8907
8958
|
[ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8908
8959
|
[ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8909
|
-
[ActionType.
|
|
8960
|
+
[ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8910
8961
|
[ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8911
8962
|
[ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
|
|
8912
8963
|
[ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
|
|
@@ -8915,6 +8966,9 @@ function filterActionsByFlags(actions, flags) {
|
|
|
8915
8966
|
return actions.filter((action) => ACTION_FILTERS[action]?.(flags) ?? true);
|
|
8916
8967
|
}
|
|
8917
8968
|
function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
8969
|
+
if (flags.includes(InherentFlags.EDIT_IN_PROGRESS)) {
|
|
8970
|
+
return [ActionType.NOTIFY, ActionType.DECLARE, ActionType.REGISTER];
|
|
8971
|
+
}
|
|
8918
8972
|
switch (status2) {
|
|
8919
8973
|
case EventStatus.enum.CREATED: {
|
|
8920
8974
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
@@ -8924,7 +8978,7 @@ function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
|
8924
8978
|
return getAvailableActionsWithoutFlagFilters(
|
|
8925
8979
|
EventStatus.enum.CREATED,
|
|
8926
8980
|
flags.filter((flag2) => flag2 !== InherentFlags.REJECTED)
|
|
8927
|
-
).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
|
|
8981
|
+
).filter((action) => action !== ActionType.DELETE).concat(ActionType.EDIT).concat(ActionType.ARCHIVE);
|
|
8928
8982
|
}
|
|
8929
8983
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
8930
8984
|
}
|
|
@@ -8933,7 +8987,7 @@ function getAvailableActionsWithoutFlagFilters(status2, flags) {
|
|
|
8933
8987
|
return getAvailableActionsWithoutFlagFilters(
|
|
8934
8988
|
EventStatus.enum.CREATED,
|
|
8935
8989
|
flags.filter((flag2) => flag2 !== InherentFlags.REJECTED)
|
|
8936
|
-
).filter((action) => action !== ActionType.DELETE).concat(ActionType.ARCHIVE);
|
|
8990
|
+
).filter((action) => action !== ActionType.DELETE).concat(ActionType.EDIT).concat(ActionType.ARCHIVE);
|
|
8937
8991
|
}
|
|
8938
8992
|
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[status2];
|
|
8939
8993
|
}
|