@opencrvs/toolkit 1.8.0-rc.ff0b26c → 1.8.0-rc.ff1f8e0

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.
Files changed (34) hide show
  1. package/dist/commons/api/router.d.ts +2356 -1097
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -6
  3. package/dist/commons/events/ActionConfig.d.ts +15774 -7797
  4. package/dist/commons/events/ActionDocument.d.ts +533 -346
  5. package/dist/commons/events/ActionInput.d.ts +197 -125
  6. package/dist/commons/events/Constants.d.ts +2 -0
  7. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  8. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  9. package/dist/commons/events/Draft.d.ts +29 -24
  10. package/dist/commons/events/EventConfig.d.ts +13649 -9488
  11. package/dist/commons/events/EventDocument.d.ts +386 -267
  12. package/dist/commons/events/EventIndex.d.ts +209 -605
  13. package/dist/commons/events/EventInput.d.ts +0 -13
  14. package/dist/commons/events/EventMetadata.d.ts +71 -48
  15. package/dist/commons/events/FieldConfig.d.ts +486 -440
  16. package/dist/commons/events/FieldTypeMapping.d.ts +5 -2
  17. package/dist/commons/events/FieldValue.d.ts +2 -0
  18. package/dist/commons/events/FormConfig.d.ts +3346 -3052
  19. package/dist/commons/events/PageConfig.d.ts +750 -680
  20. package/dist/commons/events/User.d.ts +31 -7
  21. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  22. package/dist/commons/events/WorkqueueConfig.d.ts +3460 -485
  23. package/dist/commons/events/defineConfig.d.ts +1381 -575
  24. package/dist/commons/events/event.d.ts +2 -2
  25. package/dist/commons/events/field.d.ts +4 -13
  26. package/dist/commons/events/index.d.ts +4 -0
  27. package/dist/commons/events/serializer.d.ts +2 -0
  28. package/dist/commons/events/test.utils.d.ts +26 -5
  29. package/dist/commons/events/transactions.d.ts +1 -1
  30. package/dist/commons/events/utils.d.ts +333 -296
  31. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  32. package/dist/conditionals/index.js +28 -8
  33. package/dist/events/index.js +1564 -584
  34. package/package.json +1 -1
