@opencrvs/toolkit 1.8.0-rc.f872339 → 1.8.0-rc.f8a9481
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 +319 -4032
- package/dist/commons/events/ActionDocument.d.ts +212 -6
- package/dist/commons/events/ActionInput.d.ts +68 -60
- package/dist/commons/events/Draft.d.ts +14 -4
- package/dist/commons/events/EventConfig.d.ts +0 -53
- package/dist/commons/events/EventDocument.d.ts +160 -4
- package/dist/commons/events/EventIndex.d.ts +3 -0
- package/dist/commons/events/EventMetadata.d.ts +3 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +44 -20
- package/dist/commons/events/defineConfig.d.ts +0 -6
- package/dist/commons/events/utils.d.ts +3 -3
- package/dist/events/index.js +400 -463
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -71,6 +71,7 @@ __export(events_exports, {
|
|
71
71
|
DeclarationUpdateActions: () => DeclarationUpdateActions,
|
72
72
|
DeclareActionInput: () => DeclareActionInput,
|
73
73
|
DeduplicationConfig: () => DeduplicationConfig,
|
74
|
+
DeleteActionInput: () => DeleteActionInput,
|
74
75
|
DisplayOnReviewConditional: () => DisplayOnReviewConditional,
|
75
76
|
Draft: () => Draft,
|
76
77
|
DraftInput: () => DraftInput,
|
@@ -145,6 +146,7 @@ __export(events_exports, {
|
|
145
146
|
defineFormConditional: () => defineFormConditional,
|
146
147
|
defineFormPage: () => defineFormPage,
|
147
148
|
definePage: () => definePage,
|
149
|
+
defineWorkqueue: () => defineWorkqueue,
|
148
150
|
errorMessages: () => errorMessages,
|
149
151
|
event: () => event,
|
150
152
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -172,6 +174,7 @@ __export(events_exports, {
|
|
172
174
|
getActionReviewFields: () => getActionReviewFields,
|
173
175
|
getAllAnnotationFields: () => getAllAnnotationFields,
|
174
176
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
177
|
+
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
175
178
|
getCurrentEventState: () => getCurrentEventState,
|
176
179
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
177
180
|
getDeclaration: () => getDeclaration,
|
@@ -224,7 +227,6 @@ __export(events_exports, {
|
|
224
227
|
user: () => user,
|
225
228
|
validate: () => validate,
|
226
229
|
validateFieldInput: () => validateFieldInput,
|
227
|
-
validateWorkqueueConfig: () => validateWorkqueueConfig,
|
228
230
|
writeActions: () => writeActions
|
229
231
|
});
|
230
232
|
module.exports = __toCommonJS(events_exports);
|
@@ -234,9 +236,12 @@ var import_zod9 = require("zod");
|
|
234
236
|
|
235
237
|
// ../commons/src/events/Conditional.ts
|
236
238
|
var import_zod = require("zod");
|
237
|
-
var
|
238
|
-
|
239
|
-
)
|
239
|
+
var import_zod_openapi = require("zod-openapi");
|
240
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
241
|
+
var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
242
|
+
description: "JSON schema conditional configuration",
|
243
|
+
ref: "Conditional"
|
244
|
+
});
|
240
245
|
var ConditionalType = {
|
241
246
|
SHOW: "SHOW",
|
242
247
|
ENABLE: "ENABLE",
|
@@ -273,7 +278,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
273
278
|
EnableConditional,
|
274
279
|
// Field output can be shown / hidden on the review page
|
275
280
|
DisplayOnReviewConditional
|
276
|
-
])
|
281
|
+
]).openapi({
|
282
|
+
description: "Field conditional configuration",
|
283
|
+
ref: "FieldConditional"
|
284
|
+
});
|
277
285
|
|
278
286
|
// ../commons/src/events/PageConfig.ts
|
279
287
|
var import_zod6 = require("zod");
|
@@ -283,6 +291,8 @@ var import_zod5 = require("zod");
|
|
283
291
|
|
284
292
|
// ../commons/src/events/TranslationConfig.ts
|
285
293
|
var import_zod2 = require("zod");
|
294
|
+
var import_zod_openapi2 = require("zod-openapi");
|
295
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
286
296
|
var TranslationConfig = import_zod2.z.object({
|
287
297
|
id: import_zod2.z.string().describe(
|
288
298
|
"The identifier of the translation referred in translation CSV files"
|
@@ -291,8 +301,14 @@ var TranslationConfig = import_zod2.z.object({
|
|
291
301
|
description: import_zod2.z.string().describe(
|
292
302
|
"Describe the translation for a translator to be able to identify it."
|
293
303
|
)
|
304
|
+
}).openapi({
|
305
|
+
description: "Translation configuration",
|
306
|
+
ref: "TranslationConfig"
|
294
307
|
});
|
295
308
|
|
309
|
+
// ../commons/src/events/FieldConfig.ts
|
310
|
+
var import_zod_openapi3 = require("zod-openapi");
|
311
|
+
|
296
312
|
// ../commons/src/events/FieldType.ts
|
297
313
|
var FieldType = {
|
298
314
|
ADDRESS: "ADDRESS",
|
@@ -443,6 +459,7 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
443
459
|
]);
|
444
460
|
|
445
461
|
// ../commons/src/events/FieldConfig.ts
|
462
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
446
463
|
var FieldId = import_zod5.z.string();
|
447
464
|
var DependencyExpression = import_zod5.z.object({
|
448
465
|
dependsOn: import_zod5.z.array(FieldId).default([]),
|
@@ -702,10 +719,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
702
719
|
EmailField,
|
703
720
|
FileUploadWithOptions,
|
704
721
|
DataField
|
705
|
-
|
706
|
-
|
722
|
+
]).openapi({
|
723
|
+
description: "Form field configuration",
|
724
|
+
ref: "FieldConfig"
|
725
|
+
});
|
707
726
|
|
708
727
|
// ../commons/src/events/PageConfig.ts
|
728
|
+
var import_zod_openapi4 = require("zod-openapi");
|
729
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
709
730
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
710
731
|
var PageConfigBase = import_zod6.z.object({
|
711
732
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -717,6 +738,9 @@ var PageConfigBase = import_zod6.z.object({
|
|
717
738
|
});
|
718
739
|
var FormPageConfig = PageConfigBase.extend({
|
719
740
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
741
|
+
}).openapi({
|
742
|
+
description: "Form page configuration",
|
743
|
+
ref: "FormPageConfig"
|
720
744
|
});
|
721
745
|
var VerificationActionConfig = import_zod6.z.object({
|
722
746
|
verify: import_zod6.z.object({ label: TranslationConfig }),
|
@@ -727,7 +751,10 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
727
751
|
body: TranslationConfig
|
728
752
|
})
|
729
753
|
})
|
730
|
-
}).describe("Actions available on the verification page")
|
754
|
+
}).describe("Actions available on the verification page").openapi({
|
755
|
+
description: "Verification action configuration",
|
756
|
+
ref: "VerificationActionConfig"
|
757
|
+
});
|
731
758
|
var VerificationPageConfig = FormPageConfig.extend({
|
732
759
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
733
760
|
actions: VerificationActionConfig
|
@@ -827,6 +854,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
827
854
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
828
855
|
|
829
856
|
// ../commons/src/events/ActionConfig.ts
|
857
|
+
var import_zod_openapi5 = require("zod-openapi");
|
858
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
830
859
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
831
860
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
832
861
|
ShowConditional,
|
@@ -904,18 +933,24 @@ var ApproveCorrectionConfig = ActionConfigBase.merge(
|
|
904
933
|
})
|
905
934
|
);
|
906
935
|
var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
936
|
+
/*
|
937
|
+
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
938
|
+
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
939
|
+
*/
|
940
|
+
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
941
|
+
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
942
|
+
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
943
|
+
MarkedAsDuplicateConfig.openapi({ ref: "MarkedAsDuplicateActionConfig" }),
|
944
|
+
ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
|
945
|
+
RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
|
946
|
+
DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
|
947
|
+
PrintCertificateActionConfig.openapi({
|
948
|
+
ref: "PrintCertificateActionConfig"
|
949
|
+
}),
|
950
|
+
RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
|
951
|
+
RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
|
952
|
+
ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
|
953
|
+
]).openapi({ ref: "ActionConfig" });
|
919
954
|
var DeclarationActionConfig = import_zod9.z.discriminatedUnion("type", [
|
920
955
|
DeclareConfig,
|
921
956
|
ValidateConfig,
|
@@ -959,10 +994,12 @@ var LanguageConfig = import_zod11.z.object({
|
|
959
994
|
});
|
960
995
|
|
961
996
|
// ../commons/src/events/EventConfig.ts
|
962
|
-
var
|
997
|
+
var import_zod16 = require("zod");
|
963
998
|
|
964
999
|
// ../commons/src/events/DeduplicationConfig.ts
|
965
1000
|
var import_zod12 = require("zod");
|
1001
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1002
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
966
1003
|
var FieldReference = import_zod12.z.string();
|
967
1004
|
var Matcher = import_zod12.z.object({
|
968
1005
|
fieldId: import_zod12.z.string(),
|
@@ -1023,7 +1060,9 @@ var Clause = import_zod12.z.lazy(
|
|
1023
1060
|
DateRangeMatcher,
|
1024
1061
|
DateDistanceMatcher
|
1025
1062
|
])
|
1026
|
-
)
|
1063
|
+
).openapi({
|
1064
|
+
ref: "Clause"
|
1065
|
+
});
|
1027
1066
|
var DeduplicationConfig = import_zod12.z.object({
|
1028
1067
|
id: import_zod12.z.string(),
|
1029
1068
|
label: TranslationConfig,
|
@@ -1057,119 +1096,15 @@ var SummaryConfig = import_zod13.z.object({
|
|
1057
1096
|
fields: import_zod13.z.array(import_zod13.z.union([Field, ReferenceField])).describe("Fields rendered in summary view.")
|
1058
1097
|
}).describe("Configuration for summary in event.");
|
1059
1098
|
|
1060
|
-
// ../commons/src/events/WorkqueueConfig.ts
|
1061
|
-
var import_zod15 = require("zod");
|
1062
|
-
|
1063
|
-
// ../commons/src/events/EventMetadata.ts
|
1064
|
-
var import_zod14 = require("zod");
|
1065
|
-
var EventStatus = {
|
1066
|
-
CREATED: "CREATED",
|
1067
|
-
NOTIFIED: "NOTIFIED",
|
1068
|
-
DECLARED: "DECLARED",
|
1069
|
-
VALIDATED: "VALIDATED",
|
1070
|
-
REGISTERED: "REGISTERED",
|
1071
|
-
CERTIFIED: "CERTIFIED",
|
1072
|
-
REJECTED: "REJECTED",
|
1073
|
-
ARCHIVED: "ARCHIVED"
|
1074
|
-
};
|
1075
|
-
var eventStatuses = Object.values(EventStatus);
|
1076
|
-
var EventStatuses = import_zod14.z.nativeEnum(EventStatus);
|
1077
|
-
var EventMetadata = import_zod14.z.object({
|
1078
|
-
id: import_zod14.z.string(),
|
1079
|
-
type: import_zod14.z.string(),
|
1080
|
-
status: EventStatuses,
|
1081
|
-
createdAt: import_zod14.z.string().datetime(),
|
1082
|
-
createdBy: import_zod14.z.string(),
|
1083
|
-
createdAtLocation: import_zod14.z.string(),
|
1084
|
-
updatedAtLocation: import_zod14.z.string(),
|
1085
|
-
modifiedAt: import_zod14.z.string().datetime(),
|
1086
|
-
assignedTo: import_zod14.z.string().nullish(),
|
1087
|
-
updatedBy: import_zod14.z.string(),
|
1088
|
-
trackingId: import_zod14.z.string(),
|
1089
|
-
registrationNumber: import_zod14.z.string().nullish()
|
1090
|
-
});
|
1091
|
-
var eventMetadataLabelMap = {
|
1092
|
-
"event.assignedTo": {
|
1093
|
-
id: "event.assignedTo.label",
|
1094
|
-
defaultMessage: "Assigned To",
|
1095
|
-
description: "Assigned To"
|
1096
|
-
},
|
1097
|
-
"event.createdAt": {
|
1098
|
-
id: "event.createdAt.label",
|
1099
|
-
defaultMessage: "Created",
|
1100
|
-
description: "Created At"
|
1101
|
-
},
|
1102
|
-
"event.createdAtLocation": {
|
1103
|
-
id: "event.createdAtLocation.label",
|
1104
|
-
defaultMessage: "Location",
|
1105
|
-
description: "Created At Location"
|
1106
|
-
},
|
1107
|
-
"event.updatedAtLocation": {
|
1108
|
-
id: "event.updatedAtLocation.label",
|
1109
|
-
defaultMessage: "Location",
|
1110
|
-
description: "Updated At Location"
|
1111
|
-
},
|
1112
|
-
"event.createdBy": {
|
1113
|
-
id: "event.createdBy.label",
|
1114
|
-
defaultMessage: "Created By",
|
1115
|
-
description: "Created By"
|
1116
|
-
},
|
1117
|
-
"event.id": {
|
1118
|
-
id: "event.id.label",
|
1119
|
-
defaultMessage: "ID",
|
1120
|
-
description: "ID"
|
1121
|
-
},
|
1122
|
-
"event.modifiedAt": {
|
1123
|
-
id: "event.modifiedAt.label",
|
1124
|
-
defaultMessage: "Updated",
|
1125
|
-
description: "Modified At"
|
1126
|
-
},
|
1127
|
-
"event.status": {
|
1128
|
-
id: "event.status.label",
|
1129
|
-
defaultMessage: "Status",
|
1130
|
-
description: "Status"
|
1131
|
-
},
|
1132
|
-
"event.type": {
|
1133
|
-
id: "event.type.label",
|
1134
|
-
defaultMessage: "Type",
|
1135
|
-
description: "Type"
|
1136
|
-
},
|
1137
|
-
"event.updatedBy": {
|
1138
|
-
id: "event.updatedBy.label",
|
1139
|
-
defaultMessage: "Updated By",
|
1140
|
-
description: "Updated By"
|
1141
|
-
},
|
1142
|
-
"event.trackingId": {
|
1143
|
-
id: "event.trackingId.label",
|
1144
|
-
defaultMessage: "Tracking ID",
|
1145
|
-
description: "Tracking ID"
|
1146
|
-
},
|
1147
|
-
"event.registrationNumber": {
|
1148
|
-
id: "event.registrationNumber.label",
|
1149
|
-
defaultMessage: "Registration Number",
|
1150
|
-
description: "Registration Number"
|
1151
|
-
}
|
1152
|
-
};
|
1153
|
-
|
1154
|
-
// ../commons/src/events/WorkqueueConfig.ts
|
1155
|
-
var WorkqueueConfig = import_zod15.z.object({
|
1156
|
-
id: import_zod15.z.string().describe("Unique identifier for workqueue."),
|
1157
|
-
filters: import_zod15.z.array(
|
1158
|
-
import_zod15.z.object({
|
1159
|
-
status: import_zod15.z.array(EventStatuses).describe("Defines which statusese are included in the workqueue.")
|
1160
|
-
})
|
1161
|
-
).describe("Filters to be applied to workqueue.")
|
1162
|
-
}).describe("Configuration for workqueue.");
|
1163
|
-
|
1164
1099
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1165
|
-
var
|
1166
|
-
var AdvancedSearchConfig =
|
1100
|
+
var import_zod14 = require("zod");
|
1101
|
+
var AdvancedSearchConfig = import_zod14.z.object({
|
1167
1102
|
title: TranslationConfig.describe("Advanced search tab title"),
|
1168
|
-
fields:
|
1169
|
-
|
1170
|
-
fieldId:
|
1171
|
-
config:
|
1172
|
-
type:
|
1103
|
+
fields: import_zod14.z.array(
|
1104
|
+
import_zod14.z.object({
|
1105
|
+
fieldId: import_zod14.z.string(),
|
1106
|
+
config: import_zod14.z.object({
|
1107
|
+
type: import_zod14.z.enum(["FUZZY", "EXACT", "RANGE"]).describe("Determines the type of field")
|
1173
1108
|
}).optional().describe("Configuration options for the field")
|
1174
1109
|
})
|
1175
1110
|
).optional().default([]).describe("Advanced search fields.")
|
@@ -1178,139 +1113,13 @@ var AdvancedSearchConfig = import_zod16.z.object({
|
|
1178
1113
|
// ../commons/src/events/utils.ts
|
1179
1114
|
var import_lodash = require("lodash");
|
1180
1115
|
|
1181
|
-
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1182
|
-
var import_zod18 = require("zod");
|
1183
|
-
|
1184
|
-
// ../commons/src/workqueues/defaultColumns.ts
|
1185
|
-
var import_zod17 = require("zod");
|
1186
|
-
var WorkQueueColumnConfig = import_zod17.z.object({
|
1187
|
-
id: import_zod17.z.string(),
|
1188
|
-
label: TranslationConfig
|
1189
|
-
});
|
1190
|
-
var defaultColumns = {
|
1191
|
-
event: {
|
1192
|
-
id: "event",
|
1193
|
-
label: {
|
1194
|
-
defaultMessage: "Event",
|
1195
|
-
description: "This is the label for the workqueue column",
|
1196
|
-
id: "workqueue.default.column.event"
|
1197
|
-
}
|
1198
|
-
},
|
1199
|
-
status: {
|
1200
|
-
id: "status",
|
1201
|
-
label: {
|
1202
|
-
defaultMessage: "Status",
|
1203
|
-
description: "This is the label for the workqueue column",
|
1204
|
-
id: "workqueue.default.column.status"
|
1205
|
-
}
|
1206
|
-
},
|
1207
|
-
createdAt: {
|
1208
|
-
id: "createdAt",
|
1209
|
-
label: {
|
1210
|
-
defaultMessage: "Created",
|
1211
|
-
description: "This is the label for the workqueue column",
|
1212
|
-
id: "workqueue.default.column.createdAt"
|
1213
|
-
}
|
1214
|
-
},
|
1215
|
-
modifiedAt: {
|
1216
|
-
id: "modifiedAt",
|
1217
|
-
label: {
|
1218
|
-
defaultMessage: "Modified",
|
1219
|
-
description: "This is the label for the workqueue column",
|
1220
|
-
id: "workqueue.default.column.modifiedAt"
|
1221
|
-
}
|
1222
|
-
}
|
1223
|
-
};
|
1224
|
-
var DefaultColumnKeys = import_zod17.z.enum(
|
1225
|
-
Object.keys(defaultColumns)
|
1226
|
-
);
|
1227
|
-
|
1228
|
-
// ../commons/src/workqueues/WorkqueueConfig.ts
|
1229
|
-
var rootWorkqueueConfig = import_zod18.z.object({
|
1230
|
-
id: import_zod18.z.string(),
|
1231
|
-
title: TranslationConfig,
|
1232
|
-
columns: import_zod18.z.array(WorkQueueColumnConfig),
|
1233
|
-
defaultColumns: import_zod18.z.array(DefaultColumnKeys)
|
1234
|
-
});
|
1235
|
-
var defineWorkqueue = (config) => rootWorkqueueConfig.parse(config);
|
1236
|
-
|
1237
|
-
// ../commons/src/workqueues/all.ts
|
1238
|
-
var allWorkqueue = defineWorkqueue({
|
1239
|
-
id: "all",
|
1240
|
-
title: {
|
1241
|
-
defaultMessage: "All events",
|
1242
|
-
description: "This is the label for the workqueue",
|
1243
|
-
id: "workqueue.all.label"
|
1244
|
-
},
|
1245
|
-
columns: [
|
1246
|
-
{
|
1247
|
-
id: "title",
|
1248
|
-
label: {
|
1249
|
-
defaultMessage: "Title",
|
1250
|
-
description: "This is the label for the workqueue column",
|
1251
|
-
id: "workqueue.all.column.title"
|
1252
|
-
}
|
1253
|
-
}
|
1254
|
-
],
|
1255
|
-
defaultColumns: ["event", "status", "createdAt", "modifiedAt"]
|
1256
|
-
});
|
1257
|
-
|
1258
|
-
// ../commons/src/workqueues/readyForReview.ts
|
1259
|
-
var inReviewWorkqueue = defineWorkqueue({
|
1260
|
-
id: "ready-for-review",
|
1261
|
-
title: {
|
1262
|
-
defaultMessage: "Ready for review",
|
1263
|
-
description: "Label for in review workqueue",
|
1264
|
-
id: "event.workqueue.in-review.label"
|
1265
|
-
},
|
1266
|
-
columns: [
|
1267
|
-
{
|
1268
|
-
id: "title",
|
1269
|
-
label: {
|
1270
|
-
defaultMessage: "Title",
|
1271
|
-
description: "This is the label for the workqueue column",
|
1272
|
-
id: "workqueue.in-reveiw.column.title"
|
1273
|
-
}
|
1274
|
-
}
|
1275
|
-
],
|
1276
|
-
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1277
|
-
});
|
1278
|
-
|
1279
|
-
// ../commons/src/workqueues/readyToPrint.ts
|
1280
|
-
var registeredWorkqueue = defineWorkqueue({
|
1281
|
-
id: "registered",
|
1282
|
-
title: {
|
1283
|
-
defaultMessage: "Ready to print",
|
1284
|
-
description: "Label for registered workqueue",
|
1285
|
-
id: "event.workqueue.registered.label"
|
1286
|
-
},
|
1287
|
-
columns: [
|
1288
|
-
{
|
1289
|
-
id: "title",
|
1290
|
-
label: {
|
1291
|
-
defaultMessage: "Title",
|
1292
|
-
description: "This is the label for the workqueue column",
|
1293
|
-
id: "workqueue.registered.column.title"
|
1294
|
-
}
|
1295
|
-
}
|
1296
|
-
],
|
1297
|
-
defaultColumns: ["event", "createdAt", "modifiedAt"]
|
1298
|
-
});
|
1299
|
-
|
1300
|
-
// ../commons/src/workqueues/index.ts
|
1301
|
-
var workqueues = {
|
1302
|
-
all: allWorkqueue,
|
1303
|
-
registered: registeredWorkqueue,
|
1304
|
-
inReview: inReviewWorkqueue
|
1305
|
-
};
|
1306
|
-
|
1307
1116
|
// ../commons/src/conditionals/validate.ts
|
1308
1117
|
var import_ajv = __toESM(require("ajv"));
|
1309
1118
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
1310
1119
|
var import_date_fns = require("date-fns");
|
1311
1120
|
|
1312
1121
|
// ../commons/src/events/FieldTypeMapping.ts
|
1313
|
-
var
|
1122
|
+
var import_zod15 = require("zod");
|
1314
1123
|
function mapFieldTypeToZod(type, required) {
|
1315
1124
|
let schema;
|
1316
1125
|
switch (type) {
|
@@ -1363,7 +1172,7 @@ function createValidationSchema(config) {
|
|
1363
1172
|
for (const field2 of config) {
|
1364
1173
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1365
1174
|
}
|
1366
|
-
return
|
1175
|
+
return import_zod15.z.object(shape);
|
1367
1176
|
}
|
1368
1177
|
function mapFieldTypeToMockValue(field2, i) {
|
1369
1178
|
switch (field2.type) {
|
@@ -1772,18 +1581,6 @@ function getActionReview(configuration, actionType) {
|
|
1772
1581
|
function getActionReviewFields(configuration, actionType) {
|
1773
1582
|
return getActionReview(configuration, actionType).fields;
|
1774
1583
|
}
|
1775
|
-
function validateWorkqueueConfig(workqueueConfigs) {
|
1776
|
-
workqueueConfigs.map((workqueue) => {
|
1777
|
-
const rootWorkqueue = Object.values(workqueues).find(
|
1778
|
-
(wq) => wq.id === workqueue.id
|
1779
|
-
);
|
1780
|
-
if (!rootWorkqueue) {
|
1781
|
-
throw new Error(
|
1782
|
-
`Invalid workqueue configuration: workqueue not found with id: ${workqueue.id}`
|
1783
|
-
);
|
1784
|
-
}
|
1785
|
-
});
|
1786
|
-
}
|
1787
1584
|
function isPageVisible(page, formValues) {
|
1788
1585
|
if (!page.conditional) {
|
1789
1586
|
return true;
|
@@ -1855,17 +1652,18 @@ function isWriteAction(actionType) {
|
|
1855
1652
|
}
|
1856
1653
|
|
1857
1654
|
// ../commons/src/events/EventConfig.ts
|
1858
|
-
var
|
1859
|
-
|
1655
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1656
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1657
|
+
var EventConfig = import_zod16.z.object({
|
1658
|
+
id: import_zod16.z.string().describe(
|
1860
1659
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1861
1660
|
),
|
1862
1661
|
summary: SummaryConfig,
|
1863
1662
|
label: TranslationConfig,
|
1864
|
-
actions:
|
1663
|
+
actions: import_zod16.z.array(ActionConfig),
|
1865
1664
|
declaration: DeclarationFormConfig,
|
1866
|
-
|
1867
|
-
|
1868
|
-
advancedSearch: import_zod20.z.array(AdvancedSearchConfig).optional().default([])
|
1665
|
+
deduplication: import_zod16.z.array(DeduplicationConfig).optional().default([]),
|
1666
|
+
advancedSearch: import_zod16.z.array(AdvancedSearchConfig).optional().default([])
|
1869
1667
|
}).superRefine((event2, ctx) => {
|
1870
1668
|
const allFields = findAllFields(event2);
|
1871
1669
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1891,6 +1689,8 @@ var EventConfig = import_zod20.z.object({
|
|
1891
1689
|
path: ["advancedSearch"]
|
1892
1690
|
});
|
1893
1691
|
}
|
1692
|
+
}).openapi({
|
1693
|
+
ref: "EventConfig"
|
1894
1694
|
});
|
1895
1695
|
|
1896
1696
|
// ../commons/src/events/EventConfigInput.ts
|
@@ -1899,269 +1699,312 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
|
|
1899
1699
|
var definePage = (page) => PageConfig.parse(page);
|
1900
1700
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1901
1701
|
|
1702
|
+
// ../commons/src/events/WorkqueueConfig.ts
|
1703
|
+
var import_zod17 = require("zod");
|
1704
|
+
var WorkqueueConfig = import_zod17.z.object({
|
1705
|
+
slug: import_zod17.z.string().describe("Determines the url of the workqueue."),
|
1706
|
+
name: TranslationConfig.describe(
|
1707
|
+
"Title of the workflow (both in navigation and on the page)"
|
1708
|
+
),
|
1709
|
+
/**
|
1710
|
+
* Placeholder untill the following gets merged to develop
|
1711
|
+
* https://github.com/opencrvs/opencrvs-core/blob/5fbe9854a88504a7a13fcc856b3e82594b70c38c/packages/commons/src/events/EventIndex.ts#L92-L93
|
1712
|
+
*/
|
1713
|
+
query: import_zod17.z.string(),
|
1714
|
+
actions: import_zod17.z.array(
|
1715
|
+
import_zod17.z.object({
|
1716
|
+
type: import_zod17.z.string(),
|
1717
|
+
conditionals: import_zod17.z.array(Conditional).optional()
|
1718
|
+
})
|
1719
|
+
)
|
1720
|
+
}).describe("Configuration for workqueue.");
|
1721
|
+
function defineWorkqueue(workqueues) {
|
1722
|
+
return workqueues.map((workqueue) => WorkqueueConfig.parse(workqueue));
|
1723
|
+
}
|
1724
|
+
|
1902
1725
|
// ../commons/src/events/Draft.ts
|
1903
|
-
var
|
1726
|
+
var import_zod20 = require("zod");
|
1904
1727
|
|
1905
1728
|
// ../commons/src/events/ActionDocument.ts
|
1906
|
-
var
|
1907
|
-
var
|
1729
|
+
var import_zod18 = require("zod");
|
1730
|
+
var import_zod_openapi8 = require("zod-openapi");
|
1731
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
1732
|
+
var ActionUpdate = import_zod18.z.record(import_zod18.z.string(), FieldUpdateValue);
|
1908
1733
|
var ActionStatus = {
|
1909
1734
|
Requested: "Requested",
|
1910
1735
|
Accepted: "Accepted",
|
1911
1736
|
Rejected: "Rejected"
|
1912
1737
|
};
|
1913
|
-
var ActionBase =
|
1914
|
-
id:
|
1915
|
-
|
1916
|
-
|
1738
|
+
var ActionBase = import_zod18.z.object({
|
1739
|
+
id: import_zod18.z.string(),
|
1740
|
+
transactionId: import_zod18.z.string(),
|
1741
|
+
createdAt: import_zod18.z.string().datetime(),
|
1742
|
+
createdBy: import_zod18.z.string(),
|
1743
|
+
createdByRole: import_zod18.z.string(),
|
1917
1744
|
declaration: ActionUpdate,
|
1918
1745
|
annotation: ActionUpdate.optional(),
|
1919
|
-
createdAtLocation:
|
1920
|
-
status:
|
1746
|
+
createdAtLocation: import_zod18.z.string(),
|
1747
|
+
status: import_zod18.z.enum([
|
1921
1748
|
ActionStatus.Requested,
|
1922
1749
|
ActionStatus.Accepted,
|
1923
1750
|
ActionStatus.Rejected
|
1924
1751
|
]),
|
1925
1752
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1926
|
-
originalActionId:
|
1753
|
+
originalActionId: import_zod18.z.string().optional()
|
1927
1754
|
});
|
1928
1755
|
var AssignedAction = ActionBase.merge(
|
1929
|
-
|
1930
|
-
type:
|
1931
|
-
assignedTo:
|
1756
|
+
import_zod18.z.object({
|
1757
|
+
type: import_zod18.z.literal(ActionType.ASSIGN),
|
1758
|
+
assignedTo: import_zod18.z.string()
|
1932
1759
|
})
|
1933
1760
|
);
|
1934
1761
|
var UnassignedAction = ActionBase.merge(
|
1935
|
-
|
1936
|
-
type:
|
1937
|
-
assignedTo:
|
1762
|
+
import_zod18.z.object({
|
1763
|
+
type: import_zod18.z.literal(ActionType.UNASSIGN),
|
1764
|
+
assignedTo: import_zod18.z.literal(null)
|
1938
1765
|
})
|
1939
1766
|
);
|
1940
1767
|
var RegisterAction = ActionBase.merge(
|
1941
|
-
|
1942
|
-
type:
|
1943
|
-
registrationNumber:
|
1768
|
+
import_zod18.z.object({
|
1769
|
+
type: import_zod18.z.literal(ActionType.REGISTER),
|
1770
|
+
registrationNumber: import_zod18.z.string().optional()
|
1944
1771
|
})
|
1945
1772
|
);
|
1946
1773
|
var DeclareAction = ActionBase.merge(
|
1947
|
-
|
1948
|
-
type:
|
1774
|
+
import_zod18.z.object({
|
1775
|
+
type: import_zod18.z.literal(ActionType.DECLARE)
|
1949
1776
|
})
|
1950
1777
|
);
|
1951
1778
|
var ValidateAction = ActionBase.merge(
|
1952
|
-
|
1953
|
-
type:
|
1779
|
+
import_zod18.z.object({
|
1780
|
+
type: import_zod18.z.literal(ActionType.VALIDATE)
|
1954
1781
|
})
|
1955
1782
|
);
|
1956
1783
|
var RejectAction = ActionBase.merge(
|
1957
|
-
|
1958
|
-
type:
|
1784
|
+
import_zod18.z.object({
|
1785
|
+
type: import_zod18.z.literal(ActionType.REJECT)
|
1959
1786
|
})
|
1960
1787
|
);
|
1961
1788
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1962
|
-
|
1963
|
-
type:
|
1789
|
+
import_zod18.z.object({
|
1790
|
+
type: import_zod18.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1964
1791
|
})
|
1965
1792
|
);
|
1966
1793
|
var ArchiveAction = ActionBase.merge(
|
1967
|
-
|
1968
|
-
type:
|
1794
|
+
import_zod18.z.object({
|
1795
|
+
type: import_zod18.z.literal(ActionType.ARCHIVE)
|
1969
1796
|
})
|
1970
1797
|
);
|
1971
1798
|
var CreatedAction = ActionBase.merge(
|
1972
|
-
|
1973
|
-
type:
|
1799
|
+
import_zod18.z.object({
|
1800
|
+
type: import_zod18.z.literal(ActionType.CREATE)
|
1974
1801
|
})
|
1975
1802
|
);
|
1976
1803
|
var NotifiedAction = ActionBase.merge(
|
1977
|
-
|
1978
|
-
type:
|
1804
|
+
import_zod18.z.object({
|
1805
|
+
type: import_zod18.z.literal(ActionType.NOTIFY)
|
1979
1806
|
})
|
1980
1807
|
);
|
1981
1808
|
var PrintCertificateAction = ActionBase.merge(
|
1982
|
-
|
1983
|
-
type:
|
1809
|
+
import_zod18.z.object({
|
1810
|
+
type: import_zod18.z.literal(ActionType.PRINT_CERTIFICATE)
|
1984
1811
|
})
|
1985
1812
|
);
|
1986
1813
|
var RequestedCorrectionAction = ActionBase.merge(
|
1987
|
-
|
1988
|
-
type:
|
1814
|
+
import_zod18.z.object({
|
1815
|
+
type: import_zod18.z.literal(ActionType.REQUEST_CORRECTION)
|
1989
1816
|
})
|
1990
1817
|
);
|
1991
1818
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1992
|
-
|
1993
|
-
type:
|
1994
|
-
requestId:
|
1819
|
+
import_zod18.z.object({
|
1820
|
+
type: import_zod18.z.literal(ActionType.APPROVE_CORRECTION),
|
1821
|
+
requestId: import_zod18.z.string()
|
1995
1822
|
})
|
1996
1823
|
);
|
1997
1824
|
var RejectedCorrectionAction = ActionBase.merge(
|
1998
|
-
|
1999
|
-
type:
|
2000
|
-
requestId:
|
1825
|
+
import_zod18.z.object({
|
1826
|
+
type: import_zod18.z.literal(ActionType.REJECT_CORRECTION),
|
1827
|
+
requestId: import_zod18.z.string()
|
2001
1828
|
})
|
2002
1829
|
);
|
2003
1830
|
var ReadAction = ActionBase.merge(
|
2004
|
-
|
2005
|
-
type:
|
1831
|
+
import_zod18.z.object({
|
1832
|
+
type: import_zod18.z.literal(ActionType.READ)
|
2006
1833
|
})
|
2007
1834
|
);
|
2008
|
-
var ActionDocument =
|
2009
|
-
CreatedAction,
|
2010
|
-
ValidateAction,
|
2011
|
-
RejectAction,
|
2012
|
-
MarkAsDuplicateAction,
|
2013
|
-
ArchiveAction,
|
2014
|
-
NotifiedAction,
|
2015
|
-
RegisterAction,
|
2016
|
-
DeclareAction,
|
2017
|
-
AssignedAction,
|
2018
|
-
RequestedCorrectionAction,
|
2019
|
-
ApprovedCorrectionAction,
|
2020
|
-
RejectedCorrectionAction,
|
2021
|
-
UnassignedAction,
|
2022
|
-
PrintCertificateAction,
|
2023
|
-
ReadAction
|
2024
|
-
])
|
1835
|
+
var ActionDocument = import_zod18.z.discriminatedUnion("type", [
|
1836
|
+
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1837
|
+
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1838
|
+
RejectAction.openapi({ ref: "RejectAction" }),
|
1839
|
+
MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
|
1840
|
+
ArchiveAction.openapi({ ref: "ArchiveAction" }),
|
1841
|
+
NotifiedAction.openapi({ ref: "NotifiedAction" }),
|
1842
|
+
RegisterAction.openapi({ ref: "RegisterAction" }),
|
1843
|
+
DeclareAction.openapi({ ref: "DeclareAction" }),
|
1844
|
+
AssignedAction.openapi({ ref: "AssignedAction" }),
|
1845
|
+
RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
|
1846
|
+
ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
|
1847
|
+
RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
|
1848
|
+
UnassignedAction.openapi({ ref: "UnassignedAction" }),
|
1849
|
+
PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
|
1850
|
+
ReadAction.openapi({ ref: "ReadAction" })
|
1851
|
+
]).openapi({
|
1852
|
+
ref: "ActionDocument"
|
1853
|
+
});
|
2025
1854
|
var AsyncRejectActionDocument = ActionBase.omit({
|
2026
1855
|
declaration: true,
|
2027
1856
|
annotation: true,
|
2028
1857
|
createdBy: true,
|
1858
|
+
createdByRole: true,
|
2029
1859
|
createdAtLocation: true
|
2030
1860
|
}).merge(
|
2031
|
-
|
2032
|
-
type:
|
2033
|
-
status:
|
1861
|
+
import_zod18.z.object({
|
1862
|
+
type: import_zod18.z.enum(ConfirmableActions),
|
1863
|
+
status: import_zod18.z.literal(ActionStatus.Rejected)
|
2034
1864
|
})
|
2035
1865
|
);
|
2036
|
-
var Action =
|
2037
|
-
var ResolvedUser =
|
2038
|
-
id:
|
2039
|
-
role:
|
2040
|
-
name:
|
2041
|
-
|
2042
|
-
use:
|
2043
|
-
given:
|
2044
|
-
family:
|
1866
|
+
var Action = import_zod18.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1867
|
+
var ResolvedUser = import_zod18.z.object({
|
1868
|
+
id: import_zod18.z.string(),
|
1869
|
+
role: import_zod18.z.string(),
|
1870
|
+
name: import_zod18.z.array(
|
1871
|
+
import_zod18.z.object({
|
1872
|
+
use: import_zod18.z.string(),
|
1873
|
+
given: import_zod18.z.array(import_zod18.z.string()),
|
1874
|
+
family: import_zod18.z.string()
|
2045
1875
|
})
|
2046
1876
|
)
|
2047
1877
|
});
|
2048
1878
|
|
2049
1879
|
// ../commons/src/events/ActionInput.ts
|
2050
|
-
var
|
2051
|
-
var
|
2052
|
-
|
2053
|
-
|
1880
|
+
var import_zod19 = require("zod");
|
1881
|
+
var import_zod_openapi9 = require("zod-openapi");
|
1882
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod19.z);
|
1883
|
+
var BaseActionInput = import_zod19.z.object({
|
1884
|
+
eventId: import_zod19.z.string(),
|
1885
|
+
transactionId: import_zod19.z.string(),
|
2054
1886
|
declaration: ActionUpdate.default({}),
|
2055
1887
|
annotation: ActionUpdate.optional(),
|
2056
|
-
originalActionId:
|
2057
|
-
keepAssignment:
|
1888
|
+
originalActionId: import_zod19.z.string().optional(),
|
1889
|
+
keepAssignment: import_zod19.z.boolean().optional()
|
2058
1890
|
});
|
2059
1891
|
var CreateActionInput = BaseActionInput.merge(
|
2060
|
-
|
2061
|
-
type:
|
2062
|
-
createdAtLocation:
|
1892
|
+
import_zod19.z.object({
|
1893
|
+
type: import_zod19.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
1894
|
+
createdAtLocation: import_zod19.z.string()
|
2063
1895
|
})
|
2064
1896
|
);
|
2065
1897
|
var RegisterActionInput = BaseActionInput.merge(
|
2066
|
-
|
2067
|
-
type:
|
2068
|
-
registrationNumber:
|
1898
|
+
import_zod19.z.object({
|
1899
|
+
type: import_zod19.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
1900
|
+
registrationNumber: import_zod19.z.string().optional()
|
2069
1901
|
})
|
2070
1902
|
);
|
2071
1903
|
var ValidateActionInput = BaseActionInput.merge(
|
2072
|
-
|
2073
|
-
type:
|
2074
|
-
duplicates:
|
1904
|
+
import_zod19.z.object({
|
1905
|
+
type: import_zod19.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
1906
|
+
duplicates: import_zod19.z.array(import_zod19.z.string())
|
2075
1907
|
})
|
2076
1908
|
);
|
2077
1909
|
var NotifyActionInput = BaseActionInput.merge(
|
2078
|
-
|
2079
|
-
type:
|
1910
|
+
import_zod19.z.object({
|
1911
|
+
type: import_zod19.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2080
1912
|
})
|
2081
1913
|
);
|
2082
1914
|
var DeclareActionInput = BaseActionInput.merge(
|
2083
|
-
|
2084
|
-
type:
|
1915
|
+
import_zod19.z.object({
|
1916
|
+
type: import_zod19.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2085
1917
|
})
|
2086
1918
|
);
|
2087
1919
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
2088
|
-
|
2089
|
-
type:
|
1920
|
+
import_zod19.z.object({
|
1921
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2090
1922
|
})
|
2091
1923
|
);
|
2092
1924
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2093
|
-
|
2094
|
-
type:
|
1925
|
+
import_zod19.z.object({
|
1926
|
+
type: import_zod19.z.literal(ActionType.REJECT).default(ActionType.REJECT)
|
2095
1927
|
})
|
2096
1928
|
);
|
2097
1929
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2098
|
-
|
2099
|
-
type:
|
1930
|
+
import_zod19.z.object({
|
1931
|
+
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2100
1932
|
})
|
2101
1933
|
);
|
2102
1934
|
var ArchiveActionInput = BaseActionInput.merge(
|
2103
|
-
|
2104
|
-
type:
|
1935
|
+
import_zod19.z.object({
|
1936
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
2105
1937
|
})
|
2106
1938
|
);
|
2107
1939
|
var AssignActionInput = BaseActionInput.merge(
|
2108
|
-
|
2109
|
-
type:
|
2110
|
-
assignedTo:
|
1940
|
+
import_zod19.z.object({
|
1941
|
+
type: import_zod19.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
1942
|
+
assignedTo: import_zod19.z.string()
|
2111
1943
|
})
|
2112
1944
|
);
|
2113
1945
|
var UnassignActionInput = BaseActionInput.merge(
|
2114
|
-
|
2115
|
-
type:
|
2116
|
-
assignedTo:
|
1946
|
+
import_zod19.z.object({
|
1947
|
+
type: import_zod19.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
1948
|
+
assignedTo: import_zod19.z.literal(null).default(null)
|
2117
1949
|
})
|
2118
1950
|
);
|
2119
1951
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2120
|
-
|
2121
|
-
type:
|
1952
|
+
import_zod19.z.object({
|
1953
|
+
type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2122
1954
|
})
|
2123
1955
|
);
|
2124
1956
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2125
|
-
|
2126
|
-
requestId:
|
2127
|
-
type:
|
1957
|
+
import_zod19.z.object({
|
1958
|
+
requestId: import_zod19.z.string(),
|
1959
|
+
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2128
1960
|
})
|
2129
1961
|
);
|
2130
1962
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2131
|
-
|
2132
|
-
requestId:
|
2133
|
-
type:
|
1963
|
+
import_zod19.z.object({
|
1964
|
+
requestId: import_zod19.z.string(),
|
1965
|
+
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2134
1966
|
})
|
2135
1967
|
);
|
2136
1968
|
var ReadActionInput = BaseActionInput.merge(
|
2137
|
-
|
2138
|
-
type:
|
1969
|
+
import_zod19.z.object({
|
1970
|
+
type: import_zod19.z.literal(ActionType.READ).default(ActionType.READ)
|
2139
1971
|
})
|
2140
1972
|
);
|
2141
|
-
var
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
1973
|
+
var DeleteActionInput = import_zod19.z.object({ eventId: import_zod19.z.string() });
|
1974
|
+
var ActionInput = import_zod19.z.discriminatedUnion("type", [
|
1975
|
+
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
1976
|
+
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
1977
|
+
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
1978
|
+
NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
|
1979
|
+
DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
|
1980
|
+
RejectDeclarationActionInput.openapi({
|
1981
|
+
ref: "RejectDeclarationActionInput"
|
1982
|
+
}),
|
1983
|
+
MarkedAsDuplicateActionInput.openapi({
|
1984
|
+
ref: "MarkedAsDuplicateActionInput"
|
1985
|
+
}),
|
1986
|
+
ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
|
1987
|
+
AssignActionInput.openapi({ ref: "AssignActionInput" }),
|
1988
|
+
UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
|
1989
|
+
PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
|
1990
|
+
RequestCorrectionActionInput.openapi({
|
1991
|
+
ref: "RequestCorrectionActionInput"
|
1992
|
+
}),
|
1993
|
+
RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
|
1994
|
+
ApproveCorrectionActionInput.openapi({
|
1995
|
+
ref: "ApproveCorrectionActionInput"
|
1996
|
+
}),
|
1997
|
+
ReadActionInput.openapi({ ref: "ReadActionInput" })
|
1998
|
+
]).openapi({
|
1999
|
+
ref: "ActionInput"
|
2000
|
+
});
|
2158
2001
|
|
2159
2002
|
// ../commons/src/events/Draft.ts
|
2160
|
-
var Draft =
|
2161
|
-
id:
|
2162
|
-
eventId:
|
2163
|
-
transactionId:
|
2164
|
-
createdAt:
|
2003
|
+
var Draft = import_zod20.z.object({
|
2004
|
+
id: import_zod20.z.string(),
|
2005
|
+
eventId: import_zod20.z.string(),
|
2006
|
+
transactionId: import_zod20.z.string(),
|
2007
|
+
createdAt: import_zod20.z.string().datetime(),
|
2165
2008
|
action: ActionBase.extend({
|
2166
2009
|
type: ActionTypes
|
2167
2010
|
}).omit({ id: true })
|
@@ -2170,33 +2013,132 @@ var DraftInput = BaseActionInput.extend({
|
|
2170
2013
|
type: ActionTypes
|
2171
2014
|
});
|
2172
2015
|
|
2016
|
+
// ../commons/src/events/EventMetadata.ts
|
2017
|
+
var import_zod21 = require("zod");
|
2018
|
+
var EventStatus = {
|
2019
|
+
CREATED: "CREATED",
|
2020
|
+
NOTIFIED: "NOTIFIED",
|
2021
|
+
DECLARED: "DECLARED",
|
2022
|
+
VALIDATED: "VALIDATED",
|
2023
|
+
REGISTERED: "REGISTERED",
|
2024
|
+
CERTIFIED: "CERTIFIED",
|
2025
|
+
REJECTED: "REJECTED",
|
2026
|
+
ARCHIVED: "ARCHIVED"
|
2027
|
+
};
|
2028
|
+
var eventStatuses = Object.values(EventStatus);
|
2029
|
+
var EventStatuses = import_zod21.z.nativeEnum(EventStatus);
|
2030
|
+
var EventMetadata = import_zod21.z.object({
|
2031
|
+
id: import_zod21.z.string(),
|
2032
|
+
type: import_zod21.z.string(),
|
2033
|
+
status: EventStatuses,
|
2034
|
+
createdAt: import_zod21.z.string().datetime(),
|
2035
|
+
createdBy: import_zod21.z.string(),
|
2036
|
+
updatedByUserRole: import_zod21.z.string(),
|
2037
|
+
createdAtLocation: import_zod21.z.string(),
|
2038
|
+
updatedAtLocation: import_zod21.z.string(),
|
2039
|
+
modifiedAt: import_zod21.z.string().datetime(),
|
2040
|
+
assignedTo: import_zod21.z.string().nullish(),
|
2041
|
+
updatedBy: import_zod21.z.string(),
|
2042
|
+
trackingId: import_zod21.z.string(),
|
2043
|
+
registrationNumber: import_zod21.z.string().nullish()
|
2044
|
+
});
|
2045
|
+
var eventMetadataLabelMap = {
|
2046
|
+
"event.assignedTo": {
|
2047
|
+
id: "event.assignedTo.label",
|
2048
|
+
defaultMessage: "Assigned To",
|
2049
|
+
description: "Assigned To"
|
2050
|
+
},
|
2051
|
+
"event.createdAt": {
|
2052
|
+
id: "event.createdAt.label",
|
2053
|
+
defaultMessage: "Created",
|
2054
|
+
description: "Created At"
|
2055
|
+
},
|
2056
|
+
"event.createdAtLocation": {
|
2057
|
+
id: "event.createdAtLocation.label",
|
2058
|
+
defaultMessage: "Location",
|
2059
|
+
description: "Created At Location"
|
2060
|
+
},
|
2061
|
+
"event.updatedAtLocation": {
|
2062
|
+
id: "event.updatedAtLocation.label",
|
2063
|
+
defaultMessage: "Location",
|
2064
|
+
description: "Updated At Location"
|
2065
|
+
},
|
2066
|
+
"event.createdBy": {
|
2067
|
+
id: "event.createdBy.label",
|
2068
|
+
defaultMessage: "Created By",
|
2069
|
+
description: "Created By"
|
2070
|
+
},
|
2071
|
+
"event.updatedByUserRole": {
|
2072
|
+
id: "event.updatedByUserRole.label",
|
2073
|
+
defaultMessage: "Updated By Role",
|
2074
|
+
description: "Updated By Role"
|
2075
|
+
},
|
2076
|
+
"event.id": {
|
2077
|
+
id: "event.id.label",
|
2078
|
+
defaultMessage: "ID",
|
2079
|
+
description: "ID"
|
2080
|
+
},
|
2081
|
+
"event.modifiedAt": {
|
2082
|
+
id: "event.modifiedAt.label",
|
2083
|
+
defaultMessage: "Updated",
|
2084
|
+
description: "Modified At"
|
2085
|
+
},
|
2086
|
+
"event.status": {
|
2087
|
+
id: "event.status.label",
|
2088
|
+
defaultMessage: "Status",
|
2089
|
+
description: "Status"
|
2090
|
+
},
|
2091
|
+
"event.type": {
|
2092
|
+
id: "event.type.label",
|
2093
|
+
defaultMessage: "Type",
|
2094
|
+
description: "Type"
|
2095
|
+
},
|
2096
|
+
"event.updatedBy": {
|
2097
|
+
id: "event.updatedBy.label",
|
2098
|
+
defaultMessage: "Updated By",
|
2099
|
+
description: "Updated By"
|
2100
|
+
},
|
2101
|
+
"event.trackingId": {
|
2102
|
+
id: "event.trackingId.label",
|
2103
|
+
defaultMessage: "Tracking ID",
|
2104
|
+
description: "Tracking ID"
|
2105
|
+
},
|
2106
|
+
"event.registrationNumber": {
|
2107
|
+
id: "event.registrationNumber.label",
|
2108
|
+
defaultMessage: "Registration Number",
|
2109
|
+
description: "Registration Number"
|
2110
|
+
}
|
2111
|
+
};
|
2112
|
+
|
2173
2113
|
// ../commons/src/events/EventInput.ts
|
2174
|
-
var
|
2175
|
-
var EventInput =
|
2176
|
-
transactionId:
|
2177
|
-
type:
|
2114
|
+
var import_zod22 = require("zod");
|
2115
|
+
var EventInput = import_zod22.z.object({
|
2116
|
+
transactionId: import_zod22.z.string(),
|
2117
|
+
type: import_zod22.z.string()
|
2178
2118
|
});
|
2179
2119
|
|
2180
2120
|
// ../commons/src/events/EventDocument.ts
|
2181
|
-
var
|
2182
|
-
var
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2121
|
+
var import_zod23 = require("zod");
|
2122
|
+
var import_zod_openapi10 = require("zod-openapi");
|
2123
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod23.z);
|
2124
|
+
var EventDocument = import_zod23.z.object({
|
2125
|
+
id: import_zod23.z.string(),
|
2126
|
+
type: import_zod23.z.string(),
|
2127
|
+
createdAt: import_zod23.z.string().datetime(),
|
2128
|
+
updatedAt: import_zod23.z.string().datetime(),
|
2129
|
+
updatedAtLocation: import_zod23.z.string(),
|
2130
|
+
actions: import_zod23.z.array(Action),
|
2131
|
+
trackingId: import_zod23.z.string()
|
2132
|
+
}).openapi({ ref: "EventDocument" });
|
2191
2133
|
|
2192
2134
|
// ../commons/src/events/EventIndex.ts
|
2193
|
-
var
|
2135
|
+
var import_zod24 = require("zod");
|
2194
2136
|
var EventIndex = EventMetadata.extend({
|
2195
|
-
declaration:
|
2137
|
+
declaration: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any())
|
2196
2138
|
});
|
2197
|
-
var EventSearchIndex =
|
2198
|
-
|
2199
|
-
type:
|
2139
|
+
var EventSearchIndex = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.any()).and(
|
2140
|
+
import_zod24.z.object({
|
2141
|
+
type: import_zod24.z.string()
|
2200
2142
|
// Ensures "type" (event-id) exists and is a string
|
2201
2143
|
})
|
2202
2144
|
);
|
@@ -2238,6 +2180,18 @@ function getStatusFromActions(actions) {
|
|
2238
2180
|
}
|
2239
2181
|
}, EventStatus.CREATED);
|
2240
2182
|
}
|
2183
|
+
function getLastUpdatedByUserRoleFromActions(actions) {
|
2184
|
+
const actionsWithRoles = actions.filter(
|
2185
|
+
(action) => !isWriteAction(action.type) && action.status !== ActionStatus.Rejected
|
2186
|
+
).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2187
|
+
const lastAction = actionsWithRoles.at(-1);
|
2188
|
+
if (!lastAction) {
|
2189
|
+
throw new Error(
|
2190
|
+
"Should never happen, at least CREATE action should be present"
|
2191
|
+
);
|
2192
|
+
}
|
2193
|
+
return ActionDocument.parse(lastAction).createdByRole;
|
2194
|
+
}
|
2241
2195
|
function getAssignedUserFromActions(actions) {
|
2242
2196
|
return actions.reduce((user2, action) => {
|
2243
2197
|
if (action.type === ActionType.ASSIGN) {
|
@@ -2318,7 +2272,8 @@ function getCurrentEventState(event2) {
|
|
2318
2272
|
updatedAtLocation: event2.updatedAtLocation,
|
2319
2273
|
declaration: aggregateActionDeclarations(activeActions),
|
2320
2274
|
trackingId: event2.trackingId,
|
2321
|
-
registrationNumber
|
2275
|
+
registrationNumber,
|
2276
|
+
updatedByUserRole: getLastUpdatedByUserRoleFromActions(event2.actions)
|
2322
2277
|
});
|
2323
2278
|
}
|
2324
2279
|
function getCurrentEventStateWithDrafts(event2, drafts) {
|
@@ -2366,7 +2321,7 @@ function getAnnotationFromDrafts(drafts) {
|
|
2366
2321
|
function getActionAnnotation({
|
2367
2322
|
event: event2,
|
2368
2323
|
actionType,
|
2369
|
-
drafts
|
2324
|
+
drafts = []
|
2370
2325
|
}) {
|
2371
2326
|
const activeActions = getAcceptedActions(event2);
|
2372
2327
|
const action = activeActions.find(
|
@@ -2385,7 +2340,6 @@ function getActionAnnotation({
|
|
2385
2340
|
|
2386
2341
|
// ../commons/src/events/defineConfig.ts
|
2387
2342
|
var defineConfig = (config) => {
|
2388
|
-
validateWorkqueueConfig(config.workqueues);
|
2389
2343
|
const input = EventConfig.parse(config);
|
2390
2344
|
return input;
|
2391
2345
|
};
|
@@ -3662,28 +3616,6 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3662
3616
|
}
|
3663
3617
|
]
|
3664
3618
|
},
|
3665
|
-
workqueues: [
|
3666
|
-
{
|
3667
|
-
id: "all",
|
3668
|
-
filters: []
|
3669
|
-
},
|
3670
|
-
{
|
3671
|
-
id: "ready-for-review",
|
3672
|
-
filters: [
|
3673
|
-
{
|
3674
|
-
status: ["DECLARED"]
|
3675
|
-
}
|
3676
|
-
]
|
3677
|
-
},
|
3678
|
-
{
|
3679
|
-
id: "registered",
|
3680
|
-
filters: [
|
3681
|
-
{
|
3682
|
-
status: ["REGISTERED"]
|
3683
|
-
}
|
3684
|
-
]
|
3685
|
-
}
|
3686
|
-
],
|
3687
3619
|
actions: [
|
3688
3620
|
{
|
3689
3621
|
type: ActionType.DECLARE,
|
@@ -4062,6 +3994,7 @@ var eventPayloadGenerator = {
|
|
4062
3994
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4063
3995
|
transactionId: getUUID(),
|
4064
3996
|
action: {
|
3997
|
+
transactionId: getUUID(),
|
4065
3998
|
type: actionType,
|
4066
3999
|
status: ActionStatus.Accepted,
|
4067
4000
|
declaration: {
|
@@ -4076,6 +4009,7 @@ var eventPayloadGenerator = {
|
|
4076
4009
|
},
|
4077
4010
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4078
4011
|
createdBy: "@todo",
|
4012
|
+
createdByRole: "@todo",
|
4079
4013
|
createdAtLocation: "@todo"
|
4080
4014
|
}
|
4081
4015
|
},
|
@@ -4237,12 +4171,14 @@ function generateActionDocument({
|
|
4237
4171
|
// @TODO: This should be fixed in the future.
|
4238
4172
|
createdAt: new Date(Date.now() - 500).toISOString(),
|
4239
4173
|
createdBy: getUUID(),
|
4174
|
+
createdByRole: "FIELD_AGENT",
|
4240
4175
|
id: getUUID(),
|
4241
4176
|
createdAtLocation: "TODO",
|
4242
4177
|
declaration: generateActionDeclarationInput(configuration, action),
|
4243
4178
|
annotation: {},
|
4244
4179
|
...defaults,
|
4245
|
-
status: ActionStatus.Accepted
|
4180
|
+
status: ActionStatus.Accepted,
|
4181
|
+
transactionId: getUUID()
|
4246
4182
|
};
|
4247
4183
|
switch (action) {
|
4248
4184
|
case ActionType.READ:
|
@@ -4334,6 +4270,7 @@ var eventQueryDataGenerator = (overrides = {}) => ({
|
|
4334
4270
|
modifiedAt: overrides.modifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
4335
4271
|
assignedTo: overrides.assignedTo ?? null,
|
4336
4272
|
updatedBy: overrides.updatedBy ?? getUUID(),
|
4273
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
4337
4274
|
declaration: overrides.declaration ?? {
|
4338
4275
|
"recommender.none": true,
|
4339
4276
|
"applicant.firstname": "Danny",
|