@opencrvs/toolkit 1.8.0-rc.ff0a1b5 → 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 (38) hide show
  1. package/dist/commons/api/router.d.ts +8086 -3911
  2. package/dist/commons/conditionals/conditionals.d.ts +7 -6
  3. package/dist/commons/events/ActionConfig.d.ts +22281 -7289
  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/AdvancedSearchConfig.d.ts +603 -12
  7. package/dist/commons/events/Constants.d.ts +2 -0
  8. package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
  9. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  10. package/dist/commons/events/Draft.d.ts +29 -24
  11. package/dist/commons/events/EventConfig.d.ts +17241 -9571
  12. package/dist/commons/events/EventDocument.d.ts +386 -267
  13. package/dist/commons/events/EventIndex.d.ts +343 -466
  14. package/dist/commons/events/EventInput.d.ts +0 -13
  15. package/dist/commons/events/EventMetadata.d.ts +72 -48
  16. package/dist/commons/events/FieldConfig.d.ts +991 -428
  17. package/dist/commons/events/FieldTypeMapping.d.ts +5 -2
  18. package/dist/commons/events/FieldValue.d.ts +2 -0
  19. package/dist/commons/events/FormConfig.d.ts +7190 -3722
  20. package/dist/commons/events/PageConfig.d.ts +1512 -660
  21. package/dist/commons/events/User.d.ts +31 -7
  22. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  23. package/dist/commons/events/WorkqueueConfig.d.ts +3506 -239
  24. package/dist/commons/events/defineConfig.d.ts +1632 -574
  25. package/dist/commons/events/event.d.ts +37 -10
  26. package/dist/commons/events/field.d.ts +25 -20
  27. package/dist/commons/events/index.d.ts +4 -0
  28. package/dist/commons/events/scopes.d.ts +20 -1
  29. package/dist/commons/events/serializer.d.ts +2 -0
  30. package/dist/commons/events/test.utils.d.ts +28 -7
  31. package/dist/commons/events/transactions.d.ts +1 -1
  32. package/dist/commons/events/utils.d.ts +443 -291
  33. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  34. package/dist/conditionals/index.js +28 -8
  35. package/dist/events/index.js +2153 -865
  36. package/dist/scopes/index.d.ts +94 -6
  37. package/dist/scopes/index.js +42 -21
  38. package/package.json +1 -1
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/events/index.ts
31
31
  var events_exports = {};