@@ -50,11 +50,14 @@ __export(events_exports, {
50
50
  AddressType: () => AddressType,
51
51
  AdministrativeAreas: () => AdministrativeAreas,
52
52
  AdvancedSearchConfig: () => AdvancedSearchConfig,
53
+ AnyOf: () => AnyOf,
54
+ AnyOfStatus: () => AnyOfStatus,
53
55
  ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
54
56
  ArchiveActionInput: () => ArchiveActionInput,
55
57
  AssignActionInput: () => AssignActionInput,
56
58
  AsyncRejectActionDocument: () => AsyncRejectActionDocument,
57
59
  BaseActionInput: () => BaseActionInput,
60
+ BearerTokenByUserType: () => BearerTokenByUserType,
58
61
  CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
59
62
  CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
60
63
  CertificateConfig: () => CertificateConfig,
@@ -68,6 +71,7 @@ __export(events_exports, {
68
71
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
69
72
  DataEntry: () => DataEntry,
70
73
  DataFieldValue: () => DataFieldValue,
74
+ DateCondition: () => DateCondition,
71
75
  DateRangeFieldValue: () => DateRangeFieldValue,
72
76
  DateValue: () => DateValue,
73
77
  DatetimeValue: () => DatetimeValue,
@@ -93,15 +97,18 @@ __export(events_exports, {
93
97
  EventInput: () => EventInput,
94
98
  EventMetadata: () => EventMetadata,
95
99
  EventMetadataKeys: () => EventMetadataKeys,
96
- EventMetadataParameter: () => EventMetadataParameter,
100
+ EventMetadataKeysArray: () => EventMetadataKeysArray,
97
101
  EventSearchIndex: () => EventSearchIndex,
98
102
  EventState: () => EventState,
99
103
  EventStatus: () => EventStatus,
100
104
  EventStatusEnum: () => EventStatusEnum,
101
105
  EventStatuses: () => EventStatuses,
106
+ Exact: () => Exact,
107
+ ExactStatus: () => ExactStatus,
102
108
  FieldConditional: () => FieldConditional,
103
109
  FieldConfig: () => FieldConfig,
104
110
  FieldConfigSchema: () => FieldConfigSchema,
111
+ FieldReference: () => FieldReference,
105
112
  FieldType: () => FieldType,
106
113
  FieldUpdateValue: () => FieldUpdateValue,
107
114
  FieldValue: () => FieldValue,
@@ -111,6 +118,7 @@ __export(events_exports, {
111
118
  Flag: () => Flag,
112
119
  FormConfig: () => FormConfig,
113
120
  FormPageConfig: () => FormPageConfig,
121
+ Fuzzy: () => Fuzzy,
114
122
  GenericAddressUpdateValue: () => GenericAddressUpdateValue,
115
123
  GenericAddressValue: () => GenericAddressValue,
116
124
  GeographicalArea: () => GeographicalArea,
@@ -120,19 +128,23 @@ __export(events_exports, {
120
128
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
121
129
  MimeType: () => MimeType,
122
130
  NonEmptyTextValue: () => NonEmptyTextValue,
131
+ Not: () => Not,
123
132
  NotifyActionInput: () => NotifyActionInput,
124
133
  NumberFieldValue: () => NumberFieldValue,
125
134
  PageConfig: () => PageConfig,
126
135
  PageTypes: () => PageTypes,
127
136
  PrintCertificateActionInput: () => PrintCertificateActionInput,
137
+ QueryExpression: () => QueryExpression,
128
138
  QueryInput: () => QueryInput,
129
139
  QueryType: () => QueryType,
140
+ Range: () => Range,
130
141
  ReadActionInput: () => ReadActionInput,
131
142
  RegisterAction: () => RegisterAction,
132
143
  RegisterActionInput: () => RegisterActionInput,
133
144
  RegistrationCreationMetadata: () => RegistrationCreationMetadata,
134
145
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
135
146
  RejectDeclarationActionInput: () => RejectDeclarationActionInput,
147
+ RejectionReason: () => RejectionReason,
136
148
  RequestCorrectionActionInput: () => RequestCorrectionActionInput,
137
149
  ResolvedUser: () => ResolvedUser,
138
150
  RuralAddressUpdateValue: () => RuralAddressUpdateValue,
@@ -141,16 +153,27 @@ __export(events_exports, {
141
153
  SearchQueryParams: () => SearchQueryParams,
142
154
  SelectOption: () => SelectOption,
143
155
  ShowConditional: () => ShowConditional,
156
+ SignatureFieldValue: () => SignatureFieldValue,
144
157
  SummaryConfig: () => SummaryConfig,
158
+ TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
145
159
  TextValue: () => TextValue,
146
160
  TranslationConfig: () => TranslationConfig,
147
161
  UnassignActionInput: () => UnassignActionInput,
148
162
  UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
149
163
  UrbanAddressValue: () => UrbanAddressValue,
164
+ User: () => User,
150
165
  ValidateActionInput: () => ValidateActionInput,
151
166
  VerificationActionConfig: () => VerificationActionConfig,
152
167
  VerificationPageConfig: () => VerificationPageConfig,
168
+ Within: () => Within,
169
+ WorkqueueColumn: () => WorkqueueColumn,
170
+ WorkqueueColumnKeys: () => WorkqueueColumnKeys,
171
+ WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
172
+ WorkqueueColumnValue: () => WorkqueueColumnValue,
153
173
  WorkqueueConfig: () => WorkqueueConfig,
174
+ WorkqueueConfigInput: () => WorkqueueConfigInput,
175
+ WorkqueueCountInput: () => WorkqueueCountInput,
176
+ WorkqueueCountOutput: () => WorkqueueCountOutput,
154
177
  ZodDate: () => ZodDate,
155
178
  alwaysTrue: () => alwaysTrue,
156
179
  and: () => and,
@@ -161,9 +184,12 @@ __export(events_exports, {
161
184
  createEmptyDraft: () => createEmptyDraft,
162
185
  createEventConditionals: () => createEventConditionals,
163
186
  createFieldConditionals: () => createFieldConditionals,
187
+ createPseudoRandomNumberGenerator: () => createPseudoRandomNumberGenerator,
164
188
  createValidationSchema: () => createValidationSchema,
189
+ dateOfEventColumn: () => dateOfEventColumn,
165
190
  deepDropNulls: () => deepDropNulls,
166
191
  deepMerge: () => deepMerge,
192
+ defaultWorkqueueColumns: () => defaultWorkqueueColumns,
167
193
  defineActionForm: () => defineActionForm,
168
194
  defineConditional: () => defineConditional,
169
195
  defineConfig: () => defineConfig,
@@ -172,6 +198,9 @@ __export(events_exports, {
172
198
  defineFormPage: () => defineFormPage,
173
199
  definePage: () => definePage,
174
200
  defineWorkqueue: () => defineWorkqueue,
201
+ defineWorkqueues: () => defineWorkqueues,
202
+ defineWorkqueuesColumns: () => defineWorkqueuesColumns,
203
+ deserializeQuery: () => deserializeQuery,
175
204
  errorMessages: () => errorMessages,
176
205
  event: () => event,
177
206
  eventMetadataLabelMap: () => eventMetadataLabelMap,
@@ -190,8 +219,10 @@ __export(events_exports, {
190
219
  generateActionDocument: () => generateActionDocument,
191
220
  generateEventDocument: () => generateEventDocument,
192
221
  generateEventDraftDocument: () => generateEventDraftDocument,
222
+ generateRandomSignature: () => generateRandomSignature,
193
223
  generateTransactionId: () => generateTransactionId,
194
224
  generateTranslationConfig: () => generateTranslationConfig,
225
+ generateWorkqueues: () => generateWorkqueues,
195
226
  getAcceptedActions: () => getAcceptedActions,
196
227
  getActionAnnotation: () => getActionAnnotation,
197
228
  getActionAnnotationFields: () => getActionAnnotationFields,
@@ -200,6 +231,7 @@ __export(events_exports, {
200
231
  getActionVerificationPageIds: () => getActionVerificationPageIds,
201
232
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
202
233
  getAssignedUserFromActions: () => getAssignedUserFromActions,
234
+ getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
203
235
  getCurrentEventState: () => getCurrentEventState,
204
236
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
205
237
  getDeclaration: () => getDeclaration,
@@ -207,6 +239,7 @@ __export(events_exports, {
207
239
  getDeclarationPages: () => getDeclarationPages,
208
240
  getMixedPath: () => getMixedPath,
209
241
  getRandomDatetime: () => getRandomDatetime,
242
+ getStatusFromActions: () => getStatusFromActions,
210
243
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
211
244
  hasAnyOfScopes: () => hasAnyOfScopes,
212
245
  isAddressFieldType: () => isAddressFieldType,
@@ -230,6 +263,7 @@ __export(events_exports, {
230
263
  isFileFieldType: () => isFileFieldType,
231
264
  isFileFieldWithOptionType: () => isFileFieldWithOptionType,
232
265
  isLocationFieldType: () => isLocationFieldType,
266
+ isNonInteractiveFieldType: () => isNonInteractiveFieldType,
233
267
  isNumberFieldType: () => isNumberFieldType,
234
268
  isOfficeFieldType: () => isOfficeFieldType,
235
269
  isPageHeaderFieldType: () => isPageHeaderFieldType,
@@ -261,6 +295,9 @@ __export(events_exports, {
261
295
  });
262
296
  module.exports = __toCommonJS(events_exports);
263
297
 
298
+ // ../commons/src/events/Constants.ts
299
+ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
300
+
264
301
  // ../commons/src/events/ActionConfig.ts
265
302
  var import_zod9 = require("zod");
266
303
 
@@ -463,6 +500,7 @@ var EmailValue = import_zod4.z.string().email();
463
500
  var CheckboxFieldValue = import_zod4.z.boolean();
464
501
  var NumberFieldValue = import_zod4.z.number();
465
502
  var DataFieldValue = import_zod4.z.undefined();
503
+ var SignatureFieldValue = import_zod4.z.string();
466
504
  var FieldValue = import_zod4.z.union([
467
505
  TextValue,
468
506
  DateValue,
@@ -493,19 +531,13 @@ var FieldUpdateValue = import_zod4.z.union([
493
531
  // ../commons/src/events/FieldConfig.ts
494
532
  var import_zod_openapi3 = require("zod-openapi");
495
533
  (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
496
- var FieldId = import_zod5.z.string();
497
- var ParentReference = import_zod5.z.object({
498
- _fieldId: FieldId.optional()
499
- }).optional();
534
+ var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
535
+ var FieldReference = import_zod5.z.object({
536
+ $$field: FieldId
537
+ }).describe("Reference to a field by its ID");
538
+ var ParentReference = FieldReference.optional();
500
539
  var BaseField = import_zod5.z.object({
501
540
  id: FieldId,
502
- defaultValue: import_zod5.z.union([
503
- TextValue,
504
- NonEmptyTextValue,
505
- DateValue,
506
- NumberFieldValue,
507
- CheckboxFieldValue
508
- ]).optional(),
509
541
  parent: ParentReference,
510
542
  conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
511
543
  required: import_zod5.z.boolean().default(false).optional(),
@@ -567,6 +599,7 @@ var SignatureField = BaseField.extend({
567
599
  signaturePromptLabel: TranslationConfig.describe(
568
600
  "Title of the signature modal"
569
601
  ),
602
+ defaultValue: SignatureFieldValue.optional(),
570
603
  configuration: import_zod5.z.object({
571
604
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
572
605
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -626,6 +659,7 @@ var PageHeader = BaseField.extend({
626
659
  }).describe("A read-only header component for form pages");
627
660
  var File = BaseField.extend({
628
661
  type: import_zod5.z.literal(FieldType.FILE),
662
+ defaultValue: FileFieldValue.optional(),
629
663
  configuration: import_zod5.z.object({
630
664
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
631
665
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -699,6 +733,7 @@ var Location = BaseField.extend({
699
733
  var FileUploadWithOptions = BaseField.extend({
700
734
  type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
701
735
  options: import_zod5.z.array(SelectOption).describe("A list of options"),
736
+ defaultValue: FileFieldWithOptionValue.optional(),
702
737
  configuration: import_zod5.z.object({
703
738
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
704
739
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -910,6 +945,12 @@ var ActionConfigBase = import_zod9.z.object({
910
945
  conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
911
946
  draft: import_zod9.z.boolean().optional()
912
947
  });
948
+ var ReadActionConfig = ActionConfigBase.merge(
949
+ import_zod9.z.object({
950
+ type: import_zod9.z.literal(ActionType.READ),
951
+ review: DeclarationReviewConfig
952
+ })
953
+ );
913
954
  var DeclareConfig = ActionConfigBase.merge(
914
955
  import_zod9.z.object({
915
956
  type: import_zod9.z.literal(ActionType.DECLARE),
@@ -976,6 +1017,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
976
1017
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
977
1018
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
978
1019
  */
1020
+ ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
979
1021
  DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
980
1022
  ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
981
1023
  RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
@@ -1033,13 +1075,13 @@ var LanguageConfig = import_zod11.z.object({
1033
1075
  });
1034
1076
 
1035
1077
  // ../commons/src/events/EventConfig.ts
1036
- var import_zod17 = require("zod");
1078
+ var import_zod18 = require("zod");
1037
1079
 
1038
1080
  // ../commons/src/events/DeduplicationConfig.ts
1039
1081
  var import_zod12 = require("zod");
1040
1082
  var import_zod_openapi6 = require("zod-openapi");
1041
1083
  (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
1042
- var FieldReference = import_zod12.z.string();
1084
+ var FieldReference2 = import_zod12.z.string();
1043
1085
  var Matcher = import_zod12.z.object({
1044
1086
  fieldId: import_zod12.z.string(),
1045
1087
  options: import_zod12.z.object({
@@ -1068,7 +1110,7 @@ var DateRangeMatcher = Matcher.extend({
1068
1110
  type: import_zod12.z.literal("dateRange"),
1069
1111
  options: import_zod12.z.object({
1070
1112
  days: import_zod12.z.number(),
1071
- origin: FieldReference,
1113
+ origin: FieldReference2,
1072
1114
  boost: import_zod12.z.number().optional().default(1)
1073
1115
  })
1074
1116
  });
@@ -1076,7 +1118,7 @@ var DateDistanceMatcher = Matcher.extend({
1076
1118
  type: import_zod12.z.literal("dateDistance"),
1077
1119
  options: import_zod12.z.object({
1078
1120
  days: import_zod12.z.number(),
1079
- origin: FieldReference,
1121
+ origin: FieldReference2,
1080
1122
  boost: import_zod12.z.number().optional().default(1)
1081
1123
  })
1082
1124
  });
@@ -1208,114 +1250,134 @@ var AdvancedSearchConfig = import_zod14.z.object({
1208
1250
  var import_lodash = require("lodash");
1209
1251
 
1210
1252
  // ../commons/src/events/ActionDocument.ts
1211
- var import_zod15 = require("zod");
1253
+ var import_zod16 = require("zod");
1212
1254
  var import_zod_openapi7 = require("zod-openapi");
1213
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod15.z);
1214
- var ActionUpdate = import_zod15.z.record(import_zod15.z.string(), FieldUpdateValue);
1215
- var EventState = import_zod15.z.record(import_zod15.z.string(), FieldValue);
1255
+
1256
+ // ../commons/src/uuid.ts
1257
+ var import_uuid = require("uuid");
1258
+ var import_zod15 = require("zod");
1259
+ var UUID = import_zod15.z.string().uuid().brand("UUID");
1260
+ function getUUID() {
1261
+ return (0, import_uuid.v4)();
1262
+ }
1263
+
1264
+ // ../commons/src/events/CreatedAtLocation.ts
1265
+ var CreatedAtLocation = UUID.nullish();
1266
+
1267
+ // ../commons/src/events/ActionDocument.ts
1268
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
1269
+ var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
1270
+ var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
1216
1271
  var ActionStatus = {
1217
1272
  Requested: "Requested",
1218
1273
  Accepted: "Accepted",
1219
1274
  Rejected: "Rejected"
1220
1275
  };
1221
- var ActionBase = import_zod15.z.object({
1222
- id: import_zod15.z.string(),
1223
- transactionId: import_zod15.z.string(),
1224
- createdAt: import_zod15.z.string().datetime(),
1225
- createdBy: import_zod15.z.string(),
1226
- createdByRole: import_zod15.z.string(),
1276
+ var ActionBase = import_zod16.z.object({
1277
+ id: import_zod16.z.string(),
1278
+ transactionId: import_zod16.z.string(),
1279
+ createdAt: import_zod16.z.string().datetime(),
1280
+ createdBy: import_zod16.z.string(),
1281
+ createdByRole: import_zod16.z.string(),
1282
+ createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
1283
+ createdAtLocation: CreatedAtLocation,
1227
1284
  declaration: ActionUpdate,
1228
- annotation: ActionUpdate.optional(),
1229
- createdAtLocation: import_zod15.z.string(),
1230
- status: import_zod15.z.enum([
1285
+ annotation: ActionUpdate.optional().nullable(),
1286
+ status: import_zod16.z.enum([
1231
1287
  ActionStatus.Requested,
1232
1288
  ActionStatus.Accepted,
1233
1289
  ActionStatus.Rejected
1234
1290
  ]),
1235
1291
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1236
- originalActionId: import_zod15.z.string().optional()
1292
+ originalActionId: UUID.optional().nullable()
1237
1293
  });
1238
1294
  var AssignedAction = ActionBase.merge(
1239
- import_zod15.z.object({
1240
- type: import_zod15.z.literal(ActionType.ASSIGN),
1241
- assignedTo: import_zod15.z.string()
1295
+ import_zod16.z.object({
1296
+ type: import_zod16.z.literal(ActionType.ASSIGN),
1297
+ assignedTo: import_zod16.z.string()
1242
1298
  })
1243
1299
  );
1244
1300
  var UnassignedAction = ActionBase.merge(
1245
- import_zod15.z.object({
1246
- type: import_zod15.z.literal(ActionType.UNASSIGN),
1247
- assignedTo: import_zod15.z.literal(null)
1301
+ import_zod16.z.object({
1302
+ type: import_zod16.z.literal(ActionType.UNASSIGN),
1303
+ assignedTo: import_zod16.z.literal(null)
1248
1304
  })
1249
1305
  );
1250
1306
  var RegisterAction = ActionBase.merge(
1251
- import_zod15.z.object({
1252
- type: import_zod15.z.literal(ActionType.REGISTER),
1253
- registrationNumber: import_zod15.z.string().optional()
1307
+ import_zod16.z.object({
1308
+ type: import_zod16.z.literal(ActionType.REGISTER),
1309
+ registrationNumber: import_zod16.z.string().optional()
1254
1310
  })
1255
1311
  );
1256
1312
  var DeclareAction = ActionBase.merge(
1257
- import_zod15.z.object({
1258
- type: import_zod15.z.literal(ActionType.DECLARE)
1313
+ import_zod16.z.object({
1314
+ type: import_zod16.z.literal(ActionType.DECLARE)
1259
1315
  })
1260
1316
  );
1261
1317
  var ValidateAction = ActionBase.merge(
1262
- import_zod15.z.object({
1263
- type: import_zod15.z.literal(ActionType.VALIDATE)
1318
+ import_zod16.z.object({
1319
+ type: import_zod16.z.literal(ActionType.VALIDATE)
1264
1320
  })
1265
1321
  );
1322
+ var RejectionReason = import_zod16.z.object({
1323
+ message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
1324
+ isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
1325
+ });
1266
1326
  var RejectAction = ActionBase.merge(
1267
- import_zod15.z.object({
1268
- type: import_zod15.z.literal(ActionType.REJECT)
1327
+ import_zod16.z.object({
1328
+ type: import_zod16.z.literal(ActionType.REJECT),
1329
+ reason: RejectionReason
1269
1330
  })
1270
1331
  );
1271
1332
  var MarkAsDuplicateAction = ActionBase.merge(
1272
- import_zod15.z.object({
1273
- type: import_zod15.z.literal(ActionType.MARKED_AS_DUPLICATE)
1333
+ import_zod16.z.object({
1334
+ type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
1274
1335
  })
1275
1336
  );
1276
1337
  var ArchiveAction = ActionBase.merge(
1277
- import_zod15.z.object({
1278
- type: import_zod15.z.literal(ActionType.ARCHIVE)
1338
+ import_zod16.z.object({
1339
+ type: import_zod16.z.literal(ActionType.ARCHIVE),
1340
+ reason: RejectionReason
1279
1341
  })
1280
1342
  );
1281
1343
  var CreatedAction = ActionBase.merge(
1282
- import_zod15.z.object({
1283
- type: import_zod15.z.literal(ActionType.CREATE)
1344
+ import_zod16.z.object({
1345
+ type: import_zod16.z.literal(ActionType.CREATE)
1284
1346
  })
1285
1347
  );
1286
1348
  var NotifiedAction = ActionBase.merge(
1287
- import_zod15.z.object({
1288
- type: import_zod15.z.literal(ActionType.NOTIFY)
1349
+ import_zod16.z.object({
1350
+ type: import_zod16.z.literal(ActionType.NOTIFY)
1289
1351
  })
1290
1352
  );
1291
1353
  var PrintCertificateAction = ActionBase.merge(
1292
- import_zod15.z.object({
1293
- type: import_zod15.z.literal(ActionType.PRINT_CERTIFICATE)
1354
+ import_zod16.z.object({
1355
+ type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
1294
1356
  })
1295
1357
  );
1296
1358
  var RequestedCorrectionAction = ActionBase.merge(
1297
- import_zod15.z.object({
1298
- type: import_zod15.z.literal(ActionType.REQUEST_CORRECTION)
1359
+ import_zod16.z.object({
1360
+ type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
1299
1361
  })
1300
1362
  );
1301
1363
  var ApprovedCorrectionAction = ActionBase.merge(
1302
- import_zod15.z.object({
1303
- type: import_zod15.z.literal(ActionType.APPROVE_CORRECTION),
1304
- requestId: import_zod15.z.string()
1364
+ import_zod16.z.object({
1365
+ type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
1366
+ requestId: import_zod16.z.string()
1305
1367
  })
1306
1368
  );
1307
1369
  var RejectedCorrectionAction = ActionBase.merge(
1308
- import_zod15.z.object({
1309
- type: import_zod15.z.literal(ActionType.REJECT_CORRECTION),
1310
- requestId: import_zod15.z.string()
1370
+ import_zod16.z.object({
1371
+ type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
1372
+ requestId: import_zod16.z.string()
1311
1373
  })
1312
1374
  );
1313
1375
  var ReadAction = ActionBase.merge(
1314
- import_zod15.z.object({
1315
- type: import_zod15.z.literal(ActionType.READ)
1376
+ import_zod16.z.object({
1377
+ type: import_zod16.z.literal(ActionType.READ)
1316
1378
  })
1317
1379
  );
1318
- var ActionDocument = import_zod15.z.discriminatedUnion("type", [
1380
+ var ActionDocument = import_zod16.z.discriminatedUnion("type", [
1319
1381
  CreatedAction.openapi({ ref: "CreatedAction" }),
1320
1382
  ValidateAction.openapi({ ref: "ValidateAction" }),
1321
1383
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1338,20 +1400,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1338
1400
  declaration: true,
1339
1401
  annotation: true
1340
1402
  }).merge(
1341
- import_zod15.z.object({
1342
- type: import_zod15.z.enum(ConfirmableActions),
1343
- status: import_zod15.z.literal(ActionStatus.Rejected)
1403
+ import_zod16.z.object({
1404
+ type: import_zod16.z.enum(ConfirmableActions),
1405
+ status: import_zod16.z.literal(ActionStatus.Rejected)
1344
1406
  })
1345
1407
  );
1346
- var Action = import_zod15.z.union([ActionDocument, AsyncRejectActionDocument]);
1347
- var ResolvedUser = import_zod15.z.object({
1348
- id: import_zod15.z.string(),
1349
- role: import_zod15.z.string(),
1350
- name: import_zod15.z.array(
1351
- import_zod15.z.object({
1352
- use: import_zod15.z.string(),
1353
- given: import_zod15.z.array(import_zod15.z.string()),
1354
- family: import_zod15.z.string()
1408
+ var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
1409
+ var ResolvedUser = import_zod16.z.object({
1410
+ id: import_zod16.z.string(),
1411
+ role: import_zod16.z.string(),
1412
+ name: import_zod16.z.array(
1413
+ import_zod16.z.object({
1414
+ use: import_zod16.z.string(),
1415
+ given: import_zod16.z.array(import_zod16.z.string()),
1416
+ family: import_zod16.z.string()
1355
1417
  })
1356
1418
  )
1357
1419
  });
@@ -1362,7 +1424,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1362
1424
  var import_date_fns = require("date-fns");
1363
1425
 
1364
1426
  // ../commons/src/events/FieldTypeMapping.ts
1365
- var import_zod16 = require("zod");
1427
+ var import_zod17 = require("zod");
1366
1428
  function mapFieldTypeToZod(type, required) {
1367
1429
  let schema;
1368
1430
  switch (type) {
@@ -1388,7 +1450,6 @@ function mapFieldTypeToZod(type, required) {
1388
1450
  case FieldType.ADMINISTRATIVE_AREA:
1389
1451
  case FieldType.FACILITY:
1390
1452
  case FieldType.OFFICE:
1391
- case FieldType.SIGNATURE:
1392
1453
  schema = required ? NonEmptyTextValue : TextValue;
1393
1454
  break;
1394
1455
  case FieldType.NUMBER:
@@ -1397,6 +1458,7 @@ function mapFieldTypeToZod(type, required) {
1397
1458
  case FieldType.CHECKBOX:
1398
1459
  schema = CheckboxFieldValue;
1399
1460
  break;
1461
+ case FieldType.SIGNATURE:
1400
1462
  case FieldType.FILE:
1401
1463
  schema = FileFieldValue;
1402
1464
  break;
@@ -1417,7 +1479,7 @@ function createValidationSchema(config) {
1417
1479
  for (const field2 of config) {
1418
1480
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1419
1481
  }
1420
- return import_zod16.z.object(shape);
1482
+ return import_zod17.z.object(shape);
1421
1483
  }
1422
1484
  function mapFieldTypeToMockValue(field2, i) {
1423
1485
  switch (field2.type) {
@@ -1430,7 +1492,6 @@ function mapFieldTypeToMockValue(field2, i) {
1430
1492
  case FieldType.SELECT:
1431
1493
  case FieldType.COUNTRY:
1432
1494
  case FieldType.RADIO_GROUP:
1433
- case FieldType.SIGNATURE:
1434
1495
  case FieldType.PARAGRAPH:
1435
1496
  case FieldType.ADMINISTRATIVE_AREA:
1436
1497
  case FieldType.FACILITY:
@@ -1459,6 +1520,7 @@ function mapFieldTypeToMockValue(field2, i) {
1459
1520
  return ["2021-01-01", "2021-01-02"];
1460
1521
  case FieldType.CHECKBOX:
1461
1522
  return true;
1523
+ case FieldType.SIGNATURE:
1462
1524
  case FieldType.FILE:
1463
1525
  return {
1464
1526
  filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
@@ -1482,7 +1544,6 @@ function mapFieldTypeToEmptyValue(field2) {
1482
1544
  case FieldType.SELECT:
1483
1545
  case FieldType.COUNTRY:
1484
1546
  case FieldType.RADIO_GROUP:
1485
- case FieldType.SIGNATURE:
1486
1547
  case FieldType.PARAGRAPH:
1487
1548
  case FieldType.ADMINISTRATIVE_AREA:
1488
1549
  case FieldType.FACILITY:
@@ -1508,6 +1569,7 @@ function mapFieldTypeToEmptyValue(field2) {
1508
1569
  number: null,
1509
1570
  zipCode: null
1510
1571
  };
1572
+ case FieldType.SIGNATURE:
1511
1573
  case FieldType.FILE:
1512
1574
  return {
1513
1575
  filename: "",
@@ -1587,6 +1649,9 @@ var isOfficeFieldType = (field2) => {
1587
1649
  var isDataFieldType = (field2) => {
1588
1650
  return field2.config.type === FieldType.DATA;
1589
1651
  };
1652
+ var isNonInteractiveFieldType = (field2) => {
1653
+ return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
1654
+ };
1590
1655
 
1591
1656
  // ../commons/src/conditionals/validate.ts
1592
1657
  var ajv = new import_ajv.default({
@@ -1763,12 +1828,6 @@ function runFieldValidations({
1763
1828
  };
1764
1829
  }
1765
1830
 
1766
- // ../commons/src/uuid.ts
1767
- var import_uuid = require("uuid");
1768
- function getUUID() {
1769
- return (0, import_uuid.v4)();
1770
- }
1771
-
1772
1831
  // ../commons/src/utils.ts
1773
1832
  function getOrThrow(x, message) {
1774
1833
  if (x === void 0 || x === null) {
@@ -1869,7 +1928,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
1869
1928
  annotation: {},
1870
1929
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1871
1930
  createdBy: "@todo",
1872
- createdAtLocation: "@todo",
1931
+ createdAtLocation: "00000000-0000-0000-0000-000000000000",
1873
1932
  status: ActionStatus.Accepted,
1874
1933
  transactionId: "@todo",
1875
1934
  createdByRole: "@todo"
@@ -1965,22 +2024,22 @@ function getMixedPath(obj, path, defaultValue) {
1965
2024
 
1966
2025
  // ../commons/src/events/EventConfig.ts
1967
2026
  var import_zod_openapi8 = require("zod-openapi");
1968
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod17.z);
1969
- var EventConfig = import_zod17.z.object({
1970
- id: import_zod17.z.string().describe(
2027
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2028
+ var EventConfig = import_zod18.z.object({
2029
+ id: import_zod18.z.string().describe(
1971
2030
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
1972
2031
  ),
1973
- dateOfEvent: import_zod17.z.object({ fieldId: import_zod17.z.string() }).optional(),
2032
+ dateOfEvent: FieldReference.optional(),
1974
2033
  title: TranslationConfig,
1975
2034
  fallbackTitle: TranslationConfig.optional().describe(
1976
2035
  "This is a fallback title if actual title resolves to empty string"
1977
2036
  ),
1978
2037
  summary: SummaryConfig,
1979
2038
  label: TranslationConfig,
1980
- actions: import_zod17.z.array(ActionConfig),
2039
+ actions: import_zod18.z.array(ActionConfig),
1981
2040
  declaration: DeclarationFormConfig,
1982
- deduplication: import_zod17.z.array(DeduplicationConfig).optional().default([]),
1983
- advancedSearch: import_zod17.z.array(AdvancedSearchConfig).optional().default([])
2041
+ deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
2042
+ advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
1984
2043
  }).superRefine((event2, ctx) => {
1985
2044
  const allFields = findAllFields(event2);
1986
2045
  const fieldIds = allFields.map((field2) => field2.id);
@@ -2014,13 +2073,13 @@ var EventConfig = import_zod17.z.object({
2014
2073
  }
2015
2074
  if (event2.dateOfEvent) {
2016
2075
  const eventDateFieldId = getDeclarationFields(event2).find(
2017
- ({ id }) => id === event2.dateOfEvent?.fieldId
2076
+ ({ id }) => id === event2.dateOfEvent?.$$field
2018
2077
  );
2019
2078
  if (!eventDateFieldId) {
2020
2079
  ctx.addIssue({
2021
2080
  code: "custom",
2022
2081
  message: `Date of event field id must match a field id in fields array.
2023
- Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.fieldId}`,
2082
+ Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
2024
2083
  path: ["dateOfEvent"]
2025
2084
  });
2026
2085
  } else if (eventDateFieldId.type !== FieldType.DATE) {
@@ -2042,241 +2101,24 @@ var definePage = (page) => PageConfig.parse(page);
2042
2101
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2043
2102
 
2044
2103
  // ../commons/src/events/WorkqueueConfig.ts
2045
- var import_zod20 = require("zod");
2104
+ var import_zod25 = require("zod");
2046
2105
 
2047
- // ../commons/src/events/EventIndex.ts
2106
+ // ../commons/src/events/serializers/user/serializer.ts
2048
2107
  var import_zod19 = require("zod");
2049
-
2050
- // ../commons/src/events/EventMetadata.ts
2051
- var import_zod18 = require("zod");
2052
- var EventStatus = {
2053
- CREATED: "CREATED",
2054
- NOTIFIED: "NOTIFIED",
2055
- DECLARED: "DECLARED",
2056
- VALIDATED: "VALIDATED",
2057
- REGISTERED: "REGISTERED",
2058
- CERTIFIED: "CERTIFIED",
2059
- REJECTED: "REJECTED",
2060
- ARCHIVED: "ARCHIVED"
2061
- };
2062
- var eventStatusValues = [
2063
- EventStatus.CREATED,
2064
- EventStatus.NOTIFIED,
2065
- EventStatus.DECLARED,
2066
- EventStatus.VALIDATED,
2067
- EventStatus.REGISTERED,
2068
- EventStatus.CERTIFIED,
2069
- EventStatus.REJECTED,
2070
- EventStatus.ARCHIVED
2071
- ];
2072
- var EventStatusEnum = import_zod18.z.enum(eventStatusValues);
2073
- var CustomFlags = {
2074
- CERTIFICATE_PRINTED: "certificate-printed"
2075
- };
2076
- var Flag = import_zod18.z.string().regex(
2077
- new RegExp(
2078
- `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(ActionStatus).join("|").toLowerCase()})$`
2079
- ),
2080
- "Flag must be in the format ActionType:ActionStatus (lowerCase)"
2081
- ).or(import_zod18.z.nativeEnum(CustomFlags));
2082
- var eventStatuses = Object.values(EventStatus);
2083
- var EventStatuses = import_zod18.z.nativeEnum(EventStatus);
2084
- var ZodDate = import_zod18.z.string().date();
2085
- var ActionCreationMetadata = import_zod18.z.object({
2086
- createdAt: import_zod18.z.string().datetime().describe("The timestamp when the action request was created."),
2087
- createdBy: import_zod18.z.string().describe("ID of the user who created the action request."),
2088
- createdAtLocation: import_zod18.z.string().describe("Location of the user who created the action request."),
2089
- acceptedAt: import_zod18.z.string().datetime().describe("Timestamp when the action request was accepted."),
2090
- createdByRole: import_zod18.z.string().describe("Role of the user at the time of action request creation.")
2091
- });
2092
- var RegistrationCreationMetadata = ActionCreationMetadata.extend({
2093
- registrationNumber: import_zod18.z.string().describe(
2094
- "Registration number of the event. Always present for accepted registrations."
2095
- )
2096
- });
2097
- var LegalStatuses = import_zod18.z.object({
2098
- [EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
2099
- [EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
2100
- });
2101
- var EventMetadata = import_zod18.z.object({
2102
- id: import_zod18.z.string(),
2103
- type: import_zod18.z.string().describe("The type of event, such as birth, death, or marriage."),
2104
- status: EventStatuses,
2105
- legalStatuses: LegalStatuses.describe(
2106
- "Metadata related to the legal registration of the event, such as who registered it and when."
2107
- ),
2108
- createdAt: import_zod18.z.string().datetime().describe("The timestamp when the event was first created and saved."),
2109
- dateOfEvent: ZodDate.nullish(),
2110
- createdBy: import_zod18.z.string().describe("ID of the user who created the event."),
2111
- updatedByUserRole: import_zod18.z.string().describe("Role of the user who last updated the declaration."),
2112
- createdAtLocation: import_zod18.z.string().describe("Location of the user who created the event."),
2113
- updatedAtLocation: import_zod18.z.string().nullish().describe("Location of the user who last updated the declaration."),
2114
- updatedAt: import_zod18.z.string().datetime().describe("Timestamp of the most recent declaration update."),
2115
- assignedTo: import_zod18.z.string().nullish().describe("ID of the user currently assigned to the event."),
2116
- updatedBy: import_zod18.z.string().nullish().describe("ID of the user who last updated the declaration."),
2117
- trackingId: import_zod18.z.string().describe(
2118
- "System-generated tracking ID used by informants or registrars to look up the event."
2119
- ),
2120
- flags: import_zod18.z.array(Flag)
2121
- });
2122
- var EventMetadataKeys = import_zod18.z.enum([
2123
- "id",
2124
- "type",
2125
- "status",
2126
- "createdAt",
2127
- "dateOfEvent",
2128
- "createdBy",
2129
- "updatedByUserRole",
2130
- "createdAtLocation",
2131
- "updatedAtLocation",
2132
- "updatedAt",
2133
- "assignedTo",
2134
- "updatedBy",
2135
- "trackingId",
2136
- "legalStatuses",
2137
- "flags"
2138
- ]);
2139
- var EventMetadataParameter = import_zod18.z.object({
2140
- // @TODO: Reconcile with the event metadata definition. How could we derive one from the other?
2141
- $event: EventMetadataKeys
2142
- });
2143
- var eventMetadataLabelMap = {
2144
- "event.assignedTo": {
2145
- id: "event.assignedTo.label",
2146
- defaultMessage: "Assigned To",
2147
- description: "Assigned To"
2148
- },
2149
- "event.createdAt": {
2150
- id: "event.createdAt.label",
2151
- defaultMessage: "Created",
2152
- description: "Created At"
2153
- },
2154
- "event.dateOfEvent": {
2155
- id: "event.dateOfEvent.label",
2156
- defaultMessage: "Date of Event",
2157
- description: "Date of Event"
2158
- },
2159
- "event.createdAtLocation": {
2160
- id: "event.createdAtLocation.label",
2161
- defaultMessage: "Location",
2162
- description: "Created At Location"
2163
- },
2164
- "event.updatedAtLocation": {
2165
- id: "event.updatedAtLocation.label",
2166
- defaultMessage: "Location",
2167
- description: "Updated At Location"
2168
- },
2169
- "event.createdBy": {
2170
- id: "event.createdBy.label",
2171
- defaultMessage: "Created By",
2172
- description: "Created By"
2173
- },
2174
- "event.updatedByUserRole": {
2175
- id: "event.updatedByUserRole.label",
2176
- defaultMessage: "Updated By Role",
2177
- description: "Updated By Role"
2178
- },
2179
- "event.id": {
2180
- id: "event.id.label",
2181
- defaultMessage: "ID",
2182
- description: "ID"
2183
- },
2184
- "event.updatedAt": {
2185
- id: "event.modifiedAt.label",
2186
- defaultMessage: "Updated",
2187
- description: "Modified At"
2188
- },
2189
- "event.status": {
2190
- id: "event.status.label",
2191
- defaultMessage: "Status",
2192
- description: "Status"
2193
- },
2194
- "event.type": {
2195
- id: "event.type.label",
2196
- defaultMessage: "Type",
2197
- description: "Type"
2198
- },
2199
- "event.updatedBy": {
2200
- id: "event.updatedBy.label",
2201
- defaultMessage: "Updated By",
2202
- description: "Updated By"
2203
- },
2204
- "event.trackingId": {
2205
- id: "event.trackingId.label",
2206
- defaultMessage: "Tracking ID",
2207
- description: "Tracking ID"
2208
- },
2209
- "event.flags": {
2210
- id: "event.flags.label",
2211
- defaultMessage: "Flags",
2212
- description: "Flags"
2213
- }
2214
- };
2215
-
2216
- // ../commons/src/events/EventIndex.ts
2217
- var EventIndex = EventMetadata.extend({
2218
- declaration: EventState
2219
- });
2220
- var EventSearchIndex = import_zod19.z.record(import_zod19.z.string(), import_zod19.z.any()).and(
2221
- import_zod19.z.object({
2222
- type: import_zod19.z.string()
2223
- // Ensures "type" (event-id) exists and is a string
2224
- })
2225
- );
2226
- var Fuzzy = import_zod19.z.object({ type: import_zod19.z.literal("fuzzy"), term: import_zod19.z.string() });
2227
- var Exact = import_zod19.z.object({ type: import_zod19.z.literal("exact"), term: import_zod19.z.string() });
2228
- var AnyOf = import_zod19.z.object({
2229
- type: import_zod19.z.literal("anyOf"),
2230
- terms: import_zod19.z.array(import_zod19.z.string())
2231
- });
2232
- var ExactStatus = import_zod19.z.object({
2233
- type: import_zod19.z.literal("exact"),
2234
- term: EventStatusEnum
2235
- });
2236
- var AnyOfStatus = import_zod19.z.object({
2237
- type: import_zod19.z.literal("anyOf"),
2238
- terms: import_zod19.z.array(EventStatusEnum)
2239
- });
2240
- var Range = import_zod19.z.object({
2241
- type: import_zod19.z.literal("range"),
2242
- gte: import_zod19.z.string(),
2243
- lte: import_zod19.z.string()
2244
- });
2245
- var Not = import_zod19.z.object({ type: import_zod19.z.literal("not"), term: import_zod19.z.string() });
2246
- var Within = import_zod19.z.object({ type: import_zod19.z.literal("within"), location: import_zod19.z.string() });
2247
- var DateCondition = import_zod19.z.union([Exact, Range]);
2248
- var QueryInput = import_zod19.z.lazy(
2249
- () => import_zod19.z.union([
2250
- import_zod19.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
2251
- import_zod19.z.record(import_zod19.z.string(), QueryInput)
2108
+ var SerializedUserField = import_zod19.z.object({
2109
+ $userField: import_zod19.z.enum([
2110
+ "id",
2111
+ "name",
2112
+ "role",
2113
+ "signatureFilename",
2114
+ "primaryOfficeId"
2252
2115
  ])
2253
- );
2254
- var QueryExpression = import_zod19.z.object({
2255
- eventType: import_zod19.z.string(),
2256
- status: import_zod19.z.optional(import_zod19.z.union([AnyOfStatus, ExactStatus])),
2257
- createdAt: import_zod19.z.optional(DateCondition),
2258
- updatedAt: import_zod19.z.optional(DateCondition),
2259
- "legalStatus.REGISTERED.createdAt": import_zod19.z.optional(DateCondition),
2260
- "legalStatus.REGISTERED.createdAtLocation": import_zod19.z.optional(
2261
- import_zod19.z.union([Within, Exact])
2262
- ),
2263
- createAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
2264
- updatedAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
2265
- createdBy: import_zod19.z.optional(Exact),
2266
- updatedBy: import_zod19.z.optional(Exact),
2267
- trackingId: import_zod19.z.optional(Exact),
2268
- flags: import_zod19.z.optional(import_zod19.z.array(import_zod19.z.union([AnyOf, Not]))),
2269
- data: QueryInput
2270
- }).partial();
2271
- var Or2 = import_zod19.z.object({
2272
- type: import_zod19.z.literal("or"),
2273
- clauses: import_zod19.z.array(QueryExpression)
2274
- });
2275
- var And2 = import_zod19.z.object({
2276
- type: import_zod19.z.literal("and"),
2277
- clauses: import_zod19.z.array(QueryExpression)
2278
2116
  });
2279
- var QueryType = import_zod19.z.discriminatedUnion("type", [Or2, And2]);
2117
+ function userSerializer(userField) {
2118
+ return {
2119
+ $userField: userField
2120
+ };
2121
+ }
2280
2122
 
2281
2123
  // ../commons/src/conditionals/conditionals.ts
2282
2124
  function defineConditional(schema) {
@@ -2319,7 +2161,7 @@ function not(condition) {
2319
2161
  function never() {
2320
2162
  return not(alwaysTrue());
2321
2163
  }
2322
- var user = {
2164
+ var user = Object.assign(userSerializer, {
2323
2165
  hasScope: (scope) => defineConditional({
2324
2166
  type: "object",
2325
2167
  properties: {
@@ -2339,7 +2181,7 @@ var user = {
2339
2181
  },
2340
2182
  required: ["$user"]
2341
2183
  })
2342
- };
2184
+ });
2343
2185
  function createEventConditionals() {
2344
2186
  return {
2345
2187
  /**
@@ -2390,7 +2232,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2390
2232
  };
2391
2233
  }
2392
2234
  function isFieldReference(value) {
2393
- return typeof value === "object" && value !== null && "_fieldId" in value;
2235
+ return typeof value === "object" && value !== null && "$$field" in value;
2394
2236
  }
2395
2237
  function createFieldConditionals(fieldId) {
2396
2238
  const getDateRange = (date, clause) => ({
@@ -2405,6 +2247,10 @@ function createFieldConditionals(fieldId) {
2405
2247
  required: [fieldId]
2406
2248
  });
2407
2249
  return {
2250
+ /**
2251
+ * @private Internal property used for field reference tracking.
2252
+ */
2253
+ $$field: fieldId,
2408
2254
  isAfter: () => ({
2409
2255
  days: (days) => ({
2410
2256
  inPast: () => defineFormConditional(
@@ -2416,7 +2262,7 @@ function createFieldConditionals(fieldId) {
2416
2262
  }),
2417
2263
  date: (date) => {
2418
2264
  if (isFieldReference(date)) {
2419
- const comparedFieldId = date._fieldId;
2265
+ const comparedFieldId = date.$$field;
2420
2266
  return defineFormConditional(
2421
2267
  getDateRangeToFieldReference(
2422
2268
  fieldId,
@@ -2440,7 +2286,7 @@ function createFieldConditionals(fieldId) {
2440
2286
  }),
2441
2287
  date: (date) => {
2442
2288
  if (isFieldReference(date)) {
2443
- const comparedFieldId = date._fieldId;
2289
+ const comparedFieldId = date.$$field;
2444
2290
  return defineFormConditional(
2445
2291
  getDateRangeToFieldReference(
2446
2292
  fieldId,
@@ -2455,7 +2301,7 @@ function createFieldConditionals(fieldId) {
2455
2301
  }),
2456
2302
  isEqualTo: (value) => {
2457
2303
  if (isFieldReference(value)) {
2458
- const comparedFieldId = value._fieldId;
2304
+ const comparedFieldId = value.$$field;
2459
2305
  return defineFormConditional({
2460
2306
  type: "object",
2461
2307
  properties: {
@@ -2571,8 +2417,7 @@ function createFieldConditionals(fieldId) {
2571
2417
  }
2572
2418
  },
2573
2419
  required: [fieldId]
2574
- }),
2575
- getId: () => ({ fieldId })
2420
+ })
2576
2421
  };
2577
2422
  }
2578
2423
 
@@ -2646,144 +2491,670 @@ var event = Object.assign(eventFn, {
2646
2491
  }
2647
2492
  });
2648
2493
 
2649
- // ../commons/src/events/WorkqueueConfig.ts
2650
- var WorkqueueConfig = import_zod20.z.object({
2651
- slug: import_zod20.z.string().describe("Determines the url of the workqueue."),
2652
- name: TranslationConfig.describe(
2653
- "Title of the workflow (both in navigation and on the page)"
2494
+ // ../commons/src/events/WorkqueueColumnConfig.ts
2495
+ var import_zod21 = require("zod");
2496
+
2497
+ // ../commons/src/events/EventMetadata.ts
2498
+ var import_zod20 = require("zod");
2499
+ var EventStatus = {
2500
+ CREATED: "CREATED",
2501
+ NOTIFIED: "NOTIFIED",
2502
+ DECLARED: "DECLARED",
2503
+ VALIDATED: "VALIDATED",
2504
+ REGISTERED: "REGISTERED",
2505
+ CERTIFIED: "CERTIFIED",
2506
+ REJECTED: "REJECTED",
2507
+ ARCHIVED: "ARCHIVED"
2508
+ };
2509
+ var eventStatusValues = [
2510
+ EventStatus.CREATED,
2511
+ EventStatus.NOTIFIED,
2512
+ EventStatus.DECLARED,
2513
+ EventStatus.VALIDATED,
2514
+ EventStatus.REGISTERED,
2515
+ EventStatus.CERTIFIED,
2516
+ EventStatus.REJECTED,
2517
+ EventStatus.ARCHIVED
2518
+ ];
2519
+ var EventStatusEnum = import_zod20.z.enum(eventStatusValues);
2520
+ var CustomFlags = {
2521
+ CERTIFICATE_PRINTED: "certificate-printed"
2522
+ };
2523
+ var Flag = import_zod20.z.string().regex(
2524
+ new RegExp(
2525
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
2526
+ ActionStatus
2527
+ ).join("|").toLowerCase()})$`
2654
2528
  ),
2655
- query: QueryType,
2656
- actions: import_zod20.z.array(
2657
- import_zod20.z.object({
2658
- type: import_zod20.z.string(),
2659
- conditionals: import_zod20.z.array(Conditional).optional()
2660
- })
2529
+ "Flag must be in the format ActionType:ActionStatus (lowerCase)"
2530
+ ).or(import_zod20.z.nativeEnum(CustomFlags));
2531
+ var eventStatuses = Object.values(EventStatus);
2532
+ var EventStatuses = import_zod20.z.nativeEnum(EventStatus);
2533
+ var ZodDate = import_zod20.z.string().date();
2534
+ var ActionCreationMetadata = import_zod20.z.object({
2535
+ createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
2536
+ createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
2537
+ createdAtLocation: CreatedAtLocation.describe(
2538
+ "Location of the user who created the action request."
2661
2539
  ),
2662
- columns: import_zod20.z.array(
2663
- import_zod20.z.object({ label: TranslationConfig, value: EventMetadataParameter })
2664
- ).default([
2665
- {
2666
- label: {
2667
- id: "workqueues.dateOfEvent",
2668
- defaultMessage: "Date of Event",
2669
- description: "Label for workqueue column: dateOfEvent"
2670
- },
2671
- value: event.field("dateOfEvent")
2672
- }
2673
- ])
2674
- }).describe("Configuration for workqueue.");
2675
- function defineWorkqueue(workqueues) {
2676
- return workqueues.map((workqueue) => WorkqueueConfig.parse(workqueue));
2677
- }
2678
-
2679
- // ../commons/src/events/Draft.ts
2680
- var import_zod22 = require("zod");
2681
-
2682
- // ../commons/src/events/ActionInput.ts
2683
- var import_zod21 = require("zod");
2684
- var import_zod_openapi9 = require("zod-openapi");
2685
- var import_uuid3 = require("uuid");
2686
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod21.z);
2687
- var BaseActionInput = import_zod21.z.object({
2688
- eventId: import_zod21.z.string(),
2689
- transactionId: import_zod21.z.string(),
2690
- declaration: ActionUpdate.default({}),
2691
- annotation: ActionUpdate.optional(),
2692
- originalActionId: import_zod21.z.string().optional(),
2693
- keepAssignment: import_zod21.z.boolean().optional()
2540
+ acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
2541
+ createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
2542
+ createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
2694
2543
  });
2695
- var CreateActionInput = BaseActionInput.merge(
2696
- import_zod21.z.object({
2697
- type: import_zod21.z.literal(ActionType.CREATE).default(ActionType.CREATE),
2698
- createdAtLocation: import_zod21.z.string()
2699
- })
2700
- );
2701
- var RegisterActionInput = BaseActionInput.merge(
2702
- import_zod21.z.object({
2703
- type: import_zod21.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
2704
- registrationNumber: import_zod21.z.string().optional()
2544
+ var RegistrationCreationMetadata = ActionCreationMetadata.extend({
2545
+ registrationNumber: import_zod20.z.string().describe(
2546
+ "Registration number of the event. Always present for accepted registrations."
2547
+ )
2548
+ });
2549
+ var LegalStatuses = import_zod20.z.object({
2550
+ [EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
2551
+ [EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
2552
+ });
2553
+ var EventMetadata = import_zod20.z.object({
2554
+ id: UUID,
2555
+ type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
2556
+ status: EventStatuses,
2557
+ legalStatuses: LegalStatuses.describe(
2558
+ "Metadata related to the legal registration of the event, such as who registered it and when."
2559
+ ),
2560
+ createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
2561
+ dateOfEvent: ZodDate.nullish(),
2562
+ createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
2563
+ updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
2564
+ createdAtLocation: CreatedAtLocation.describe(
2565
+ "Location of the user who created the event."
2566
+ ),
2567
+ createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
2568
+ updatedAtLocation: UUID.nullish().describe(
2569
+ "Location of the user who last updated the declaration."
2570
+ ),
2571
+ updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
2572
+ assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
2573
+ updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
2574
+ trackingId: import_zod20.z.string().describe(
2575
+ "System-generated tracking ID used by informants or registrars to look up the event."
2576
+ ),
2577
+ flags: import_zod20.z.array(Flag)
2578
+ });
2579
+ var EventMetadataKeysArray = [
2580
+ "id",
2581
+ "type",
2582
+ "status",
2583
+ "createdAt",
2584
+ "dateOfEvent",
2585
+ "createdBy",
2586
+ "updatedByUserRole",
2587
+ "createdAtLocation",
2588
+ "updatedAtLocation",
2589
+ "updatedAt",
2590
+ "assignedTo",
2591
+ "updatedBy",
2592
+ "trackingId",
2593
+ "legalStatuses",
2594
+ "flags"
2595
+ ];
2596
+ var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
2597
+ var eventMetadataLabelMap = {
2598
+ "event.assignedTo": {
2599
+ id: "event.assignedTo.label",
2600
+ defaultMessage: "Assigned To",
2601
+ description: "Assigned To"
2602
+ },
2603
+ "event.createdAt": {
2604
+ id: "event.createdAt.label",
2605
+ defaultMessage: "Created",
2606
+ description: "Created At"
2607
+ },
2608
+ "event.dateOfEvent": {
2609
+ id: "event.dateOfEvent.label",
2610
+ defaultMessage: "Date of Event",
2611
+ description: "Date of Event"
2612
+ },
2613
+ "event.createdAtLocation": {
2614
+ id: "event.createdAtLocation.label",
2615
+ defaultMessage: "Location",
2616
+ description: "Created At Location"
2617
+ },
2618
+ "event.updatedAtLocation": {
2619
+ id: "event.updatedAtLocation.label",
2620
+ defaultMessage: "Location",
2621
+ description: "Updated At Location"
2622
+ },
2623
+ "event.createdBy": {
2624
+ id: "event.createdBy.label",
2625
+ defaultMessage: "Created By",
2626
+ description: "Created By"
2627
+ },
2628
+ "event.updatedByUserRole": {
2629
+ id: "event.updatedByUserRole.label",
2630
+ defaultMessage: "Updated By Role",
2631
+ description: "Updated By Role"
2632
+ },
2633
+ "event.id": {
2634
+ id: "event.id.label",
2635
+ defaultMessage: "ID",
2636
+ description: "ID"
2637
+ },
2638
+ "event.updatedAt": {
2639
+ id: "event.modifiedAt.label",
2640
+ defaultMessage: "Updated",
2641
+ description: "Modified At"
2642
+ },
2643
+ "event.status": {
2644
+ id: "event.status.label",
2645
+ defaultMessage: "Status",
2646
+ description: "Status"
2647
+ },
2648
+ "event.type": {
2649
+ id: "event.type.label",
2650
+ defaultMessage: "Type",
2651
+ description: "Type"
2652
+ },
2653
+ "event.updatedBy": {
2654
+ id: "event.updatedBy.label",
2655
+ defaultMessage: "Updated By",
2656
+ description: "Updated By"
2657
+ },
2658
+ "event.trackingId": {
2659
+ id: "event.trackingId.label",
2660
+ defaultMessage: "Tracking ID",
2661
+ description: "Tracking ID"
2662
+ },
2663
+ "event.flags": {
2664
+ id: "event.flags.label",
2665
+ defaultMessage: "Flags",
2666
+ description: "Flags"
2667
+ }
2668
+ };
2669
+
2670
+ // ../commons/src/events/WorkqueueColumnConfig.ts
2671
+ var WorkqueueColumnKeysArray = [
2672
+ ...EventMetadataKeysArray,
2673
+ "title"
2674
+ ];
2675
+ var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
2676
+ var WorkqueueColumnValue = import_zod21.z.object({
2677
+ $event: WorkqueueColumnKeys
2678
+ });
2679
+ var WorkqueueColumn = import_zod21.z.object({
2680
+ label: TranslationConfig,
2681
+ value: WorkqueueColumnValue
2682
+ });
2683
+ function defineWorkqueuesColumns(workqueueColumns) {
2684
+ return workqueueColumns.map(
2685
+ (workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
2686
+ );
2687
+ }
2688
+
2689
+ // ../commons/src/events/CountryConfigQueryInput.ts
2690
+ var import_zod23 = require("zod");
2691
+
2692
+ // ../commons/src/events/EventIndex.ts
2693
+ var import_zod22 = require("zod");
2694
+ var import_zod_openapi9 = require("zod-openapi");
2695
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
2696
+ var EventIndex = EventMetadata.extend({
2697
+ declaration: EventState
2698
+ }).openapi({
2699
+ ref: "EventIndex"
2700
+ });
2701
+ var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
2702
+ import_zod22.z.object({
2703
+ type: import_zod22.z.string()
2704
+ // Ensures "type" (event-id) exists and is a string
2705
+ })
2706
+ ).openapi({
2707
+ ref: "EventSearchIndex"
2708
+ });
2709
+ var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
2710
+ ref: "Fuzzy"
2711
+ });
2712
+ var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
2713
+ ref: "Exact"
2714
+ });
2715
+ var AnyOf = import_zod22.z.object({
2716
+ type: import_zod22.z.literal("anyOf"),
2717
+ terms: import_zod22.z.array(import_zod22.z.string())
2718
+ }).openapi({
2719
+ ref: "AnyOf"
2720
+ });
2721
+ var ExactStatus = import_zod22.z.object({
2722
+ type: import_zod22.z.literal("exact"),
2723
+ term: EventStatusEnum
2724
+ }).openapi({
2725
+ ref: "ExactStatus"
2726
+ });
2727
+ var AnyOfStatus = import_zod22.z.object({
2728
+ type: import_zod22.z.literal("anyOf"),
2729
+ terms: import_zod22.z.array(EventStatusEnum)
2730
+ }).openapi({
2731
+ ref: "AnyOfStatus"
2732
+ });
2733
+ var Range = import_zod22.z.object({
2734
+ type: import_zod22.z.literal("range"),
2735
+ gte: import_zod22.z.string(),
2736
+ lte: import_zod22.z.string()
2737
+ }).openapi({
2738
+ ref: "Range"
2739
+ });
2740
+ var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
2741
+ ref: "Not"
2742
+ });
2743
+ var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
2744
+ ref: "Within"
2745
+ });
2746
+ var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
2747
+ ref: "DateCondition"
2748
+ });
2749
+ var QueryInput = import_zod22.z.lazy(
2750
+ () => import_zod22.z.union([
2751
+ import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
2752
+ import_zod22.z.record(import_zod22.z.string(), QueryInput)
2753
+ ])
2754
+ ).openapi({
2755
+ ref: "QueryInput"
2756
+ });
2757
+ var QueryExpression = import_zod22.z.object({
2758
+ eventType: import_zod22.z.string(),
2759
+ status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
2760
+ createdAt: import_zod22.z.optional(DateCondition),
2761
+ updatedAt: import_zod22.z.optional(DateCondition),
2762
+ "legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
2763
+ "legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
2764
+ import_zod22.z.union([Within, Exact])
2765
+ ),
2766
+ createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2767
+ updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
2768
+ assignedTo: import_zod22.z.optional(Exact),
2769
+ createdBy: import_zod22.z.optional(Exact),
2770
+ updatedBy: import_zod22.z.optional(Exact),
2771
+ trackingId: import_zod22.z.optional(Exact),
2772
+ flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
2773
+ data: QueryInput
2774
+ }).partial().openapi({
2775
+ ref: "QueryExpression"
2776
+ });
2777
+ var QueryType = import_zod22.z.object({
2778
+ type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
2779
+ clauses: import_zod22.z.preprocess(
2780
+ (val) => {
2781
+ if (typeof val === "string") {
2782
+ return [JSON.parse(val)];
2783
+ }
2784
+ if (Array.isArray(val)) {
2785
+ return val.map((v) => typeof v === "string" ? JSON.parse(v) : v);
2786
+ }
2787
+ return val;
2788
+ },
2789
+ import_zod22.z.array(QueryExpression).openapi({
2790
+ default: [
2791
+ {
2792
+ eventType: TENNIS_CLUB_MEMBERSHIP,
2793
+ status: {
2794
+ type: "anyOf",
2795
+ terms: [
2796
+ "CREATED",
2797
+ "NOTIFIED",
2798
+ "DECLARED",
2799
+ "VALIDATED",
2800
+ "REGISTERED",
2801
+ "CERTIFIED",
2802
+ "REJECTED",
2803
+ "ARCHIVED"
2804
+ ]
2805
+ },
2806
+ updatedAt: {
2807
+ type: "range",
2808
+ gte: "2025-05-22",
2809
+ lte: "2025-05-29"
2810
+ },
2811
+ data: {}
2812
+ }
2813
+ ]
2814
+ })
2815
+ )
2816
+ }).openapi({
2817
+ ref: "QueryType"
2818
+ });
2819
+
2820
+ // ../commons/src/events/CountryConfigQueryInput.ts
2821
+ var SerializableExact = import_zod23.z.object({
2822
+ type: import_zod23.z.literal("exact"),
2823
+ term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
2824
+ });
2825
+ var SerializableWithin = import_zod23.z.object({
2826
+ type: import_zod23.z.literal("within"),
2827
+ location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
2828
+ });
2829
+ var SerializedQueryExpression = import_zod23.z.object({
2830
+ eventType: import_zod23.z.string(),
2831
+ status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
2832
+ createdAt: import_zod23.z.optional(DateCondition),
2833
+ updatedAt: import_zod23.z.optional(DateCondition),
2834
+ createdAtLocation: import_zod23.z.optional(
2835
+ import_zod23.z.union([SerializableWithin, SerializableExact])
2836
+ ),
2837
+ updatedAtLocation: import_zod23.z.optional(
2838
+ import_zod23.z.union([SerializableWithin, SerializableExact])
2839
+ ),
2840
+ assignedTo: import_zod23.z.optional(SerializableExact),
2841
+ createdBy: import_zod23.z.optional(SerializableExact),
2842
+ updatedBy: import_zod23.z.optional(SerializableExact),
2843
+ trackingId: import_zod23.z.optional(Exact),
2844
+ flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
2845
+ data: QueryInput
2846
+ }).partial();
2847
+ var Or2 = import_zod23.z.object({
2848
+ type: import_zod23.z.literal("or"),
2849
+ clauses: import_zod23.z.array(SerializedQueryExpression)
2850
+ });
2851
+ var And2 = import_zod23.z.object({
2852
+ type: import_zod23.z.literal("and"),
2853
+ clauses: import_zod23.z.array(SerializedQueryExpression)
2854
+ });
2855
+ var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
2856
+ var CountryConfigQueryInputType = import_zod23.z.union([
2857
+ SerializedQueryExpression,
2858
+ And2,
2859
+ Or2
2860
+ ]);
2861
+
2862
+ // ../commons/src/icons.ts
2863
+ var import_zod24 = require("zod");
2864
+ var AvailableIcons = import_zod24.z.enum([
2865
+ "Archived",
2866
+ "Assigned",
2867
+ "Certified",
2868
+ "Close",
2869
+ "Collapse",
2870
+ "Draft",
2871
+ "DuplicateYellow",
2872
+ "Expand",
2873
+ "ExternalValidate",
2874
+ "FilledCheck",
2875
+ "InReview",
2876
+ "Offline",
2877
+ "Registered",
2878
+ "RequiresUpdates",
2879
+ "Sent",
2880
+ "Validated",
2881
+ "WaitingApproval",
2882
+ "ChartActivity",
2883
+ "Activity",
2884
+ "Archive",
2885
+ "ArchiveTray",
2886
+ "ArrowLeft",
2887
+ "ArrowRight",
2888
+ "Buildings",
2889
+ "Circle",
2890
+ "CaretDown",
2891
+ "CaretLeft",
2892
+ "CaretRight",
2893
+ "ChartBar",
2894
+ "ChartLine",
2895
+ "ChatCircle",
2896
+ "CheckSquare",
2897
+ "Compass",
2898
+ "Check",
2899
+ "Copy",
2900
+ "Database",
2901
+ "DotsThreeVertical",
2902
+ "DownloadSimple",
2903
+ "ArrowCounterClockwise",
2904
+ "MagnifyingGlassMinus",
2905
+ "MagnifyingGlassPlus",
2906
+ "Export",
2907
+ "Eye",
2908
+ "EyeSlash",
2909
+ "Envelope",
2910
+ "File",
2911
+ "FileSearch",
2912
+ "FileMinus",
2913
+ "FilePlus",
2914
+ "FileText",
2915
+ "FileX",
2916
+ "Handshake",
2917
+ "Gear",
2918
+ "GitBranch",
2919
+ "IdentificationCard",
2920
+ "List",
2921
+ "ListBullets",
2922
+ "Lock",
2923
+ "MagnifyingGlass",
2924
+ "MapPin",
2925
+ "Medal",
2926
+ "NotePencil",
2927
+ "Paperclip",
2928
+ "PaperPlaneTilt",
2929
+ "Pen",
2930
+ "Pencil",
2931
+ "PencilSimpleLine",
2932
+ "Phone",
2933
+ "Plus",
2934
+ "Printer",
2935
+ "SignOut",
2936
+ "Star",
2937
+ "Target",
2938
+ "TextT",
2939
+ "Trash",
2940
+ "UploadSimple",
2941
+ "User",
2942
+ "UserPlus",
2943
+ "Users",
2944
+ "WarningCircle",
2945
+ "X",
2946
+ "CircleWavyCheck",
2947
+ "CircleWavyQuestion",
2948
+ "ArchiveBox",
2949
+ "ArrowCircleDown",
2950
+ "FileArrowUp",
2951
+ "FileDotted",
2952
+ "Files",
2953
+ "PencilLine",
2954
+ "PencilCircle",
2955
+ "UserCircle",
2956
+ "Clock",
2957
+ "QrCode",
2958
+ "Webcam",
2959
+ "Sun",
2960
+ "DeviceTabletCamera",
2961
+ "Globe",
2962
+ "Fingerprint",
2963
+ "PushPin",
2964
+ "Timer"
2965
+ ]);
2966
+
2967
+ // ../commons/src/events/WorkqueueConfig.ts
2968
+ var dateOfEventColumn = defineWorkqueuesColumns([
2969
+ {
2970
+ label: {
2971
+ id: "workqueues.dateOfEvent",
2972
+ defaultMessage: "Date of Event",
2973
+ description: "Label for workqueue column: dateOfEvent"
2974
+ },
2975
+ value: event.field("dateOfEvent")
2976
+ },
2977
+ {
2978
+ label: {
2979
+ defaultMessage: "Last updated",
2980
+ description: "This is the label for the workqueue column",
2981
+ id: "workqueue.default.column.modifiedAt"
2982
+ },
2983
+ value: event.field("updatedAt")
2984
+ }
2985
+ ]);
2986
+ var WorkqueueConfig = import_zod25.z.object({
2987
+ slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
2988
+ name: TranslationConfig.describe(
2989
+ "Title of the workflow (both in navigation and on the page)"
2990
+ ),
2991
+ query: CountryConfigQueryType,
2992
+ actions: import_zod25.z.array(
2993
+ import_zod25.z.object({
2994
+ type: import_zod25.z.string(),
2995
+ conditionals: import_zod25.z.array(Conditional).optional()
2996
+ })
2997
+ ),
2998
+ columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
2999
+ icon: AvailableIcons
3000
+ }).describe("Configuration for workqueue.");
3001
+ var WorkqueueConfigInput = import_zod25.z.object({
3002
+ slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
3003
+ name: TranslationConfig.describe(
3004
+ "Title of the workflow (both in navigation and on the page)"
3005
+ ),
3006
+ query: CountryConfigQueryInputType,
3007
+ actions: import_zod25.z.array(
3008
+ import_zod25.z.object({
3009
+ type: import_zod25.z.string(),
3010
+ conditionals: import_zod25.z.array(Conditional).optional()
3011
+ })
3012
+ ),
3013
+ columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
3014
+ icon: AvailableIcons
3015
+ });
3016
+ function defineWorkqueue(workqueueInput) {
3017
+ const queryInput = workqueueInput.query;
3018
+ const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
3019
+ return WorkqueueConfig.parse({ ...workqueueInput, query });
3020
+ }
3021
+ function defineWorkqueues(workqueues) {
3022
+ return workqueues.map((workqueue) => defineWorkqueue(workqueue));
3023
+ }
3024
+ var WorkqueueCountInput = import_zod25.z.array(
3025
+ import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
3026
+ );
3027
+ var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
3028
+
3029
+ // ../commons/src/events/workqueueDefaultColumns.ts
3030
+ var defaultWorkqueueColumns = [
3031
+ {
3032
+ label: {
3033
+ defaultMessage: "Title",
3034
+ description: "This is the label for the workqueue column",
3035
+ id: "workqueue.in-reveiw.column.title"
3036
+ },
3037
+ value: event.field("title")
3038
+ },
3039
+ {
3040
+ label: {
3041
+ defaultMessage: "Event",
3042
+ description: "This is the label for the workqueue column",
3043
+ id: "workqueue.default.column.event"
3044
+ },
3045
+ value: event.field("type")
3046
+ }
3047
+ ];
3048
+
3049
+ // ../commons/src/events/Draft.ts
3050
+ var import_zod27 = require("zod");
3051
+
3052
+ // ../commons/src/events/ActionInput.ts
3053
+ var import_zod26 = require("zod");
3054
+ var import_zod_openapi10 = require("zod-openapi");
3055
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
3056
+ var BaseActionInput = import_zod26.z.object({
3057
+ eventId: UUID,
3058
+ transactionId: import_zod26.z.string(),
3059
+ declaration: ActionUpdate.default({}),
3060
+ annotation: ActionUpdate.optional(),
3061
+ originalActionId: UUID.optional(),
3062
+ keepAssignment: import_zod26.z.boolean().optional()
3063
+ });
3064
+ var CreateActionInput = BaseActionInput.merge(
3065
+ import_zod26.z.object({
3066
+ type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3067
+ createdAtLocation: CreatedAtLocation
3068
+ })
3069
+ );
3070
+ var RegisterActionInput = BaseActionInput.merge(
3071
+ import_zod26.z.object({
3072
+ type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3073
+ registrationNumber: import_zod26.z.string().optional()
2705
3074
  })
2706
3075
  );
2707
3076
  var ValidateActionInput = BaseActionInput.merge(
2708
- import_zod21.z.object({
2709
- type: import_zod21.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
2710
- duplicates: import_zod21.z.array(import_zod21.z.string())
3077
+ import_zod26.z.object({
3078
+ type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
3079
+ duplicates: import_zod26.z.array(import_zod26.z.string())
2711
3080
  })
2712
3081
  );
2713
3082
  var NotifyActionInput = BaseActionInput.merge(
2714
- import_zod21.z.object({
2715
- type: import_zod21.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3083
+ import_zod26.z.object({
3084
+ type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
2716
3085
  })
2717
3086
  ).openapi({
2718
3087
  default: {
2719
3088
  eventId: "<event-id-here>",
2720
- transactionId: (0, import_uuid3.v4)(),
3089
+ transactionId: getUUID(),
2721
3090
  declaration: {},
2722
3091
  annotation: {},
2723
3092
  type: ActionType.NOTIFY
2724
3093
  }
2725
3094
  });
2726
3095
  var DeclareActionInput = BaseActionInput.merge(
2727
- import_zod21.z.object({
2728
- type: import_zod21.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3096
+ import_zod26.z.object({
3097
+ type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
2729
3098
  })
2730
3099
  );
2731
3100
  var PrintCertificateActionInput = BaseActionInput.merge(
2732
- import_zod21.z.object({
2733
- type: import_zod21.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
3101
+ import_zod26.z.object({
3102
+ type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
2734
3103
  })
2735
3104
  );
2736
3105
  var RejectDeclarationActionInput = BaseActionInput.merge(
2737
- import_zod21.z.object({
2738
- type: import_zod21.z.literal(ActionType.REJECT).default(ActionType.REJECT)
3106
+ import_zod26.z.object({
3107
+ type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3108
+ reason: RejectionReason
2739
3109
  })
2740
3110
  );
2741
3111
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
2742
- import_zod21.z.object({
2743
- type: import_zod21.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
3112
+ import_zod26.z.object({
3113
+ type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
2744
3114
  })
2745
3115
  );
2746
3116
  var ArchiveActionInput = BaseActionInput.merge(
2747
- import_zod21.z.object({
2748
- type: import_zod21.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
3117
+ import_zod26.z.object({
3118
+ type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3119
+ reason: RejectionReason
2749
3120
  })
2750
3121
  );
2751
3122
  var AssignActionInput = BaseActionInput.merge(
2752
- import_zod21.z.object({
2753
- type: import_zod21.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
2754
- assignedTo: import_zod21.z.string()
3123
+ import_zod26.z.object({
3124
+ type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
3125
+ assignedTo: import_zod26.z.string()
2755
3126
  })
2756
3127
  );
2757
3128
  var UnassignActionInput = BaseActionInput.merge(
2758
- import_zod21.z.object({
2759
- type: import_zod21.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
2760
- assignedTo: import_zod21.z.literal(null).default(null)
3129
+ import_zod26.z.object({
3130
+ type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3131
+ assignedTo: import_zod26.z.literal(null).default(null)
2761
3132
  })
2762
3133
  );
2763
3134
  var RequestCorrectionActionInput = BaseActionInput.merge(
2764
- import_zod21.z.object({
2765
- type: import_zod21.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3135
+ import_zod26.z.object({
3136
+ type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
2766
3137
  })
2767
3138
  );
2768
3139
  var RejectCorrectionActionInput = BaseActionInput.merge(
2769
- import_zod21.z.object({
2770
- requestId: import_zod21.z.string(),
2771
- type: import_zod21.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
3140
+ import_zod26.z.object({
3141
+ requestId: import_zod26.z.string(),
3142
+ type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
2772
3143
  })
2773
3144
  );
2774
3145
  var ApproveCorrectionActionInput = BaseActionInput.merge(
2775
- import_zod21.z.object({
2776
- requestId: import_zod21.z.string(),
2777
- type: import_zod21.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3146
+ import_zod26.z.object({
3147
+ requestId: import_zod26.z.string(),
3148
+ type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
2778
3149
  })
2779
3150
  );
2780
3151
  var ReadActionInput = BaseActionInput.merge(
2781
- import_zod21.z.object({
2782
- type: import_zod21.z.literal(ActionType.READ).default(ActionType.READ)
3152
+ import_zod26.z.object({
3153
+ type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
2783
3154
  })
2784
3155
  );
2785
- var DeleteActionInput = import_zod21.z.object({ eventId: import_zod21.z.string() });
2786
- var ActionInput = import_zod21.z.discriminatedUnion("type", [
3156
+ var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
3157
+ var ActionInput = import_zod26.z.discriminatedUnion("type", [
2787
3158
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
2788
3159
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
2789
3160
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -2812,18 +3183,18 @@ var ActionInput = import_zod21.z.discriminatedUnion("type", [
2812
3183
  });
2813
3184
 
2814
3185
  // ../commons/src/events/Draft.ts
2815
- var Draft = import_zod22.z.object({
2816
- id: import_zod22.z.string(),
2817
- eventId: import_zod22.z.string(),
2818
- transactionId: import_zod22.z.string(),
2819
- createdAt: import_zod22.z.string().datetime(),
3186
+ var Draft = import_zod27.z.object({
3187
+ id: UUID,
3188
+ eventId: UUID,
3189
+ transactionId: import_zod27.z.string(),
3190
+ createdAt: import_zod27.z.string().datetime(),
2820
3191
  action: ActionBase.extend({
2821
3192
  type: ActionTypes
2822
3193
  }).omit({ id: true })
2823
3194
  });
2824
3195
  var DraftInput = BaseActionInput.extend({
2825
3196
  type: ActionTypes,
2826
- status: import_zod22.z.enum([
3197
+ status: import_zod27.z.enum([
2827
3198
  ActionStatus.Requested,
2828
3199
  ActionStatus.Accepted,
2829
3200
  ActionStatus.Rejected
@@ -2831,26 +3202,24 @@ var DraftInput = BaseActionInput.extend({
2831
3202
  });
2832
3203
 
2833
3204
  // ../commons/src/events/EventInput.ts
2834
- var import_zod23 = require("zod");
2835
- var import_uuid4 = require("uuid");
2836
- var EventInput = import_zod23.z.object({
2837
- transactionId: import_zod23.z.string(),
2838
- type: import_zod23.z.string(),
2839
- dateOfEvent: import_zod23.z.object({ fieldId: import_zod23.z.string() }).optional()
2840
- }).openapi({ default: { transactionId: (0, import_uuid4.v4)(), type: "v2.birth" } });
3205
+ var import_zod28 = require("zod");
3206
+ var import_uuid8 = require("uuid");
3207
+ var EventInput = import_zod28.z.object({
3208
+ transactionId: import_zod28.z.string(),
3209
+ type: import_zod28.z.string()
3210
+ }).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
2841
3211
 
2842
3212
  // ../commons/src/events/EventDocument.ts
2843
- var import_zod24 = require("zod");
2844
- var import_zod_openapi10 = require("zod-openapi");
2845
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod24.z);
2846
- var EventDocument = import_zod24.z.object({
2847
- id: import_zod24.z.string(),
2848
- type: import_zod24.z.string(),
2849
- dateOfEvent: import_zod24.z.object({ fieldId: import_zod24.z.string() }).optional(),
2850
- createdAt: import_zod24.z.string().datetime(),
2851
- updatedAt: import_zod24.z.string().datetime(),
2852
- actions: import_zod24.z.array(Action),
2853
- trackingId: import_zod24.z.string()
3213
+ var import_zod29 = require("zod");
3214
+ var import_zod_openapi11 = require("zod-openapi");
3215
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
3216
+ var EventDocument = import_zod29.z.object({
3217
+ id: UUID,
3218
+ type: import_zod29.z.string(),
3219
+ createdAt: import_zod29.z.string().datetime(),
3220
+ updatedAt: import_zod29.z.string().datetime(),
3221
+ actions: import_zod29.z.array(Action),
3222
+ trackingId: import_zod29.z.string()
2854
3223
  }).openapi({ ref: "EventDocument" });
2855
3224
 
2856
3225
  // ../commons/src/events/state/utils.ts
@@ -2887,6 +3256,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
2887
3256
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
2888
3257
  acceptedAt: acceptAction.createdAt,
2889
3258
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
3259
+ createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
2890
3260
  registrationNumber
2891
3261
  };
2892
3262
  }
@@ -3007,23 +3377,34 @@ function getAssignedUserFromActions(actions) {
3007
3377
  return user2;
3008
3378
  }, null);
3009
3379
  }
3380
+ function getAssignedUserSignatureFromActions(actions) {
3381
+ return actions.reduce((signature, action) => {
3382
+ if (action.type === ActionType.ASSIGN) {
3383
+ return action.createdBySignature || null;
3384
+ }
3385
+ if (action.type === ActionType.UNASSIGN) {
3386
+ return null;
3387
+ }
3388
+ return signature;
3389
+ }, null);
3390
+ }
3010
3391
  function aggregateActionDeclarations(actions) {
3011
3392
  const excludedActions = [
3012
3393
  ActionType.REQUEST_CORRECTION,
3013
3394
  ActionType.PRINT_CERTIFICATE
3014
3395
  ];
3015
- return actions.reduce((status, action) => {
3396
+ return actions.reduce((declaration, action) => {
3016
3397
  if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
3017
- return status;
3398
+ return declaration;
3018
3399
  }
3019
3400
  if (action.type === ActionType.APPROVE_CORRECTION) {
3020
3401
  const requestAction = actions.find(({ id }) => id === action.requestId);
3021
3402
  if (!requestAction) {
3022
- return status;
3403
+ return declaration;
3023
3404
  }
3024
- return deepMerge(status, requestAction.declaration);
3405
+ return deepMerge(declaration, requestAction.declaration);
3025
3406
  }
3026
- return deepMerge(status, action.declaration);
3407
+ return deepMerge(declaration, action.declaration);
3027
3408
  }, {});
3028
3409
  }
3029
3410
  function deepDropNulls(obj) {
@@ -3051,7 +3432,7 @@ function getAcceptedActions(event2) {
3051
3432
  );
3052
3433
  }
3053
3434
  var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
3054
- function getCurrentEventState(event2) {
3435
+ function getCurrentEventState(event2, config) {
3055
3436
  const creationAction = event2.actions.find(
3056
3437
  (action) => action.type === ActionType.CREATE
3057
3438
  );
@@ -3063,9 +3444,17 @@ function getCurrentEventState(event2) {
3063
3444
  event2.actions
3064
3445
  );
3065
3446
  const declaration = aggregateActionDeclarations(acceptedActions);
3066
- const dateOfEvent = ZodDate.safeParse(
3067
- event2.dateOfEvent?.fieldId ? declaration[event2.dateOfEvent.fieldId] : event2[DEFAULT_DATE_OF_EVENT_PROPERTY]
3068
- ).data ?? null;
3447
+ let dateOfEvent;
3448
+ if (config.dateOfEvent) {
3449
+ const parsedDate = ZodDate.safeParse(
3450
+ declaration[config.dateOfEvent.$$field]
3451
+ );
3452
+ if (parsedDate.success) {
3453
+ dateOfEvent = parsedDate.data;
3454
+ }
3455
+ } else {
3456
+ dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
3457
+ }
3069
3458
  return deepDropNulls({
3070
3459
  id: event2.id,
3071
3460
  type: event2.type,
@@ -3074,19 +3463,24 @@ function getCurrentEventState(event2) {
3074
3463
  createdAt: creationAction.createdAt,
3075
3464
  createdBy: creationAction.createdBy,
3076
3465
  createdAtLocation: creationAction.createdAtLocation,
3466
+ createdBySignature: creationAction.createdBySignature,
3077
3467
  updatedAt: declarationUpdateMetadata.createdAt,
3078
3468
  assignedTo: getAssignedUserFromActions(acceptedActions),
3469
+ assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
3079
3470
  updatedBy: declarationUpdateMetadata.createdBy,
3080
3471
  updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
3081
3472
  declaration,
3082
3473
  trackingId: event2.trackingId,
3083
- // @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
3084
3474
  updatedByUserRole: declarationUpdateMetadata.createdByRole,
3085
3475
  dateOfEvent,
3086
3476
  flags: getFlagsFromActions(event2.actions)
3087
3477
  });
3088
3478
  }
3089
- function getCurrentEventStateWithDrafts(event2, drafts) {
3479
+ function getCurrentEventStateWithDrafts({
3480
+ event: event2,
3481
+ drafts,
3482
+ configuration
3483
+ }) {
3090
3484
  const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
3091
3485
  const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
3092
3486
  if (action.type === ActionType.REQUEST_CORRECTION) {
@@ -3105,7 +3499,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
3105
3499
  ...event2,
3106
3500
  actions: actionWithDrafts
3107
3501
  };
3108
- return getCurrentEventState(withDrafts);
3502
+ return getCurrentEventState(withDrafts, configuration);
3109
3503
  }
3110
3504
  function applyDraftsToEventIndex(eventIndex, drafts) {
3111
3505
  const indexedAt = eventIndex.updatedAt;
@@ -3159,6 +3553,21 @@ function generateTransactionId() {
3159
3553
  return getUUID();
3160
3554
  }
3161
3555
 
3556
+ // ../commons/src/events/User.ts
3557
+ var import_zod30 = require("zod");
3558
+ var User = import_zod30.z.object({
3559
+ id: import_zod30.z.string(),
3560
+ name: import_zod30.z.array(
3561
+ import_zod30.z.object({
3562
+ use: import_zod30.z.string(),
3563
+ given: import_zod30.z.array(import_zod30.z.string()),
3564
+ family: import_zod30.z.string()
3565
+ })
3566
+ ),
3567
+ role: import_zod30.z.string(),
3568
+ signatureFilename: import_zod30.z.string().optional()
3569
+ });
3570
+
3162
3571
  // ../commons/src/events/test.utils.ts
3163
3572
  var import_lodash2 = require("lodash");
3164
3573
  var import_addDays = __toESM(require("date-fns/addDays"));
@@ -3176,16 +3585,12 @@ function createFieldConfig(fieldId, options) {
3176
3585
  // ../commons/src/events/field.ts
3177
3586
  function field(fieldId, options = {}) {
3178
3587
  return {
3179
- /**
3180
- * @private Internal property used for field reference tracking.
3181
- */
3182
- _fieldId: fieldId,
3183
3588
  ...createFieldConditionals(fieldId),
3184
3589
  ...createFieldConfig(fieldId, options)
3185
3590
  };
3186
3591
  }
3187
3592
 
3188
- // ../commons/src/fixtures/tennis-club-membership-event.ts
3593
+ // ../commons/src/fixtures/forms.ts
3189
3594
  var import_date_fns2 = require("date-fns");
3190
3595
  var PRINT_CERTIFICATE_FORM = defineActionForm({
3191
3596
  label: {
@@ -4176,7 +4581,10 @@ var timePeriodOptions = [
4176
4581
  description: "Label for option of time period select: last 7 days",
4177
4582
  id: "form.section.label.timePeriodLast7Days"
4178
4583
  },
4179
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd")}`
4584
+ value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
4585
+ /* @__PURE__ */ new Date(),
4586
+ "yyyy-MM-dd"
4587
+ )}`
4180
4588
  },
4181
4589
  {
4182
4590
  label: {
@@ -4184,7 +4592,10 @@ var timePeriodOptions = [
4184
4592
  description: "Label for option of time period select: last 30 days",
4185
4593
  id: "form.section.label.timePeriodLast30Days"
4186
4594
  },
4187
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd")}`
4595
+ value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
4596
+ /* @__PURE__ */ new Date(),
4597
+ "yyyy-MM-dd"
4598
+ )}`
4188
4599
  },
4189
4600
  {
4190
4601
  label: {
@@ -4192,7 +4603,10 @@ var timePeriodOptions = [
4192
4603
  description: "Label for option of time period select: last 90 days",
4193
4604
  id: "form.section.label.timePeriodLast90Days"
4194
4605
  },
4195
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd")}`
4606
+ value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
4607
+ /* @__PURE__ */ new Date(),
4608
+ "yyyy-MM-dd"
4609
+ )}`
4196
4610
  },
4197
4611
  {
4198
4612
  label: {
@@ -4200,15 +4614,20 @@ var timePeriodOptions = [
4200
4614
  description: "Label for option of time period select: last year",
4201
4615
  id: "form.section.label.timePeriodLastYear"
4202
4616
  },
4203
- value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd")}`
4617
+ value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
4618
+ /* @__PURE__ */ new Date(),
4619
+ "yyyy-MM-dd"
4620
+ )}`
4204
4621
  }
4205
4622
  ];
4623
+
4624
+ // ../commons/src/fixtures/tennis-club-membership-event.ts
4206
4625
  var tennisClubMembershipEvent = defineConfig({
4207
- id: "TENNIS_CLUB_MEMBERSHIP",
4626
+ id: TENNIS_CLUB_MEMBERSHIP,
4208
4627
  label: {
4209
4628
  defaultMessage: "Tennis club membership application",
4210
4629
  description: "This is what this event is referred as in the system",
4211
- id: "event.tennis-club-membership.label"
4630
+ id: "v2.event.tennis-club-membership.label"
4212
4631
  },
4213
4632
  title: {
4214
4633
  defaultMessage: "{applicant.firstname} {applicant.surname}",
@@ -4249,6 +4668,15 @@ var tennisClubMembershipEvent = defineConfig({
4249
4668
  ]
4250
4669
  },
4251
4670
  actions: [
4671
+ {
4672
+ type: ActionType.READ,
4673
+ label: {
4674
+ id: "v2.event.tennis-club-membership.action.read.label",
4675
+ defaultMessage: "Read",
4676
+ description: "Title of the read only page"
4677
+ },
4678
+ review: TENNIS_CLUB_DECLARATION_REVIEW
4679
+ },
4252
4680
  {
4253
4681
  type: ActionType.DECLARE,
4254
4682
  label: {
@@ -4590,10 +5018,466 @@ var tennisClubMembershipEvent = defineConfig({
4590
5018
  declaration: TENNIS_CLUB_DECLARATION_FORM
4591
5019
  });
4592
5020
 
4593
- // ../commons/src/events/test.utils.ts
4594
- function fieldConfigsToActionPayload(fields) {
4595
- return fields.reduce(
4596
- (acc, field2, i) => ({
5021
+ // ../commons/src/fixtures/football-club-membership-event.ts
5022
+ var footballClubMembershipEvent = defineConfig({
5023
+ id: "FOOTBALL_CLUB_MEMBERSHIP",
5024
+ label: {
5025
+ defaultMessage: "Football club membership application",
5026
+ description: "This is what this event is referred as in the system",
5027
+ id: "event.football-club-membership.label"
5028
+ },
5029
+ title: {
5030
+ defaultMessage: "{applicant.firstname} {applicant.surname}",
5031
+ description: "This is the title of the summary",
5032
+ id: "v2.event.football-club-membership.title"
5033
+ },
5034
+ summary: {
5035
+ fields: [
5036
+ {
5037
+ id: "applicant.firstname",
5038
+ label: {
5039
+ defaultMessage: "Applicant's first name",
5040
+ description: "This is the label for the field",
5041
+ id: "event.football-club-membership.summary.field.firstname.label"
5042
+ },
5043
+ value: {
5044
+ defaultMessage: "{applicant.firstname}",
5045
+ description: "This is the value to show in the summary",
5046
+ id: "event.football-club-membership.summary.field.firstname"
5047
+ },
5048
+ emptyValueMessage: {
5049
+ defaultMessage: "First name is not provided",
5050
+ description: "This is the message to show when the field is empty",
5051
+ id: "event.football-club-membership.summary.field.firstname.empty"
5052
+ }
5053
+ },
5054
+ {
5055
+ fieldId: "applicant.surname",
5056
+ label: {
5057
+ defaultMessage: "Applicant's last name",
5058
+ description: "Label for surname",
5059
+ id: "v2.event.football-club-membership.summary.field.surname.label"
5060
+ }
5061
+ },
5062
+ {
5063
+ fieldId: "applicant.email"
5064
+ }
5065
+ ]
5066
+ },
5067
+ actions: [
5068
+ {
5069
+ type: ActionType.READ,
5070
+ label: {
5071
+ id: "v2.event.football-club-membership.action.read.label",
5072
+ defaultMessage: "Read",
5073
+ description: "Title of the read only page"
5074
+ },
5075
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5076
+ },
5077
+ {
5078
+ type: ActionType.DECLARE,
5079
+ label: {
5080
+ defaultMessage: "Send an application",
5081
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5082
+ id: "event.football-club-membership.action.declare.label"
5083
+ },
5084
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5085
+ },
5086
+ {
5087
+ type: ActionType.VALIDATE,
5088
+ label: {
5089
+ defaultMessage: "Validate",
5090
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5091
+ id: "event.football-club-membership.action.validate.label"
5092
+ },
5093
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5094
+ },
5095
+ {
5096
+ type: ActionType.REGISTER,
5097
+ label: {
5098
+ defaultMessage: "Register",
5099
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5100
+ id: "event.football-club-membership.action.register.label"
5101
+ },
5102
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5103
+ },
5104
+ {
5105
+ type: ActionType.REQUEST_CORRECTION,
5106
+ label: {
5107
+ defaultMessage: "Request correction",
5108
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5109
+ id: "event.football-club-membership.action.correction.request.label"
5110
+ },
5111
+ onboardingForm: [
5112
+ {
5113
+ id: "correction-requester",
5114
+ type: PageTypes.enum.FORM,
5115
+ title: {
5116
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5117
+ defaultMessage: "Correction requester",
5118
+ description: "This is the title of the section"
5119
+ },
5120
+ fields: [
5121
+ {
5122
+ id: "correction.requester.relationshop.intro",
5123
+ type: "PAGE_HEADER",
5124
+ label: {
5125
+ id: "correction.requester.relationshop.intro.label",
5126
+ defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
5127
+ description: "The title for the corrector form"
5128
+ }
5129
+ },
5130
+ {
5131
+ id: "correction.requester.relationship",
5132
+ type: "RADIO_GROUP",
5133
+ label: {
5134
+ id: "v2.correction.corrector.title",
5135
+ defaultMessage: "Who is requesting a change to this record?",
5136
+ description: "The title for the corrector form"
5137
+ },
5138
+ defaultValue: "",
5139
+ options: [
5140
+ {
5141
+ value: "INFORMANT",
5142
+ label: {
5143
+ id: "v2.correction.corrector.informant",
5144
+ defaultMessage: "Informant",
5145
+ description: "Label for informant option in certificate correction form"
5146
+ }
5147
+ },
5148
+ {
5149
+ value: "ANOTHER_AGENT",
5150
+ label: {
5151
+ id: "v2.correction.corrector.anotherAgent",
5152
+ defaultMessage: "Another registration agent or field agent",
5153
+ description: "Label for another registration or field agent option in certificate correction form"
5154
+ }
5155
+ },
5156
+ {
5157
+ value: "REGISTRAR",
5158
+ label: {
5159
+ id: "v2.correction.corrector.me",
5160
+ defaultMessage: "Me (Registrar)",
5161
+ description: "Label for registrar option in certificate correction form"
5162
+ }
5163
+ },
5164
+ {
5165
+ value: "OTHER",
5166
+ label: {
5167
+ id: "v2.correction.corrector.others",
5168
+ defaultMessage: "Someone else",
5169
+ description: "Label for someone else option in certificate correction form"
5170
+ }
5171
+ }
5172
+ ]
5173
+ }
5174
+ ]
5175
+ },
5176
+ {
5177
+ id: "identity-check",
5178
+ type: PageTypes.enum.FORM,
5179
+ title: {
5180
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5181
+ defaultMessage: "Verify their identity",
5182
+ description: "This is the title of the section"
5183
+ },
5184
+ fields: [
5185
+ {
5186
+ id: "correction.identity-check.instructions",
5187
+ type: "PAGE_HEADER",
5188
+ label: {
5189
+ id: "correction.corrector.identity.instruction",
5190
+ defaultMessage: "Please verify the identity of the person making this request",
5191
+ description: "The title for the corrector form"
5192
+ }
5193
+ },
5194
+ {
5195
+ id: "correction.identity-check.verified",
5196
+ type: "RADIO_GROUP",
5197
+ label: {
5198
+ id: "correction.corrector.identity.verified.label",
5199
+ defaultMessage: "Identity verified",
5200
+ description: "The title for the corrector form"
5201
+ },
5202
+ defaultValue: "",
5203
+ required: true,
5204
+ options: [
5205
+ {
5206
+ value: "VERIFIED",
5207
+ label: {
5208
+ id: "correction.corrector.identity.verified",
5209
+ defaultMessage: "I have verified their identity",
5210
+ description: "Label for verified option in corrector identity check page"
5211
+ }
5212
+ }
5213
+ ]
5214
+ }
5215
+ ]
5216
+ }
5217
+ ],
5218
+ additionalDetailsForm: [
5219
+ {
5220
+ id: "correction-request.supporting-documents",
5221
+ type: PageTypes.enum.FORM,
5222
+ title: {
5223
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
5224
+ defaultMessage: "Upload supporting documents",
5225
+ description: "This is the title of the section"
5226
+ },
5227
+ fields: [
5228
+ {
5229
+ id: "correction.supportingDocs.introduction",
5230
+ type: "PAGE_HEADER",
5231
+ label: {
5232
+ id: "correction.corrector.paragraph.title",
5233
+ defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
5234
+ description: "The title for the corrector form"
5235
+ }
5236
+ },
5237
+ {
5238
+ id: "correction.supportingDocs",
5239
+ type: FieldType.FILE,
5240
+ label: {
5241
+ id: "correction.corrector.title",
5242
+ defaultMessage: "Upload supporting documents",
5243
+ description: "The title for the corrector form"
5244
+ }
5245
+ },
5246
+ {
5247
+ id: "correction.request.supportingDocuments",
5248
+ type: "RADIO_GROUP",
5249
+ label: {
5250
+ id: "correction.corrector.title",
5251
+ defaultMessage: "Who is requesting a change to this record?",
5252
+ description: "The title for the corrector form"
5253
+ },
5254
+ defaultValue: "",
5255
+ configuration: {
5256
+ styles: {
5257
+ size: "NORMAL"
5258
+ }
5259
+ },
5260
+ options: [
5261
+ {
5262
+ value: "ATTEST",
5263
+ label: {
5264
+ id: "correction.supportingDocuments.attest.label",
5265
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
5266
+ description: ""
5267
+ }
5268
+ },
5269
+ {
5270
+ value: "NOT_NEEDED",
5271
+ label: {
5272
+ id: "correction.supportingDocuments.notNeeded.label",
5273
+ defaultMessage: "No supporting documents required",
5274
+ description: ""
5275
+ }
5276
+ }
5277
+ ]
5278
+ }
5279
+ ]
5280
+ },
5281
+ {
5282
+ id: "correction-request.additional-details",
5283
+ type: PageTypes.enum.FORM,
5284
+ title: {
5285
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
5286
+ defaultMessage: "Reason for correction",
5287
+ description: "This is the title of the section"
5288
+ },
5289
+ fields: [
5290
+ {
5291
+ id: "correction.request.reason",
5292
+ type: FieldType.TEXT,
5293
+ label: {
5294
+ id: "correction.reason.title",
5295
+ defaultMessage: "Reason for correction?",
5296
+ description: "The title for the corrector form"
5297
+ }
5298
+ }
5299
+ ]
5300
+ }
5301
+ ]
5302
+ },
5303
+ {
5304
+ type: ActionType.APPROVE_CORRECTION,
5305
+ label: {
5306
+ defaultMessage: "Approve correction",
5307
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5308
+ id: "event.football-club-membership.action.correction.approve.label"
5309
+ }
5310
+ },
5311
+ {
5312
+ type: ActionType.PRINT_CERTIFICATE,
5313
+ label: {
5314
+ id: "v2.event.football-club-membership.action.collect-certificate.label",
5315
+ defaultMessage: "Print certificate",
5316
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5317
+ },
5318
+ printForm: PRINT_CERTIFICATE_FORM,
5319
+ conditionals: [
5320
+ {
5321
+ type: "SHOW",
5322
+ conditional: defineConditional({
5323
+ type: "object",
5324
+ properties: {
5325
+ $event: {
5326
+ type: "object",
5327
+ properties: {
5328
+ actions: {
5329
+ type: "array",
5330
+ contains: {
5331
+ type: "object",
5332
+ properties: {
5333
+ type: {
5334
+ const: "REGISTER"
5335
+ },
5336
+ draft: {
5337
+ type: "boolean"
5338
+ }
5339
+ },
5340
+ required: ["type"],
5341
+ not: {
5342
+ properties: {
5343
+ draft: {
5344
+ const: true
5345
+ }
5346
+ }
5347
+ }
5348
+ }
5349
+ }
5350
+ },
5351
+ required: ["actions"]
5352
+ }
5353
+ },
5354
+ required: ["$event"]
5355
+ })
5356
+ }
5357
+ ]
5358
+ },
5359
+ {
5360
+ type: ActionType.ARCHIVE,
5361
+ label: {
5362
+ id: "v2.event.football-club-membership.action.archive.label",
5363
+ defaultMessage: "Archive",
5364
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5365
+ }
5366
+ },
5367
+ {
5368
+ type: ActionType.REJECT,
5369
+ label: {
5370
+ id: "v2.event.football-club-membership.action.reject.label",
5371
+ defaultMessage: "Reject",
5372
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5373
+ }
5374
+ }
5375
+ ],
5376
+ advancedSearch: [
5377
+ {
5378
+ title: {
5379
+ defaultMessage: "Registration details",
5380
+ description: "The title of Registration details accordion",
5381
+ id: "v2.advancedSearch.form.registrationDetails"
5382
+ },
5383
+ fields: [
5384
+ event("legalStatus.REGISTERED.createdAtLocation").exact(),
5385
+ event("legalStatus.REGISTERED.createdAt").range(),
5386
+ event("status", statusOptions).exact(),
5387
+ event("updatedAt", timePeriodOptions).range()
5388
+ ]
5389
+ },
5390
+ {
5391
+ title: {
5392
+ defaultMessage: "Applicant's details",
5393
+ description: "Applicant details search field section title",
5394
+ id: "v2.event.football-club-membership.search.applicants"
5395
+ },
5396
+ fields: [
5397
+ field("applicant.firstname").fuzzy(),
5398
+ field("applicant.surname").fuzzy(),
5399
+ field("applicant.dob").range(),
5400
+ field("applicant.email").exact()
5401
+ ]
5402
+ },
5403
+ {
5404
+ title: {
5405
+ defaultMessage: "Recommender's details",
5406
+ description: "Recommender details search field section title",
5407
+ id: "v2.event.football-club-membership.search.recommender"
5408
+ },
5409
+ fields: [
5410
+ field("recommender.firstname").fuzzy(),
5411
+ field("recommender.surname").fuzzy()
5412
+ ]
5413
+ }
5414
+ ],
5415
+ declaration: TENNIS_CLUB_DECLARATION_FORM
5416
+ });
5417
+
5418
+ // ../commons/src/fixtures/library-membership-event.ts
5419
+ var libraryMembershipForm = defineDeclarationForm({
5420
+ label: {
5421
+ id: "v2.event.library-membership.action.declare.form.label",
5422
+ defaultMessage: "Library membership application",
5423
+ description: "This is what this form is referred as in the system"
5424
+ },
5425
+ pages: [
5426
+ {
5427
+ id: "member",
5428
+ title: {
5429
+ id: "v2.event.library-membership.action.declare.form.section.who.title",
5430
+ defaultMessage: "Who is applying for the membership?",
5431
+ description: "This is the title of the section"
5432
+ },
5433
+ fields: [
5434
+ {
5435
+ id: "member.firstname",
5436
+ type: FieldType.TEXT,
5437
+ required: true,
5438
+ conditionals: [],
5439
+ label: {
5440
+ defaultMessage: "Member's first name",
5441
+ description: "This is the label for the field",
5442
+ id: "v2.event.library-membership.action.declare.form.section.who.field.firstname.label"
5443
+ }
5444
+ },
5445
+ {
5446
+ id: "member.surname",
5447
+ type: FieldType.TEXT,
5448
+ required: true,
5449
+ conditionals: [],
5450
+ label: {
5451
+ defaultMessage: "Member's surname",
5452
+ description: "This is the label for the field",
5453
+ id: "v2.event.library-membership.action.declare.form.section.who.field.surname.label"
5454
+ }
5455
+ }
5456
+ ]
5457
+ }
5458
+ ]
5459
+ });
5460
+ var libraryMembershipEvent = defineConfig({
5461
+ id: "library-membership",
5462
+ label: {
5463
+ defaultMessage: "Library membership application",
5464
+ description: "This is what this event is referred as in the system",
5465
+ id: "event.library-membership.label"
5466
+ },
5467
+ title: {
5468
+ defaultMessage: "{member.firstname} {member.surname}",
5469
+ description: "This is the title of the summary",
5470
+ id: "v2.event.library-membership.title"
5471
+ },
5472
+ summary: { fields: [] },
5473
+ actions: [],
5474
+ declaration: libraryMembershipForm
5475
+ });
5476
+
5477
+ // ../commons/src/events/test.utils.ts
5478
+ function fieldConfigsToActionPayload(fields) {
5479
+ return fields.reduce(
5480
+ (acc, field2, i) => ({
4597
5481
  ...acc,
4598
5482
  [field2.id]: mapFieldTypeToMockValue(field2, i)
4599
5483
  }),
@@ -4637,11 +5521,11 @@ function generateActionAnnotationInput(configuration, action) {
4637
5521
  var eventPayloadGenerator = {
4638
5522
  create: (input = {}) => ({
4639
5523
  transactionId: input.transactionId ?? getUUID(),
4640
- type: input.type ?? "TENNIS_CLUB_MEMBERSHIP"
5524
+ type: input.type ?? TENNIS_CLUB_MEMBERSHIP
4641
5525
  }),
4642
5526
  patch: (id, input = {}) => ({
4643
5527
  transactionId: input.transactionId ?? getUUID(),
4644
- type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
5528
+ type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
4645
5529
  id
4646
5530
  }),
4647
5531
  draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
@@ -4667,7 +5551,7 @@ var eventPayloadGenerator = {
4667
5551
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4668
5552
  createdBy: "@todo",
4669
5553
  createdByRole: "@todo",
4670
- createdAtLocation: "@todo"
5554
+ createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
4671
5555
  }
4672
5556
  },
4673
5557
  input
@@ -4741,9 +5625,13 @@ var eventPayloadGenerator = {
4741
5625
  transactionId: input.transactionId ?? getUUID(),
4742
5626
  declaration: {},
4743
5627
  // @TODO: Check whether generator is needed?
4744
- annotation: { isDuplicate: isDuplicate ?? false },
5628
+ annotation: {},
4745
5629
  duplicates: [],
4746
- eventId
5630
+ eventId,
5631
+ reason: {
5632
+ message: `${ActionType.ARCHIVE}`,
5633
+ isDuplicate: isDuplicate ?? false
5634
+ }
4747
5635
  }),
4748
5636
  reject: (eventId, input = {}) => ({
4749
5637
  type: ActionType.REJECT,
@@ -4754,7 +5642,8 @@ var eventPayloadGenerator = {
4754
5642
  ActionType.REJECT
4755
5643
  ),
4756
5644
  duplicates: [],
4757
- eventId
5645
+ eventId,
5646
+ reason: { message: `${ActionType.REJECT}` }
4758
5647
  }),
4759
5648
  register: (eventId, input = {}) => ({
4760
5649
  type: ActionType.REGISTER,
@@ -4851,9 +5740,9 @@ function generateActionDocument({
4851
5740
  case ActionType.VALIDATE:
4852
5741
  return { ...actionBase, type: action };
4853
5742
  case ActionType.ARCHIVE:
4854
- return { ...actionBase, type: action };
5743
+ return { ...actionBase, type: action, reason: { message: "Archive" } };
4855
5744
  case ActionType.REJECT:
4856
- return { ...actionBase, type: action };
5745
+ return { ...actionBase, type: action, reason: { message: "Reject" } };
4857
5746
  case ActionType.CREATE:
4858
5747
  return { ...actionBase, type: action };
4859
5748
  case ActionType.NOTIFY:
@@ -4865,7 +5754,11 @@ function generateActionDocument({
4865
5754
  case ActionType.APPROVE_CORRECTION:
4866
5755
  return { ...actionBase, requestId: getUUID(), type: action };
4867
5756
  case ActionType.REJECT_CORRECTION:
4868
- return { ...actionBase, requestId: getUUID(), type: action };
5757
+ return {
5758
+ ...actionBase,
5759
+ requestId: getUUID(),
5760
+ type: action
5761
+ };
4869
5762
  case ActionType.REGISTER:
4870
5763
  return {
4871
5764
  ...actionBase,
@@ -4893,8 +5786,7 @@ function generateEventDocument({
4893
5786
  id: getUUID(),
4894
5787
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
4895
5788
  // @TODO: This should be fixed in the future.
4896
- updatedAt: new Date(Date.now() - 1e3).toISOString(),
4897
- dateOfEvent: configuration.dateOfEvent
5789
+ updatedAt: new Date(Date.now() - 1e3).toISOString()
4898
5790
  };
4899
5791
  }
4900
5792
  function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
@@ -4982,6 +5874,9 @@ function generateTrackingId(rng) {
4982
5874
  const trackingId = uuid.slice(0, 6).toUpperCase();
4983
5875
  return trackingId;
4984
5876
  }
5877
+ function generateRandomSignature(rng) {
5878
+ return `/random-bucket/${generateUuid(rng)}.png`;
5879
+ }
4985
5880
  var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
4986
5881
  const rng = createPseudoRandomNumberGenerator(seed);
4987
5882
  const createdAt = getRandomDatetime(
@@ -4991,12 +5886,13 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
4991
5886
  );
4992
5887
  return {
4993
5888
  id: overrides.id ?? generateUuid(rng),
4994
- type: overrides.type ?? "TENNIS_CLUB_MEMBERSHIP",
5889
+ type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
4995
5890
  status: overrides.status ?? pickRandom(rng, eventStatuses),
4996
5891
  createdAt: overrides.createdAt ?? createdAt,
4997
5892
  createdBy: overrides.createdBy ?? generateUuid(rng),
4998
5893
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
4999
5894
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
5895
+ createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
5000
5896
  updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
5001
5897
  assignedTo: overrides.assignedTo ?? null,
5002
5898
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -5012,6 +5908,28 @@ var generateTranslationConfig = (message) => ({
5012
5908
  description: "Description for ${message}",
5013
5909
  id: message
5014
5910
  });
5911
+ var BearerTokenByUserType = {
5912
+ fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyZS1iaXJ0aCIsInJlY29yZC5kZWNsYXJlLWRlYXRoIiwicmVjb3JkLmRlY2xhcmUtbWFycmlhZ2UiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWluY29tcGxldGUiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJkZW1vIl0sInVzZXJUeXBlIjoidXNlciIsImlhdCI6MTc0ODUyNjQ4OCwiZXhwIjoxNzQ5MTMxMjg4LCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjc3ZmIwODYzMGYzYWJmYTMzMDcyNzBmIn0.qLif2TmTPpqfbSUWR3TSfWf5syyCtRRJV-fDOZBtN9th-gdT0sUPZp5PB_t2QHHCLes7JLDlSA9CGNIbVvRR8a7EedXTAf0T7pwiE96PgljHSKI9jLMCYb_rhqnl8BwfsxAU3qv8EBYM9rDlcabl5iKnAOM-YLMv63CRMQxZOZ0O3Wl1Xil82dp6PqW_Lom5Qd-Esftt9BWXk5gxmqq-YegT8qU9n3hDXEsOvmIyYQvPDwmUOB-xp74CKJk_o3eBuq4TVCMYxY-tS9qkkn2A7Txhh-bzWMVNrQjQ1Yumvs8gi_F-XYTi89QbZVz8PzJ9kT8w3jshYwmAy7be9M-EQg",
5913
+ registrationAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItYXBwcm92YWwiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci11cGRhdGVzIiwicmVjb3JkLmRlY2xhcmF0aW9uLWFyY2hpdmUiLCJyZWNvcmQuZGVjbGFyYXRpb24tcmVpbnN0YXRlIiwicmVjb3JkLnJlZ2lzdHJhdGlvbi1yZXF1ZXN0LWNvcnJlY3Rpb24iLCJyZWNvcmQuZGVjbGFyYXRpb24tcHJpbnQtc3VwcG9ydGluZy1kb2N1bWVudHMiLCJyZWNvcmQuZXhwb3J0LXJlY29yZHMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJwZXJmb3JtYW5jZS5yZWFkIiwicGVyZm9ybWFuY2UucmVhZC1kYXNoYm9hcmRzIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDY4LCJleHAiOjE3NDkxMzEyNjgsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MTgifQ.C0R3cda9tczdJyadyJzk_wjVx79yiQ4r2BZbrF5VMTol97CwqMk1cPKVv5xZR1fHW5nhYl1X_vsmTYx-p9oSmcAYVud-4Z24TrA3oZ214zCB8RW_RmmFzJSczwe-9Son-96JOpRJTz2F-F_SSmblF0cjndJ-iXCAbOn1hmQ1q45NqaV-oFaFWigvAaRoBFcEvGufQxss_NjRmG12ooENSfWQl0tYM9BmTw4JQo2xerwJcgaJTrtDgRagkuiR7zhVNjcoT64AQiSRp5KmWRhbU4ozlJ2tfy1ccD9jJkbQTf1AZT2pl1diusjstJYFuM9QPFPOyCO0umaxYfgSer_Hmg",
5914
+ localRegistrar: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItdXBkYXRlcyIsInJlY29yZC5yZXZpZXctZHVwbGljYXRlcyIsInJlY29yZC5kZWNsYXJhdGlvbi1hcmNoaXZlIiwicmVjb3JkLmRlY2xhcmF0aW9uLXJlaW5zdGF0ZSIsInJlY29yZC5yZWdpc3RlciIsInJlY29yZC5yZWdpc3RyYXRpb24tY29ycmVjdCIsInJlY29yZC5kZWNsYXJhdGlvbi1wcmludC1zdXBwb3J0aW5nLWRvY3VtZW50cyIsInJlY29yZC5leHBvcnQtcmVjb3JkcyIsInJlY29yZC51bmFzc2lnbi1vdGhlcnMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJyZWNvcmQuY29uZmlybS1yZWdpc3RyYXRpb24iLCJyZWNvcmQucmVqZWN0LXJlZ2lzdHJhdGlvbiIsInBlcmZvcm1hbmNlLnJlYWQiLCJwZXJmb3JtYW5jZS5yZWFkLWRhc2hib2FyZHMiLCJwcm9maWxlLmVsZWN0cm9uaWMtc2lnbmF0dXJlIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDIwLCJleHAiOjE3NDkxMzEyMjAsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MjEifQ.Exwojy_1lsoPmp-kQ79SMWI0eQy8Qt7yO_ynGvb_oIVdqSwTxFkkNr9x4UxhBA-o0P6LkMZ2ELKOlSzBr3PRJ8IQnfMQ7Db8oG8HAPsY8sKqra_L6ryV088NW2e2LqAjoOX0dXRIqYMolUhF_OOuZpHW5K8nvog5SLlnJ1gKysQ1EuWBg2dcKbjkkB16v-9NGz4XHye3vcoZlalyha5OOujzbPhkmr9UGiksSIXFNbanBhkQdt-EJlLX9SXvQ4ACJWPKFb_f4gv8p84jdLiryzQux46zHPpTicZHzg0nZtoKKIH1AyFtqWfBFm4y8qWC3ht9TAk93NAXTfkS0wzxKA"
5915
+ };
5916
+ var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
5917
+ {
5918
+ slug,
5919
+ name: {
5920
+ id: "workqueues.inProgress.title",
5921
+ defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
5922
+ description: "Title of in progress workqueue"
5923
+ },
5924
+ query: {
5925
+ type: "and",
5926
+ clauses: [{ eventType: tennisClubMembershipEvent.id }]
5927
+ },
5928
+ actions: [],
5929
+ icon: "Draft",
5930
+ columns: []
5931
+ }
5932
+ ]);
5015
5933
 
5016
5934
  // ../commons/src/events/TemplateConfig.ts
5017
5935
  function isTemplateVariable(value) {
@@ -5049,7 +5967,7 @@ function isFieldConfigDefaultValue(value) {
5049
5967
  var import_lodash3 = require("lodash");
5050
5968
 
5051
5969
  // ../commons/src/scopes.ts
5052
- var import_zod25 = require("zod");
5970
+ var import_zod31 = require("zod");
5053
5971
  var SCOPES = {
5054
5972
  // TODO v1.8 legacy scopes
5055
5973
  NATLSYSADMIN: "natlsysadmin",
@@ -5162,111 +6080,111 @@ var SCOPES = {
5162
6080
  // data seeding
5163
6081
  USER_DATA_SEEDING: "user.data-seeding"
5164
6082
  };
5165
- var LiteralScopes = import_zod25.z.union([
5166
- import_zod25.z.literal(SCOPES.NATLSYSADMIN),
5167
- import_zod25.z.literal(SCOPES.BYPASSRATELIMIT),
5168
- import_zod25.z.literal(SCOPES.DECLARE),
5169
- import_zod25.z.literal(SCOPES.REGISTER),
5170
- import_zod25.z.literal(SCOPES.VALIDATE),
5171
- import_zod25.z.literal(SCOPES.DEMO),
5172
- import_zod25.z.literal(SCOPES.CERTIFY),
5173
- import_zod25.z.literal(SCOPES.PERFORMANCE),
5174
- import_zod25.z.literal(SCOPES.SYSADMIN),
5175
- import_zod25.z.literal(SCOPES.TEAMS),
5176
- import_zod25.z.literal(SCOPES.CONFIG),
5177
- import_zod25.z.literal(SCOPES.WEBHOOK),
5178
- import_zod25.z.literal(SCOPES.NATIONALID),
5179
- import_zod25.z.literal(SCOPES.NOTIFICATION_API),
5180
- import_zod25.z.literal(SCOPES.RECORDSEARCH),
5181
- import_zod25.z.literal(SCOPES.RECORD_IMPORT),
5182
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
5183
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
5184
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_DEATH),
5185
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
5186
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
5187
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
5188
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
5189
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
5190
- import_zod25.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
5191
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
5192
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
5193
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
5194
- import_zod25.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
5195
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
5196
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
5197
- import_zod25.z.literal(SCOPES.RECORD_REGISTER),
5198
- import_zod25.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
5199
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
5200
- import_zod25.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
5201
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
5202
- import_zod25.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
5203
- import_zod25.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
5204
- import_zod25.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
5205
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
5206
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
5207
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
5208
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
5209
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
5210
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
5211
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
5212
- import_zod25.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
5213
- import_zod25.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
5214
- import_zod25.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
5215
- import_zod25.z.literal(SCOPES.SEARCH_BIRTH),
5216
- import_zod25.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
5217
- import_zod25.z.literal(SCOPES.SEARCH_DEATH),
5218
- import_zod25.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
5219
- import_zod25.z.literal(SCOPES.SEARCH_MARRIAGE),
5220
- import_zod25.z.literal(SCOPES.RECORD_READ),
5221
- import_zod25.z.literal(SCOPES.RECORD_READ_AUDIT),
5222
- import_zod25.z.literal(SCOPES.RECORD_READ_COMMENTS),
5223
- import_zod25.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
5224
- import_zod25.z.literal(SCOPES.PROFILE_UPDATE),
5225
- import_zod25.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
5226
- import_zod25.z.literal(SCOPES.PERFORMANCE_READ),
5227
- import_zod25.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
5228
- import_zod25.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
5229
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
5230
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
5231
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
5232
- import_zod25.z.literal(SCOPES.USER_READ),
5233
- import_zod25.z.literal(SCOPES.USER_READ_MY_OFFICE),
5234
- import_zod25.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
5235
- import_zod25.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
5236
- import_zod25.z.literal(SCOPES.USER_CREATE),
5237
- import_zod25.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
5238
- import_zod25.z.literal(SCOPES.USER_UPDATE),
5239
- import_zod25.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
5240
- import_zod25.z.literal(SCOPES.CONFIG_UPDATE_ALL),
5241
- import_zod25.z.literal(SCOPES.USER_DATA_SEEDING)
6083
+ var LiteralScopes = import_zod31.z.union([
6084
+ import_zod31.z.literal(SCOPES.NATLSYSADMIN),
6085
+ import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
6086
+ import_zod31.z.literal(SCOPES.DECLARE),
6087
+ import_zod31.z.literal(SCOPES.REGISTER),
6088
+ import_zod31.z.literal(SCOPES.VALIDATE),
6089
+ import_zod31.z.literal(SCOPES.DEMO),
6090
+ import_zod31.z.literal(SCOPES.CERTIFY),
6091
+ import_zod31.z.literal(SCOPES.PERFORMANCE),
6092
+ import_zod31.z.literal(SCOPES.SYSADMIN),
6093
+ import_zod31.z.literal(SCOPES.TEAMS),
6094
+ import_zod31.z.literal(SCOPES.CONFIG),
6095
+ import_zod31.z.literal(SCOPES.WEBHOOK),
6096
+ import_zod31.z.literal(SCOPES.NATIONALID),
6097
+ import_zod31.z.literal(SCOPES.NOTIFICATION_API),
6098
+ import_zod31.z.literal(SCOPES.RECORDSEARCH),
6099
+ import_zod31.z.literal(SCOPES.RECORD_IMPORT),
6100
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
6101
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
6102
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
6103
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
6104
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
6105
+ import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
6106
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
6107
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
6108
+ import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
6109
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
6110
+ import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
6111
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
6112
+ import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
6113
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
6114
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
6115
+ import_zod31.z.literal(SCOPES.RECORD_REGISTER),
6116
+ import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
6117
+ import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
6118
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
6119
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
6120
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
6121
+ import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
6122
+ import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
6123
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
6124
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
6125
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
6126
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
6127
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
6128
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
6129
+ import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
6130
+ import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
6131
+ import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
6132
+ import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
6133
+ import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
6134
+ import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
6135
+ import_zod31.z.literal(SCOPES.SEARCH_DEATH),
6136
+ import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
6137
+ import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
6138
+ import_zod31.z.literal(SCOPES.RECORD_READ),
6139
+ import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
6140
+ import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
6141
+ import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
6142
+ import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
6143
+ import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
6144
+ import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
6145
+ import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
6146
+ import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
6147
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
6148
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
6149
+ import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
6150
+ import_zod31.z.literal(SCOPES.USER_READ),
6151
+ import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
6152
+ import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
6153
+ import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
6154
+ import_zod31.z.literal(SCOPES.USER_CREATE),
6155
+ import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
6156
+ import_zod31.z.literal(SCOPES.USER_UPDATE),
6157
+ import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
6158
+ import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
6159
+ import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
5242
6160
  ]);
5243
6161
  var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
5244
- var rawConfigurableScope = import_zod25.z.string().regex(rawConfigurableScopeRegex);
5245
- var CreateUserScope = import_zod25.z.object({
5246
- type: import_zod25.z.literal("user.create"),
5247
- options: import_zod25.z.object({
5248
- role: import_zod25.z.array(import_zod25.z.string())
6162
+ var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
6163
+ var CreateUserScope = import_zod31.z.object({
6164
+ type: import_zod31.z.literal("user.create"),
6165
+ options: import_zod31.z.object({
6166
+ role: import_zod31.z.array(import_zod31.z.string())
5249
6167
  })
5250
6168
  });
5251
- var EditUserScope = import_zod25.z.object({
5252
- type: import_zod25.z.literal("user.edit"),
5253
- options: import_zod25.z.object({
5254
- role: import_zod25.z.array(import_zod25.z.string())
6169
+ var EditUserScope = import_zod31.z.object({
6170
+ type: import_zod31.z.literal("user.edit"),
6171
+ options: import_zod31.z.object({
6172
+ role: import_zod31.z.array(import_zod31.z.string())
5255
6173
  })
5256
6174
  });
5257
- var WorkqueueScope = import_zod25.z.object({
5258
- type: import_zod25.z.literal("workqueue"),
5259
- options: import_zod25.z.object({
5260
- id: import_zod25.z.array(import_zod25.z.string())
6175
+ var WorkqueueScope = import_zod31.z.object({
6176
+ type: import_zod31.z.literal("workqueue"),
6177
+ options: import_zod31.z.object({
6178
+ id: import_zod31.z.array(import_zod31.z.string())
5261
6179
  })
5262
6180
  });
5263
- var NotifyRecordScope = import_zod25.z.object({
5264
- type: import_zod25.z.literal("record.notify"),
5265
- options: import_zod25.z.object({
5266
- event: import_zod25.z.array(import_zod25.z.string())
6181
+ var NotifyRecordScope = import_zod31.z.object({
6182
+ type: import_zod31.z.literal("record.notify"),
6183
+ options: import_zod31.z.object({
6184
+ event: import_zod31.z.array(import_zod31.z.string())
5267
6185
  })
5268
6186
  });
5269
- var ConfigurableScopes = import_zod25.z.discriminatedUnion("type", [
6187
+ var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
5270
6188
  CreateUserScope,
5271
6189
  EditUserScope,
5272
6190
  WorkqueueScope,
@@ -5370,3 +6288,65 @@ function filterUnallowedActions(actions, userScopes) {
5370
6288
  }
5371
6289
  return [ActionType.READ];
5372
6290
  }
6291
+
6292
+ // ../commons/src/events/serializers/user/deserializer.ts
6293
+ var import_zod32 = require("zod");
6294
+ var UserWithPrimaryOffice = User.extend({
6295
+ primaryOfficeId: import_zod32.z.string()
6296
+ });
6297
+ function userDeserializer(serializedUserField, user2) {
6298
+ if (typeof serializedUserField === "string") {
6299
+ return serializedUserField;
6300
+ }
6301
+ if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
6302
+ throw new Error(
6303
+ `Deserializer for ${serializedUserField.$userField} is not implemented yet`
6304
+ );
6305
+ }
6306
+ return user2[serializedUserField.$userField];
6307
+ }
6308
+ function deserializeQueryExpression(expression, user2) {
6309
+ return {
6310
+ ...expression,
6311
+ assignedTo: expression.assignedTo && {
6312
+ ...expression.assignedTo,
6313
+ term: userDeserializer(expression.assignedTo.term, user2)
6314
+ },
6315
+ createdBy: expression.createdBy && {
6316
+ ...expression.createdBy,
6317
+ term: userDeserializer(expression.createdBy.term, user2)
6318
+ },
6319
+ updatedBy: expression.updatedBy && {
6320
+ ...expression.updatedBy,
6321
+ term: userDeserializer(expression.updatedBy.term, user2)
6322
+ },
6323
+ createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
6324
+ ...expression.createdAtLocation,
6325
+ location: userDeserializer(
6326
+ expression.createdAtLocation.location,
6327
+ user2
6328
+ )
6329
+ } : {
6330
+ ...expression.createdAtLocation,
6331
+ term: userDeserializer(expression.createdAtLocation.term, user2)
6332
+ }),
6333
+ updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
6334
+ ...expression.updatedAtLocation,
6335
+ location: userDeserializer(
6336
+ expression.updatedAtLocation.location,
6337
+ user2
6338
+ )
6339
+ } : {
6340
+ ...expression.updatedAtLocation,
6341
+ term: userDeserializer(expression.updatedAtLocation.term, user2)
6342
+ })
6343
+ };
6344
+ }
6345
+ function deserializeQuery(query, user2) {
6346
+ return {
6347
+ ...query,
6348
+ clauses: query.clauses.map(
6349
+ (clause) => deserializeQueryExpression(clause, user2)
6350
+ )
6351
+ };
6352
+ }