32
32
  __export(events_exports, {
33
+ ACTION_ALLOWED_CONFIGURABLE_SCOPES: () => ACTION_ALLOWED_CONFIGURABLE_SCOPES,
33
34
  ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
34
35
  Action: () => Action,
35
36
  ActionBase: () => ActionBase,
@@ -49,11 +50,14 @@ __export(events_exports, {
49
50
  AddressType: () => AddressType,
50
51
  AdministrativeAreas: () => AdministrativeAreas,
51
52
  AdvancedSearchConfig: () => AdvancedSearchConfig,
53
+ AnyOf: () => AnyOf,
54
+ AnyOfStatus: () => AnyOfStatus,
52
55
  ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
53
56
  ArchiveActionInput: () => ArchiveActionInput,
54
57
  AssignActionInput: () => AssignActionInput,
55
58
  AsyncRejectActionDocument: () => AsyncRejectActionDocument,
56
59
  BaseActionInput: () => BaseActionInput,
60
+ BearerTokenByUserType: () => BearerTokenByUserType,
57
61
  CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
58
62
  CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
59
63
  CertificateConfig: () => CertificateConfig,
@@ -67,6 +71,7 @@ __export(events_exports, {
67
71
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
68
72
  DataEntry: () => DataEntry,
69
73
  DataFieldValue: () => DataFieldValue,
74
+ DateCondition: () => DateCondition,
70
75
  DateRangeFieldValue: () => DateRangeFieldValue,
71
76
  DateValue: () => DateValue,
72
77
  DatetimeValue: () => DatetimeValue,
@@ -92,14 +97,18 @@ __export(events_exports, {
92
97
  EventInput: () => EventInput,
93
98
  EventMetadata: () => EventMetadata,
94
99
  EventMetadataKeys: () => EventMetadataKeys,
95
- EventMetadataParameter: () => EventMetadataParameter,
100
+ EventMetadataKeysArray: () => EventMetadataKeysArray,
96
101
  EventSearchIndex: () => EventSearchIndex,
97
102
  EventState: () => EventState,
98
103
  EventStatus: () => EventStatus,
104
+ EventStatusEnum: () => EventStatusEnum,
99
105
  EventStatuses: () => EventStatuses,
106
+ Exact: () => Exact,
107
+ ExactStatus: () => ExactStatus,
100
108
  FieldConditional: () => FieldConditional,
101
109
  FieldConfig: () => FieldConfig,
102
110
  FieldConfigSchema: () => FieldConfigSchema,
111
+ FieldReference: () => FieldReference,
103
112
  FieldType: () => FieldType,
104
113
  FieldUpdateValue: () => FieldUpdateValue,
105
114
  FieldValue: () => FieldValue,
@@ -109,6 +118,7 @@ __export(events_exports, {
109
118
  Flag: () => Flag,
110
119
  FormConfig: () => FormConfig,
111
120
  FormPageConfig: () => FormPageConfig,
121
+ Fuzzy: () => Fuzzy,
112
122
  GenericAddressUpdateValue: () => GenericAddressUpdateValue,
113
123
  GenericAddressValue: () => GenericAddressValue,
114
124
  GeographicalArea: () => GeographicalArea,
@@ -118,36 +128,52 @@ __export(events_exports, {
118
128
  MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
119
129
  MimeType: () => MimeType,
120
130
  NonEmptyTextValue: () => NonEmptyTextValue,
131
+ Not: () => Not,
121
132
  NotifyActionInput: () => NotifyActionInput,
122
133
  NumberFieldValue: () => NumberFieldValue,
123
134
  PageConfig: () => PageConfig,
124
135
  PageTypes: () => PageTypes,
125
136
  PrintCertificateActionInput: () => PrintCertificateActionInput,
137
+ QueryExpression: () => QueryExpression,
126
138
  QueryInput: () => QueryInput,
127
139
  QueryType: () => QueryType,
140
+ Range: () => Range,
128
141
  ReadActionInput: () => ReadActionInput,
129
142
  RegisterAction: () => RegisterAction,
130
143
  RegisterActionInput: () => RegisterActionInput,
131
144
  RegistrationCreationMetadata: () => RegistrationCreationMetadata,
132
145
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
133
146
  RejectDeclarationActionInput: () => RejectDeclarationActionInput,
147
+ RejectionReason: () => RejectionReason,
134
148
  RequestCorrectionActionInput: () => RequestCorrectionActionInput,
135
149
  ResolvedUser: () => ResolvedUser,
136
150
  RuralAddressUpdateValue: () => RuralAddressUpdateValue,
137
151
  RuralAddressValue: () => RuralAddressValue,
138
152
  SearchField: () => SearchField,
153
+ SearchQueryParams: () => SearchQueryParams,
139
154
  SelectOption: () => SelectOption,
140
155
  ShowConditional: () => ShowConditional,
156
+ SignatureFieldValue: () => SignatureFieldValue,
141
157
  SummaryConfig: () => SummaryConfig,
158
+ TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
142
159
  TextValue: () => TextValue,
143
160
  TranslationConfig: () => TranslationConfig,
144
161
  UnassignActionInput: () => UnassignActionInput,
145
162
  UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
146
163
  UrbanAddressValue: () => UrbanAddressValue,
164
+ User: () => User,
147
165
  ValidateActionInput: () => ValidateActionInput,
148
166
  VerificationActionConfig: () => VerificationActionConfig,
149
167
  VerificationPageConfig: () => VerificationPageConfig,
168
+ Within: () => Within,
169
+ WorkqueueColumn: () => WorkqueueColumn,
170
+ WorkqueueColumnKeys: () => WorkqueueColumnKeys,
171
+ WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
172
+ WorkqueueColumnValue: () => WorkqueueColumnValue,
150
173
  WorkqueueConfig: () => WorkqueueConfig,
174
+ WorkqueueConfigInput: () => WorkqueueConfigInput,
175
+ WorkqueueCountInput: () => WorkqueueCountInput,
176
+ WorkqueueCountOutput: () => WorkqueueCountOutput,
151
177
  ZodDate: () => ZodDate,
152
178
  alwaysTrue: () => alwaysTrue,
153
179
  and: () => and,
@@ -158,9 +184,12 @@ __export(events_exports, {
158
184
  createEmptyDraft: () => createEmptyDraft,
159
185
  createEventConditionals: () => createEventConditionals,
160
186
  createFieldConditionals: () => createFieldConditionals,
187
+ createPseudoRandomNumberGenerator: () => createPseudoRandomNumberGenerator,
161
188
  createValidationSchema: () => createValidationSchema,
189
+ dateOfEventColumn: () => dateOfEventColumn,
162
190
  deepDropNulls: () => deepDropNulls,
163
191
  deepMerge: () => deepMerge,
192
+ defaultWorkqueueColumns: () => defaultWorkqueueColumns,
164
193
  defineActionForm: () => defineActionForm,
165
194
  defineConditional: () => defineConditional,
166
195
  defineConfig: () => defineConfig,
@@ -169,6 +198,9 @@ __export(events_exports, {
169
198
  defineFormPage: () => defineFormPage,
170
199
  definePage: () => definePage,
171
200
  defineWorkqueue: () => defineWorkqueue,
201
+ defineWorkqueues: () => defineWorkqueues,
202
+ defineWorkqueuesColumns: () => defineWorkqueuesColumns,
203
+ deserializeQuery: () => deserializeQuery,
172
204
  errorMessages: () => errorMessages,
173
205
  event: () => event,
174
206
  eventMetadataLabelMap: () => eventMetadataLabelMap,
@@ -187,8 +219,10 @@ __export(events_exports, {
187
219
  generateActionDocument: () => generateActionDocument,
188
220
  generateEventDocument: () => generateEventDocument,
189
221
  generateEventDraftDocument: () => generateEventDraftDocument,
222
+ generateRandomSignature: () => generateRandomSignature,
190
223
  generateTransactionId: () => generateTransactionId,
191
224
  generateTranslationConfig: () => generateTranslationConfig,
225
+ generateWorkqueues: () => generateWorkqueues,
192
226
  getAcceptedActions: () => getAcceptedActions,
193
227
  getActionAnnotation: () => getActionAnnotation,
194
228
  getActionAnnotationFields: () => getActionAnnotationFields,
@@ -197,12 +231,15 @@ __export(events_exports, {
197
231
  getActionVerificationPageIds: () => getActionVerificationPageIds,
198
232
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
199
233
  getAssignedUserFromActions: () => getAssignedUserFromActions,
234
+ getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
200
235
  getCurrentEventState: () => getCurrentEventState,
201
236
  getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
202
237
  getDeclaration: () => getDeclaration,
203
238
  getDeclarationFields: () => getDeclarationFields,
204
239
  getDeclarationPages: () => getDeclarationPages,
205
240
  getMixedPath: () => getMixedPath,
241
+ getRandomDatetime: () => getRandomDatetime,
242
+ getStatusFromActions: () => getStatusFromActions,
206
243
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
207
244
  hasAnyOfScopes: () => hasAnyOfScopes,
208
245
  isAddressFieldType: () => isAddressFieldType,
@@ -226,6 +263,7 @@ __export(events_exports, {
226
263
  isFileFieldType: () => isFileFieldType,
227
264
  isFileFieldWithOptionType: () => isFileFieldWithOptionType,
228
265
  isLocationFieldType: () => isLocationFieldType,
266
+ isNonInteractiveFieldType: () => isNonInteractiveFieldType,
229
267
  isNumberFieldType: () => isNumberFieldType,
230
268
  isOfficeFieldType: () => isOfficeFieldType,
231
269
  isPageHeaderFieldType: () => isPageHeaderFieldType,
@@ -257,14 +295,20 @@ __export(events_exports, {
257
295
  });
258
296
  module.exports = __toCommonJS(events_exports);
259
297
 
298
+ // ../commons/src/events/Constants.ts
299
+ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
300
+
260
301
  // ../commons/src/events/ActionConfig.ts
261
302
  var import_zod9 = require("zod");
262
303
 
263
304
  // ../commons/src/events/Conditional.ts
264
305
  var import_zod = require("zod");
265
- var Conditional = import_zod.z.custom(
266
- (val) => typeof val === "object" && val !== null
267
- );
306
+ var import_zod_openapi = require("zod-openapi");
307
+ (0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
308
+ var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
309
+ description: "JSON schema conditional configuration",
310
+ ref: "Conditional"
311
+ });
268
312
  var ConditionalType = {
269
313
  SHOW: "SHOW",
270
314
  ENABLE: "ENABLE",
@@ -301,7 +345,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
301
345
  EnableConditional,
302
346
  // Field output can be shown / hidden on the review page
303
347
  DisplayOnReviewConditional
304
- ]);
348
+ ]).openapi({
349
+ description: "Field conditional configuration",
350
+ ref: "FieldConditional"
351
+ });
305
352
 
306
353
  // ../commons/src/events/PageConfig.ts
307
354
  var import_zod6 = require("zod");
@@ -311,6 +358,8 @@ var import_zod5 = require("zod");
311
358
 
312
359
  // ../commons/src/events/TranslationConfig.ts
313
360
  var import_zod2 = require("zod");
361
+ var import_zod_openapi2 = require("zod-openapi");
362
+ (0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
314
363
  var TranslationConfig = import_zod2.z.object({
315
364
  id: import_zod2.z.string().describe(
316
365
  "The identifier of the translation referred in translation CSV files"
@@ -319,6 +368,9 @@ var TranslationConfig = import_zod2.z.object({
319
368
  description: import_zod2.z.string().describe(
320
369
  "Describe the translation for a translator to be able to identify it."
321
370
  )
371
+ }).openapi({
372
+ description: "Translation configuration",
373
+ ref: "TranslationConfig"
322
374
  });
323
375
 
324
376
  // ../commons/src/events/FieldType.ts
@@ -448,6 +500,7 @@ var EmailValue = import_zod4.z.string().email();
448
500
  var CheckboxFieldValue = import_zod4.z.boolean();
449
501
  var NumberFieldValue = import_zod4.z.number();
450
502
  var DataFieldValue = import_zod4.z.undefined();
503
+ var SignatureFieldValue = import_zod4.z.string();
451
504
  var FieldValue = import_zod4.z.union([
452
505
  TextValue,
453
506
  DateValue,
@@ -476,19 +529,15 @@ var FieldUpdateValue = import_zod4.z.union([
476
529
  ]);
477
530
 
478
531
  // ../commons/src/events/FieldConfig.ts
479
- var FieldId = import_zod5.z.string();
480
- var ParentReference = import_zod5.z.object({
481
- _fieldId: FieldId.optional()
482
- }).optional();
532
+ var import_zod_openapi3 = require("zod-openapi");
533
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
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();
483
539
  var BaseField = import_zod5.z.object({
484
540
  id: FieldId,
485
- defaultValue: import_zod5.z.union([
486
- TextValue,
487
- NonEmptyTextValue,
488
- DateValue,
489
- NumberFieldValue,
490
- CheckboxFieldValue
491
- ]).optional(),
492
541
  parent: ParentReference,
493
542
  conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
494
543
  required: import_zod5.z.boolean().default(false).optional(),
@@ -500,6 +549,7 @@ var BaseField = import_zod5.z.object({
500
549
  })
501
550
  ).default([]).optional(),
502
551
  label: TranslationConfig,
552
+ helperText: TranslationConfig.optional(),
503
553
  hideLabel: import_zod5.z.boolean().default(false).optional()
504
554
  });
505
555
  var Divider = BaseField.extend({
@@ -549,6 +599,7 @@ var SignatureField = BaseField.extend({
549
599
  signaturePromptLabel: TranslationConfig.describe(
550
600
  "Title of the signature modal"
551
601
  ),
602
+ defaultValue: SignatureFieldValue.optional(),
552
603
  configuration: import_zod5.z.object({
553
604
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
554
605
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -608,6 +659,7 @@ var PageHeader = BaseField.extend({
608
659
  }).describe("A read-only header component for form pages");
609
660
  var File = BaseField.extend({
610
661
  type: import_zod5.z.literal(FieldType.FILE),
662
+ defaultValue: FileFieldValue.optional(),
611
663
  configuration: import_zod5.z.object({
612
664
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
613
665
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
@@ -681,6 +733,7 @@ var Location = BaseField.extend({
681
733
  var FileUploadWithOptions = BaseField.extend({
682
734
  type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
683
735
  options: import_zod5.z.array(SelectOption).describe("A list of options"),
736
+ defaultValue: FileFieldWithOptionValue.optional(),
684
737
  configuration: import_zod5.z.object({
685
738
  maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
686
739
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
@@ -740,9 +793,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
740
793
  EmailField,
741
794
  FileUploadWithOptions,
742
795
  DataField
743
- ]);
796
+ ]).openapi({
797
+ description: "Form field configuration",
798
+ ref: "FieldConfig"
799
+ });
744
800
 
745
801
  // ../commons/src/events/PageConfig.ts
802
+ var import_zod_openapi4 = require("zod-openapi");
803
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
746
804
  var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
747
805
  var PageConfigBase = import_zod6.z.object({
748
806
  id: import_zod6.z.string().describe("Unique identifier for the page"),
@@ -751,6 +809,9 @@ var PageConfigBase = import_zod6.z.object({
751
809
  conditional: Conditional.optional().describe(
752
810
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
753
811
  )
812
+ }).openapi({
813
+ description: "Form page configuration",
814
+ ref: "FormPageConfig"
754
815
  });
755
816
  var FormPageConfig = PageConfigBase.extend({
756
817
  type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
@@ -764,7 +825,10 @@ var VerificationActionConfig = import_zod6.z.object({
764
825
  body: TranslationConfig
765
826
  })
766
827
  })
767
- }).describe("Actions available on the verification page");
828
+ }).describe("Actions available on the verification page").openapi({
829
+ description: "Verification action configuration",
830
+ ref: "VerificationActionConfig"
831
+ });
768
832
  var VerificationPageConfig = FormPageConfig.extend({
769
833
  type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
770
834
  actions: VerificationActionConfig
@@ -864,8 +928,8 @@ var ActionFormConfig = import_zod8.z.object({
864
928
  var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
865
929
 
866
930
  // ../commons/src/events/ActionConfig.ts
867
- var import_zod_openapi = require("zod-openapi");
868
- (0, import_zod_openapi.extendZodWithOpenApi)(import_zod9.z);
931
+ var import_zod_openapi5 = require("zod-openapi");
932
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
869
933
  var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
870
934
  /** If conditional is defined, the action is shown to the user only if the condition is met */
871
935
  ShowConditional,
@@ -881,6 +945,12 @@ var ActionConfigBase = import_zod9.z.object({
881
945
  conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
882
946
  draft: import_zod9.z.boolean().optional()
883
947
  });
948
+ var ReadActionConfig = ActionConfigBase.merge(
949
+ import_zod9.z.object({
950
+ type: import_zod9.z.literal(ActionType.READ),
951
+ review: DeclarationReviewConfig
952
+ })
953
+ );
884
954
  var DeclareConfig = ActionConfigBase.merge(
885
955
  import_zod9.z.object({
886
956
  type: import_zod9.z.literal(ActionType.DECLARE),
@@ -947,6 +1017,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
947
1017
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
948
1018
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
949
1019
  */
1020
+ ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
950
1021
  DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
951
1022
  ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
952
1023
  RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
@@ -1004,13 +1075,13 @@ var LanguageConfig = import_zod11.z.object({
1004
1075
  });
1005
1076
 
1006
1077
  // ../commons/src/events/EventConfig.ts
1007
- var import_zod17 = require("zod");
1078
+ var import_zod18 = require("zod");
1008
1079
 
1009
1080
  // ../commons/src/events/DeduplicationConfig.ts
1010
1081
  var import_zod12 = require("zod");
1011
- var import_zod_openapi2 = require("zod-openapi");
1012
- (0, import_zod_openapi2.extendZodWithOpenApi)(import_zod12.z);
1013
- var FieldReference = import_zod12.z.string();
1082
+ var import_zod_openapi6 = require("zod-openapi");
1083
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
1084
+ var FieldReference2 = import_zod12.z.string();
1014
1085
  var Matcher = import_zod12.z.object({
1015
1086
  fieldId: import_zod12.z.string(),
1016
1087
  options: import_zod12.z.object({
@@ -1039,7 +1110,7 @@ var DateRangeMatcher = Matcher.extend({
1039
1110
  type: import_zod12.z.literal("dateRange"),
1040
1111
  options: import_zod12.z.object({
1041
1112
  days: import_zod12.z.number(),
1042
- origin: FieldReference,
1113
+ origin: FieldReference2,
1043
1114
  boost: import_zod12.z.number().optional().default(1)
1044
1115
  })
1045
1116
  });
@@ -1047,7 +1118,7 @@ var DateDistanceMatcher = Matcher.extend({
1047
1118
  type: import_zod12.z.literal("dateDistance"),
1048
1119
  options: import_zod12.z.object({
1049
1120
  days: import_zod12.z.number(),
1050
- origin: FieldReference,
1121
+ origin: FieldReference2,
1051
1122
  boost: import_zod12.z.number().optional().default(1)
1052
1123
  })
1053
1124
  });
@@ -1110,13 +1181,58 @@ var BaseField3 = import_zod14.z.object({
1110
1181
  config: import_zod14.z.object({
1111
1182
  type: MatchType.describe("Determines the type of field")
1112
1183
  }),
1113
- options: import_zod14.z.array(SelectOption).optional()
1184
+ options: import_zod14.z.array(SelectOption).optional(),
1185
+ searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
1186
+ `
1187
+ This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
1188
+ when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
1189
+
1190
+ For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
1191
+
1192
+ A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
1193
+
1194
+ So, if both child.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
1195
+ which is ambiguous.
1196
+
1197
+ Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
1198
+ descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
1199
+ label would be "Applicant Applicant's First Name", which is redundant and awkward.
1200
+
1201
+ By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
1202
+ in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
1203
+ `
1204
+ ),
1205
+ conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
1206
+ `
1207
+ In advanced search, we sometimes need to override the default field visibility conditionals.
1208
+
1209
+ For example, Informant fields in the declaration form may have conditional logic
1210
+ that hides them based on other field values. Since the advanced search form reuses
1211
+ the declaration form config, those same conditionals would apply by default.
1212
+
1213
+ However, in advanced search we often want to make all Informant fields searchable,
1214
+ regardless of their original visibility logic. To do this, we explicitly set their
1215
+ 'conditionals' to an empty array ('[]') in the search config. This ensures they
1216
+ are always rendered in the advanced search form.
1217
+ `
1218
+ )
1114
1219
  });
1220
+ var SearchQueryParams = import_zod14.z.object({
1221
+ eventType: import_zod14.z.string().optional().describe(
1222
+ "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
1223
+ )
1224
+ }).catchall(FieldValue);
1115
1225
  var FieldConfigSchema = BaseField3.extend({
1116
1226
  fieldId: import_zod14.z.string(),
1117
1227
  fieldType: import_zod14.z.literal("field")
1118
1228
  });
1119
- var EventFieldId = import_zod14.z.enum(["trackingId", "status"]);
1229
+ var EventFieldId = import_zod14.z.enum([
1230
+ "trackingId",
1231
+ "status",
1232
+ "legalStatus.REGISTERED.createdAt",
1233
+ "legalStatus.REGISTERED.createdAtLocation",
1234
+ "updatedAt"
1235
+ ]);
1120
1236
  var EventFieldConfigSchema = BaseField3.extend({
1121
1237
  fieldId: EventFieldId,
1122
1238
  fieldType: import_zod14.z.literal("event")
@@ -1134,114 +1250,134 @@ var AdvancedSearchConfig = import_zod14.z.object({
1134
1250
  var import_lodash = require("lodash");
1135
1251
 
1136
1252
  // ../commons/src/events/ActionDocument.ts
1253
+ var import_zod16 = require("zod");
1254
+ var import_zod_openapi7 = require("zod-openapi");
1255
+
1256
+ // ../commons/src/uuid.ts
1257
+ var import_uuid = require("uuid");
1137
1258
  var import_zod15 = require("zod");
1138
- var import_zod_openapi3 = require("zod-openapi");
1139
- (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod15.z);
1140
- var ActionUpdate = import_zod15.z.record(import_zod15.z.string(), FieldUpdateValue);
1141
- var EventState = import_zod15.z.record(import_zod15.z.string(), FieldValue);
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);
1142
1271
  var ActionStatus = {
1143
1272
  Requested: "Requested",
1144
1273
  Accepted: "Accepted",
1145
1274
  Rejected: "Rejected"
1146
1275
  };
1147
- var ActionBase = import_zod15.z.object({
1148
- id: import_zod15.z.string(),
1149
- transactionId: import_zod15.z.string(),
1150
- createdAt: import_zod15.z.string().datetime(),
1151
- createdBy: import_zod15.z.string(),
1152
- 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,
1153
1284
  declaration: ActionUpdate,
1154
- annotation: ActionUpdate.optional(),
1155
- createdAtLocation: import_zod15.z.string(),
1156
- status: import_zod15.z.enum([
1285
+ annotation: ActionUpdate.optional().nullable(),
1286
+ status: import_zod16.z.enum([
1157
1287
  ActionStatus.Requested,
1158
1288
  ActionStatus.Accepted,
1159
1289
  ActionStatus.Rejected
1160
1290
  ]),
1161
1291
  // If the action is an asynchronous confirmation for another action, we will save the original action id here.
1162
- originalActionId: import_zod15.z.string().optional()
1292
+ originalActionId: UUID.optional().nullable()
1163
1293
  });
1164
1294
  var AssignedAction = ActionBase.merge(
1165
- import_zod15.z.object({
1166
- type: import_zod15.z.literal(ActionType.ASSIGN),
1167
- assignedTo: import_zod15.z.string()
1295
+ import_zod16.z.object({
1296
+ type: import_zod16.z.literal(ActionType.ASSIGN),
1297
+ assignedTo: import_zod16.z.string()
1168
1298
  })
1169
1299
  );
1170
1300
  var UnassignedAction = ActionBase.merge(
1171
- import_zod15.z.object({
1172
- type: import_zod15.z.literal(ActionType.UNASSIGN),
1173
- 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)
1174
1304
  })
1175
1305
  );
1176
1306
  var RegisterAction = ActionBase.merge(
1177
- import_zod15.z.object({
1178
- type: import_zod15.z.literal(ActionType.REGISTER),
1179
- 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()
1180
1310
  })
1181
1311
  );
1182
1312
  var DeclareAction = ActionBase.merge(
1183
- import_zod15.z.object({
1184
- type: import_zod15.z.literal(ActionType.DECLARE)
1313
+ import_zod16.z.object({
1314
+ type: import_zod16.z.literal(ActionType.DECLARE)
1185
1315
  })
1186
1316
  );
1187
1317
  var ValidateAction = ActionBase.merge(
1188
- import_zod15.z.object({
1189
- type: import_zod15.z.literal(ActionType.VALIDATE)
1318
+ import_zod16.z.object({
1319
+ type: import_zod16.z.literal(ActionType.VALIDATE)
1190
1320
  })
1191
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
+ });
1192
1326
  var RejectAction = ActionBase.merge(
1193
- import_zod15.z.object({
1194
- type: import_zod15.z.literal(ActionType.REJECT)
1327
+ import_zod16.z.object({
1328
+ type: import_zod16.z.literal(ActionType.REJECT),
1329
+ reason: RejectionReason
1195
1330
  })
1196
1331
  );
1197
1332
  var MarkAsDuplicateAction = ActionBase.merge(
1198
- import_zod15.z.object({
1199
- type: import_zod15.z.literal(ActionType.MARKED_AS_DUPLICATE)
1333
+ import_zod16.z.object({
1334
+ type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
1200
1335
  })
1201
1336
  );
1202
1337
  var ArchiveAction = ActionBase.merge(
1203
- import_zod15.z.object({
1204
- type: import_zod15.z.literal(ActionType.ARCHIVE)
1338
+ import_zod16.z.object({
1339
+ type: import_zod16.z.literal(ActionType.ARCHIVE),
1340
+ reason: RejectionReason
1205
1341
  })
1206
1342
  );
1207
1343
  var CreatedAction = ActionBase.merge(
1208
- import_zod15.z.object({
1209
- type: import_zod15.z.literal(ActionType.CREATE)
1344
+ import_zod16.z.object({
1345
+ type: import_zod16.z.literal(ActionType.CREATE)
1210
1346
  })
1211
1347
  );
1212
1348
  var NotifiedAction = ActionBase.merge(
1213
- import_zod15.z.object({
1214
- type: import_zod15.z.literal(ActionType.NOTIFY)
1349
+ import_zod16.z.object({
1350
+ type: import_zod16.z.literal(ActionType.NOTIFY)
1215
1351
  })
1216
1352
  );
1217
1353
  var PrintCertificateAction = ActionBase.merge(
1218
- import_zod15.z.object({
1219
- type: import_zod15.z.literal(ActionType.PRINT_CERTIFICATE)
1354
+ import_zod16.z.object({
1355
+ type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
1220
1356
  })
1221
1357
  );
1222
1358
  var RequestedCorrectionAction = ActionBase.merge(
1223
- import_zod15.z.object({
1224
- type: import_zod15.z.literal(ActionType.REQUEST_CORRECTION)
1359
+ import_zod16.z.object({
1360
+ type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
1225
1361
  })
1226
1362
  );
1227
1363
  var ApprovedCorrectionAction = ActionBase.merge(
1228
- import_zod15.z.object({
1229
- type: import_zod15.z.literal(ActionType.APPROVE_CORRECTION),
1230
- 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()
1231
1367
  })
1232
1368
  );
1233
1369
  var RejectedCorrectionAction = ActionBase.merge(
1234
- import_zod15.z.object({
1235
- type: import_zod15.z.literal(ActionType.REJECT_CORRECTION),
1236
- 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()
1237
1373
  })
1238
1374
  );
1239
1375
  var ReadAction = ActionBase.merge(
1240
- import_zod15.z.object({
1241
- type: import_zod15.z.literal(ActionType.READ)
1376
+ import_zod16.z.object({
1377
+ type: import_zod16.z.literal(ActionType.READ)
1242
1378
  })
1243
1379
  );
1244
- var ActionDocument = import_zod15.z.discriminatedUnion("type", [
1380
+ var ActionDocument = import_zod16.z.discriminatedUnion("type", [
1245
1381
  CreatedAction.openapi({ ref: "CreatedAction" }),
1246
1382
  ValidateAction.openapi({ ref: "ValidateAction" }),
1247
1383
  RejectAction.openapi({ ref: "RejectAction" }),
@@ -1264,20 +1400,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
1264
1400
  declaration: true,
1265
1401
  annotation: true
1266
1402
  }).merge(
1267
- import_zod15.z.object({
1268
- type: import_zod15.z.enum(ConfirmableActions),
1269
- 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)
1270
1406
  })
1271
1407
  );
1272
- var Action = import_zod15.z.union([ActionDocument, AsyncRejectActionDocument]);
1273
- var ResolvedUser = import_zod15.z.object({
1274
- id: import_zod15.z.string(),
1275
- role: import_zod15.z.string(),
1276
- name: import_zod15.z.array(
1277
- import_zod15.z.object({
1278
- use: import_zod15.z.string(),
1279
- given: import_zod15.z.array(import_zod15.z.string()),
1280
- 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()
1281
1417
  })
1282
1418
  )
1283
1419
  });
@@ -1288,7 +1424,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
1288
1424
  var import_date_fns = require("date-fns");
1289
1425
 
1290
1426
  // ../commons/src/events/FieldTypeMapping.ts
1291
- var import_zod16 = require("zod");
1427
+ var import_zod17 = require("zod");
1292
1428
  function mapFieldTypeToZod(type, required) {
1293
1429
  let schema;
1294
1430
  switch (type) {
@@ -1314,7 +1450,6 @@ function mapFieldTypeToZod(type, required) {
1314
1450
  case FieldType.ADMINISTRATIVE_AREA:
1315
1451
  case FieldType.FACILITY:
1316
1452
  case FieldType.OFFICE:
1317
- case FieldType.SIGNATURE:
1318
1453
  schema = required ? NonEmptyTextValue : TextValue;
1319
1454
  break;
1320
1455
  case FieldType.NUMBER:
@@ -1323,6 +1458,7 @@ function mapFieldTypeToZod(type, required) {
1323
1458
  case FieldType.CHECKBOX:
1324
1459
  schema = CheckboxFieldValue;
1325
1460
  break;
1461
+ case FieldType.SIGNATURE:
1326
1462
  case FieldType.FILE:
1327
1463
  schema = FileFieldValue;
1328
1464
  break;
@@ -1343,7 +1479,7 @@ function createValidationSchema(config) {
1343
1479
  for (const field2 of config) {
1344
1480
  shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
1345
1481
  }
1346
- return import_zod16.z.object(shape);
1482
+ return import_zod17.z.object(shape);
1347
1483
  }
1348
1484
  function mapFieldTypeToMockValue(field2, i) {
1349
1485
  switch (field2.type) {
@@ -1356,7 +1492,6 @@ function mapFieldTypeToMockValue(field2, i) {
1356
1492
  case FieldType.SELECT:
1357
1493
  case FieldType.COUNTRY:
1358
1494
  case FieldType.RADIO_GROUP:
1359
- case FieldType.SIGNATURE:
1360
1495
  case FieldType.PARAGRAPH:
1361
1496
  case FieldType.ADMINISTRATIVE_AREA:
1362
1497
  case FieldType.FACILITY:
@@ -1385,6 +1520,7 @@ function mapFieldTypeToMockValue(field2, i) {
1385
1520
  return ["2021-01-01", "2021-01-02"];
1386
1521
  case FieldType.CHECKBOX:
1387
1522
  return true;
1523
+ case FieldType.SIGNATURE:
1388
1524
  case FieldType.FILE:
1389
1525
  return {
1390
1526
  filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
@@ -1408,7 +1544,6 @@ function mapFieldTypeToEmptyValue(field2) {
1408
1544
  case FieldType.SELECT:
1409
1545
  case FieldType.COUNTRY:
1410
1546
  case FieldType.RADIO_GROUP:
1411
- case FieldType.SIGNATURE:
1412
1547
  case FieldType.PARAGRAPH:
1413
1548
  case FieldType.ADMINISTRATIVE_AREA:
1414
1549
  case FieldType.FACILITY:
@@ -1434,6 +1569,7 @@ function mapFieldTypeToEmptyValue(field2) {
1434
1569
  number: null,
1435
1570
  zipCode: null
1436
1571
  };
1572
+ case FieldType.SIGNATURE:
1437
1573
  case FieldType.FILE:
1438
1574
  return {
1439
1575
  filename: "",
@@ -1513,6 +1649,9 @@ var isOfficeFieldType = (field2) => {
1513
1649
  var isDataFieldType = (field2) => {
1514
1650
  return field2.config.type === FieldType.DATA;
1515
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
+ };
1516
1655
 
1517
1656
  // ../commons/src/conditionals/validate.ts
1518
1657
  var ajv = new import_ajv.default({
@@ -1689,12 +1828,6 @@ function runFieldValidations({
1689
1828
  };
1690
1829
  }
1691
1830
 
1692
- // ../commons/src/uuid.ts
1693
- var import_uuid = require("uuid");
1694
- function getUUID() {
1695
- return (0, import_uuid.v4)();
1696
- }
1697
-
1698
1831
  // ../commons/src/utils.ts
1699
1832
  function getOrThrow(x, message) {
1700
1833
  if (x === void 0 || x === null) {
@@ -1795,7 +1928,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
1795
1928
  annotation: {},
1796
1929
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1797
1930
  createdBy: "@todo",
1798
- createdAtLocation: "@todo",
1931
+ createdAtLocation: "00000000-0000-0000-0000-000000000000",
1799
1932
  status: ActionStatus.Accepted,
1800
1933
  transactionId: "@todo",
1801
1934
  createdByRole: "@todo"
@@ -1890,23 +2023,23 @@ function getMixedPath(obj, path, defaultValue) {
1890
2023
  }
1891
2024
 
1892
2025
  // ../commons/src/events/EventConfig.ts
1893
- var import_zod_openapi4 = require("zod-openapi");
1894
- (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod17.z);
1895
- var EventConfig = import_zod17.z.object({
1896
- id: import_zod17.z.string().describe(
2026
+ var import_zod_openapi8 = require("zod-openapi");
2027
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2028
+ var EventConfig = import_zod18.z.object({
2029
+ id: import_zod18.z.string().describe(
1897
2030
  'A machine-readable identifier for the event, e.g. "birth" or "death"'
1898
2031
  ),
1899
- dateOfEvent: import_zod17.z.object({ fieldId: import_zod17.z.string() }).optional(),
2032
+ dateOfEvent: FieldReference.optional(),
1900
2033
  title: TranslationConfig,
1901
2034
  fallbackTitle: TranslationConfig.optional().describe(
1902
2035
  "This is a fallback title if actual title resolves to empty string"
1903
2036
  ),
1904
2037
  summary: SummaryConfig,
1905
2038
  label: TranslationConfig,
1906
- actions: import_zod17.z.array(ActionConfig),
2039
+ actions: import_zod18.z.array(ActionConfig),
1907
2040
  declaration: DeclarationFormConfig,
1908
- deduplication: import_zod17.z.array(DeduplicationConfig).optional().default([]),
1909
- 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([])
1910
2043
  }).superRefine((event2, ctx) => {
1911
2044
  const allFields = findAllFields(event2);
1912
2045
  const fieldIds = allFields.map((field2) => field2.id);
@@ -1940,13 +2073,13 @@ var EventConfig = import_zod17.z.object({
1940
2073
  }
1941
2074
  if (event2.dateOfEvent) {
1942
2075
  const eventDateFieldId = getDeclarationFields(event2).find(
1943
- ({ id }) => id === event2.dateOfEvent?.fieldId
2076
+ ({ id }) => id === event2.dateOfEvent?.$$field
1944
2077
  );
1945
2078
  if (!eventDateFieldId) {
1946
2079
  ctx.addIssue({
1947
2080
  code: "custom",
1948
2081
  message: `Date of event field id must match a field id in fields array.
1949
- 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}`,
1950
2083
  path: ["dateOfEvent"]
1951
2084
  });
1952
2085
  } else if (eventDateFieldId.type !== FieldType.DATE) {
@@ -1968,218 +2101,24 @@ var definePage = (page) => PageConfig.parse(page);
1968
2101
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
1969
2102
 
1970
2103
  // ../commons/src/events/WorkqueueConfig.ts
1971
- var import_zod20 = require("zod");
2104
+ var import_zod25 = require("zod");
1972
2105
 
1973
- // ../commons/src/events/EventIndex.ts
2106
+ // ../commons/src/events/serializers/user/serializer.ts
1974
2107
  var import_zod19 = require("zod");
1975
-
1976
- // ../commons/src/events/EventMetadata.ts
1977
- var import_zod18 = require("zod");
1978
- var EventStatus = {
1979
- CREATED: "CREATED",
1980
- NOTIFIED: "NOTIFIED",
1981
- DECLARED: "DECLARED",
1982
- VALIDATED: "VALIDATED",
1983
- REGISTERED: "REGISTERED",
1984
- CERTIFIED: "CERTIFIED",
1985
- REJECTED: "REJECTED",
1986
- ARCHIVED: "ARCHIVED"
1987
- };
1988
- var CustomFlags = {
1989
- CERTIFICATE_PRINTED: "certificate-printed"
1990
- };
1991
- var Flag = import_zod18.z.string().regex(
1992
- new RegExp(
1993
- `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(ActionStatus).join("|").toLowerCase()})$`
1994
- ),
1995
- "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1996
- ).or(import_zod18.z.nativeEnum(CustomFlags));
1997
- var eventStatuses = Object.values(EventStatus);
1998
- var EventStatuses = import_zod18.z.nativeEnum(EventStatus);
1999
- var ZodDate = import_zod18.z.string().date();
2000
- var ActionCreationMetadata = import_zod18.z.object({
2001
- createdAt: import_zod18.z.string().datetime().describe("The timestamp when the action request was created."),
2002
- createdBy: import_zod18.z.string().describe("ID of the user who created the action request."),
2003
- createdAtLocation: import_zod18.z.string().describe("Location of the user who created the action request."),
2004
- acceptedAt: import_zod18.z.string().datetime().describe("Timestamp when the action request was accepted."),
2005
- createdByRole: import_zod18.z.string().describe("Role of the user at the time of action request creation.")
2006
- });
2007
- var RegistrationCreationMetadata = ActionCreationMetadata.extend({
2008
- registrationNumber: import_zod18.z.string().describe(
2009
- "Registration number of the event. Always present for accepted registrations."
2010
- )
2011
- });
2012
- var LegalStatuses = import_zod18.z.object({
2013
- [EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
2014
- [EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
2015
- });
2016
- var EventMetadata = import_zod18.z.object({
2017
- id: import_zod18.z.string(),
2018
- type: import_zod18.z.string().describe("The type of event, such as birth, death, or marriage."),
2019
- status: EventStatuses,
2020
- legalStatuses: LegalStatuses.describe(
2021
- "Metadata related to the legal registration of the event, such as who registered it and when."
2022
- ),
2023
- createdAt: import_zod18.z.string().datetime().describe("The timestamp when the event was first created and saved."),
2024
- dateOfEvent: ZodDate.nullish(),
2025
- createdBy: import_zod18.z.string().describe("ID of the user who created the event."),
2026
- updatedByUserRole: import_zod18.z.string().describe("Role of the user who last updated the declaration."),
2027
- createdAtLocation: import_zod18.z.string().describe("Location of the user who created the event."),
2028
- updatedAtLocation: import_zod18.z.string().nullish().describe("Location of the user who last updated the declaration."),
2029
- updatedAt: import_zod18.z.string().datetime().describe("Timestamp of the most recent declaration update."),
2030
- assignedTo: import_zod18.z.string().nullish().describe("ID of the user currently assigned to the event."),
2031
- updatedBy: import_zod18.z.string().nullish().describe("ID of the user who last updated the declaration."),
2032
- trackingId: import_zod18.z.string().describe(
2033
- "System-generated tracking ID used by informants or registrars to look up the event."
2034
- ),
2035
- flags: import_zod18.z.array(Flag)
2036
- });
2037
- var EventMetadataKeys = import_zod18.z.enum([
2038
- "id",
2039
- "type",
2040
- "status",
2041
- "createdAt",
2042
- "dateOfEvent",
2043
- "createdBy",
2044
- "updatedByUserRole",
2045
- "createdAtLocation",
2046
- "updatedAtLocation",
2047
- "updatedAt",
2048
- "assignedTo",
2049
- "updatedBy",
2050
- "trackingId",
2051
- "legalStatuses",
2052
- "flags"
2053
- ]);
2054
- var EventMetadataParameter = import_zod18.z.object({
2055
- // @TODO: Reconcile with the event metadata definition. How could we derive one from the other?
2056
- $event: EventMetadataKeys
2057
- });
2058
- var eventMetadataLabelMap = {
2059
- "event.assignedTo": {
2060
- id: "event.assignedTo.label",
2061
- defaultMessage: "Assigned To",
2062
- description: "Assigned To"
2063
- },
2064
- "event.createdAt": {
2065
- id: "event.createdAt.label",
2066
- defaultMessage: "Created",
2067
- description: "Created At"
2068
- },
2069
- "event.dateOfEvent": {
2070
- id: "event.dateOfEvent.label",
2071
- defaultMessage: "Date of Event",
2072
- description: "Date of Event"
2073
- },
2074
- "event.createdAtLocation": {
2075
- id: "event.createdAtLocation.label",
2076
- defaultMessage: "Location",
2077
- description: "Created At Location"
2078
- },
2079
- "event.updatedAtLocation": {
2080
- id: "event.updatedAtLocation.label",
2081
- defaultMessage: "Location",
2082
- description: "Updated At Location"
2083
- },
2084
- "event.createdBy": {
2085
- id: "event.createdBy.label",
2086
- defaultMessage: "Created By",
2087
- description: "Created By"
2088
- },
2089
- "event.updatedByUserRole": {
2090
- id: "event.updatedByUserRole.label",
2091
- defaultMessage: "Updated By Role",
2092
- description: "Updated By Role"
2093
- },
2094
- "event.id": {
2095
- id: "event.id.label",
2096
- defaultMessage: "ID",
2097
- description: "ID"
2098
- },
2099
- "event.updatedAt": {
2100
- id: "event.modifiedAt.label",
2101
- defaultMessage: "Updated",
2102
- description: "Modified At"
2103
- },
2104
- "event.status": {
2105
- id: "event.status.label",
2106
- defaultMessage: "Status",
2107
- description: "Status"
2108
- },
2109
- "event.type": {
2110
- id: "event.type.label",
2111
- defaultMessage: "Type",
2112
- description: "Type"
2113
- },
2114
- "event.updatedBy": {
2115
- id: "event.updatedBy.label",
2116
- defaultMessage: "Updated By",
2117
- description: "Updated By"
2118
- },
2119
- "event.trackingId": {
2120
- id: "event.trackingId.label",
2121
- defaultMessage: "Tracking ID",
2122
- description: "Tracking ID"
2123
- },
2124
- "event.flags": {
2125
- id: "event.flags.label",
2126
- defaultMessage: "Flags",
2127
- description: "Flags"
2128
- }
2129
- };
2130
-
2131
- // ../commons/src/events/EventIndex.ts
2132
- var EventIndex = EventMetadata.extend({
2133
- declaration: EventState
2134
- });
2135
- var EventSearchIndex = import_zod19.z.record(import_zod19.z.string(), import_zod19.z.any()).and(
2136
- import_zod19.z.object({
2137
- type: import_zod19.z.string()
2138
- // Ensures "type" (event-id) exists and is a string
2139
- })
2140
- );
2141
- var Fuzzy = import_zod19.z.object({ type: import_zod19.z.literal("fuzzy"), term: import_zod19.z.string() });
2142
- var Exact = import_zod19.z.object({ type: import_zod19.z.literal("exact"), term: import_zod19.z.string() });
2143
- var AnyOf = import_zod19.z.object({
2144
- type: import_zod19.z.literal("anyOf"),
2145
- terms: import_zod19.z.array(import_zod19.z.string())
2146
- });
2147
- var Range = import_zod19.z.object({
2148
- type: import_zod19.z.literal("range"),
2149
- gte: import_zod19.z.string(),
2150
- lte: import_zod19.z.string()
2151
- });
2152
- var Not = import_zod19.z.object({ type: import_zod19.z.literal("not"), term: import_zod19.z.string() });
2153
- var Within = import_zod19.z.object({ type: import_zod19.z.literal("within"), location: import_zod19.z.string() });
2154
- var DateCondition = import_zod19.z.union([Exact, Range]);
2155
- var QueryInput = import_zod19.z.lazy(
2156
- () => import_zod19.z.union([
2157
- import_zod19.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
2158
- 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"
2159
2115
  ])
2160
- );
2161
- var QueryExpression = import_zod19.z.object({
2162
- eventType: import_zod19.z.string(),
2163
- status: import_zod19.z.optional(import_zod19.z.union([AnyOf, Exact])),
2164
- createdAt: import_zod19.z.optional(DateCondition),
2165
- updatedAt: import_zod19.z.optional(DateCondition),
2166
- createAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
2167
- updatedAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
2168
- createdBy: import_zod19.z.optional(Exact),
2169
- updatedBy: import_zod19.z.optional(Exact),
2170
- trackingId: import_zod19.z.optional(Exact),
2171
- flags: import_zod19.z.optional(import_zod19.z.array(import_zod19.z.union([AnyOf, Not]))),
2172
- data: QueryInput
2173
- }).partial();
2174
- var Or2 = import_zod19.z.object({
2175
- type: import_zod19.z.literal("or"),
2176
- clauses: import_zod19.z.array(QueryExpression)
2177
- });
2178
- var And2 = import_zod19.z.object({
2179
- type: import_zod19.z.literal("and"),
2180
- clauses: import_zod19.z.array(QueryExpression)
2181
2116
  });
2182
- var QueryType = import_zod19.z.discriminatedUnion("type", [Or2, And2]);
2117
+ function userSerializer(userField) {
2118
+ return {
2119
+ $userField: userField
2120
+ };
2121
+ }
2183
2122
 
2184
2123
  // ../commons/src/conditionals/conditionals.ts
2185
2124
  function defineConditional(schema) {
@@ -2222,7 +2161,7 @@ function not(condition) {
2222
2161
  function never() {
2223
2162
  return not(alwaysTrue());
2224
2163
  }
2225
- var user = {
2164
+ var user = Object.assign(userSerializer, {
2226
2165
  hasScope: (scope) => defineConditional({
2227
2166
  type: "object",
2228
2167
  properties: {
@@ -2242,7 +2181,7 @@ var user = {
2242
2181
  },
2243
2182
  required: ["$user"]
2244
2183
  })
2245
- };
2184
+ });
2246
2185
  function createEventConditionals() {
2247
2186
  return {
2248
2187
  /**
@@ -2293,7 +2232,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
2293
2232
  };
2294
2233
  }
2295
2234
  function isFieldReference(value) {
2296
- return typeof value === "object" && value !== null && "_fieldId" in value;
2235
+ return typeof value === "object" && value !== null && "$$field" in value;
2297
2236
  }
2298
2237
  function createFieldConditionals(fieldId) {
2299
2238
  const getDateRange = (date, clause) => ({
@@ -2308,6 +2247,10 @@ function createFieldConditionals(fieldId) {
2308
2247
  required: [fieldId]
2309
2248
  });
2310
2249
  return {
2250
+ /**
2251
+ * @private Internal property used for field reference tracking.
2252
+ */
2253
+ $$field: fieldId,
2311
2254
  isAfter: () => ({
2312
2255
  days: (days) => ({
2313
2256
  inPast: () => defineFormConditional(
@@ -2319,7 +2262,7 @@ function createFieldConditionals(fieldId) {
2319
2262
  }),
2320
2263
  date: (date) => {
2321
2264
  if (isFieldReference(date)) {
2322
- const comparedFieldId = date._fieldId;
2265
+ const comparedFieldId = date.$$field;
2323
2266
  return defineFormConditional(
2324
2267
  getDateRangeToFieldReference(
2325
2268
  fieldId,
@@ -2343,7 +2286,7 @@ function createFieldConditionals(fieldId) {
2343
2286
  }),
2344
2287
  date: (date) => {
2345
2288
  if (isFieldReference(date)) {
2346
- const comparedFieldId = date._fieldId;
2289
+ const comparedFieldId = date.$$field;
2347
2290
  return defineFormConditional(
2348
2291
  getDateRangeToFieldReference(
2349
2292
  fieldId,
@@ -2358,7 +2301,7 @@ function createFieldConditionals(fieldId) {
2358
2301
  }),
2359
2302
  isEqualTo: (value) => {
2360
2303
  if (isFieldReference(value)) {
2361
- const comparedFieldId = value._fieldId;
2304
+ const comparedFieldId = value.$$field;
2362
2305
  return defineFormConditional({
2363
2306
  type: "object",
2364
2307
  properties: {
@@ -2474,163 +2417,744 @@ function createFieldConditionals(fieldId) {
2474
2417
  }
2475
2418
  },
2476
2419
  required: [fieldId]
2477
- }),
2478
- getId: () => ({ fieldId })
2420
+ })
2479
2421
  };
2480
2422
  }
2481
2423
 
2482
- // ../commons/src/event-config/event-configuration.ts
2483
- function createEventFieldConfig(fieldId, options) {
2424
+ // ../commons/src/searchConfigs.ts
2425
+ function createSearchConfig(baseField) {
2484
2426
  return {
2485
- fieldId,
2486
- options,
2487
- config: { type: "exact" },
2488
- fieldType: "event"
2489
- };
2490
- }
2491
-
2492
- // ../commons/src/events/event.ts
2493
- function eventFn(fieldId, options) {
2494
- return createEventFieldConfig(fieldId, options);
2495
- }
2496
- var event = Object.assign(eventFn, {
2497
- ...createEventConditionals(),
2498
- field(field2) {
2499
- return {
2500
- $event: field2
2501
- };
2502
- }
2503
- });
2504
-
2505
- // ../commons/src/events/WorkqueueConfig.ts
2506
- var WorkqueueConfig = import_zod20.z.object({
2507
- slug: import_zod20.z.string().describe("Determines the url of the workqueue."),
2508
- name: TranslationConfig.describe(
2509
- "Title of the workflow (both in navigation and on the page)"
2510
- ),
2511
- query: QueryType,
2512
- actions: import_zod20.z.array(
2513
- import_zod20.z.object({
2514
- type: import_zod20.z.string(),
2515
- conditionals: import_zod20.z.array(Conditional).optional()
2516
- })
2517
- ),
2518
- columns: import_zod20.z.array(
2519
- import_zod20.z.object({ label: TranslationConfig, value: EventMetadataParameter })
2520
- ).default([
2521
- {
2522
- label: {
2523
- id: "workqueues.dateOfEvent",
2524
- defaultMessage: "Date of Event",
2525
- description: "Label for workqueue column: dateOfEvent"
2526
- },
2527
- value: event.field("dateOfEvent")
2528
- }
2529
- ])
2530
- }).describe("Configuration for workqueue.");
2531
- function defineWorkqueue(workqueues) {
2532
- return workqueues.map((workqueue) => WorkqueueConfig.parse(workqueue));
2533
- }
2534
-
2535
- // ../commons/src/events/Draft.ts
2536
- var import_zod22 = require("zod");
2537
-
2538
- // ../commons/src/events/ActionInput.ts
2427
+ /**
2428
+ * Creates a range configuration for the specified field.
2429
+ *
2430
+ * @returns An object containing the field ID and a configuration object with a type of 'range'.
2431
+ *
2432
+ * @example event('legalStatus.REGISTERED.createdAt').range()
2433
+ * // {
2434
+ * // ...
2435
+ * // config: { type: 'range' }
2436
+ * // }
2437
+ */
2438
+ range: () => ({
2439
+ ...baseField,
2440
+ config: { type: "range" }
2441
+ }),
2442
+ /**
2443
+ * Creates a configuration for exact matching of the specified field.
2444
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
2445
+ * @example field('dob').exact()
2446
+ * // {
2447
+ * // ...
2448
+ * // config: { type: 'exact' }
2449
+ * // }
2450
+ */
2451
+ exact: () => ({
2452
+ ...baseField,
2453
+ config: { type: "exact" }
2454
+ }),
2455
+ /**
2456
+ * Creates a configuration for fuzzy matching of the specified field.
2457
+ * @returns An object containing the field ID and a configuration object with a type of 'exact'.
2458
+ * @example field('name').fuzzy()
2459
+ * // {
2460
+ * // ...
2461
+ * // config: { type: 'fuzzy' }
2462
+ * // }
2463
+ */
2464
+ fuzzy: () => ({
2465
+ ...baseField,
2466
+ config: { type: "fuzzy" }
2467
+ })
2468
+ };
2469
+ }
2470
+
2471
+ // ../commons/src/event-config/event-configuration.ts
2472
+ function createEventFieldConfig(fieldId, options) {
2473
+ const baseField = {
2474
+ fieldId,
2475
+ options,
2476
+ fieldType: "event"
2477
+ };
2478
+ return createSearchConfig(baseField);
2479
+ }
2480
+
2481
+ // ../commons/src/events/event.ts
2482
+ function eventFn(fieldId, options) {
2483
+ return createEventFieldConfig(fieldId, options);
2484
+ }
2485
+ var event = Object.assign(eventFn, {
2486
+ ...createEventConditionals(),
2487
+ field(field2) {
2488
+ return {
2489
+ $event: field2
2490
+ };
2491
+ }
2492
+ });
2493
+
2494
+ // ../commons/src/events/WorkqueueColumnConfig.ts
2539
2495
  var import_zod21 = require("zod");
2540
- var import_zod_openapi5 = require("zod-openapi");
2541
- (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod21.z);
2542
- var BaseActionInput = import_zod21.z.object({
2543
- eventId: import_zod21.z.string(),
2544
- transactionId: import_zod21.z.string(),
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()})$`
2528
+ ),
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."
2539
+ ),
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.")
2543
+ });
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(),
2545
3059
  declaration: ActionUpdate.default({}),
2546
3060
  annotation: ActionUpdate.optional(),
2547
- originalActionId: import_zod21.z.string().optional(),
2548
- keepAssignment: import_zod21.z.boolean().optional()
3061
+ originalActionId: UUID.optional(),
3062
+ keepAssignment: import_zod26.z.boolean().optional()
2549
3063
  });
2550
3064
  var CreateActionInput = BaseActionInput.merge(
2551
- import_zod21.z.object({
2552
- type: import_zod21.z.literal(ActionType.CREATE).default(ActionType.CREATE),
2553
- createdAtLocation: import_zod21.z.string()
3065
+ import_zod26.z.object({
3066
+ type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3067
+ createdAtLocation: CreatedAtLocation
2554
3068
  })
2555
3069
  );
2556
3070
  var RegisterActionInput = BaseActionInput.merge(
2557
- import_zod21.z.object({
2558
- type: import_zod21.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
2559
- registrationNumber: import_zod21.z.string().optional()
3071
+ import_zod26.z.object({
3072
+ type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3073
+ registrationNumber: import_zod26.z.string().optional()
2560
3074
  })
2561
3075
  );
2562
3076
  var ValidateActionInput = BaseActionInput.merge(
2563
- import_zod21.z.object({
2564
- type: import_zod21.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
2565
- 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())
2566
3080
  })
2567
3081
  );
2568
3082
  var NotifyActionInput = BaseActionInput.merge(
2569
- import_zod21.z.object({
2570
- 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)
2571
3085
  })
2572
- );
3086
+ ).openapi({
3087
+ default: {
3088
+ eventId: "<event-id-here>",
3089
+ transactionId: getUUID(),
3090
+ declaration: {},
3091
+ annotation: {},
3092
+ type: ActionType.NOTIFY
3093
+ }
3094
+ });
2573
3095
  var DeclareActionInput = BaseActionInput.merge(
2574
- import_zod21.z.object({
2575
- 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)
2576
3098
  })
2577
3099
  );
2578
3100
  var PrintCertificateActionInput = BaseActionInput.merge(
2579
- import_zod21.z.object({
2580
- 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)
2581
3103
  })
2582
3104
  );
2583
3105
  var RejectDeclarationActionInput = BaseActionInput.merge(
2584
- import_zod21.z.object({
2585
- 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
2586
3109
  })
2587
3110
  );
2588
3111
  var MarkedAsDuplicateActionInput = BaseActionInput.merge(
2589
- import_zod21.z.object({
2590
- 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)
2591
3114
  })
2592
3115
  );
2593
3116
  var ArchiveActionInput = BaseActionInput.merge(
2594
- import_zod21.z.object({
2595
- 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
2596
3120
  })
2597
3121
  );
2598
3122
  var AssignActionInput = BaseActionInput.merge(
2599
- import_zod21.z.object({
2600
- type: import_zod21.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
2601
- 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()
2602
3126
  })
2603
3127
  );
2604
3128
  var UnassignActionInput = BaseActionInput.merge(
2605
- import_zod21.z.object({
2606
- type: import_zod21.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
2607
- 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)
2608
3132
  })
2609
3133
  );
2610
3134
  var RequestCorrectionActionInput = BaseActionInput.merge(
2611
- import_zod21.z.object({
2612
- 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)
2613
3137
  })
2614
3138
  );
2615
3139
  var RejectCorrectionActionInput = BaseActionInput.merge(
2616
- import_zod21.z.object({
2617
- requestId: import_zod21.z.string(),
2618
- 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)
2619
3143
  })
2620
3144
  );
2621
3145
  var ApproveCorrectionActionInput = BaseActionInput.merge(
2622
- import_zod21.z.object({
2623
- requestId: import_zod21.z.string(),
2624
- 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)
2625
3149
  })
2626
3150
  );
2627
3151
  var ReadActionInput = BaseActionInput.merge(
2628
- import_zod21.z.object({
2629
- 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)
2630
3154
  })
2631
3155
  );
2632
- var DeleteActionInput = import_zod21.z.object({ eventId: import_zod21.z.string() });
2633
- var ActionInput = import_zod21.z.discriminatedUnion("type", [
3156
+ var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
3157
+ var ActionInput = import_zod26.z.discriminatedUnion("type", [
2634
3158
  CreateActionInput.openapi({ ref: "CreateActionInput" }),
2635
3159
  ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
2636
3160
  RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
@@ -2659,18 +3183,18 @@ var ActionInput = import_zod21.z.discriminatedUnion("type", [
2659
3183
  });
2660
3184
 
2661
3185
  // ../commons/src/events/Draft.ts
2662
- var Draft = import_zod22.z.object({
2663
- id: import_zod22.z.string(),
2664
- eventId: import_zod22.z.string(),
2665
- transactionId: import_zod22.z.string(),
2666
- 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(),
2667
3191
  action: ActionBase.extend({
2668
3192
  type: ActionTypes
2669
3193
  }).omit({ id: true })
2670
3194
  });
2671
3195
  var DraftInput = BaseActionInput.extend({
2672
3196
  type: ActionTypes,
2673
- status: import_zod22.z.enum([
3197
+ status: import_zod27.z.enum([
2674
3198
  ActionStatus.Requested,
2675
3199
  ActionStatus.Accepted,
2676
3200
  ActionStatus.Rejected
@@ -2678,25 +3202,24 @@ var DraftInput = BaseActionInput.extend({
2678
3202
  });
2679
3203
 
2680
3204
  // ../commons/src/events/EventInput.ts
2681
- var import_zod23 = require("zod");
2682
- var EventInput = import_zod23.z.object({
2683
- transactionId: import_zod23.z.string(),
2684
- type: import_zod23.z.string(),
2685
- dateOfEvent: import_zod23.z.object({ fieldId: import_zod23.z.string() }).optional()
2686
- });
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" } });
2687
3211
 
2688
3212
  // ../commons/src/events/EventDocument.ts
2689
- var import_zod24 = require("zod");
2690
- var import_zod_openapi6 = require("zod-openapi");
2691
- (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod24.z);
2692
- var EventDocument = import_zod24.z.object({
2693
- id: import_zod24.z.string(),
2694
- type: import_zod24.z.string(),
2695
- dateOfEvent: import_zod24.z.object({ fieldId: import_zod24.z.string() }).optional(),
2696
- createdAt: import_zod24.z.string().datetime(),
2697
- updatedAt: import_zod24.z.string().datetime(),
2698
- actions: import_zod24.z.array(Action),
2699
- 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()
2700
3223
  }).openapi({ ref: "EventDocument" });
2701
3224
 
2702
3225
  // ../commons/src/events/state/utils.ts
@@ -2733,6 +3256,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
2733
3256
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
2734
3257
  acceptedAt: acceptAction.createdAt,
2735
3258
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
3259
+ createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
2736
3260
  registrationNumber
2737
3261
  };
2738
3262
  }
@@ -2853,23 +3377,34 @@ function getAssignedUserFromActions(actions) {
2853
3377
  return user2;
2854
3378
  }, null);
2855
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
+ }
2856
3391
  function aggregateActionDeclarations(actions) {
2857
3392
  const excludedActions = [
2858
3393
  ActionType.REQUEST_CORRECTION,
2859
3394
  ActionType.PRINT_CERTIFICATE
2860
3395
  ];
2861
- return actions.reduce((status, action) => {
3396
+ return actions.reduce((declaration, action) => {
2862
3397
  if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
2863
- return status;
3398
+ return declaration;
2864
3399
  }
2865
3400
  if (action.type === ActionType.APPROVE_CORRECTION) {
2866
3401
  const requestAction = actions.find(({ id }) => id === action.requestId);
2867
3402
  if (!requestAction) {
2868
- return status;
3403
+ return declaration;
2869
3404
  }
2870
- return deepMerge(status, requestAction.declaration);
3405
+ return deepMerge(declaration, requestAction.declaration);
2871
3406
  }
2872
- return deepMerge(status, action.declaration);
3407
+ return deepMerge(declaration, action.declaration);
2873
3408
  }, {});
2874
3409
  }
2875
3410
  function deepDropNulls(obj) {
@@ -2897,7 +3432,7 @@ function getAcceptedActions(event2) {
2897
3432
  );
2898
3433
  }
2899
3434
  var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
2900
- function getCurrentEventState(event2) {
3435
+ function getCurrentEventState(event2, config) {
2901
3436
  const creationAction = event2.actions.find(
2902
3437
  (action) => action.type === ActionType.CREATE
2903
3438
  );
@@ -2909,9 +3444,17 @@ function getCurrentEventState(event2) {
2909
3444
  event2.actions
2910
3445
  );
2911
3446
  const declaration = aggregateActionDeclarations(acceptedActions);
2912
- const dateOfEvent = ZodDate.safeParse(
2913
- event2.dateOfEvent?.fieldId ? declaration[event2.dateOfEvent.fieldId] : event2[DEFAULT_DATE_OF_EVENT_PROPERTY]
2914
- ).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
+ }
2915
3458
  return deepDropNulls({
2916
3459
  id: event2.id,
2917
3460
  type: event2.type,
@@ -2920,19 +3463,24 @@ function getCurrentEventState(event2) {
2920
3463
  createdAt: creationAction.createdAt,
2921
3464
  createdBy: creationAction.createdBy,
2922
3465
  createdAtLocation: creationAction.createdAtLocation,
3466
+ createdBySignature: creationAction.createdBySignature,
2923
3467
  updatedAt: declarationUpdateMetadata.createdAt,
2924
3468
  assignedTo: getAssignedUserFromActions(acceptedActions),
3469
+ assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
2925
3470
  updatedBy: declarationUpdateMetadata.createdBy,
2926
3471
  updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
2927
3472
  declaration,
2928
3473
  trackingId: event2.trackingId,
2929
- // @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
2930
3474
  updatedByUserRole: declarationUpdateMetadata.createdByRole,
2931
3475
  dateOfEvent,
2932
3476
  flags: getFlagsFromActions(event2.actions)
2933
3477
  });
2934
3478
  }
2935
- function getCurrentEventStateWithDrafts(event2, drafts) {
3479
+ function getCurrentEventStateWithDrafts({
3480
+ event: event2,
3481
+ drafts,
3482
+ configuration
3483
+ }) {
2936
3484
  const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
2937
3485
  const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
2938
3486
  if (action.type === ActionType.REQUEST_CORRECTION) {
@@ -2951,7 +3499,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
2951
3499
  ...event2,
2952
3500
  actions: actionWithDrafts
2953
3501
  };
2954
- return getCurrentEventState(withDrafts);
3502
+ return getCurrentEventState(withDrafts, configuration);
2955
3503
  }
2956
3504
  function applyDraftsToEventIndex(eventIndex, drafts) {
2957
3505
  const indexedAt = eventIndex.updatedAt;
@@ -3005,73 +3553,45 @@ function generateTransactionId() {
3005
3553
  return getUUID();
3006
3554
  }
3007
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
+
3008
3571
  // ../commons/src/events/test.utils.ts
3009
3572
  var import_lodash2 = require("lodash");
3573
+ var import_addDays = __toESM(require("date-fns/addDays"));
3010
3574
 
3011
3575
  // ../commons/src/field-config/field-configuration.ts
3012
- function createFieldConfigs(fieldId) {
3576
+ function createFieldConfig(fieldId, options) {
3013
3577
  const baseField = {
3014
3578
  fieldId,
3015
- fieldType: "field"
3016
- };
3017
- return {
3018
- /**
3019
- * Creates a range configuration for the specified field.
3020
- *
3021
- * @returns An object containing the field ID and a configuration object with a type of 'range'.
3022
- *
3023
- * @example field('age').range()
3024
- * // {
3025
- * // fieldId: 'age',
3026
- * // config: { type: 'range' }
3027
- * // }
3028
- */
3029
- range: () => ({
3030
- ...baseField,
3031
- config: { type: "range" }
3032
- }),
3033
- /**
3034
- * Creates a configuration for exact matching of the specified field.
3035
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
3036
- * @example field('dob').exact()
3037
- * // {
3038
- * // fieldId: 'dob',
3039
- * // config: { type: 'exact' }
3040
- * // }
3041
- */
3042
- exact: () => ({
3043
- ...baseField,
3044
- config: { type: "exact" }
3045
- }),
3046
- /**
3047
- * Creates a configuration for fuzzy matching of the specified field.
3048
- * @returns An object containing the field ID and a configuration object with a type of 'exact'.
3049
- * @example field('name').fuzzy()
3050
- * // {
3051
- * // fieldId: 'name',
3052
- * // config: { type: 'fuzzy' }
3053
- * // }
3054
- */
3055
- fuzzy: () => ({
3056
- ...baseField,
3057
- config: { type: "fuzzy" }
3058
- })
3579
+ fieldType: "field",
3580
+ ...options
3059
3581
  };
3582
+ return createSearchConfig(baseField);
3060
3583
  }
3061
3584
 
3062
3585
  // ../commons/src/events/field.ts
3063
- function field(fieldId) {
3586
+ function field(fieldId, options = {}) {
3064
3587
  return {
3065
- /**
3066
- * @private Internal property used for field reference tracking.
3067
- */
3068
- _fieldId: fieldId,
3069
3588
  ...createFieldConditionals(fieldId),
3070
- ...createFieldConfigs(fieldId)
3589
+ ...createFieldConfig(fieldId, options)
3071
3590
  };
3072
3591
  }
3073
3592
 
3074
- // ../commons/src/fixtures/tennis-club-membership-event.ts
3593
+ // ../commons/src/fixtures/forms.ts
3594
+ var import_date_fns2 = require("date-fns");
3075
3595
  var PRINT_CERTIFICATE_FORM = defineActionForm({
3076
3596
  label: {
3077
3597
  id: "v2.event.tennis-club-membership.action.certificate.form.label",
@@ -3744,253 +4264,772 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
3744
4264
  }
3745
4265
  },
3746
4266
  {
3747
- type: FieldType.SIGNATURE,
3748
- id: "review.signature",
3749
- label: {
3750
- defaultMessage: "Signature of informant",
3751
- id: "v2.event.birth.action.declare.form.review.signature.label",
3752
- description: "Label for the signature field in the review section"
4267
+ type: FieldType.SIGNATURE,
4268
+ id: "review.signature",
4269
+ label: {
4270
+ defaultMessage: "Signature of informant",
4271
+ id: "v2.event.birth.action.declare.form.review.signature.label",
4272
+ description: "Label for the signature field in the review section"
4273
+ },
4274
+ signaturePromptLabel: {
4275
+ id: "v2.signature.upload.modal.title",
4276
+ defaultMessage: "Draw signature",
4277
+ description: "Title for the modal to draw signature"
4278
+ }
4279
+ }
4280
+ ]
4281
+ };
4282
+ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4283
+ label: {
4284
+ id: "v2.event.tennis-club-membership.action.declare.form.label",
4285
+ defaultMessage: "Tennis club membership application",
4286
+ description: "This is what this form is referred as in the system"
4287
+ },
4288
+ pages: [
4289
+ {
4290
+ id: "applicant",
4291
+ title: {
4292
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.title",
4293
+ defaultMessage: "Who is applying for the membership?",
4294
+ description: "This is the title of the section"
4295
+ },
4296
+ fields: [
4297
+ {
4298
+ id: "applicant.firstname",
4299
+ type: FieldType.TEXT,
4300
+ required: true,
4301
+ conditionals: [],
4302
+ label: {
4303
+ defaultMessage: "Applicant's first name",
4304
+ description: "This is the label for the field",
4305
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
4306
+ }
4307
+ },
4308
+ {
4309
+ id: "applicant.surname",
4310
+ type: FieldType.TEXT,
4311
+ required: true,
4312
+ conditionals: [],
4313
+ label: {
4314
+ defaultMessage: "Applicant's surname",
4315
+ description: "This is the label for the field",
4316
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
4317
+ }
4318
+ },
4319
+ {
4320
+ id: "applicant.email",
4321
+ type: "EMAIL",
4322
+ required: false,
4323
+ conditionals: [],
4324
+ label: {
4325
+ defaultMessage: "Applicant's email",
4326
+ description: "This is the label for the field",
4327
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.email.label"
4328
+ }
4329
+ },
4330
+ {
4331
+ id: "applicant.dob",
4332
+ type: FieldType.DATE,
4333
+ required: true,
4334
+ validation: [
4335
+ {
4336
+ message: {
4337
+ defaultMessage: "Please enter a valid date",
4338
+ description: "This is the error message for invalid date",
4339
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.error"
4340
+ },
4341
+ validator: field("applicant.dob").isBefore().now()
4342
+ }
4343
+ ],
4344
+ conditionals: [
4345
+ {
4346
+ type: ConditionalType.SHOW,
4347
+ conditional: field("applicant.dobUnknown").isFalsy()
4348
+ }
4349
+ ],
4350
+ label: {
4351
+ defaultMessage: "Applicant's date of birth",
4352
+ description: "This is the label for the field",
4353
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.label"
4354
+ }
4355
+ },
4356
+ {
4357
+ id: "applicant.dobUnknown",
4358
+ type: FieldType.CHECKBOX,
4359
+ required: false,
4360
+ label: {
4361
+ defaultMessage: "Exact date of birth unknown",
4362
+ description: "This is the label for the field",
4363
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dobUnknown.label"
4364
+ },
4365
+ conditionals: [
4366
+ {
4367
+ type: ConditionalType.DISPLAY_ON_REVIEW,
4368
+ conditional: never()
4369
+ }
4370
+ ]
4371
+ },
4372
+ {
4373
+ id: "applicant.age",
4374
+ type: FieldType.NUMBER,
4375
+ required: true,
4376
+ label: {
4377
+ defaultMessage: "Age of tennis-member",
4378
+ description: "This is the label for the field",
4379
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.age.label"
4380
+ },
4381
+ conditionals: [
4382
+ {
4383
+ type: ConditionalType.SHOW,
4384
+ conditional: field("applicant.dobUnknown").isEqualTo(true)
4385
+ }
4386
+ ]
4387
+ },
4388
+ {
4389
+ id: "applicant.image",
4390
+ type: FieldType.FILE,
4391
+ required: false,
4392
+ label: {
4393
+ defaultMessage: "Applicant's profile picture",
4394
+ description: "This is the label for the field",
4395
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.image.label"
4396
+ }
4397
+ },
4398
+ {
4399
+ id: "applicant.address",
4400
+ type: "ADDRESS",
4401
+ required: true,
4402
+ conditionals: [],
4403
+ label: {
4404
+ defaultMessage: "Applicant's address",
4405
+ description: "This is the label for the field",
4406
+ id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.address.label"
4407
+ }
4408
+ }
4409
+ ]
4410
+ },
4411
+ {
4412
+ id: "senior-pass",
4413
+ conditional: field("applicant.dob").isBefore().date("1950-01-01"),
4414
+ title: {
4415
+ id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
4416
+ defaultMessage: "Assign senior pass for applicant",
4417
+ description: "This is the title of the section"
3753
4418
  },
3754
- signaturePromptLabel: {
3755
- id: "v2.signature.upload.modal.title",
3756
- defaultMessage: "Draw signature",
3757
- description: "Title for the modal to draw signature"
3758
- }
3759
- }
3760
- ]
3761
- };
3762
- var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
3763
- label: {
3764
- id: "v2.event.tennis-club-membership.action.declare.form.label",
3765
- defaultMessage: "Tennis club membership application",
3766
- description: "This is what this form is referred as in the system"
3767
- },
3768
- pages: [
4419
+ fields: [
4420
+ {
4421
+ id: "senior-pass.id",
4422
+ type: FieldType.TEXT,
4423
+ required: true,
4424
+ label: {
4425
+ defaultMessage: "Senior pass ID",
4426
+ description: "This is the label for the field",
4427
+ id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
4428
+ }
4429
+ }
4430
+ ]
4431
+ },
3769
4432
  {
3770
- id: "applicant",
4433
+ id: "recommender",
3771
4434
  title: {
3772
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.title",
3773
- defaultMessage: "Who is applying for the membership?",
4435
+ id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
4436
+ defaultMessage: "Who is recommending the applicant?",
3774
4437
  description: "This is the title of the section"
3775
4438
  },
3776
4439
  fields: [
3777
4440
  {
3778
- id: "applicant.firstname",
4441
+ id: "recommender.none",
4442
+ type: "CHECKBOX",
4443
+ required: false,
4444
+ conditionals: [],
4445
+ label: {
4446
+ defaultMessage: "No recommender",
4447
+ description: "This is the label for the field",
4448
+ id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
4449
+ }
4450
+ },
4451
+ {
4452
+ id: "recommender.firstname",
3779
4453
  type: FieldType.TEXT,
3780
4454
  required: true,
3781
- conditionals: [],
4455
+ conditionals: [
4456
+ {
4457
+ type: ConditionalType.SHOW,
4458
+ conditional: field("recommender.none").isFalsy()
4459
+ }
4460
+ ],
3782
4461
  label: {
3783
- defaultMessage: "Applicant's first name",
4462
+ defaultMessage: "Recommender's first name",
3784
4463
  description: "This is the label for the field",
3785
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.firstname.label"
4464
+ id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
3786
4465
  }
3787
4466
  },
3788
4467
  {
3789
- id: "applicant.surname",
4468
+ id: "recommender.surname",
3790
4469
  type: FieldType.TEXT,
3791
4470
  required: true,
3792
- conditionals: [],
4471
+ conditionals: [
4472
+ {
4473
+ type: ConditionalType.SHOW,
4474
+ conditional: field("recommender.none").isFalsy()
4475
+ }
4476
+ ],
3793
4477
  label: {
3794
- defaultMessage: "Applicant's surname",
4478
+ defaultMessage: "Recommender's surname",
3795
4479
  description: "This is the label for the field",
3796
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.surname.label"
4480
+ id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
3797
4481
  }
3798
4482
  },
3799
4483
  {
3800
- id: "applicant.email",
3801
- type: "EMAIL",
3802
- required: false,
3803
- conditionals: [],
4484
+ id: "recommender.id",
4485
+ type: FieldType.TEXT,
4486
+ required: true,
4487
+ conditionals: [
4488
+ {
4489
+ type: ConditionalType.SHOW,
4490
+ conditional: field("recommender.none").isFalsy()
4491
+ }
4492
+ ],
3804
4493
  label: {
3805
- defaultMessage: "Applicant's email",
4494
+ defaultMessage: "Recommender's membership ID",
3806
4495
  description: "This is the label for the field",
3807
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.email.label"
4496
+ id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
3808
4497
  }
4498
+ }
4499
+ ]
4500
+ }
4501
+ ]
4502
+ });
4503
+ var statusOptions = [
4504
+ {
4505
+ value: "ALL",
4506
+ label: {
4507
+ defaultMessage: "Any status",
4508
+ description: "Option for form field: status of record",
4509
+ id: "v2.advancedSearch.form.recordStatusAny"
4510
+ }
4511
+ },
4512
+ {
4513
+ value: EventStatus.CREATED,
4514
+ label: {
4515
+ defaultMessage: "Draft",
4516
+ description: "Option for form field: status of record",
4517
+ id: "v2.advancedSearch.form.recordStatusCreated"
4518
+ }
4519
+ },
4520
+ {
4521
+ value: EventStatus.NOTIFIED,
4522
+ label: {
4523
+ defaultMessage: "Notified",
4524
+ description: "Option for form field: status of record",
4525
+ id: "v2.advancedSearch.form.recordStatusNotified"
4526
+ }
4527
+ },
4528
+ {
4529
+ value: EventStatus.DECLARED,
4530
+ label: {
4531
+ defaultMessage: "Declared",
4532
+ description: "Option for form field: status of record",
4533
+ id: "v2.advancedSearch.form.recordStatusDeclared"
4534
+ }
4535
+ },
4536
+ {
4537
+ value: EventStatus.VALIDATED,
4538
+ label: {
4539
+ defaultMessage: "Validated",
4540
+ description: "Option for form field: status of record",
4541
+ id: "v2.advancedSearch.form.recordStatusValidated"
4542
+ }
4543
+ },
4544
+ {
4545
+ value: EventStatus.REGISTERED,
4546
+ label: {
4547
+ defaultMessage: "Registered",
4548
+ description: "Option for form field: status of record",
4549
+ id: "v2.advancedSearch.form.recordStatusRegistered"
4550
+ }
4551
+ },
4552
+ {
4553
+ value: EventStatus.CERTIFIED,
4554
+ label: {
4555
+ defaultMessage: "Certified",
4556
+ description: "Option for form field: status of record",
4557
+ id: "v2.advancedSearch.form.recordStatusCertified"
4558
+ }
4559
+ },
4560
+ {
4561
+ value: EventStatus.REJECTED,
4562
+ label: {
4563
+ defaultMessage: "Rejected",
4564
+ description: "Option for form field: status of record",
4565
+ id: "v2.advancedSearch.form.recordStatusRejected"
4566
+ }
4567
+ },
4568
+ {
4569
+ value: EventStatus.ARCHIVED,
4570
+ label: {
4571
+ defaultMessage: "Archived",
4572
+ description: "Option for form field: status of record",
4573
+ id: "v2.advancedSearch.form.recordStatusArchived"
4574
+ }
4575
+ }
4576
+ ];
4577
+ var timePeriodOptions = [
4578
+ {
4579
+ label: {
4580
+ defaultMessage: "Last 7 days",
4581
+ description: "Label for option of time period select: last 7 days",
4582
+ id: "form.section.label.timePeriodLast7Days"
4583
+ },
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
+ )}`
4588
+ },
4589
+ {
4590
+ label: {
4591
+ defaultMessage: "Last 30 days",
4592
+ description: "Label for option of time period select: last 30 days",
4593
+ id: "form.section.label.timePeriodLast30Days"
4594
+ },
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
+ )}`
4599
+ },
4600
+ {
4601
+ label: {
4602
+ defaultMessage: "Last 90 days",
4603
+ description: "Label for option of time period select: last 90 days",
4604
+ id: "form.section.label.timePeriodLast90Days"
4605
+ },
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
+ )}`
4610
+ },
4611
+ {
4612
+ label: {
4613
+ defaultMessage: "Last year",
4614
+ description: "Label for option of time period select: last year",
4615
+ id: "form.section.label.timePeriodLastYear"
4616
+ },
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
+ )}`
4621
+ }
4622
+ ];
4623
+
4624
+ // ../commons/src/fixtures/tennis-club-membership-event.ts
4625
+ var tennisClubMembershipEvent = defineConfig({
4626
+ id: TENNIS_CLUB_MEMBERSHIP,
4627
+ label: {
4628
+ defaultMessage: "Tennis club membership application",
4629
+ description: "This is what this event is referred as in the system",
4630
+ id: "v2.event.tennis-club-membership.label"
4631
+ },
4632
+ title: {
4633
+ defaultMessage: "{applicant.firstname} {applicant.surname}",
4634
+ description: "This is the title of the summary",
4635
+ id: "v2.event.tennis-club-membership.title"
4636
+ },
4637
+ summary: {
4638
+ fields: [
4639
+ {
4640
+ id: "applicant.firstname",
4641
+ label: {
4642
+ defaultMessage: "Applicant's first name",
4643
+ description: "This is the label for the field",
4644
+ id: "event.tennis-club-membership.summary.field.firstname.label"
4645
+ },
4646
+ value: {
4647
+ defaultMessage: "{applicant.firstname}",
4648
+ description: "This is the value to show in the summary",
4649
+ id: "event.tennis-club-membership.summary.field.firstname"
4650
+ },
4651
+ emptyValueMessage: {
4652
+ defaultMessage: "First name is not provided",
4653
+ description: "This is the message to show when the field is empty",
4654
+ id: "event.tennis-club-membership.summary.field.firstname.empty"
4655
+ }
4656
+ },
4657
+ {
4658
+ fieldId: "applicant.surname",
4659
+ label: {
4660
+ defaultMessage: "Applicant's last name",
4661
+ description: "Label for surname",
4662
+ id: "v2.event.tennis-club-membership.summary.field.surname.label"
4663
+ }
4664
+ },
4665
+ {
4666
+ fieldId: "applicant.email"
4667
+ }
4668
+ ]
4669
+ },
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
+ },
4680
+ {
4681
+ type: ActionType.DECLARE,
4682
+ label: {
4683
+ defaultMessage: "Send an application",
4684
+ description: "This is shown as the action name anywhere the user can trigger the action from",
4685
+ id: "event.tennis-club-membership.action.declare.label"
4686
+ },
4687
+ review: TENNIS_CLUB_DECLARATION_REVIEW
4688
+ },
4689
+ {
4690
+ type: ActionType.VALIDATE,
4691
+ label: {
4692
+ defaultMessage: "Validate",
4693
+ description: "This is shown as the action name anywhere the user can trigger the action from",
4694
+ id: "event.tennis-club-membership.action.validate.label"
4695
+ },
4696
+ review: TENNIS_CLUB_DECLARATION_REVIEW
4697
+ },
4698
+ {
4699
+ type: ActionType.REGISTER,
4700
+ label: {
4701
+ defaultMessage: "Register",
4702
+ description: "This is shown as the action name anywhere the user can trigger the action from",
4703
+ id: "event.tennis-club-membership.action.register.label"
4704
+ },
4705
+ review: TENNIS_CLUB_DECLARATION_REVIEW
4706
+ },
4707
+ {
4708
+ type: ActionType.REQUEST_CORRECTION,
4709
+ label: {
4710
+ defaultMessage: "Request correction",
4711
+ description: "This is shown as the action name anywhere the user can trigger the action from",
4712
+ id: "event.tennis-club-membership.action.correction.request.label"
4713
+ },
4714
+ onboardingForm: [
4715
+ {
4716
+ id: "correction-requester",
4717
+ type: PageTypes.enum.FORM,
4718
+ title: {
4719
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
4720
+ defaultMessage: "Correction requester",
4721
+ description: "This is the title of the section"
4722
+ },
4723
+ fields: [
4724
+ {
4725
+ id: "correction.requester.relationshop.intro",
4726
+ type: "PAGE_HEADER",
4727
+ label: {
4728
+ id: "correction.requester.relationshop.intro.label",
4729
+ 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.",
4730
+ description: "The title for the corrector form"
4731
+ }
4732
+ },
4733
+ {
4734
+ id: "correction.requester.relationship",
4735
+ type: "RADIO_GROUP",
4736
+ label: {
4737
+ id: "v2.correction.corrector.title",
4738
+ defaultMessage: "Who is requesting a change to this record?",
4739
+ description: "The title for the corrector form"
4740
+ },
4741
+ defaultValue: "",
4742
+ options: [
4743
+ {
4744
+ value: "INFORMANT",
4745
+ label: {
4746
+ id: "v2.correction.corrector.informant",
4747
+ defaultMessage: "Informant",
4748
+ description: "Label for informant option in certificate correction form"
4749
+ }
4750
+ },
4751
+ {
4752
+ value: "ANOTHER_AGENT",
4753
+ label: {
4754
+ id: "v2.correction.corrector.anotherAgent",
4755
+ defaultMessage: "Another registration agent or field agent",
4756
+ description: "Label for another registration or field agent option in certificate correction form"
4757
+ }
4758
+ },
4759
+ {
4760
+ value: "REGISTRAR",
4761
+ label: {
4762
+ id: "v2.correction.corrector.me",
4763
+ defaultMessage: "Me (Registrar)",
4764
+ description: "Label for registrar option in certificate correction form"
4765
+ }
4766
+ },
4767
+ {
4768
+ value: "OTHER",
4769
+ label: {
4770
+ id: "v2.correction.corrector.others",
4771
+ defaultMessage: "Someone else",
4772
+ description: "Label for someone else option in certificate correction form"
4773
+ }
4774
+ }
4775
+ ]
4776
+ }
4777
+ ]
3809
4778
  },
3810
4779
  {
3811
- id: "applicant.dob",
3812
- type: FieldType.DATE,
3813
- required: true,
3814
- validation: [
4780
+ id: "identity-check",
4781
+ type: PageTypes.enum.FORM,
4782
+ title: {
4783
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
4784
+ defaultMessage: "Verify their identity",
4785
+ description: "This is the title of the section"
4786
+ },
4787
+ fields: [
3815
4788
  {
3816
- message: {
3817
- defaultMessage: "Please enter a valid date",
3818
- description: "This is the error message for invalid date",
3819
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.error"
3820
- },
3821
- validator: field("applicant.dob").isBefore().now()
3822
- }
3823
- ],
3824
- conditionals: [
4789
+ id: "correction.identity-check.instructions",
4790
+ type: "PAGE_HEADER",
4791
+ label: {
4792
+ id: "correction.corrector.identity.instruction",
4793
+ defaultMessage: "Please verify the identity of the person making this request",
4794
+ description: "The title for the corrector form"
4795
+ }
4796
+ },
3825
4797
  {
3826
- type: ConditionalType.SHOW,
3827
- conditional: field("applicant.dobUnknown").isFalsy()
4798
+ id: "correction.identity-check.verified",
4799
+ type: "RADIO_GROUP",
4800
+ label: {
4801
+ id: "correction.corrector.identity.verified.label",
4802
+ defaultMessage: "Identity verified",
4803
+ description: "The title for the corrector form"
4804
+ },
4805
+ defaultValue: "",
4806
+ required: true,
4807
+ options: [
4808
+ {
4809
+ value: "VERIFIED",
4810
+ label: {
4811
+ id: "correction.corrector.identity.verified",
4812
+ defaultMessage: "I have verified their identity",
4813
+ description: "Label for verified option in corrector identity check page"
4814
+ }
4815
+ }
4816
+ ]
3828
4817
  }
3829
- ],
3830
- label: {
3831
- defaultMessage: "Applicant's date of birth",
3832
- description: "This is the label for the field",
3833
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dob.label"
3834
- }
3835
- },
4818
+ ]
4819
+ }
4820
+ ],
4821
+ additionalDetailsForm: [
3836
4822
  {
3837
- id: "applicant.dobUnknown",
3838
- type: FieldType.CHECKBOX,
3839
- required: false,
3840
- label: {
3841
- defaultMessage: "Exact date of birth unknown",
3842
- description: "This is the label for the field",
3843
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.dobUnknown.label"
4823
+ id: "correction-request.supporting-documents",
4824
+ type: PageTypes.enum.FORM,
4825
+ title: {
4826
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
4827
+ defaultMessage: "Upload supporting documents",
4828
+ description: "This is the title of the section"
3844
4829
  },
3845
- conditionals: [
4830
+ fields: [
3846
4831
  {
3847
- type: ConditionalType.DISPLAY_ON_REVIEW,
3848
- conditional: never()
4832
+ id: "correction.supportingDocs.introduction",
4833
+ type: "PAGE_HEADER",
4834
+ label: {
4835
+ id: "correction.corrector.paragraph.title",
4836
+ 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.",
4837
+ description: "The title for the corrector form"
4838
+ }
4839
+ },
4840
+ {
4841
+ id: "correction.supportingDocs",
4842
+ type: FieldType.FILE,
4843
+ label: {
4844
+ id: "correction.corrector.title",
4845
+ defaultMessage: "Upload supporting documents",
4846
+ description: "The title for the corrector form"
4847
+ }
4848
+ },
4849
+ {
4850
+ id: "correction.request.supportingDocuments",
4851
+ type: "RADIO_GROUP",
4852
+ label: {
4853
+ id: "correction.corrector.title",
4854
+ defaultMessage: "Who is requesting a change to this record?",
4855
+ description: "The title for the corrector form"
4856
+ },
4857
+ defaultValue: "",
4858
+ configuration: {
4859
+ styles: {
4860
+ size: "NORMAL"
4861
+ }
4862
+ },
4863
+ options: [
4864
+ {
4865
+ value: "ATTEST",
4866
+ label: {
4867
+ id: "correction.supportingDocuments.attest.label",
4868
+ defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
4869
+ description: ""
4870
+ }
4871
+ },
4872
+ {
4873
+ value: "NOT_NEEDED",
4874
+ label: {
4875
+ id: "correction.supportingDocuments.notNeeded.label",
4876
+ defaultMessage: "No supporting documents required",
4877
+ description: ""
4878
+ }
4879
+ }
4880
+ ]
3849
4881
  }
3850
4882
  ]
3851
4883
  },
3852
4884
  {
3853
- id: "applicant.age",
3854
- type: FieldType.NUMBER,
3855
- required: true,
3856
- label: {
3857
- defaultMessage: "Age of tennis-member",
3858
- description: "This is the label for the field",
3859
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.age.label"
4885
+ id: "correction-request.additional-details",
4886
+ type: PageTypes.enum.FORM,
4887
+ title: {
4888
+ id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
4889
+ defaultMessage: "Reason for correction",
4890
+ description: "This is the title of the section"
3860
4891
  },
3861
- conditionals: [
4892
+ fields: [
3862
4893
  {
3863
- type: ConditionalType.SHOW,
3864
- conditional: field("applicant.dobUnknown").isEqualTo(true)
4894
+ id: "correction.request.reason",
4895
+ type: FieldType.TEXT,
4896
+ label: {
4897
+ id: "correction.reason.title",
4898
+ defaultMessage: "Reason for correction?",
4899
+ description: "The title for the corrector form"
4900
+ }
3865
4901
  }
3866
4902
  ]
3867
- },
3868
- {
3869
- id: "applicant.image",
3870
- type: FieldType.FILE,
3871
- required: false,
3872
- label: {
3873
- defaultMessage: "Applicant's profile picture",
3874
- description: "This is the label for the field",
3875
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.image.label"
3876
- }
3877
- },
4903
+ }
4904
+ ]
4905
+ },
4906
+ {
4907
+ type: ActionType.APPROVE_CORRECTION,
4908
+ label: {
4909
+ defaultMessage: "Approve correction",
4910
+ description: "This is shown as the action name anywhere the user can trigger the action from",
4911
+ id: "event.tennis-club-membership.action.correction.approve.label"
4912
+ }
4913
+ },
4914
+ {
4915
+ type: ActionType.PRINT_CERTIFICATE,
4916
+ label: {
4917
+ id: "v2.event.tennis-club-membership.action.collect-certificate.label",
4918
+ defaultMessage: "Print certificate",
4919
+ description: "This is shown as the action name anywhere the user can trigger the action from"
4920
+ },
4921
+ printForm: PRINT_CERTIFICATE_FORM,
4922
+ conditionals: [
3878
4923
  {
3879
- id: "applicant.address",
3880
- type: "ADDRESS",
3881
- required: true,
3882
- conditionals: [],
3883
- label: {
3884
- defaultMessage: "Applicant's address",
3885
- description: "This is the label for the field",
3886
- id: "v2.event.tennis-club-membership.action.declare.form.section.who.field.address.label"
3887
- }
4924
+ type: "SHOW",
4925
+ conditional: defineConditional({
4926
+ type: "object",
4927
+ properties: {
4928
+ $event: {
4929
+ type: "object",
4930
+ properties: {
4931
+ actions: {
4932
+ type: "array",
4933
+ contains: {
4934
+ type: "object",
4935
+ properties: {
4936
+ type: {
4937
+ const: "REGISTER"
4938
+ },
4939
+ draft: {
4940
+ type: "boolean"
4941
+ }
4942
+ },
4943
+ required: ["type"],
4944
+ not: {
4945
+ properties: {
4946
+ draft: {
4947
+ const: true
4948
+ }
4949
+ }
4950
+ }
4951
+ }
4952
+ }
4953
+ },
4954
+ required: ["actions"]
4955
+ }
4956
+ },
4957
+ required: ["$event"]
4958
+ })
3888
4959
  }
3889
4960
  ]
3890
4961
  },
3891
4962
  {
3892
- id: "senior-pass",
3893
- conditional: field("applicant.dob").isBefore().date("1950-01-01"),
4963
+ type: ActionType.ARCHIVE,
4964
+ label: {
4965
+ id: "v2.event.tennis-club-membership.action.archive.label",
4966
+ defaultMessage: "Archive",
4967
+ description: "This is shown as the action name anywhere the user can trigger the action from"
4968
+ }
4969
+ },
4970
+ {
4971
+ type: ActionType.REJECT,
4972
+ label: {
4973
+ id: "v2.event.tennis-club-membership.action.reject.label",
4974
+ defaultMessage: "Reject",
4975
+ description: "This is shown as the action name anywhere the user can trigger the action from"
4976
+ }
4977
+ }
4978
+ ],
4979
+ advancedSearch: [
4980
+ {
3894
4981
  title: {
3895
- id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
3896
- defaultMessage: "Assign senior pass for applicant",
3897
- description: "This is the title of the section"
4982
+ defaultMessage: "Registration details",
4983
+ description: "The title of Registration details accordion",
4984
+ id: "v2.advancedSearch.form.registrationDetails"
3898
4985
  },
3899
4986
  fields: [
3900
- {
3901
- id: "senior-pass.id",
3902
- type: FieldType.TEXT,
3903
- required: true,
3904
- label: {
3905
- defaultMessage: "Senior pass ID",
3906
- description: "This is the label for the field",
3907
- id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
3908
- }
3909
- }
4987
+ event("legalStatus.REGISTERED.createdAtLocation").exact(),
4988
+ event("legalStatus.REGISTERED.createdAt").range(),
4989
+ event("status", statusOptions).exact(),
4990
+ event("updatedAt", timePeriodOptions).range()
3910
4991
  ]
3911
4992
  },
3912
4993
  {
3913
- id: "recommender",
3914
4994
  title: {
3915
- id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
3916
- defaultMessage: "Who is recommending the applicant?",
3917
- description: "This is the title of the section"
4995
+ defaultMessage: "Applicant's details",
4996
+ description: "Applicant details search field section title",
4997
+ id: "v2.event.tennis-club-membership.search.applicants"
3918
4998
  },
3919
4999
  fields: [
3920
- {
3921
- id: "recommender.none",
3922
- type: "CHECKBOX",
3923
- required: false,
3924
- conditionals: [],
3925
- label: {
3926
- defaultMessage: "No recommender",
3927
- description: "This is the label for the field",
3928
- id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
3929
- }
3930
- },
3931
- {
3932
- id: "recommender.firstname",
3933
- type: FieldType.TEXT,
3934
- required: true,
3935
- conditionals: [
3936
- {
3937
- type: ConditionalType.SHOW,
3938
- conditional: field("recommender.none").isFalsy()
3939
- }
3940
- ],
3941
- label: {
3942
- defaultMessage: "Recommender's first name",
3943
- description: "This is the label for the field",
3944
- id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
3945
- }
3946
- },
3947
- {
3948
- id: "recommender.surname",
3949
- type: FieldType.TEXT,
3950
- required: true,
3951
- conditionals: [
3952
- {
3953
- type: ConditionalType.SHOW,
3954
- conditional: field("recommender.none").isFalsy()
3955
- }
3956
- ],
3957
- label: {
3958
- defaultMessage: "Recommender's surname",
3959
- description: "This is the label for the field",
3960
- id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
3961
- }
3962
- },
3963
- {
3964
- id: "recommender.id",
3965
- type: FieldType.TEXT,
3966
- required: true,
3967
- conditionals: [
3968
- {
3969
- type: ConditionalType.SHOW,
3970
- conditional: field("recommender.none").isFalsy()
3971
- }
3972
- ],
3973
- label: {
3974
- defaultMessage: "Recommender's membership ID",
3975
- description: "This is the label for the field",
3976
- id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
3977
- }
3978
- }
5000
+ field("applicant.firstname").fuzzy(),
5001
+ field("applicant.surname").fuzzy(),
5002
+ field("applicant.dob").range(),
5003
+ field("applicant.email").exact()
5004
+ ]
5005
+ },
5006
+ {
5007
+ title: {
5008
+ defaultMessage: "Recommender's details",
5009
+ description: "Recommender details search field section title",
5010
+ id: "v2.event.tennis-club-membership.search.recommender"
5011
+ },
5012
+ fields: [
5013
+ field("recommender.firstname").fuzzy(),
5014
+ field("recommender.surname").fuzzy()
3979
5015
  ]
3980
5016
  }
3981
- ]
5017
+ ],
5018
+ declaration: TENNIS_CLUB_DECLARATION_FORM
3982
5019
  });
3983
- var tennisClubMembershipEvent = defineConfig({
3984
- id: "TENNIS_CLUB_MEMBERSHIP",
5020
+
5021
+ // ../commons/src/fixtures/football-club-membership-event.ts
5022
+ var footballClubMembershipEvent = defineConfig({
5023
+ id: "FOOTBALL_CLUB_MEMBERSHIP",
3985
5024
  label: {
3986
- defaultMessage: "Tennis club membership application",
5025
+ defaultMessage: "Football club membership application",
3987
5026
  description: "This is what this event is referred as in the system",
3988
- id: "event.tennis-club-membership.label"
5027
+ id: "event.football-club-membership.label"
3989
5028
  },
3990
5029
  title: {
3991
5030
  defaultMessage: "{applicant.firstname} {applicant.surname}",
3992
5031
  description: "This is the title of the summary",
3993
- id: "v2.event.tennis-club-membership.title"
5032
+ id: "v2.event.football-club-membership.title"
3994
5033
  },
3995
5034
  summary: {
3996
5035
  fields: [
@@ -3999,17 +5038,17 @@ var tennisClubMembershipEvent = defineConfig({
3999
5038
  label: {
4000
5039
  defaultMessage: "Applicant's first name",
4001
5040
  description: "This is the label for the field",
4002
- id: "event.tennis-club-membership.summary.field.firstname.label"
5041
+ id: "event.football-club-membership.summary.field.firstname.label"
4003
5042
  },
4004
5043
  value: {
4005
5044
  defaultMessage: "{applicant.firstname}",
4006
5045
  description: "This is the value to show in the summary",
4007
- id: "event.tennis-club-membership.summary.field.firstname"
5046
+ id: "event.football-club-membership.summary.field.firstname"
4008
5047
  },
4009
5048
  emptyValueMessage: {
4010
5049
  defaultMessage: "First name is not provided",
4011
5050
  description: "This is the message to show when the field is empty",
4012
- id: "event.tennis-club-membership.summary.field.firstname.empty"
5051
+ id: "event.football-club-membership.summary.field.firstname.empty"
4013
5052
  }
4014
5053
  },
4015
5054
  {
@@ -4017,7 +5056,7 @@ var tennisClubMembershipEvent = defineConfig({
4017
5056
  label: {
4018
5057
  defaultMessage: "Applicant's last name",
4019
5058
  description: "Label for surname",
4020
- id: "v2.event.tennis-club-membership.summary.field.surname.label"
5059
+ id: "v2.event.football-club-membership.summary.field.surname.label"
4021
5060
  }
4022
5061
  },
4023
5062
  {
@@ -4026,12 +5065,21 @@ var tennisClubMembershipEvent = defineConfig({
4026
5065
  ]
4027
5066
  },
4028
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
+ },
4029
5077
  {
4030
5078
  type: ActionType.DECLARE,
4031
5079
  label: {
4032
5080
  defaultMessage: "Send an application",
4033
5081
  description: "This is shown as the action name anywhere the user can trigger the action from",
4034
- id: "event.tennis-club-membership.action.declare.label"
5082
+ id: "event.football-club-membership.action.declare.label"
4035
5083
  },
4036
5084
  review: TENNIS_CLUB_DECLARATION_REVIEW
4037
5085
  },
@@ -4040,7 +5088,7 @@ var tennisClubMembershipEvent = defineConfig({
4040
5088
  label: {
4041
5089
  defaultMessage: "Validate",
4042
5090
  description: "This is shown as the action name anywhere the user can trigger the action from",
4043
- id: "event.tennis-club-membership.action.validate.label"
5091
+ id: "event.football-club-membership.action.validate.label"
4044
5092
  },
4045
5093
  review: TENNIS_CLUB_DECLARATION_REVIEW
4046
5094
  },
@@ -4049,7 +5097,7 @@ var tennisClubMembershipEvent = defineConfig({
4049
5097
  label: {
4050
5098
  defaultMessage: "Register",
4051
5099
  description: "This is shown as the action name anywhere the user can trigger the action from",
4052
- id: "event.tennis-club-membership.action.register.label"
5100
+ id: "event.football-club-membership.action.register.label"
4053
5101
  },
4054
5102
  review: TENNIS_CLUB_DECLARATION_REVIEW
4055
5103
  },
@@ -4058,14 +5106,14 @@ var tennisClubMembershipEvent = defineConfig({
4058
5106
  label: {
4059
5107
  defaultMessage: "Request correction",
4060
5108
  description: "This is shown as the action name anywhere the user can trigger the action from",
4061
- id: "event.tennis-club-membership.action.correction.request.label"
5109
+ id: "event.football-club-membership.action.correction.request.label"
4062
5110
  },
4063
5111
  onboardingForm: [
4064
5112
  {
4065
5113
  id: "correction-requester",
4066
5114
  type: PageTypes.enum.FORM,
4067
5115
  title: {
4068
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5116
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
4069
5117
  defaultMessage: "Correction requester",
4070
5118
  description: "This is the title of the section"
4071
5119
  },
@@ -4129,7 +5177,7 @@ var tennisClubMembershipEvent = defineConfig({
4129
5177
  id: "identity-check",
4130
5178
  type: PageTypes.enum.FORM,
4131
5179
  title: {
4132
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5180
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
4133
5181
  defaultMessage: "Verify their identity",
4134
5182
  description: "This is the title of the section"
4135
5183
  },
@@ -4172,7 +5220,7 @@ var tennisClubMembershipEvent = defineConfig({
4172
5220
  id: "correction-request.supporting-documents",
4173
5221
  type: PageTypes.enum.FORM,
4174
5222
  title: {
4175
- id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
5223
+ id: "event.football-club-membership.action.requestCorrection.form.section.verify",
4176
5224
  defaultMessage: "Upload supporting documents",
4177
5225
  description: "This is the title of the section"
4178
5226
  },
@@ -4234,7 +5282,7 @@ var tennisClubMembershipEvent = defineConfig({
4234
5282
  id: "correction-request.additional-details",
4235
5283
  type: PageTypes.enum.FORM,
4236
5284
  title: {
4237
- id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
5285
+ id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
4238
5286
  defaultMessage: "Reason for correction",
4239
5287
  description: "This is the title of the section"
4240
5288
  },
@@ -4257,13 +5305,13 @@ var tennisClubMembershipEvent = defineConfig({
4257
5305
  label: {
4258
5306
  defaultMessage: "Approve correction",
4259
5307
  description: "This is shown as the action name anywhere the user can trigger the action from",
4260
- id: "event.tennis-club-membership.action.correction.approve.label"
5308
+ id: "event.football-club-membership.action.correction.approve.label"
4261
5309
  }
4262
5310
  },
4263
5311
  {
4264
5312
  type: ActionType.PRINT_CERTIFICATE,
4265
5313
  label: {
4266
- id: "v2.event.tennis-club-membership.action.collect-certificate.label",
5314
+ id: "v2.event.football-club-membership.action.collect-certificate.label",
4267
5315
  defaultMessage: "Print certificate",
4268
5316
  description: "This is shown as the action name anywhere the user can trigger the action from"
4269
5317
  },
@@ -4311,7 +5359,7 @@ var tennisClubMembershipEvent = defineConfig({
4311
5359
  {
4312
5360
  type: ActionType.ARCHIVE,
4313
5361
  label: {
4314
- id: "v2.event.tennis-club-membership.action.archive.label",
5362
+ id: "v2.event.football-club-membership.action.archive.label",
4315
5363
  defaultMessage: "Archive",
4316
5364
  description: "This is shown as the action name anywhere the user can trigger the action from"
4317
5365
  }
@@ -4319,7 +5367,7 @@ var tennisClubMembershipEvent = defineConfig({
4319
5367
  {
4320
5368
  type: ActionType.REJECT,
4321
5369
  label: {
4322
- id: "v2.event.tennis-club-membership.action.reject.label",
5370
+ id: "v2.event.football-club-membership.action.reject.label",
4323
5371
  defaultMessage: "Reject",
4324
5372
  description: "This is shown as the action name anywhere the user can trigger the action from"
4325
5373
  }
@@ -4328,16 +5376,104 @@ var tennisClubMembershipEvent = defineConfig({
4328
5376
  advancedSearch: [
4329
5377
  {
4330
5378
  title: {
4331
- defaultMessage: "Tennis club registration search",
4332
- description: "This is what this event is referred as in the system",
4333
- id: "v2.event.tennis-club-membership.search"
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"
4334
5408
  },
4335
- fields: [field("applicant.dob").exact()]
5409
+ fields: [
5410
+ field("recommender.firstname").fuzzy(),
5411
+ field("recommender.surname").fuzzy()
5412
+ ]
4336
5413
  }
4337
5414
  ],
4338
5415
  declaration: TENNIS_CLUB_DECLARATION_FORM
4339
5416
  });
4340
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
+
4341
5477
  // ../commons/src/events/test.utils.ts
4342
5478
  function fieldConfigsToActionPayload(fields) {
4343
5479
  return fields.reduce(
@@ -4385,11 +5521,11 @@ function generateActionAnnotationInput(configuration, action) {
4385
5521
  var eventPayloadGenerator = {
4386
5522
  create: (input = {}) => ({
4387
5523
  transactionId: input.transactionId ?? getUUID(),
4388
- type: input.type ?? "TENNIS_CLUB_MEMBERSHIP"
5524
+ type: input.type ?? TENNIS_CLUB_MEMBERSHIP
4389
5525
  }),
4390
5526
  patch: (id, input = {}) => ({
4391
5527
  transactionId: input.transactionId ?? getUUID(),
4392
- type: input.type ?? "TENNIS_CLUB_MEMBERSHIP",
5528
+ type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
4393
5529
  id
4394
5530
  }),
4395
5531
  draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
@@ -4415,7 +5551,7 @@ var eventPayloadGenerator = {
4415
5551
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
4416
5552
  createdBy: "@todo",
4417
5553
  createdByRole: "@todo",
4418
- createdAtLocation: "@todo"
5554
+ createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
4419
5555
  }
4420
5556
  },
4421
5557
  input
@@ -4489,9 +5625,13 @@ var eventPayloadGenerator = {
4489
5625
  transactionId: input.transactionId ?? getUUID(),
4490
5626
  declaration: {},
4491
5627
  // @TODO: Check whether generator is needed?
4492
- annotation: { isDuplicate: isDuplicate ?? false },
5628
+ annotation: {},
4493
5629
  duplicates: [],
4494
- eventId
5630
+ eventId,
5631
+ reason: {
5632
+ message: `${ActionType.ARCHIVE}`,
5633
+ isDuplicate: isDuplicate ?? false
5634
+ }
4495
5635
  }),
4496
5636
  reject: (eventId, input = {}) => ({
4497
5637
  type: ActionType.REJECT,
@@ -4502,7 +5642,8 @@ var eventPayloadGenerator = {
4502
5642
  ActionType.REJECT
4503
5643
  ),
4504
5644
  duplicates: [],
4505
- eventId
5645
+ eventId,
5646
+ reason: { message: `${ActionType.REJECT}` }
4506
5647
  }),
4507
5648
  register: (eventId, input = {}) => ({
4508
5649
  type: ActionType.REGISTER,
@@ -4599,9 +5740,9 @@ function generateActionDocument({
4599
5740
  case ActionType.VALIDATE:
4600
5741
  return { ...actionBase, type: action };
4601
5742
  case ActionType.ARCHIVE:
4602
- return { ...actionBase, type: action };
5743
+ return { ...actionBase, type: action, reason: { message: "Archive" } };
4603
5744
  case ActionType.REJECT:
4604
- return { ...actionBase, type: action };
5745
+ return { ...actionBase, type: action, reason: { message: "Reject" } };
4605
5746
  case ActionType.CREATE:
4606
5747
  return { ...actionBase, type: action };
4607
5748
  case ActionType.NOTIFY:
@@ -4613,7 +5754,11 @@ function generateActionDocument({
4613
5754
  case ActionType.APPROVE_CORRECTION:
4614
5755
  return { ...actionBase, requestId: getUUID(), type: action };
4615
5756
  case ActionType.REJECT_CORRECTION:
4616
- return { ...actionBase, requestId: getUUID(), type: action };
5757
+ return {
5758
+ ...actionBase,
5759
+ requestId: getUUID(),
5760
+ type: action
5761
+ };
4617
5762
  case ActionType.REGISTER:
4618
5763
  return {
4619
5764
  ...actionBase,
@@ -4641,8 +5786,7 @@ function generateEventDocument({
4641
5786
  id: getUUID(),
4642
5787
  // Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
4643
5788
  // @TODO: This should be fixed in the future.
4644
- updatedAt: new Date(Date.now() - 1e3).toISOString(),
4645
- dateOfEvent: configuration.dateOfEvent
5789
+ updatedAt: new Date(Date.now() - 1e3).toISOString()
4646
5790
  };
4647
5791
  }
4648
5792
  function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
@@ -4664,21 +5808,16 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
4664
5808
  eventId
4665
5809
  };
4666
5810
  }
4667
- function getEventStatus() {
4668
- const statuses = [
4669
- EventStatus.CREATED,
4670
- EventStatus.REGISTERED,
4671
- EventStatus.DECLARED
4672
- ];
4673
- const randomIndex = Math.floor(Math.random() * 3);
4674
- return statuses[randomIndex];
5811
+ function pickRandom(rng, items) {
5812
+ return items[Math.floor(rng() * items.length)];
4675
5813
  }
4676
- function getTrackingId() {
4677
- const uuid = getUUID().replace(/-/g, "");
4678
- const trackingId = uuid.slice(0, 6).toUpperCase();
4679
- return trackingId;
5814
+ function getRandomDatetime(rng, start, end) {
5815
+ const range = end.getTime() - start.getTime();
5816
+ const offset = Math.floor(rng() * range);
5817
+ const randomDate = new Date(start.getTime() + offset);
5818
+ return randomDate.toISOString();
4680
5819
  }
4681
- function getRandomApplicant() {
5820
+ function generateRandomApplicant(rng) {
4682
5821
  const firstNames = [
4683
5822
  "Danny",
4684
5823
  "John",
@@ -4699,18 +5838,13 @@ function getRandomApplicant() {
4699
5838
  "Garcia",
4700
5839
  "Miller"
4701
5840
  ];
4702
- function getRandomDate(start, end) {
4703
- const randomDate = new Date(
4704
- start.getTime() + Math.random() * (end.getTime() - start.getTime())
4705
- );
4706
- return randomDate.toISOString().split("T")[0];
4707
- }
4708
- const randomFirstName = firstNames[Math.floor(Math.random() * firstNames.length)];
4709
- const randomSurname = surnames[Math.floor(Math.random() * surnames.length)];
4710
- const randomDob = getRandomDate(
5841
+ const randomFirstName = pickRandom(rng, firstNames);
5842
+ const randomSurname = pickRandom(rng, surnames);
5843
+ const randomDob = getRandomDatetime(
5844
+ rng,
4711
5845
  /* @__PURE__ */ new Date("1990-01-01"),
4712
5846
  /* @__PURE__ */ new Date("2010-12-31")
4713
- );
5847
+ ).split("T")[0];
4714
5848
  return {
4715
5849
  "recommender.none": true,
4716
5850
  "applicant.firstname": randomFirstName,
@@ -4718,28 +5852,84 @@ function getRandomApplicant() {
4718
5852
  "applicant.dob": randomDob
4719
5853
  };
4720
5854
  }
4721
- var eventQueryDataGenerator = (overrides = {}) => ({
4722
- id: overrides.id ?? getUUID(),
4723
- type: overrides.type ?? "TENNIS_CLUB_MEMBERSHIP",
4724
- status: overrides.status ?? getEventStatus(),
4725
- createdAt: overrides.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
4726
- createdBy: overrides.createdBy ?? getUUID(),
4727
- createdAtLocation: overrides.createdAtLocation ?? getUUID(),
4728
- updatedAtLocation: overrides.updatedAtLocation ?? getUUID(),
4729
- updatedAt: overrides.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
4730
- assignedTo: overrides.assignedTo ?? null,
4731
- updatedBy: overrides.updatedBy ?? getUUID(),
4732
- updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
4733
- flags: [],
4734
- legalStatuses: overrides.legalStatuses ?? {},
4735
- declaration: overrides.declaration ?? getRandomApplicant(),
4736
- trackingId: overrides.trackingId ?? getTrackingId()
4737
- });
5855
+ function createPseudoRandomNumberGenerator(seed) {
5856
+ const MODULUS = 2 ** 32;
5857
+ const MULTIPLIER = 1664525;
5858
+ const INCREMENT = 1013904223;
5859
+ let state = seed >>> 0;
5860
+ return () => {
5861
+ state = (MULTIPLIER * state + INCREMENT) % MODULUS;
5862
+ return state / MODULUS;
5863
+ };
5864
+ }
5865
+ function generateUuid(rng) {
5866
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
5867
+ const r = Math.floor(rng() * 16);
5868
+ const v = c === "x" ? r : r & 3 | 8;
5869
+ return v.toString(16);
5870
+ });
5871
+ }
5872
+ function generateTrackingId(rng) {
5873
+ const uuid = generateUuid(rng).replace(/-/g, "");
5874
+ const trackingId = uuid.slice(0, 6).toUpperCase();
5875
+ return trackingId;
5876
+ }
5877
+ function generateRandomSignature(rng) {
5878
+ return `/random-bucket/${generateUuid(rng)}.png`;
5879
+ }
5880
+ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
5881
+ const rng = createPseudoRandomNumberGenerator(seed);
5882
+ const createdAt = getRandomDatetime(
5883
+ rng,
5884
+ /* @__PURE__ */ new Date("2024-01-01"),
5885
+ /* @__PURE__ */ new Date("2024-12-31")
5886
+ );
5887
+ return {
5888
+ id: overrides.id ?? generateUuid(rng),
5889
+ type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
5890
+ status: overrides.status ?? pickRandom(rng, eventStatuses),
5891
+ createdAt: overrides.createdAt ?? createdAt,
5892
+ createdBy: overrides.createdBy ?? generateUuid(rng),
5893
+ createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
5894
+ updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
5895
+ createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
5896
+ updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
5897
+ assignedTo: overrides.assignedTo ?? null,
5898
+ updatedBy: overrides.updatedBy ?? generateUuid(rng),
5899
+ updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
5900
+ flags: [],
5901
+ legalStatuses: overrides.legalStatuses ?? {},
5902
+ declaration: overrides.declaration ?? generateRandomApplicant(rng),
5903
+ trackingId: overrides.trackingId ?? generateTrackingId(rng)
5904
+ };
5905
+ };
4738
5906
  var generateTranslationConfig = (message) => ({
4739
5907
  defaultMessage: message,
4740
5908
  description: "Description for ${message}",
4741
5909
  id: message
4742
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
+ ]);
4743
5933
 
4744
5934
  // ../commons/src/events/TemplateConfig.ts
4745
5935
  function isTemplateVariable(value) {
@@ -4777,7 +5967,7 @@ function isFieldConfigDefaultValue(value) {
4777
5967
  var import_lodash3 = require("lodash");
4778
5968
 
4779
5969
  // ../commons/src/scopes.ts
4780
- var import_zod25 = require("zod");
5970
+ var import_zod31 = require("zod");
4781
5971
  var SCOPES = {
4782
5972
  // TODO v1.8 legacy scopes
4783
5973
  NATLSYSADMIN: "natlsysadmin",
@@ -4801,6 +5991,8 @@ var SCOPES = {
4801
5991
  */
4802
5992
  RECORD_DECLARE: "record.declare-birth",
4803
5993
  // declare
5994
+ RECORD_IMPORT: "record.import",
5995
+ // declare
4804
5996
  RECORD_DECLARE_BIRTH: "record.declare-birth",
4805
5997
  RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
4806
5998
  RECORD_DECLARE_DEATH: "record.declare-death",
@@ -4888,107 +6080,119 @@ var SCOPES = {
4888
6080
  // data seeding
4889
6081
  USER_DATA_SEEDING: "user.data-seeding"
4890
6082
  };
4891
- var LiteralScopes = import_zod25.z.union([
4892
- import_zod25.z.literal(SCOPES.NATLSYSADMIN),
4893
- import_zod25.z.literal(SCOPES.BYPASSRATELIMIT),
4894
- import_zod25.z.literal(SCOPES.DECLARE),
4895
- import_zod25.z.literal(SCOPES.REGISTER),
4896
- import_zod25.z.literal(SCOPES.VALIDATE),
4897
- import_zod25.z.literal(SCOPES.DEMO),
4898
- import_zod25.z.literal(SCOPES.CERTIFY),
4899
- import_zod25.z.literal(SCOPES.PERFORMANCE),
4900
- import_zod25.z.literal(SCOPES.SYSADMIN),
4901
- import_zod25.z.literal(SCOPES.TEAMS),
4902
- import_zod25.z.literal(SCOPES.CONFIG),
4903
- import_zod25.z.literal(SCOPES.WEBHOOK),
4904
- import_zod25.z.literal(SCOPES.NATIONALID),
4905
- import_zod25.z.literal(SCOPES.NOTIFICATION_API),
4906
- import_zod25.z.literal(SCOPES.RECORDSEARCH),
4907
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
4908
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
4909
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_DEATH),
4910
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
4911
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
4912
- import_zod25.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
4913
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
4914
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
4915
- import_zod25.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
4916
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
4917
- import_zod25.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
4918
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
4919
- import_zod25.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
4920
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
4921
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
4922
- import_zod25.z.literal(SCOPES.RECORD_REGISTER),
4923
- import_zod25.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
4924
- import_zod25.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
4925
- import_zod25.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
4926
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
4927
- import_zod25.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
4928
- import_zod25.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
4929
- import_zod25.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
4930
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
4931
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
4932
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
4933
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
4934
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
4935
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
4936
- import_zod25.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
4937
- import_zod25.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
4938
- import_zod25.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
4939
- import_zod25.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
4940
- import_zod25.z.literal(SCOPES.SEARCH_BIRTH),
4941
- import_zod25.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
4942
- import_zod25.z.literal(SCOPES.SEARCH_DEATH),
4943
- import_zod25.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
4944
- import_zod25.z.literal(SCOPES.SEARCH_MARRIAGE),
4945
- import_zod25.z.literal(SCOPES.RECORD_READ),
4946
- import_zod25.z.literal(SCOPES.RECORD_READ_AUDIT),
4947
- import_zod25.z.literal(SCOPES.RECORD_READ_COMMENTS),
4948
- import_zod25.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
4949
- import_zod25.z.literal(SCOPES.PROFILE_UPDATE),
4950
- import_zod25.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
4951
- import_zod25.z.literal(SCOPES.PERFORMANCE_READ),
4952
- import_zod25.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
4953
- import_zod25.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
4954
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
4955
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
4956
- import_zod25.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
4957
- import_zod25.z.literal(SCOPES.USER_READ),
4958
- import_zod25.z.literal(SCOPES.USER_READ_MY_OFFICE),
4959
- import_zod25.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
4960
- import_zod25.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
4961
- import_zod25.z.literal(SCOPES.USER_CREATE),
4962
- import_zod25.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
4963
- import_zod25.z.literal(SCOPES.USER_UPDATE),
4964
- import_zod25.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
4965
- import_zod25.z.literal(SCOPES.CONFIG_UPDATE_ALL),
4966
- 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)
4967
6160
  ]);
4968
- var rawConfigurableScopeRegex = /^([a-zA-Z]+\.[a-zA-Z]+)\[((?:\w+=\w+(?:\|\w+)*)(:?,\w+=\w+(?:\|\w+)*)*)\]$/;
4969
- var rawConfigurableScope = import_zod25.z.string().regex(rawConfigurableScopeRegex);
4970
- var CreateUserScope = import_zod25.z.object({
4971
- type: import_zod25.z.literal("user.create"),
4972
- options: import_zod25.z.object({
4973
- role: import_zod25.z.array(import_zod25.z.string())
6161
+ var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
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())
4974
6167
  })
4975
6168
  });
4976
- var EditUserScope = import_zod25.z.object({
4977
- type: import_zod25.z.literal("user.edit"),
4978
- options: import_zod25.z.object({
4979
- 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())
4980
6173
  })
4981
6174
  });
4982
- var ConfigurableScopes = import_zod25.z.discriminatedUnion("type", [
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())
6179
+ })
6180
+ });
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())
6185
+ })
6186
+ });
6187
+ var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
4983
6188
  CreateUserScope,
4984
- EditUserScope
6189
+ EditUserScope,
6190
+ WorkqueueScope,
6191
+ NotifyRecordScope
4985
6192
  ]);
4986
6193
  var scopes = Object.values(SCOPES);
4987
6194
 
4988
6195
  // ../commons/src/events/scopes.ts
4989
- function hasAnyOfScopes(a, b) {
4990
- return (0, import_lodash3.intersection)(a, b).length > 0;
4991
- }
4992
6196
  var CONFIG_GET_ALLOWED_SCOPES = [
4993
6197
  SCOPES.RECORD_DECLARE,
4994
6198
  SCOPES.RECORD_READ,
@@ -5046,6 +6250,28 @@ var ACTION_ALLOWED_SCOPES = {
5046
6250
  [ActionType.UNASSIGN]: null,
5047
6251
  [ActionType.DETECT_DUPLICATE]: []
5048
6252
  };
6253
+ var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
6254
+ [ActionType.READ]: [],
6255
+ [ActionType.CREATE]: ["record.notify"],
6256
+ [ActionType.NOTIFY]: ["record.notify"],
6257
+ [ActionType.DECLARE]: [],
6258
+ [ActionType.DELETE]: [],
6259
+ [ActionType.VALIDATE]: [],
6260
+ [ActionType.REGISTER]: [],
6261
+ [ActionType.PRINT_CERTIFICATE]: [],
6262
+ [ActionType.REQUEST_CORRECTION]: [],
6263
+ [ActionType.REJECT_CORRECTION]: [],
6264
+ [ActionType.APPROVE_CORRECTION]: [],
6265
+ [ActionType.MARKED_AS_DUPLICATE]: [],
6266
+ [ActionType.ARCHIVE]: [],
6267
+ [ActionType.REJECT]: [],
6268
+ [ActionType.ASSIGN]: [],
6269
+ [ActionType.UNASSIGN]: [],
6270
+ [ActionType.DETECT_DUPLICATE]: []
6271
+ };
6272
+ function hasAnyOfScopes(a, b) {
6273
+ return (0, import_lodash3.intersection)(a, b).length > 0;
6274
+ }
5049
6275
  function filterUnallowedActions(actions, userScopes) {
5050
6276
  const allowedActions = actions.filter((action) => {
5051
6277
  const requiredScopes = ACTION_ALLOWED_SCOPES[action];
@@ -5062,3 +6288,65 @@ function filterUnallowedActions(actions, userScopes) {
5062
6288
  }
5063
6289
  return [ActionType.READ];
5064
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
+ }