@opencrvs/toolkit 1.9.6-rc.dd6e433 → 1.9.6-rc.dd9ecc6

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 (58) hide show
  1. package/dist/commons/api/router.d.ts +2466 -29533
  2. package/dist/commons/conditionals/conditionals.d.ts +1 -10
  3. package/dist/commons/conditionals/validate.d.ts +4 -11
  4. package/dist/commons/events/ActionConfig.d.ts +1552 -24973
  5. package/dist/commons/events/ActionDocument.d.ts +1856 -803
  6. package/dist/commons/events/ActionInput.d.ts +1073 -277
  7. package/dist/commons/events/ActionType.d.ts +9 -86
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -228
  9. package/dist/commons/events/CompositeFieldValue.d.ts +190 -29
  10. package/dist/commons/events/Conditional.d.ts +38 -26
  11. package/dist/commons/events/Constants.d.ts +1 -1
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +4223 -1195
  13. package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
  14. package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
  15. package/dist/commons/events/Draft.d.ts +105 -70
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2120 -19932
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1332 -320
  20. package/dist/commons/events/EventIndex.d.ts +980 -193
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +347 -106
  23. package/dist/commons/events/FieldConfig.d.ts +12296 -4517
  24. package/dist/commons/events/FieldType.d.ts +4 -20
  25. package/dist/commons/events/FieldTypeMapping.d.ts +897 -193
  26. package/dist/commons/events/FieldValue.d.ts +396 -87
  27. package/dist/commons/events/FormConfig.d.ts +721 -13980
  28. package/dist/commons/events/PageConfig.d.ts +319 -9340
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TemplateConfig.d.ts +3 -2
  31. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  32. package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
  33. package/dist/commons/events/WorkqueueConfig.d.ts +7130 -1821
  34. package/dist/commons/events/deduplication.d.ts +3 -3
  35. package/dist/commons/events/defineConfig.d.ts +162 -26578
  36. package/dist/commons/events/index.d.ts +0 -1
  37. package/dist/commons/events/locations.d.ts +19 -26
  38. package/dist/commons/events/scopes.d.ts +4 -5
  39. package/dist/commons/events/state/availableActions.d.ts +2 -0
  40. package/dist/commons/events/state/flags.d.ts +3 -21
  41. package/dist/commons/events/state/index.d.ts +19 -23
  42. package/dist/commons/events/state/utils.d.ts +112 -130
  43. package/dist/commons/events/test.utils.d.ts +8 -17
  44. package/dist/commons/events/transactions.d.ts +1 -1
  45. package/dist/commons/events/utils.d.ts +381 -53178
  46. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  47. package/dist/conditionals/index.d.ts.map +1 -1
  48. package/dist/conditionals/index.js +11 -45
  49. package/dist/events/deduplication.d.ts +3 -3
  50. package/dist/events/index.js +1700 -1972
  51. package/dist/notification/index.d.ts.map +1 -1
  52. package/dist/notification/index.js +1494 -1571
  53. package/dist/scopes/index.d.ts +132 -167
  54. package/dist/scopes/index.d.ts.map +1 -1
  55. package/dist/scopes/index.js +94 -133
  56. package/package.json +5 -5
  57. package/dist/commons/events/Flag.d.ts +0 -67
  58. package/dist/commons/events/eventConfigValidation.d.ts +0 -8
@@ -38,7 +38,6 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z41 = __toESM(require("zod/v4"));
42
41
 
43
42
  // ../commons/src/url.ts
44
43
  function joinUrl(base, path) {
@@ -48,28 +47,30 @@ function joinUrl(base, path) {
48
47
 
49
48
  // ../commons/src/events/Constants.ts
50
49
  var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
51
- var CHILD_ONBOARDING_EVENT = "child-onboarding";
50
+ var BIRTH_EVENT = "birth";
52
51
 
53
52
  // ../commons/src/events/ActionConfig.ts
54
- var z22 = __toESM(require("zod/v4"));
53
+ var import_zod20 = require("zod");
55
54
 
56
55
  // ../commons/src/events/TranslationConfig.ts
57
- var z = __toESM(require("zod/v4"));
58
- var TranslationConfig = z.object({
59
- id: z.string().describe(
56
+ var import_zod = require("zod");
57
+ var import_zod_openapi = require("zod-openapi");
58
+ (0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
59
+ var TranslationConfig = import_zod.z.object({
60
+ id: import_zod.z.string().describe(
60
61
  "The identifier of the translation referred in translation CSV files"
61
62
  ),
62
- defaultMessage: z.string().describe("Default translation message"),
63
- description: z.string().describe(
63
+ defaultMessage: import_zod.z.string().describe("Default translation message"),
64
+ description: import_zod.z.string().describe(
64
65
  "Describe the translation for a translator to be able to identify it."
65
66
  )
66
- }).meta({
67
+ }).openapi({
67
68
  description: "Translation configuration",
68
- id: "TranslationConfig"
69
+ ref: "TranslationConfig"
69
70
  });
70
71
 
71
72
  // ../commons/src/events/ActionType.ts
72
- var z2 = __toESM(require("zod/v4"));
73
+ var import_zod2 = require("zod");
73
74
  var ActionType = {
74
75
  // Pre-declaration actions
75
76
  DELETE: "DELETE",
@@ -77,8 +78,8 @@ var ActionType = {
77
78
  NOTIFY: "NOTIFY",
78
79
  // Declaration actions
79
80
  DECLARE: "DECLARE",
81
+ VALIDATE: "VALIDATE",
80
82
  REGISTER: "REGISTER",
81
- EDIT: "EDIT",
82
83
  // Declaration system actions. Non-configurable.
83
84
  DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
84
85
  REJECT: "REJECT",
@@ -94,29 +95,26 @@ var ActionType = {
94
95
  // General actions
95
96
  READ: "READ",
96
97
  ASSIGN: "ASSIGN",
97
- UNASSIGN: "UNASSIGN",
98
- // Custom action
99
- CUSTOM: "CUSTOM"
98
+ UNASSIGN: "UNASSIGN"
100
99
  };
101
100
  var ConfirmableActions = [
102
101
  ActionType.NOTIFY,
103
102
  ActionType.DECLARE,
104
- ActionType.EDIT,
103
+ ActionType.VALIDATE,
105
104
  ActionType.REGISTER,
106
105
  ActionType.REJECT,
107
106
  ActionType.ARCHIVE,
108
107
  ActionType.PRINT_CERTIFICATE,
109
108
  ActionType.REQUEST_CORRECTION,
110
109
  ActionType.APPROVE_CORRECTION,
111
- ActionType.REJECT_CORRECTION,
112
- ActionType.CUSTOM
110
+ ActionType.REJECT_CORRECTION
113
111
  ];
114
- var ActionTypes = z2.enum([
112
+ var ActionTypes = import_zod2.z.enum([
115
113
  "DELETE",
116
114
  "CREATE",
117
115
  "NOTIFY",
118
116
  "DECLARE",
119
- "EDIT",
117
+ "VALIDATE",
120
118
  "REGISTER",
121
119
  "DUPLICATE_DETECTED",
122
120
  "REJECT",
@@ -129,15 +127,14 @@ var ActionTypes = z2.enum([
129
127
  "APPROVE_CORRECTION",
130
128
  "READ",
131
129
  "ASSIGN",
132
- "UNASSIGN",
133
- "CUSTOM"
130
+ "UNASSIGN"
134
131
  ]);
135
132
  var ClientSpecificAction = {
136
133
  REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
137
134
  };
138
135
  var declarationActionValues = [
139
136
  ActionTypes.enum.DECLARE,
140
- ActionTypes.enum.EDIT,
137
+ ActionTypes.enum.VALIDATE,
141
138
  ActionTypes.enum.REGISTER,
142
139
  ActionTypes.enum.NOTIFY,
143
140
  ActionTypes.enum.DUPLICATE_DETECTED
@@ -158,14 +155,13 @@ var writeActions = ActionTypes.exclude([
158
155
  ActionType.UNASSIGN
159
156
  ]);
160
157
  var workqueueActions = ActionTypes.exclude([
161
- ActionType.READ,
162
158
  ActionType.CREATE,
163
159
  ActionType.NOTIFY,
164
160
  ActionType.DUPLICATE_DETECTED,
161
+ ActionType.REJECT,
165
162
  ActionType.MARK_AS_NOT_DUPLICATE,
166
163
  ActionType.REJECT_CORRECTION,
167
- ActionType.APPROVE_CORRECTION,
168
- ActionType.CUSTOM
164
+ ActionType.APPROVE_CORRECTION
169
165
  ]);
170
166
  var META_ACTIONS = [
171
167
  ActionType.ASSIGN,
@@ -174,57 +170,59 @@ var META_ACTIONS = [
174
170
  ];
175
171
 
176
172
  // ../commons/src/events/FieldConfig.ts
177
- var z17 = __toESM(require("zod/v4"));
173
+ var import_zod16 = require("zod");
178
174
 
179
175
  // ../commons/src/events/Conditional.ts
180
- var z3 = __toESM(require("zod/v4"));
181
- var Conditional = z3.any().describe("JSONSchema").meta({
176
+ var import_zod3 = require("zod");
177
+ var import_zod_openapi2 = require("zod-openapi");
178
+ (0, import_zod_openapi2.extendZodWithOpenApi)(import_zod3.z);
179
+ var Conditional = import_zod3.z.custom((val) => typeof val === "object" && val !== null).openapi({
182
180
  description: "JSON schema conditional configuration",
183
- id: "Conditional"
181
+ ref: "Conditional"
184
182
  });
185
183
  var ConditionalType = {
186
184
  SHOW: "SHOW",
187
185
  ENABLE: "ENABLE",
188
186
  DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
189
187
  };
190
- var ShowConditional = z3.object({
191
- type: z3.literal(ConditionalType.SHOW),
188
+ var ShowConditional = import_zod3.z.object({
189
+ type: import_zod3.z.literal(ConditionalType.SHOW),
192
190
  conditional: Conditional
193
191
  }).describe(
194
192
  "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
195
193
  );
196
- var EnableConditional = z3.object({
197
- type: z3.literal(ConditionalType.ENABLE),
194
+ var EnableConditional = import_zod3.z.object({
195
+ type: import_zod3.z.literal(ConditionalType.ENABLE),
198
196
  conditional: Conditional
199
197
  }).describe(
200
198
  "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
201
199
  );
202
- var ActionConditional = z3.discriminatedUnion("type", [
200
+ var ActionConditional = import_zod3.z.discriminatedUnion("type", [
203
201
  // Action can be shown / hidden
204
202
  ShowConditional,
205
203
  // Action can be shown to the user in the list but as disabled
206
204
  EnableConditional
207
205
  ]);
208
- var DisplayOnReviewConditional = z3.object({
209
- type: z3.literal(ConditionalType.DISPLAY_ON_REVIEW),
206
+ var DisplayOnReviewConditional = import_zod3.z.object({
207
+ type: import_zod3.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
210
208
  conditional: Conditional
211
209
  }).describe(
212
210
  "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
213
211
  );
214
- var FieldConditional = z3.discriminatedUnion("type", [
212
+ var FieldConditional = import_zod3.z.discriminatedUnion("type", [
215
213
  // Field input can be shown / hidden
216
214
  ShowConditional,
217
215
  // Field input can be shown to the user but as disabled
218
216
  EnableConditional,
219
217
  // Field output can be shown / hidden on the review page
220
218
  DisplayOnReviewConditional
221
- ]).meta({
219
+ ]).openapi({
222
220
  description: "Field conditional configuration",
223
- id: "FieldConditional"
221
+ ref: "FieldConditional"
224
222
  });
225
223
 
226
224
  // ../commons/src/events/FieldType.ts
227
- var z4 = __toESM(require("zod/v4"));
225
+ var import_zod4 = require("zod");
228
226
  var FieldType = {
229
227
  NAME: "NAME",
230
228
  PHONE: "PHONE",
@@ -267,21 +265,9 @@ var FieldType = {
267
265
  QUERY_PARAM_READER: "QUERY_PARAM_READER",
268
266
  QR_READER: "QR_READER",
269
267
  ID_READER: "ID_READER",
270
- LOADER: "LOADER",
271
- ALPHA_HIDDEN: "ALPHA_HIDDEN",
272
- /**
273
- * @internal
274
- * @experimental
275
- *
276
- * Internal API used by the OpenCRVS core team for experimentation.
277
- *
278
- * This component is not part of the public, stable API.
279
- * Its shape, behavior, or existence may change at any time or be removed
280
- * entirely without notice.
281
- */
282
- _EXPERIMENTAL_CUSTOM: "CUSTOM"
268
+ LOADER: "LOADER"
283
269
  };
284
- var FileFieldType = z4.enum([
270
+ var FileFieldType = import_zod4.z.enum([
285
271
  FieldType.FILE,
286
272
  FieldType.FILE_WITH_OPTIONS,
287
273
  FieldType.SIGNATURE
@@ -305,155 +291,154 @@ var FieldTypesToHideInReview = [
305
291
  FieldType.LOADER,
306
292
  FieldType.HTTP,
307
293
  FieldType.QUERY_PARAM_READER,
308
- FieldType.DATA,
309
- FieldType.ALPHA_HIDDEN
294
+ FieldType.DATA
310
295
  ];
311
296
 
312
297
  // ../commons/src/events/FieldValue.ts
313
- var z7 = __toESM(require("zod/v4"));
298
+ var import_zod7 = require("zod");
314
299
 
315
300
  // ../commons/src/documents.ts
316
- var z5 = __toESM(require("zod/v4"));
317
- var FullDocumentUrl = z5.string().brand("FullDocumentUrl").describe(
301
+ var import_zod5 = require("zod");
302
+ var import_zod_openapi3 = require("zod-openapi");
303
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
304
+ var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
318
305
  "A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio.opencrvs.com/bucket-name/document-id.jpg"
319
306
  );
320
- var FullDocumentPath = z5.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
307
+ var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
321
308
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
322
309
  );
323
- var DocumentPath = z5.string().brand("DocumentPath").describe(
310
+ var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
324
311
  "A full identifier starting from the root of the S3 bucket, e.g. /document-id.jpg or /directory/document-id.jpg but never /bucket-name/document-id.jpg"
325
312
  );
326
313
 
327
314
  // ../commons/src/events/CompositeFieldValue.ts
328
- var z6 = __toESM(require("zod/v4"));
315
+ var import_zod6 = require("zod");
329
316
  var AddressType = {
330
317
  DOMESTIC: "DOMESTIC",
331
318
  INTERNATIONAL: "INTERNATIONAL"
332
319
  };
333
- var FileFieldValue = z6.object({
320
+ var FileFieldValue = import_zod6.z.object({
334
321
  path: FullDocumentPath,
335
- originalFilename: z6.string(),
336
- type: z6.string()
337
- });
338
- var NameFieldValue = z6.object({
339
- firstname: z6.string(),
340
- surname: z6.string(),
341
- middlename: z6.string().optional()
342
- });
343
- var NameFieldUpdateValue = z6.object({
344
- firstname: z6.string().nullish(),
345
- surname: z6.string().nullish(),
346
- middlename: z6.string().nullish()
347
- }).or(z6.null()).or(z6.undefined());
348
- var StreetLevelDetailsValue = z6.record(z6.string(), z6.string()).optional();
349
- var StreetLevelDetailsUpdateValue = z6.record(z6.string(), z6.string().nullable()).nullish();
350
- var BaseAddressFieldValue = z6.object({
351
- country: z6.string(),
322
+ originalFilename: import_zod6.z.string(),
323
+ type: import_zod6.z.string()
324
+ });
325
+ var NameFieldValue = import_zod6.z.object({
326
+ firstname: import_zod6.z.string(),
327
+ surname: import_zod6.z.string(),
328
+ middlename: import_zod6.z.string().optional()
329
+ });
330
+ var NameFieldUpdateValue = import_zod6.z.object({
331
+ firstname: import_zod6.z.string().nullish(),
332
+ surname: import_zod6.z.string().nullish(),
333
+ middlename: import_zod6.z.string().nullish()
334
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
335
+ var StreetLevelDetailsValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional();
336
+ var StreetLevelDetailsUpdateValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string().nullable()).nullish();
337
+ var BaseAddressFieldValue = import_zod6.z.object({
338
+ country: import_zod6.z.string(),
352
339
  streetLevelDetails: StreetLevelDetailsValue
353
340
  });
354
- var BaseAddressFieldUpdateValue = z6.object({
355
- country: z6.string().nullish(),
341
+ var BaseAddressFieldUpdateValue = import_zod6.z.object({
342
+ country: import_zod6.z.string().nullish(),
356
343
  streetLevelDetails: StreetLevelDetailsUpdateValue
357
344
  });
358
345
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
359
- addressType: z6.literal(AddressType.DOMESTIC),
360
- administrativeArea: z6.string().uuid()
346
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
347
+ administrativeArea: import_zod6.z.string().uuid()
361
348
  });
362
349
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
363
- addressType: z6.literal(AddressType.INTERNATIONAL)
350
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
364
351
  });
365
- var AddressFieldValue = z6.discriminatedUnion("addressType", [
352
+ var AddressFieldValue = import_zod6.z.discriminatedUnion("addressType", [
366
353
  DomesticAddressFieldValue,
367
354
  InternationalAddressFieldValue
368
355
  ]);
369
356
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
370
- addressType: z6.literal(AddressType.DOMESTIC),
371
- administrativeArea: z6.string().uuid().nullish()
357
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
358
+ administrativeArea: import_zod6.z.string().uuid().nullish()
372
359
  /* Leaf level admin structure */
373
360
  });
374
361
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
375
362
  {
376
- addressType: z6.literal(AddressType.INTERNATIONAL)
363
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
377
364
  }
378
365
  );
379
- var AddressFieldUpdateValue = z6.discriminatedUnion("addressType", [
366
+ var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("addressType", [
380
367
  DomesticAddressUpdateFieldValue,
381
368
  InternationalAddressUpdateFieldValue
382
369
  ]).nullish();
383
- var FileFieldValueWithOption = z6.object({
370
+ var FileFieldValueWithOption = import_zod6.z.object({
384
371
  path: FullDocumentPath,
385
- originalFilename: z6.string(),
386
- type: z6.string(),
387
- option: z6.string()
388
- });
389
- var FileFieldWithOptionValue = z6.array(FileFieldValueWithOption);
390
- var HttpFieldValue = z6.object({
391
- loading: z6.boolean(),
392
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
393
- data: z6.any()
394
- });
395
- var HttpFieldUpdateValue = z6.object({
396
- loading: z6.boolean().nullish(),
397
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
398
- data: z6.any().nullish()
399
- }).or(z6.null()).or(z6.undefined());
400
- var QueryParamReaderFieldValue = z6.object({
401
- data: z6.record(z6.string(), z6.string())
372
+ originalFilename: import_zod6.z.string(),
373
+ type: import_zod6.z.string(),
374
+ option: import_zod6.z.string()
375
+ });
376
+ var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
377
+ var HttpFieldValue = import_zod6.z.object({
378
+ loading: import_zod6.z.boolean(),
379
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
380
+ data: import_zod6.z.any()
381
+ });
382
+ var HttpFieldUpdateValue = import_zod6.z.object({
383
+ loading: import_zod6.z.boolean().nullish(),
384
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
385
+ data: import_zod6.z.any().nullish()
386
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
387
+ var QueryParamReaderFieldValue = import_zod6.z.object({
388
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
402
389
  }).nullish();
403
- var QueryParamReaderFieldUpdateValue = z6.object({
404
- data: z6.record(z6.string(), z6.string())
390
+ var QueryParamReaderFieldUpdateValue = import_zod6.z.object({
391
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
405
392
  });
406
- var ReadDataValue = z6.object({
407
- data: z6.any()
393
+ var ReadDataValue = import_zod6.z.object({
394
+ data: import_zod6.z.any()
408
395
  });
409
396
  var QrReaderFieldValue = ReadDataValue;
410
397
  var IdReaderFieldValue = ReadDataValue;
411
- var NumberWithUnitFieldValue = z6.object({
412
- numericValue: z6.number(),
413
- unit: z6.string()
398
+ var NumberWithUnitFieldValue = import_zod6.z.object({
399
+ numericValue: import_zod6.z.number(),
400
+ unit: import_zod6.z.string()
414
401
  });
415
- var NumberWithUnitFieldUpdateValue = z6.object({
416
- numericValue: z6.number().optional(),
417
- unit: z6.string().optional()
402
+ var NumberWithUnitFieldUpdateValue = import_zod6.z.object({
403
+ numericValue: import_zod6.z.number().optional(),
404
+ unit: import_zod6.z.string().optional()
418
405
  });
419
- var CustomFieldValue = z6.unknown().brand("CustomFieldValue");
420
406
 
421
407
  // ../commons/src/events/FieldValue.ts
422
- var TextValue = z7.string();
423
- var HiddenFieldValue = z7.string();
408
+ var TextValue = import_zod7.z.string();
424
409
  var NonEmptyTextValue = TextValue.min(1);
425
- var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
426
- var AgeValue = z7.object({
427
- age: z7.number(),
428
- asOfDateRef: z7.string()
410
+ var DateValue = import_zod7.z.string().date().describe("Date in the format YYYY-MM-DD");
411
+ var AgeValue = import_zod7.z.object({
412
+ age: import_zod7.z.number(),
413
+ asOfDateRef: import_zod7.z.string()
429
414
  });
430
415
  var AgeUpdateValue = AgeValue.optional().nullable();
431
- var TimeValue = z7.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
432
- var DatetimeValue = z7.iso.datetime();
433
- var SelectDateRangeValue = z7.enum([
416
+ var TimeValue = import_zod7.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
417
+ var DatetimeValue = import_zod7.z.string().datetime();
418
+ var SelectDateRangeValue = import_zod7.z.enum([
434
419
  "last7Days",
435
420
  "last30Days",
436
421
  "last90Days",
437
422
  "last365Days"
438
423
  ]);
439
- var DateRangeFieldValue = z7.object({
424
+ var DateRangeFieldValue = import_zod7.z.object({
440
425
  start: DateValue,
441
426
  end: DateValue
442
427
  }).or(DateValue).describe(
443
428
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
444
429
  );
445
- var EmailValue = z7.email();
446
- var CheckboxFieldValue = z7.boolean();
447
- var NumberFieldValue = z7.number();
448
- var SignatureFieldValue = z7.string();
449
- var ButtonFieldValue = z7.number();
450
- var VerificationStatusValue = z7.enum([
430
+ var EmailValue = import_zod7.z.string().email();
431
+ var CheckboxFieldValue = import_zod7.z.boolean();
432
+ var NumberFieldValue = import_zod7.z.number();
433
+ var SignatureFieldValue = import_zod7.z.string();
434
+ var ButtonFieldValue = import_zod7.z.number();
435
+ var VerificationStatusValue = import_zod7.z.enum([
451
436
  "verified",
452
437
  "authenticated",
453
438
  "failed",
454
439
  "pending"
455
440
  ]);
456
- var FieldValuesWithoutDataField = z7.union([
441
+ var FieldValuesWithoutDataField = import_zod7.z.union([
457
442
  AddressFieldValue,
458
443
  TextValue,
459
444
  DateValue,
@@ -474,13 +459,12 @@ var FieldValuesWithoutDataField = z7.union([
474
459
  QrReaderFieldValue,
475
460
  IdReaderFieldValue,
476
461
  NumberWithUnitFieldValue,
477
- NumberWithUnitFieldUpdateValue,
478
- CustomFieldValue
462
+ NumberWithUnitFieldUpdateValue
479
463
  ]);
480
- var DataFieldValue = z7.object({
481
- data: z7.record(z7.string(), FieldValuesWithoutDataField)
464
+ var DataFieldValue = import_zod7.z.object({
465
+ data: import_zod7.z.record(import_zod7.z.string(), FieldValuesWithoutDataField)
482
466
  }).nullish();
483
- var FieldValue = z7.union([
467
+ var FieldValue = import_zod7.z.union([
484
468
  FieldValuesWithoutDataField,
485
469
  DataFieldValue
486
470
  ]);
@@ -501,38 +485,22 @@ var PRIORITY_ORDER = [
501
485
  "DataFieldValue"
502
486
  ];
503
487
  function schemaPriority(schema) {
504
- const name = schema.description;
505
- if (!name) {
506
- return 9999;
507
- }
488
+ const name = schema._def?.description;
508
489
  const idx = PRIORITY_ORDER.indexOf(name);
509
490
  return idx === -1 ? 9999 : idx;
510
491
  }
511
492
  function safeUnion(schemas) {
512
- return z7.any().superRefine((val, ctx) => {
493
+ return import_zod7.z.custom((val) => {
513
494
  const successful = schemas.filter((s) => s.safeParse(val).success);
514
495
  if (successful.length === 1) {
515
- return;
496
+ return true;
516
497
  }
517
498
  if (successful.length === 0) {
518
- ctx.addIssue({
519
- code: "invalid_type",
520
- expected: "custom",
521
- message: "Value does not match any schema"
522
- });
523
- return;
499
+ return false;
524
500
  }
525
501
  successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
526
502
  const best = successful[0];
527
- if (!best.safeParse(val).success) {
528
- ctx.addIssue({
529
- expected: "custom",
530
- code: "invalid_type",
531
- message: "Value did not match the best schema"
532
- });
533
- }
534
- }).meta({
535
- description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
503
+ return best.safeParse(val).success;
536
504
  });
537
505
  }
538
506
  var FieldUpdateValue = safeUnion([
@@ -551,23 +519,24 @@ var FieldUpdateValue = safeUnion([
551
519
  DataFieldValue.describe("DataFieldValue"),
552
520
  NameFieldUpdateValue.describe("NameFieldUpdateValue"),
553
521
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
554
- QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
555
- CustomFieldValue.describe("CustomFieldValue"),
556
- HiddenFieldValue.describe("HiddenFieldValue")
522
+ QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
557
523
  ]);
558
524
 
525
+ // ../commons/src/events/FieldConfig.ts
526
+ var import_zod_openapi6 = require("zod-openapi");
527
+
559
528
  // ../commons/src/uuid.ts
560
529
  var import_uuid = require("uuid");
561
- var z8 = __toESM(require("zod/v4"));
562
- var UUID = z8.uuid().brand("UUID");
530
+ var import_zod8 = require("zod");
531
+ var UUID = import_zod8.z.string().uuid().brand("UUID");
563
532
  function getUUID() {
564
533
  return (0, import_uuid.v4)();
565
534
  }
566
535
 
567
536
  // ../commons/src/events/serializers/user/serializer.ts
568
- var z9 = __toESM(require("zod/v4"));
569
- var SerializedUserField = z9.object({
570
- $userField: z9.enum([
537
+ var import_zod9 = require("zod");
538
+ var SerializedUserField = import_zod9.z.object({
539
+ $userField: import_zod9.z.enum([
571
540
  "id",
572
541
  "name",
573
542
  "role",
@@ -576,12 +545,11 @@ var SerializedUserField = z9.object({
576
545
  "firstname",
577
546
  "middlename",
578
547
  "surname",
579
- "signature",
580
- "avatar",
581
- "primaryOfficeId",
582
- "administrativeAreaId"
548
+ "district",
549
+ "province",
550
+ "primaryOfficeId"
583
551
  ]),
584
- $location: z9.string().optional()
552
+ $location: import_zod9.z.string().optional()
585
553
  });
586
554
  function userSerializer(userField) {
587
555
  return {
@@ -601,23 +569,24 @@ function userSerializer(userField) {
601
569
  }
602
570
 
603
571
  // ../commons/src/events/EventIndex.ts
604
- var import_v4 = require("zod/v4");
572
+ var import_zod14 = require("zod");
605
573
 
606
574
  // ../commons/src/events/EventMetadata.ts
607
- var z14 = __toESM(require("zod/v4"));
575
+ var import_zod13 = require("zod");
608
576
 
609
577
  // ../commons/src/events/ActionDocument.ts
610
- var z12 = __toESM(require("zod/v4"));
578
+ var import_zod12 = require("zod");
579
+ var import_zod_openapi4 = require("zod-openapi");
611
580
 
612
581
  // ../commons/src/events/CreatedAtLocation.ts
613
582
  var CreatedAtLocation = UUID.nullish();
614
583
 
615
584
  // ../commons/src/authentication.ts
616
585
  var import_jwt_decode = __toESM(require("jwt-decode"));
617
- var z11 = __toESM(require("zod/v4"));
586
+ var import_zod11 = require("zod");
618
587
 
619
588
  // ../commons/src/scopes.ts
620
- var z10 = __toESM(require("zod/v4"));
589
+ var import_zod10 = require("zod");
621
590
  var SCOPES = {
622
591
  // TODO v1.8 legacy scopes
623
592
  BYPASSRATELIMIT: "bypassratelimit",
@@ -696,91 +665,91 @@ var SCOPES = {
696
665
  // data seeding
697
666
  USER_DATA_SEEDING: "user.data-seeding"
698
667
  };
699
- var LegacyScopes = z10.union([
700
- z10.literal(SCOPES.BYPASSRATELIMIT),
701
- z10.literal(SCOPES.REGISTER),
702
- z10.literal(SCOPES.DEMO),
703
- z10.literal(SCOPES.CONFIG)
668
+ var LegacyScopes = import_zod10.z.union([
669
+ import_zod10.z.literal(SCOPES.BYPASSRATELIMIT),
670
+ import_zod10.z.literal(SCOPES.REGISTER),
671
+ import_zod10.z.literal(SCOPES.DEMO),
672
+ import_zod10.z.literal(SCOPES.CONFIG)
704
673
  ]);
705
- var IntegrationScopes = z10.union([
706
- z10.literal(SCOPES.WEBHOOK),
707
- z10.literal(SCOPES.NATIONALID),
708
- z10.literal(SCOPES.NOTIFICATION_API),
709
- z10.literal(SCOPES.RECORDSEARCH)
674
+ var IntegrationScopes = import_zod10.z.union([
675
+ import_zod10.z.literal(SCOPES.WEBHOOK),
676
+ import_zod10.z.literal(SCOPES.NATIONALID),
677
+ import_zod10.z.literal(SCOPES.NOTIFICATION_API),
678
+ import_zod10.z.literal(SCOPES.RECORDSEARCH)
710
679
  ]);
711
- var InternalOperationsScopes = z10.union([
712
- z10.literal(SCOPES.RECORD_REINDEX),
713
- z10.literal(SCOPES.RECORD_IMPORT)
680
+ var InternalOperationsScopes = import_zod10.z.union([
681
+ import_zod10.z.literal(SCOPES.RECORD_REINDEX),
682
+ import_zod10.z.literal(SCOPES.RECORD_IMPORT)
714
683
  ]);
715
- var DeclareScopes = z10.union([
716
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH),
717
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
718
- z10.literal(SCOPES.RECORD_DECLARE_DEATH),
719
- z10.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
720
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
721
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
722
- z10.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
723
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
684
+ var DeclareScopes = import_zod10.z.union([
685
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
686
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
687
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH),
688
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
689
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
690
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
691
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
692
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
724
693
  ]);
725
- var UnassignScope = z10.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
726
- var ValidateScopes = z10.union([
727
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
728
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
729
- z10.literal(SCOPES.RECORD_DECLARATION_EDIT),
730
- z10.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
731
- z10.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
732
- z10.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
694
+ var UnassignScope = import_zod10.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
695
+ var ValidateScopes = import_zod10.z.union([
696
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
697
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
698
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
699
+ import_zod10.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
700
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
701
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
733
702
  ]);
734
- var RegisterScope = z10.literal(SCOPES.RECORD_REGISTER);
735
- var CorrectionScopes = z10.union([
736
- z10.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
737
- z10.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
738
- z10.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
739
- z10.literal(SCOPES.RECORD_REJECT_REGISTRATION)
703
+ var RegisterScope = import_zod10.z.literal(SCOPES.RECORD_REGISTER);
704
+ var CorrectionScopes = import_zod10.z.union([
705
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
706
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
707
+ import_zod10.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
708
+ import_zod10.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
740
709
  ]);
741
- var SearchScopes = z10.union([
742
- z10.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
743
- z10.literal(SCOPES.SEARCH_BIRTH),
744
- z10.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
745
- z10.literal(SCOPES.SEARCH_DEATH),
746
- z10.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
747
- z10.literal(SCOPES.SEARCH_MARRIAGE)
710
+ var SearchScopes = import_zod10.z.union([
711
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
712
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH),
713
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
714
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH),
715
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
716
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE)
748
717
  ]);
749
- var AuditScopes = z10.literal(SCOPES.RECORD_READ);
750
- var PerformanceScopes = z10.union([
751
- z10.literal(SCOPES.PERFORMANCE_READ),
752
- z10.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
753
- z10.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
718
+ var AuditScopes = import_zod10.z.literal(SCOPES.RECORD_READ);
719
+ var PerformanceScopes = import_zod10.z.union([
720
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ),
721
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
722
+ import_zod10.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
754
723
  ]);
755
- var OrganisationScopes = z10.union([
756
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
757
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
758
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
724
+ var OrganisationScopes = import_zod10.z.union([
725
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
726
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
727
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
759
728
  ]);
760
- var UserScopes = z10.union([
761
- z10.literal(SCOPES.USER_READ),
762
- z10.literal(SCOPES.USER_READ_MY_OFFICE),
763
- z10.literal(SCOPES.USER_READ_MY_JURISDICTION),
764
- z10.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
765
- z10.literal(SCOPES.USER_CREATE),
766
- z10.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
767
- z10.literal(SCOPES.USER_UPDATE),
768
- z10.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
729
+ var UserScopes = import_zod10.z.union([
730
+ import_zod10.z.literal(SCOPES.USER_READ),
731
+ import_zod10.z.literal(SCOPES.USER_READ_MY_OFFICE),
732
+ import_zod10.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
733
+ import_zod10.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
734
+ import_zod10.z.literal(SCOPES.USER_CREATE),
735
+ import_zod10.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
736
+ import_zod10.z.literal(SCOPES.USER_UPDATE),
737
+ import_zod10.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
769
738
  ]);
770
- var ConfigScope = z10.literal(SCOPES.CONFIG_UPDATE_ALL);
771
- var DataSeedingScope = z10.literal(SCOPES.USER_DATA_SEEDING);
772
- var LiteralScopes = z10.union([
739
+ var ConfigScope = import_zod10.z.literal(SCOPES.CONFIG_UPDATE_ALL);
740
+ var DataSeedingScope = import_zod10.z.literal(SCOPES.USER_DATA_SEEDING);
741
+ var LiteralScopes = import_zod10.z.union([
773
742
  LegacyScopes,
774
743
  IntegrationScopes,
775
744
  UnassignScope,
776
745
  DeclareScopes,
777
746
  ValidateScopes,
778
747
  RegisterScope,
779
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
748
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
780
749
  CorrectionScopes,
781
750
  SearchScopes,
782
751
  AuditScopes,
783
- z10.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
752
+ import_zod10.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
784
753
  PerformanceScopes,
785
754
  OrganisationScopes,
786
755
  UserScopes,
@@ -789,38 +758,38 @@ var LiteralScopes = z10.union([
789
758
  InternalOperationsScopes
790
759
  ]);
791
760
  var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
792
- var rawConfigurableScope = z10.string().regex(rawConfigurableScopeRegex);
793
- var CreateUserScope = z10.object({
794
- type: z10.literal("user.create"),
795
- options: z10.object({
796
- role: z10.array(z10.string())
761
+ var rawConfigurableScope = import_zod10.z.string().regex(rawConfigurableScopeRegex);
762
+ var CreateUserScope = import_zod10.z.object({
763
+ type: import_zod10.z.literal("user.create"),
764
+ options: import_zod10.z.object({
765
+ role: import_zod10.z.array(import_zod10.z.string())
797
766
  })
798
767
  });
799
- var EditUserScope = z10.object({
800
- type: z10.literal("user.edit"),
801
- options: z10.object({
802
- role: z10.array(z10.string())
768
+ var EditUserScope = import_zod10.z.object({
769
+ type: import_zod10.z.literal("user.edit"),
770
+ options: import_zod10.z.object({
771
+ role: import_zod10.z.array(import_zod10.z.string())
803
772
  })
804
773
  });
805
- var WorkqueueScope = z10.object({
806
- type: z10.literal("workqueue"),
807
- options: z10.object({
808
- id: z10.array(z10.string())
774
+ var WorkqueueScope = import_zod10.z.object({
775
+ type: import_zod10.z.literal("workqueue"),
776
+ options: import_zod10.z.object({
777
+ id: import_zod10.z.array(import_zod10.z.string())
809
778
  })
810
779
  });
811
- var SearchScope = z10.object({
812
- type: z10.literal("search"),
813
- options: z10.object({
814
- event: z10.array(z10.string()).length(1),
815
- access: z10.array(z10.enum(["my-jurisdiction", "all"])).length(1)
780
+ var SearchScope = import_zod10.z.object({
781
+ type: import_zod10.z.literal("search"),
782
+ options: import_zod10.z.object({
783
+ event: import_zod10.z.array(import_zod10.z.string()).length(1),
784
+ access: import_zod10.z.array(import_zod10.z.enum(["my-jurisdiction", "all"])).length(1)
816
785
  })
817
786
  });
818
- var RecordScopeType = z10.enum([
787
+ var RecordScopeType = import_zod10.z.enum([
819
788
  "record.create",
820
789
  "record.read",
821
790
  "record.declare",
822
791
  "record.notify",
823
- "record.declared.edit",
792
+ "record.declared.validate",
824
793
  "record.declared.reject",
825
794
  "record.declared.archive",
826
795
  "record.declared.review-duplicates",
@@ -830,40 +799,27 @@ var RecordScopeType = z10.enum([
830
799
  "record.registered.correct",
831
800
  "record.unassign-others"
832
801
  ]);
833
- var RecordScope = z10.object({
802
+ var RecordScope = import_zod10.z.object({
834
803
  type: RecordScopeType,
835
- options: z10.object({
836
- event: z10.array(z10.string()).describe("Event type, e.g. birth, death")
804
+ options: import_zod10.z.object({
805
+ event: import_zod10.z.array(import_zod10.z.string()).describe("Event type, e.g. birth, death")
837
806
  })
838
807
  }).describe(
839
808
  "Scopes used to check user's permission to perform actions on a record."
840
809
  );
841
- var CustomActionScope = z10.object({
842
- type: z10.literal("record.custom-action"),
843
- options: z10.object({
844
- event: z10.array(z10.string()).describe("Allowed event type, e.g. birth, death"),
845
- customActionType: z10.array(z10.string()).describe("Allowed custom action types")
846
- })
847
- });
848
- var ConfigurableRawScopes = z10.discriminatedUnion("type", [
810
+ var ConfigurableRawScopes = import_zod10.z.discriminatedUnion("type", [
849
811
  SearchScope,
850
812
  CreateUserScope,
851
813
  EditUserScope,
852
814
  WorkqueueScope,
853
- RecordScope,
854
- CustomActionScope
855
- ]);
856
- var ConfigurableActionScopes = z10.discriminatedUnion("type", [
857
- // @TODO - Record scope holds non-action scopes as well e.g., `record.read`
858
- RecordScope,
859
- CustomActionScope
815
+ RecordScope
860
816
  ]);
861
817
  var scopes = Object.values(SCOPES);
862
- var ActionScopes = z10.union([
818
+ var ActionScopes = import_zod10.z.union([
863
819
  DeclareScopes,
864
820
  ValidateScopes,
865
821
  RegisterScope,
866
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
822
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
867
823
  CorrectionScopes
868
824
  ]);
869
825
 
@@ -997,14 +953,15 @@ var DEFAULT_ROLES_DEFINITION = [
997
953
  ]
998
954
  }
999
955
  ];
1000
- var TokenUserType = z11.enum(["user", "system"]);
1001
- var TokenWithBearer = z11.string().regex(/^Bearer\s/);
956
+ var TokenUserType = import_zod11.z.enum(["user", "system"]);
957
+ var TokenWithBearer = import_zod11.z.string().regex(/^Bearer\s/);
1002
958
 
1003
959
  // ../commons/src/events/ActionDocument.ts
1004
- var ActionUpdate = z12.record(z12.string(), FieldUpdateValue).describe(
960
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod12.z);
961
+ var ActionUpdate = import_zod12.z.record(import_zod12.z.string(), FieldUpdateValue).describe(
1005
962
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
1006
963
  );
1007
- var EventState = z12.record(z12.string(), FieldValue).describe(
964
+ var EventState = import_zod12.z.record(import_zod12.z.string(), FieldValue).describe(
1008
965
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
1009
966
  );
1010
967
  var ActionStatus = {
@@ -1012,16 +969,16 @@ var ActionStatus = {
1012
969
  Accepted: "Accepted",
1013
970
  Rejected: "Rejected"
1014
971
  };
1015
- var ActionBase = z12.object({
972
+ var ActionBase = import_zod12.z.object({
1016
973
  id: UUID.describe("Unique identifier of the action."),
1017
- transactionId: z12.string().describe("Unique identifier of the transaction."),
974
+ transactionId: import_zod12.z.string().describe("Unique identifier of the transaction."),
1018
975
  createdByUserType: TokenUserType.describe(
1019
976
  "Indicates whether the action was created by a human-user or by a system-user."
1020
977
  ),
1021
- createdAt: z12.string().datetime().describe("Timestamp indicating when the action was created."),
1022
- createdBy: z12.string().describe("Identifier of the user who created the action."),
1023
- createdByRole: z12.string().describe("Role of the user who created the action."),
1024
- createdBySignature: z12.string().nullish().describe("Reference to the signature of the user who created the action."),
978
+ createdAt: import_zod12.z.string().datetime().describe("Timestamp indicating when the action was created."),
979
+ createdBy: import_zod12.z.string().describe("Identifier of the user who created the action."),
980
+ createdByRole: import_zod12.z.string().describe("Role of the user who created the action."),
981
+ createdBySignature: import_zod12.z.string().nullish().describe("Reference to the signature of the user who created the action."),
1025
982
  createdAtLocation: CreatedAtLocation.describe(
1026
983
  "Reference to the location of the user who created the action."
1027
984
  ),
@@ -1029,7 +986,7 @@ var ActionBase = z12.object({
1029
986
  "Declaration data defined by the ActionConfig. Supports partial updates."
1030
987
  ),
1031
988
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1032
- status: z12.enum([
989
+ status: import_zod12.z.enum([
1033
990
  ActionStatus.Requested,
1034
991
  ActionStatus.Accepted,
1035
992
  ActionStatus.Rejected
@@ -1040,181 +997,172 @@ var ActionBase = z12.object({
1040
997
  "Reference to the original action asynchronously accepted or rejected by a third-party integration."
1041
998
  )
1042
999
  });
1043
- var AssignedAction = ActionBase.extend(
1044
- z12.object({
1045
- type: z12.literal(ActionType.ASSIGN),
1046
- assignedTo: z12.string().describe("Identifier of the user to whom the action is assigned.")
1000
+ var AssignedAction = ActionBase.merge(
1001
+ import_zod12.z.object({
1002
+ type: import_zod12.z.literal(ActionType.ASSIGN),
1003
+ assignedTo: import_zod12.z.string().describe("Identifier of the user to whom the action is assigned.")
1047
1004
  // TODO move into 'content' property
1048
- }).shape
1005
+ })
1049
1006
  );
1050
- var UnassignedAction = ActionBase.extend(
1051
- z12.object({
1052
- type: z12.literal(ActionType.UNASSIGN)
1053
- }).shape
1007
+ var UnassignedAction = ActionBase.merge(
1008
+ import_zod12.z.object({
1009
+ type: import_zod12.z.literal(ActionType.UNASSIGN)
1010
+ })
1054
1011
  );
1055
- var RegisterAction = ActionBase.extend(
1056
- z12.object({
1057
- type: z12.literal(ActionType.REGISTER),
1058
- registrationNumber: z12.string().optional().describe(
1012
+ var RegisterAction = ActionBase.merge(
1013
+ import_zod12.z.object({
1014
+ type: import_zod12.z.literal(ActionType.REGISTER),
1015
+ registrationNumber: import_zod12.z.string().optional().describe(
1059
1016
  "Registration number of the event. Always present for accepted registrations."
1060
1017
  )
1061
1018
  // TODO move into 'content' property
1062
- }).shape
1019
+ })
1063
1020
  );
1064
- var DeclareAction = ActionBase.extend(
1065
- z12.object({
1066
- type: z12.literal(ActionType.DECLARE)
1067
- }).shape
1021
+ var DeclareAction = ActionBase.merge(
1022
+ import_zod12.z.object({
1023
+ type: import_zod12.z.literal(ActionType.DECLARE)
1024
+ })
1068
1025
  );
1069
- var ReasonContent = z12.object({
1070
- reason: z12.string().min(1, { error: "Message cannot be empty" }).describe(
1026
+ var ValidateAction = ActionBase.merge(
1027
+ import_zod12.z.object({
1028
+ type: import_zod12.z.literal(ActionType.VALIDATE)
1029
+ })
1030
+ );
1031
+ var ReasonContent = import_zod12.z.object({
1032
+ reason: import_zod12.z.string().min(1, { message: "Message cannot be empty" }).describe(
1071
1033
  "Message describing the reason for rejecting or archiving the event."
1072
1034
  )
1073
1035
  });
1074
- var RejectAction = ActionBase.extend(
1075
- z12.object({
1076
- type: z12.literal(ActionType.REJECT),
1036
+ var RejectAction = ActionBase.merge(
1037
+ import_zod12.z.object({
1038
+ type: import_zod12.z.literal(ActionType.REJECT),
1077
1039
  content: ReasonContent
1078
- }).shape
1040
+ })
1079
1041
  );
1080
- var PotentialDuplicate = z12.object({
1042
+ var PotentialDuplicate = import_zod12.z.object({
1081
1043
  id: UUID,
1082
- trackingId: z12.string()
1044
+ trackingId: import_zod12.z.string()
1083
1045
  });
1084
- var DuplicateDetectedAction = ActionBase.extend(
1085
- z12.object({
1086
- type: z12.literal(ActionType.DUPLICATE_DETECTED),
1087
- content: z12.object({
1088
- duplicates: z12.array(PotentialDuplicate)
1046
+ var DuplicateDetectedAction = ActionBase.merge(
1047
+ import_zod12.z.object({
1048
+ type: import_zod12.z.literal(ActionType.DUPLICATE_DETECTED),
1049
+ content: import_zod12.z.object({
1050
+ duplicates: import_zod12.z.array(PotentialDuplicate)
1089
1051
  })
1090
- }).shape
1052
+ })
1091
1053
  );
1092
- var MarkNotDuplicateAction = ActionBase.extend(
1093
- z12.object({
1094
- type: z12.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1095
- }).shape
1054
+ var MarkNotDuplicateAction = ActionBase.merge(
1055
+ import_zod12.z.object({
1056
+ type: import_zod12.z.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1057
+ })
1096
1058
  );
1097
- var MarkAsDuplicateAction = ActionBase.extend(
1098
- z12.object({
1099
- type: z12.literal(ActionType.MARK_AS_DUPLICATE),
1100
- content: z12.object({
1059
+ var MarkAsDuplicateAction = ActionBase.merge(
1060
+ import_zod12.z.object({
1061
+ type: import_zod12.z.literal(ActionType.MARK_AS_DUPLICATE),
1062
+ content: import_zod12.z.object({
1101
1063
  duplicateOf: UUID
1102
1064
  }).optional()
1103
- }).shape
1065
+ })
1104
1066
  );
1105
- var ArchiveAction = ActionBase.extend(
1106
- z12.object({
1107
- type: z12.literal(ActionType.ARCHIVE),
1067
+ var ArchiveAction = ActionBase.merge(
1068
+ import_zod12.z.object({
1069
+ type: import_zod12.z.literal(ActionType.ARCHIVE),
1108
1070
  content: ReasonContent
1109
- }).shape
1110
- );
1111
- var CreatedAction = ActionBase.extend(
1112
- z12.object({
1113
- type: z12.literal(ActionType.CREATE)
1114
- }).shape
1071
+ })
1115
1072
  );
1116
- var NotifiedAction = ActionBase.extend(
1117
- z12.object({
1118
- type: z12.literal(ActionType.NOTIFY)
1119
- }).shape
1073
+ var CreatedAction = ActionBase.merge(
1074
+ import_zod12.z.object({
1075
+ type: import_zod12.z.literal(ActionType.CREATE)
1076
+ })
1120
1077
  );
1121
- var EditAction = ActionBase.extend(
1122
- z12.object({
1123
- type: z12.literal(ActionType.EDIT),
1124
- content: z12.object({
1125
- comment: z12.string().describe("Comment for the edit action.").optional()
1126
- })
1127
- }).shape
1078
+ var NotifiedAction = ActionBase.merge(
1079
+ import_zod12.z.object({
1080
+ type: import_zod12.z.literal(ActionType.NOTIFY)
1081
+ })
1128
1082
  );
1129
- var PrintContent = z12.object({
1130
- templateId: z12.string().optional()
1083
+ var PrintContent = import_zod12.z.object({
1084
+ templateId: import_zod12.z.string().optional()
1131
1085
  });
1132
- var PrintCertificateAction = ActionBase.extend(
1133
- z12.object({
1134
- type: z12.literal(ActionType.PRINT_CERTIFICATE),
1086
+ var PrintCertificateAction = ActionBase.merge(
1087
+ import_zod12.z.object({
1088
+ type: import_zod12.z.literal(ActionType.PRINT_CERTIFICATE),
1135
1089
  content: PrintContent.optional().nullable()
1136
- }).shape
1090
+ })
1137
1091
  );
1138
- var RequestedCorrectionAction = ActionBase.extend(
1139
- z12.object({
1140
- type: z12.literal(ActionType.REQUEST_CORRECTION)
1141
- }).shape
1092
+ var RequestedCorrectionAction = ActionBase.merge(
1093
+ import_zod12.z.object({
1094
+ type: import_zod12.z.literal(ActionType.REQUEST_CORRECTION)
1095
+ })
1142
1096
  );
1143
- var ApprovedCorrectionAction = ActionBase.extend(
1144
- z12.object({
1145
- type: z12.literal(ActionType.APPROVE_CORRECTION),
1146
- requestId: z12.string()
1097
+ var ApprovedCorrectionAction = ActionBase.merge(
1098
+ import_zod12.z.object({
1099
+ type: import_zod12.z.literal(ActionType.APPROVE_CORRECTION),
1100
+ requestId: import_zod12.z.string()
1147
1101
  // TODO move into 'content' property
1148
- }).shape
1102
+ })
1149
1103
  );
1150
- var RejectedCorrectionAction = ActionBase.extend(
1151
- z12.object({
1152
- type: z12.literal(ActionType.REJECT_CORRECTION),
1153
- requestId: z12.string(),
1104
+ var RejectedCorrectionAction = ActionBase.merge(
1105
+ import_zod12.z.object({
1106
+ type: import_zod12.z.literal(ActionType.REJECT_CORRECTION),
1107
+ requestId: import_zod12.z.string(),
1154
1108
  // TODO move into 'content' property
1155
1109
  content: ReasonContent
1156
- }).shape
1157
- );
1158
- var ReadAction = ActionBase.extend(
1159
- z12.object({
1160
- type: z12.literal(ActionType.READ)
1161
- }).shape
1110
+ })
1162
1111
  );
1163
- var CustomAction = ActionBase.merge(
1164
- z12.object({
1165
- type: z12.literal(ActionType.CUSTOM),
1166
- customActionType: z12.string()
1112
+ var ReadAction = ActionBase.merge(
1113
+ import_zod12.z.object({
1114
+ type: import_zod12.z.literal(ActionType.READ)
1167
1115
  })
1168
1116
  );
1169
- var ActionDocument = z12.discriminatedUnion("type", [
1170
- CreatedAction.meta({ id: "CreatedAction" }),
1171
- RejectAction.meta({ id: "RejectAction" }),
1172
- DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
1173
- MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1174
- MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1175
- ArchiveAction.meta({ id: "ArchiveAction" }),
1176
- NotifiedAction.meta({ id: "NotifiedAction" }),
1177
- RegisterAction.meta({ id: "RegisterAction" }),
1178
- DeclareAction.meta({ id: "DeclareAction" }),
1179
- AssignedAction.meta({ id: "AssignedAction" }),
1180
- RequestedCorrectionAction.meta({ id: "RequestedCorrectionAction" }),
1181
- ApprovedCorrectionAction.meta({ id: "ApprovedCorrectionAction" }),
1182
- RejectedCorrectionAction.meta({ id: "RejectedCorrectionAction" }),
1183
- UnassignedAction.meta({ id: "UnassignedAction" }),
1184
- PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
1185
- ReadAction.meta({ id: "ReadAction" }),
1186
- EditAction.meta({ id: "EditAction" }),
1187
- CustomAction.meta({ id: "CustomAction" })
1188
- ]).meta({
1189
- id: "ActionDocument"
1117
+ var ActionDocument = import_zod12.z.discriminatedUnion("type", [
1118
+ CreatedAction.openapi({ ref: "CreatedAction" }),
1119
+ ValidateAction.openapi({ ref: "ValidateAction" }),
1120
+ RejectAction.openapi({ ref: "RejectAction" }),
1121
+ DuplicateDetectedAction.openapi({ ref: "DuplicateDetectedAction" }),
1122
+ MarkNotDuplicateAction.openapi({ ref: "MarkNotDuplicateAction" }),
1123
+ MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
1124
+ ArchiveAction.openapi({ ref: "ArchiveAction" }),
1125
+ NotifiedAction.openapi({ ref: "NotifiedAction" }),
1126
+ RegisterAction.openapi({ ref: "RegisterAction" }),
1127
+ DeclareAction.openapi({ ref: "DeclareAction" }),
1128
+ AssignedAction.openapi({ ref: "AssignedAction" }),
1129
+ RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
1130
+ ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
1131
+ RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
1132
+ UnassignedAction.openapi({ ref: "UnassignedAction" }),
1133
+ PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
1134
+ ReadAction.openapi({ ref: "ReadAction" })
1135
+ ]).openapi({
1136
+ ref: "ActionDocument"
1190
1137
  });
1191
1138
  var AsyncRejectActionDocument = ActionBase.omit({
1192
1139
  declaration: true,
1193
1140
  annotation: true
1194
- }).extend(
1195
- z12.object({
1196
- type: z12.enum(ConfirmableActions),
1197
- status: z12.literal(ActionStatus.Rejected)
1198
- }).shape
1141
+ }).merge(
1142
+ import_zod12.z.object({
1143
+ type: import_zod12.z.enum(ConfirmableActions),
1144
+ status: import_zod12.z.literal(ActionStatus.Rejected)
1145
+ })
1199
1146
  );
1200
- var Action = z12.union([ActionDocument, AsyncRejectActionDocument]);
1147
+ var Action = import_zod12.z.union([ActionDocument, AsyncRejectActionDocument]);
1201
1148
 
1202
- // ../commons/src/events/Flag.ts
1203
- var z13 = __toESM(require("zod/v4"));
1149
+ // ../commons/src/events/EventMetadata.ts
1150
+ var EventStatus = import_zod13.z.enum([
1151
+ "CREATED",
1152
+ "NOTIFIED",
1153
+ "DECLARED",
1154
+ "VALIDATED",
1155
+ "REGISTERED",
1156
+ "ARCHIVED"
1157
+ ]);
1204
1158
  var InherentFlags = {
1159
+ PENDING_CERTIFICATION: "pending-certification",
1205
1160
  INCOMPLETE: "incomplete",
1206
1161
  REJECTED: "rejected",
1207
1162
  CORRECTION_REQUESTED: "correction-requested",
1208
- POTENTIAL_DUPLICATE: "potential-duplicate",
1209
- /**
1210
- * This flag is set by the Edit-action and removed after the declaration or registration.
1211
- * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
1212
- *
1213
- * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
1214
- */
1215
- EDIT_IN_PROGRESS: "edit-in-progress"
1163
+ POTENTIAL_DUPLICATE: "potential-duplicate"
1216
1164
  };
1217
- var ActionFlag = z13.string().regex(
1165
+ var ActionFlag = import_zod13.z.string().regex(
1218
1166
  new RegExp(
1219
1167
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1220
1168
  ActionStatus
@@ -1222,90 +1170,59 @@ var ActionFlag = z13.string().regex(
1222
1170
  ),
1223
1171
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1224
1172
  );
1225
- var CustomFlag = z13.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1226
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1227
- InherentFlags
1228
- ).join(", ")}`
1229
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1230
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1231
- }).describe("Custom flag identifier defined by the country config.");
1232
- var Flag = ActionFlag.or(z13.enum(InherentFlags)).or(CustomFlag);
1233
- var FlagConfig = z13.object({
1234
- id: CustomFlag,
1235
- requiresAction: z13.boolean().describe(
1236
- "Indicates if this flag expects an action to be performed to be cleared."
1237
- ),
1238
- label: TranslationConfig.describe("Human readable label of the flag.")
1239
- });
1240
- var ActionFlagConfig = z13.object({
1241
- id: Flag,
1242
- operation: z13.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1243
- conditional: Conditional.optional().describe(
1244
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1245
- )
1246
- });
1247
-
1248
- // ../commons/src/events/EventMetadata.ts
1249
- var EventStatus = z14.enum([
1250
- "CREATED",
1251
- "NOTIFIED",
1252
- "DECLARED",
1253
- "REGISTERED",
1254
- "ARCHIVED"
1255
- ]);
1256
- var ZodDate = z14.iso.date();
1257
- var ActionCreationMetadata = z14.object({
1258
- createdAt: z14.iso.datetime().describe("The timestamp when the action request was created."),
1259
- createdBy: z14.string().describe("ID of the user who created the action request."),
1173
+ var Flag = ActionFlag.or(import_zod13.z.nativeEnum(InherentFlags));
1174
+ var ZodDate = import_zod13.z.string().date();
1175
+ var ActionCreationMetadata = import_zod13.z.object({
1176
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the action request was created."),
1177
+ createdBy: import_zod13.z.string().describe("ID of the user who created the action request."),
1260
1178
  createdAtLocation: CreatedAtLocation.describe(
1261
1179
  "Location of the user who created the action request."
1262
1180
  ),
1263
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1264
- acceptedAt: z14.iso.datetime().describe("Timestamp when the action request was accepted."),
1265
- createdByRole: z14.string().describe("Role of the user at the time of action request creation."),
1266
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the action request.")
1181
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1182
+ acceptedAt: import_zod13.z.string().datetime().describe("Timestamp when the action request was accepted."),
1183
+ createdByRole: import_zod13.z.string().describe("Role of the user at the time of action request creation."),
1184
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the action request.")
1267
1185
  });
1268
1186
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1269
- registrationNumber: z14.string().describe(
1187
+ registrationNumber: import_zod13.z.string().describe(
1270
1188
  "Registration number of the event. Always present for accepted registrations."
1271
1189
  )
1272
1190
  });
1273
- var LegalStatuses = z14.object({
1191
+ var LegalStatuses = import_zod13.z.object({
1274
1192
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1275
1193
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1276
1194
  });
1277
- var EventMetadata = z14.object({
1195
+ var EventMetadata = import_zod13.z.object({
1278
1196
  id: UUID,
1279
- type: z14.string().describe("The type of event, such as birth, death, or marriage."),
1197
+ type: import_zod13.z.string().describe("The type of event, such as birth, death, or marriage."),
1280
1198
  status: EventStatus,
1281
1199
  legalStatuses: LegalStatuses.describe(
1282
1200
  "Metadata related to the legal registration of the event, such as who registered it and when."
1283
1201
  ),
1284
- createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
1202
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the event was first created and saved."),
1285
1203
  dateOfEvent: ZodDate.nullish(),
1286
- placeOfEvent: CreatedAtLocation,
1287
- createdBy: z14.string().describe("ID of the user who created the event."),
1288
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1289
- updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
1204
+ createdBy: import_zod13.z.string().describe("ID of the user who created the event."),
1205
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1206
+ updatedByUserRole: import_zod13.z.string().describe("Role of the user who last changed the status."),
1290
1207
  createdAtLocation: CreatedAtLocation.describe(
1291
1208
  "Location of the user who created the event."
1292
1209
  ),
1293
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the event."),
1210
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the event."),
1294
1211
  updatedAtLocation: UUID.nullish().describe(
1295
1212
  "Location of the user who last changed the status."
1296
1213
  ),
1297
- updatedAt: z14.iso.datetime().describe(
1214
+ updatedAt: import_zod13.z.string().datetime().describe(
1298
1215
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1299
1216
  ),
1300
- assignedTo: z14.string().nullish().describe("ID of the user currently assigned to the event."),
1301
- updatedBy: z14.string().nullish().describe("ID of the user who last changed the status."),
1302
- trackingId: z14.string().describe(
1217
+ assignedTo: import_zod13.z.string().nullish().describe("ID of the user currently assigned to the event."),
1218
+ updatedBy: import_zod13.z.string().nullish().describe("ID of the user who last changed the status."),
1219
+ trackingId: import_zod13.z.string().describe(
1303
1220
  "System-generated tracking ID used by informants or registrars to look up the event."
1304
1221
  ),
1305
- potentialDuplicates: z14.array(PotentialDuplicate).describe(
1222
+ potentialDuplicates: import_zod13.z.array(PotentialDuplicate).describe(
1306
1223
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1307
1224
  ),
1308
- flags: z14.array(Flag)
1225
+ flags: import_zod13.z.array(Flag)
1309
1226
  });
1310
1227
  var EventMetadataKeysArray = [
1311
1228
  "id",
@@ -1313,7 +1230,6 @@ var EventMetadataKeysArray = [
1313
1230
  "status",
1314
1231
  "createdAt",
1315
1232
  "dateOfEvent",
1316
- "placeOfEvent",
1317
1233
  "createdBy",
1318
1234
  "createdByUserType",
1319
1235
  "updatedByUserRole",
@@ -1326,124 +1242,130 @@ var EventMetadataKeysArray = [
1326
1242
  "legalStatuses",
1327
1243
  "flags"
1328
1244
  ];
1329
- var EventMetadataKeys = z14.enum(EventMetadataKeysArray);
1245
+ var EventMetadataKeys = import_zod13.z.enum(EventMetadataKeysArray);
1330
1246
 
1331
1247
  // ../commons/src/events/EventIndex.ts
1248
+ var import_zod_openapi5 = require("zod-openapi");
1249
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod14.z);
1332
1250
  var EventIndex = EventMetadata.extend({
1333
1251
  declaration: EventState
1334
- }).meta({
1335
- id: "EventIndex"
1252
+ }).openapi({
1253
+ ref: "EventIndex"
1336
1254
  });
1337
- var EventSearchIndex = import_v4.z.record(import_v4.z.string(), import_v4.z.any()).and(
1338
- import_v4.z.object({
1339
- type: import_v4.z.string()
1255
+ var EventSearchIndex = import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()).and(
1256
+ import_zod14.z.object({
1257
+ type: import_zod14.z.string()
1340
1258
  // Ensures "type" (event-id) exists and is a string
1341
1259
  })
1342
- ).meta({
1343
- id: "EventSearchIndex"
1260
+ ).openapi({
1261
+ ref: "EventSearchIndex"
1344
1262
  });
1345
- var Fuzzy = import_v4.z.object({ type: import_v4.z.literal("fuzzy"), term: import_v4.z.string() }).meta({
1346
- id: "Fuzzy"
1263
+ var Fuzzy = import_zod14.z.object({ type: import_zod14.z.literal("fuzzy"), term: import_zod14.z.string() }).openapi({
1264
+ ref: "Fuzzy"
1347
1265
  });
1348
- var Exact = import_v4.z.object({ type: import_v4.z.literal("exact"), term: import_v4.z.string() }).meta({
1349
- id: "Exact"
1266
+ var Exact = import_zod14.z.object({ type: import_zod14.z.literal("exact"), term: import_zod14.z.string() }).openapi({
1267
+ ref: "Exact"
1350
1268
  });
1351
- var ExactStatus = import_v4.z.object({
1352
- type: import_v4.z.literal("exact"),
1269
+ var ExactStatus = import_zod14.z.object({
1270
+ type: import_zod14.z.literal("exact"),
1353
1271
  term: EventStatus
1354
- }).meta({
1355
- id: "ExactStatus"
1272
+ }).openapi({
1273
+ ref: "ExactStatus"
1356
1274
  });
1357
- var ExactUserType = import_v4.z.object({
1358
- type: import_v4.z.literal("exact"),
1275
+ var ExactUserType = import_zod14.z.object({
1276
+ type: import_zod14.z.literal("exact"),
1359
1277
  term: TokenUserType
1360
- }).meta({
1361
- id: "ExactUserType"
1362
- });
1363
- var AnyOf = import_v4.z.object({
1364
- type: import_v4.z.literal("anyOf"),
1365
- terms: import_v4.z.array(import_v4.z.string())
1366
- }).meta({
1367
- id: "AnyOf"
1368
- });
1369
- var AnyOfStatus = import_v4.z.object({
1370
- type: import_v4.z.literal("anyOf"),
1371
- terms: import_v4.z.array(EventStatus)
1372
- }).meta({
1373
- id: "AnyOfStatus"
1374
- });
1375
- var Range = import_v4.z.object({
1376
- type: import_v4.z.literal("range"),
1377
- gte: import_v4.z.string(),
1378
- lte: import_v4.z.string()
1379
- }).meta({
1380
- id: "Range"
1381
- });
1382
- var ContainsFlags = import_v4.z.object({
1383
- anyOf: import_v4.z.array(Flag).optional(),
1384
- noneOf: import_v4.z.array(Flag).optional()
1385
- }).meta({
1386
- id: "ContainsFlags"
1387
- });
1388
- var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1389
- id: "Within"
1390
- });
1391
- var RangeDate = import_v4.z.object({
1392
- type: import_v4.z.literal("range"),
1393
- gte: import_v4.z.iso.date().or(import_v4.z.iso.datetime()),
1394
- lte: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1395
- }).meta({ id: "RangeDate" });
1278
+ }).openapi({
1279
+ ref: "ExactUserType"
1280
+ });
1281
+ var AnyOf = import_zod14.z.object({
1282
+ type: import_zod14.z.literal("anyOf"),
1283
+ terms: import_zod14.z.array(import_zod14.z.string())
1284
+ }).openapi({
1285
+ ref: "AnyOf"
1286
+ });
1287
+ var AnyOfStatus = import_zod14.z.object({
1288
+ type: import_zod14.z.literal("anyOf"),
1289
+ terms: import_zod14.z.array(EventStatus)
1290
+ }).openapi({
1291
+ ref: "AnyOfStatus"
1292
+ });
1293
+ var Range = import_zod14.z.object({
1294
+ type: import_zod14.z.literal("range"),
1295
+ gte: import_zod14.z.string(),
1296
+ lte: import_zod14.z.string()
1297
+ }).openapi({
1298
+ ref: "Range"
1299
+ });
1300
+ var ContainsFlags = import_zod14.z.object({
1301
+ anyOf: import_zod14.z.array(Flag).optional(),
1302
+ noneOf: import_zod14.z.array(Flag).optional()
1303
+ }).openapi({
1304
+ ref: "ContainsFlags"
1305
+ });
1306
+ var Within = import_zod14.z.object({ type: import_zod14.z.literal("within"), location: import_zod14.z.string() }).openapi({
1307
+ ref: "Within"
1308
+ });
1309
+ var RangeDate = import_zod14.z.object({
1310
+ type: import_zod14.z.literal("range"),
1311
+ gte: import_zod14.z.string().date().or(import_zod14.z.string().datetime()),
1312
+ lte: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1313
+ }).openapi({ ref: "RangeDate" });
1396
1314
  var ExactDate = Exact.extend({
1397
- term: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1398
- }).meta({
1399
- id: "ExactDate"
1315
+ term: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1316
+ }).openapi({
1317
+ ref: "ExactDate"
1400
1318
  });
1401
- var TimePeriod = import_v4.z.object({
1402
- type: import_v4.z.literal("timePeriod"),
1319
+ var TimePeriod = import_zod14.z.object({
1320
+ type: import_zod14.z.literal("timePeriod"),
1403
1321
  term: SelectDateRangeValue
1404
- }).meta({
1405
- id: "TimePeriod"
1322
+ }).openapi({
1323
+ ref: "TimePeriod"
1406
1324
  });
1407
- var DateCondition = import_v4.z.union([ExactDate, RangeDate, TimePeriod]).meta({
1408
- id: "DateCondition"
1325
+ var DateCondition = import_zod14.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
1326
+ ref: "DateCondition"
1409
1327
  });
1410
- var QueryInput = import_v4.z.lazy(
1411
- () => import_v4.z.union([
1412
- import_v4.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1413
- import_v4.z.record(import_v4.z.string(), QueryInput)
1328
+ var QueryInput = import_zod14.z.lazy(
1329
+ () => import_zod14.z.union([
1330
+ import_zod14.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1331
+ import_zod14.z.record(import_zod14.z.string(), QueryInput)
1414
1332
  ])
1415
- ).meta({
1416
- id: "QueryInput"
1417
- });
1418
- var QueryExpression = import_v4.z.object({
1419
- id: import_v4.z.optional(import_v4.z.string()),
1420
- eventType: import_v4.z.string(),
1421
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
1422
- createdAt: import_v4.z.optional(DateCondition),
1423
- updatedAt: import_v4.z.optional(DateCondition),
1424
- "legalStatuses.REGISTERED.acceptedAt": import_v4.z.optional(DateCondition),
1425
- "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1426
- "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1427
- "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1428
- createdAtLocation: import_v4.z.optional(Within),
1429
- updatedAtLocation: import_v4.z.optional(Within),
1430
- assignedTo: import_v4.z.optional(Exact),
1431
- createdByUserType: import_v4.z.optional(ExactUserType),
1432
- createdBy: import_v4.z.optional(Exact),
1433
- updatedBy: import_v4.z.optional(Exact),
1434
- trackingId: import_v4.z.optional(Exact),
1435
- flags: import_v4.z.optional(ContainsFlags),
1333
+ ).openapi({
1334
+ ref: "QueryInput"
1335
+ });
1336
+ var QueryExpression = import_zod14.z.object({
1337
+ id: import_zod14.z.optional(import_zod14.z.string()),
1338
+ eventType: import_zod14.z.string(),
1339
+ status: import_zod14.z.optional(import_zod14.z.union([AnyOfStatus, ExactStatus])),
1340
+ createdAt: import_zod14.z.optional(DateCondition),
1341
+ updatedAt: import_zod14.z.optional(DateCondition),
1342
+ "legalStatuses.REGISTERED.acceptedAt": import_zod14.z.optional(DateCondition),
1343
+ "legalStatuses.DECLARED.createdAtLocation": import_zod14.z.optional(
1344
+ import_zod14.z.union([Within, Exact])
1345
+ ),
1346
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod14.z.optional(
1347
+ import_zod14.z.union([Within, Exact])
1348
+ ),
1349
+ "legalStatuses.REGISTERED.registrationNumber": import_zod14.z.optional(Exact),
1350
+ createdAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1351
+ updatedAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1352
+ assignedTo: import_zod14.z.optional(Exact),
1353
+ createdByUserType: import_zod14.z.optional(ExactUserType),
1354
+ createdBy: import_zod14.z.optional(Exact),
1355
+ updatedBy: import_zod14.z.optional(Exact),
1356
+ trackingId: import_zod14.z.optional(Exact),
1357
+ flags: import_zod14.z.optional(ContainsFlags),
1436
1358
  // @todo: The type for this comes out as "any"
1437
1359
  data: QueryInput
1438
1360
  }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
1439
- error: "At least one query field must be specified."
1440
- }).meta({
1441
- id: "QueryExpression"
1442
- });
1443
- var QueryType = import_v4.z.lazy(
1444
- () => import_v4.z.object({
1445
- type: import_v4.z.literal("and").or(import_v4.z.literal("or")).meta({ default: "and" }),
1446
- clauses: import_v4.z.array(import_v4.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").meta({
1361
+ message: "At least one query field must be specified."
1362
+ }).openapi({
1363
+ ref: "QueryExpression"
1364
+ });
1365
+ var QueryType = import_zod14.z.lazy(
1366
+ () => import_zod14.z.object({
1367
+ type: import_zod14.z.literal("and").or(import_zod14.z.literal("or")).openapi({ default: "and" }),
1368
+ clauses: import_zod14.z.array(import_zod14.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").openapi({
1447
1369
  default: [
1448
1370
  {
1449
1371
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -1461,8 +1383,8 @@ var QueryType = import_v4.z.lazy(
1461
1383
  ]
1462
1384
  })
1463
1385
  })
1464
- ).meta({
1465
- id: "QueryType"
1386
+ ).openapi({
1387
+ ref: "QueryType"
1466
1388
  });
1467
1389
  function parseStringifiedQueryField(val) {
1468
1390
  if (typeof val === "string") {
@@ -1470,8 +1392,8 @@ function parseStringifiedQueryField(val) {
1470
1392
  }
1471
1393
  return val;
1472
1394
  }
1473
- var SearchQuery = import_v4.z.object({
1474
- query: import_v4.z.preprocess(parseStringifiedQueryField, QueryType).meta({
1395
+ var SearchQuery = import_zod14.z.object({
1396
+ query: import_zod14.z.preprocess(parseStringifiedQueryField, QueryType).openapi({
1475
1397
  default: {
1476
1398
  type: "and",
1477
1399
  clauses: [
@@ -1491,193 +1413,199 @@ var SearchQuery = import_v4.z.object({
1491
1413
  ]
1492
1414
  }
1493
1415
  }),
1494
- limit: import_v4.z.number().optional().default(100),
1495
- offset: import_v4.z.number().optional().default(0),
1496
- sort: import_v4.z.preprocess(
1416
+ limit: import_zod14.z.number().optional().default(100),
1417
+ offset: import_zod14.z.number().optional().default(0),
1418
+ sort: import_zod14.z.preprocess(
1497
1419
  parseStringifiedQueryField,
1498
- import_v4.z.array(
1499
- import_v4.z.object({
1500
- field: import_v4.z.string(),
1501
- direction: import_v4.z.enum(["asc", "desc"]).default("asc")
1420
+ import_zod14.z.array(
1421
+ import_zod14.z.object({
1422
+ field: import_zod14.z.string(),
1423
+ direction: import_zod14.z.enum(["asc", "desc"]).default("asc")
1502
1424
  })
1503
1425
  )
1504
1426
  ).optional()
1505
- }).meta({
1506
- id: "SearchQuery"
1427
+ }).openapi({
1428
+ ref: "SearchQuery"
1507
1429
  });
1508
1430
 
1509
1431
  // ../commons/src/events/serializers/date/serializer.ts
1510
- var import_zod = require("zod");
1511
- var SerializedNowDateTime = import_zod.z.object({
1512
- $$now: import_zod.z.literal(true)
1432
+ var import_zod15 = require("zod");
1433
+ var SerializedNowDateTime = import_zod15.z.object({
1434
+ $$now: import_zod15.z.literal(true)
1513
1435
  });
1514
1436
  function todayDateTimeValueSerializer() {
1515
1437
  return { $$now: true };
1516
1438
  }
1517
1439
 
1518
1440
  // ../commons/src/events/FieldConfig.ts
1519
- var FieldId = z17.string().superRefine((val, ctx) => {
1520
- if (val.includes("_")) {
1521
- ctx.addIssue({
1522
- code: z17.ZodIssueCode.custom,
1523
- message: `id: '${val}' must not contain underscores '_'`
1524
- });
1525
- }
1526
- }).describe("Unique identifier for the field");
1527
- var FieldReference = z17.object({
1441
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod16.z);
1442
+ var FieldId = import_zod16.z.string().refine(
1443
+ /*
1444
+ * Disallow underscores '_' in field ids.
1445
+ * Why? Theres two reasons:
1446
+ * 1. We transform dots to underscores as separator in Formik field ids, so this avoids any issues with the Formik transformations.
1447
+ * 2. On Kysely-SQL queries, we use the CamelCasePlugin. This plugin transforms snake_case to camelCase also on nested (jsonb) object keys.
1448
+ * This could be disabled via 'maintainNestedObjectKeys: true', but this would also affect SQL queries which use e.g. json_agg() or to_jsonb() to aggregate results.
1449
+ */
1450
+ (val) => !val.includes("_"),
1451
+ (val) => ({
1452
+ message: `id: '${val}' must not contain underscores '_'`
1453
+ })
1454
+ ).describe("Unique identifier for the field");
1455
+ var FieldReference = import_zod16.z.object({
1528
1456
  $$field: FieldId,
1529
- $$subfield: z17.array(z17.string()).optional().describe(
1457
+ $$subfield: import_zod16.z.array(import_zod16.z.string()).optional().describe(
1530
1458
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1531
1459
  )
1532
1460
  }).describe("Reference to a field by its ID");
1533
- var ValidationConfig = z17.object({
1461
+ var ValidationConfig = import_zod16.z.object({
1534
1462
  validator: Conditional,
1535
1463
  message: TranslationConfig
1536
1464
  });
1537
- var requiredSchema = z17.union([
1538
- z17.boolean(),
1539
- z17.object({
1465
+ var requiredSchema = import_zod16.z.union([
1466
+ import_zod16.z.boolean(),
1467
+ import_zod16.z.object({
1540
1468
  message: TranslationConfig.describe("Custom required validation message")
1541
1469
  })
1542
1470
  ]).default(false).optional();
1543
- var BaseField = z17.object({
1471
+ var BaseField = import_zod16.z.object({
1544
1472
  id: FieldId.describe("Unique identifier of the field."),
1545
1473
  label: TranslationConfig.describe("Human-readable label of the field."),
1546
- parent: FieldReference.or(z17.array(FieldReference)).optional().describe(
1474
+ parent: FieldReference.or(import_zod16.z.array(FieldReference)).optional().describe(
1547
1475
  "Reference to the parent field or fields. When a parent field changes, this field is reset."
1548
1476
  ),
1549
1477
  required: requiredSchema.describe(
1550
1478
  "Indicates whether the field is mandatory."
1551
1479
  ),
1552
- conditionals: z17.array(FieldConditional).default([]).optional().describe(
1480
+ conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
1553
1481
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1554
1482
  ),
1555
- secured: z17.boolean().default(false).optional().describe(
1483
+ secured: import_zod16.z.boolean().default(false).optional().describe(
1556
1484
  "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1557
1485
  ),
1558
1486
  placeholder: TranslationConfig.optional(),
1559
- validation: z17.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1487
+ validation: import_zod16.z.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1560
1488
  helperText: TranslationConfig.optional(),
1561
- hideLabel: z17.boolean().default(false).optional(),
1562
- uncorrectable: z17.boolean().default(false).optional().describe(
1489
+ hideLabel: import_zod16.z.boolean().default(false).optional(),
1490
+ uncorrectable: import_zod16.z.boolean().default(false).optional().describe(
1563
1491
  "Indicates whether the field can be modified during record correction."
1564
1492
  ),
1565
- value: FieldReference.or(z17.array(FieldReference)).optional().describe(
1493
+ value: FieldReference.or(import_zod16.z.array(FieldReference)).optional().describe(
1566
1494
  "Reference to the source field or fields. When a value is defined, it is copied from the parent field when changed. If multiple references are provided, the first truthy value is used."
1567
1495
  ),
1568
- analytics: z17.boolean().default(false).optional().describe(
1496
+ analytics: import_zod16.z.boolean().default(false).optional().describe(
1569
1497
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
1570
1498
  )
1571
1499
  }).describe("Common properties shared across all field types.");
1572
1500
  var Divider = BaseField.extend({
1573
- type: z17.literal(FieldType.DIVIDER)
1501
+ type: import_zod16.z.literal(FieldType.DIVIDER)
1574
1502
  });
1575
1503
  var TextField = BaseField.extend({
1576
- type: z17.literal(FieldType.TEXT),
1577
- defaultValue: z17.union([NonEmptyTextValue, SerializedUserField]).optional(),
1578
- configuration: z17.object({
1579
- maxLength: z17.number().optional().describe("Maximum length of the text"),
1580
- type: z17.enum(["text", "password"]).optional(),
1504
+ type: import_zod16.z.literal(FieldType.TEXT),
1505
+ defaultValue: import_zod16.z.union([NonEmptyTextValue, SerializedUserField]).optional(),
1506
+ configuration: import_zod16.z.object({
1507
+ maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1508
+ type: import_zod16.z.enum(["text", "password"]).optional(),
1581
1509
  prefix: TranslationConfig.optional(),
1582
1510
  postfix: TranslationConfig.optional()
1583
1511
  }).default({ type: "text" }).optional()
1584
1512
  }).describe("Text input");
1585
1513
  var NumberField = BaseField.extend({
1586
- type: z17.literal(FieldType.NUMBER),
1514
+ type: import_zod16.z.literal(FieldType.NUMBER),
1587
1515
  defaultValue: NumberFieldValue.optional(),
1588
- configuration: z17.object({
1589
- min: z17.number().optional().describe("Minimum value"),
1590
- max: z17.number().optional().describe("Maximum value"),
1516
+ configuration: import_zod16.z.object({
1517
+ min: import_zod16.z.number().optional().describe("Minimum value"),
1518
+ max: import_zod16.z.number().optional().describe("Maximum value"),
1591
1519
  prefix: TranslationConfig.optional(),
1592
1520
  postfix: TranslationConfig.optional()
1593
1521
  }).optional()
1594
1522
  }).describe("Number input");
1595
1523
  var TextAreaField = BaseField.extend({
1596
- type: z17.literal(FieldType.TEXTAREA),
1524
+ type: import_zod16.z.literal(FieldType.TEXTAREA),
1597
1525
  defaultValue: NonEmptyTextValue.optional(),
1598
- configuration: z17.object({
1599
- maxLength: z17.number().optional().describe("Maximum length of the text"),
1600
- rows: z17.number().optional().describe("Number of visible text lines"),
1601
- cols: z17.number().optional().describe("Number of visible columns"),
1526
+ configuration: import_zod16.z.object({
1527
+ maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1528
+ rows: import_zod16.z.number().optional().describe("Number of visible text lines"),
1529
+ cols: import_zod16.z.number().optional().describe("Number of visible columns"),
1602
1530
  prefix: TranslationConfig.optional(),
1603
1531
  postfix: TranslationConfig.optional()
1604
1532
  }).default({ rows: 4 }).optional()
1605
1533
  }).describe("Multiline text input");
1606
- var ImageMimeType = z17.enum([
1534
+ var ImageMimeType = import_zod16.z.enum([
1607
1535
  "image/png",
1608
1536
  "image/jpg",
1609
1537
  "image/jpeg",
1610
1538
  "image/svg+xml"
1611
1539
  ]);
1612
- var DocumentMimeType = z17.enum([
1540
+ var DocumentMimeType = import_zod16.z.enum([
1613
1541
  "application/pdf",
1614
1542
  "application/msword",
1615
1543
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1616
1544
  "application/vnd.oasis.opendocument.text"
1617
1545
  ]);
1618
- var MimeType = z17.enum([
1546
+ var MimeType = import_zod16.z.enum([
1619
1547
  ...ImageMimeType.options,
1620
1548
  ...DocumentMimeType.options
1621
1549
  ]);
1622
1550
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
1623
1551
  var SignatureField = BaseField.extend({
1624
- type: z17.literal(FieldType.SIGNATURE),
1552
+ type: import_zod16.z.literal(FieldType.SIGNATURE),
1625
1553
  signaturePromptLabel: TranslationConfig.describe(
1626
1554
  "Title of the signature modal"
1627
1555
  ),
1628
1556
  defaultValue: SignatureFieldValue.optional(),
1629
- configuration: z17.object({
1630
- maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1557
+ configuration: import_zod16.z.object({
1558
+ maxFileSize: import_zod16.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1631
1559
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1632
1560
  }).default({
1633
1561
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1634
1562
  })
1635
1563
  }).describe("Signature input field");
1636
1564
  var EmailField = BaseField.extend({
1637
- type: z17.literal(FieldType.EMAIL),
1638
- configuration: z17.object({
1639
- maxLength: z17.number().optional().describe("Maximum length of the text")
1640
- }).default({ maxLength: 255 }).optional(),
1565
+ type: import_zod16.z.literal(FieldType.EMAIL),
1566
+ configuration: import_zod16.z.object({
1567
+ maxLength: import_zod16.z.number().optional().describe("Maximum length of the text")
1568
+ }).default({ maxLength: 10 }).optional(),
1641
1569
  defaultValue: NonEmptyTextValue.optional()
1642
1570
  });
1643
1571
  var DateField = BaseField.extend({
1644
- type: z17.literal(FieldType.DATE),
1645
- defaultValue: SerializedNowDateTime.or(DateValue).optional().describe("Default date value(yyyy-MM-dd)"),
1646
- configuration: z17.object({
1572
+ type: import_zod16.z.literal(FieldType.DATE),
1573
+ defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
1574
+ configuration: import_zod16.z.object({
1647
1575
  notice: TranslationConfig.describe(
1648
1576
  "Text to display above the date input"
1649
1577
  ).optional()
1650
1578
  }).optional()
1651
1579
  }).describe("A single date input (yyyy-MM-dd)");
1652
1580
  var AgeField = BaseField.extend({
1653
- type: z17.literal(FieldType.AGE),
1581
+ type: import_zod16.z.literal(FieldType.AGE),
1654
1582
  defaultValue: NumberFieldValue.optional(),
1655
- configuration: z17.object({
1583
+ configuration: import_zod16.z.object({
1656
1584
  asOfDate: FieldReference,
1657
1585
  prefix: TranslationConfig.optional(),
1658
1586
  postfix: TranslationConfig.optional()
1659
1587
  })
1660
1588
  }).describe("An age input field which uses the current date as the asOfDate");
1661
1589
  var TimeField = BaseField.extend({
1662
- type: z17.literal(FieldType.TIME),
1663
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().describe("Default time value (HH-mm)"),
1664
- configuration: z17.object({
1665
- use12HourFormat: z17.boolean().optional().describe("Whether to use 12-hour format"),
1590
+ type: import_zod16.z.literal(FieldType.TIME),
1591
+ defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1592
+ configuration: import_zod16.z.object({
1593
+ use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
1666
1594
  notice: TranslationConfig.describe(
1667
1595
  "Text to display above the time input"
1668
1596
  ).optional()
1669
1597
  }).optional()
1670
1598
  }).describe("A single date input (HH-mm)");
1671
1599
  var DateRangeField = BaseField.extend({
1672
- type: z17.literal(FieldType.DATE_RANGE),
1600
+ type: import_zod16.z.literal(FieldType.DATE_RANGE),
1673
1601
  defaultValue: DateRangeFieldValue.optional(),
1674
- configuration: z17.object({
1602
+ configuration: import_zod16.z.object({
1675
1603
  notice: TranslationConfig.describe(
1676
1604
  "Text to display above the date input"
1677
1605
  ).optional()
1678
1606
  }).optional()
1679
1607
  }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1680
- var HtmlFontVariant = z17.enum([
1608
+ var HtmlFontVariant = import_zod16.z.enum([
1681
1609
  "reg12",
1682
1610
  "reg14",
1683
1611
  "reg16",
@@ -1687,34 +1615,34 @@ var HtmlFontVariant = z17.enum([
1687
1615
  "h2",
1688
1616
  "h1"
1689
1617
  ]);
1690
- var ParagraphConfiguration = z17.object({
1691
- styles: z17.object({
1618
+ var ParagraphConfiguration = import_zod16.z.object({
1619
+ styles: import_zod16.z.object({
1692
1620
  fontVariant: HtmlFontVariant.optional().describe(
1693
1621
  "Font variant to use for the paragraph text"
1694
1622
  ),
1695
- hint: z17.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
1623
+ hint: import_zod16.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
1696
1624
  }).optional()
1697
1625
  }).default({});
1698
1626
  var Paragraph = BaseField.extend({
1699
- type: z17.literal(FieldType.PARAGRAPH),
1627
+ type: import_zod16.z.literal(FieldType.PARAGRAPH),
1700
1628
  defaultValue: NonEmptyTextValue.optional(),
1701
1629
  configuration: ParagraphConfiguration
1702
1630
  }).describe("A read-only HTML <p> paragraph");
1703
1631
  var PageHeader = BaseField.extend({
1704
- type: z17.literal(FieldType.PAGE_HEADER),
1632
+ type: import_zod16.z.literal(FieldType.PAGE_HEADER),
1705
1633
  defaultValue: NonEmptyTextValue.optional()
1706
1634
  }).describe("A read-only header component for form pages");
1707
1635
  var File = BaseField.extend({
1708
- type: z17.literal(FieldType.FILE),
1636
+ type: import_zod16.z.literal(FieldType.FILE),
1709
1637
  defaultValue: FileFieldValue.optional(),
1710
- configuration: z17.object({
1711
- maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1638
+ configuration: import_zod16.z.object({
1639
+ maxFileSize: import_zod16.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1712
1640
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
1713
- maxImageSize: z17.object({
1714
- targetSize: z17.object({ width: z17.number(), height: z17.number() })
1641
+ maxImageSize: import_zod16.z.object({
1642
+ targetSize: import_zod16.z.object({ width: import_zod16.z.number(), height: import_zod16.z.number() })
1715
1643
  }).optional(),
1716
- style: z17.object({
1717
- width: z17.enum(["full", "auto"]).optional().describe(
1644
+ style: import_zod16.z.object({
1645
+ width: import_zod16.z.enum(["full", "auto"]).optional().describe(
1718
1646
  "Whether the file upload button should take the full width of the container or not"
1719
1647
  )
1720
1648
  }).optional(),
@@ -1723,46 +1651,46 @@ var File = BaseField.extend({
1723
1651
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1724
1652
  })
1725
1653
  }).describe("File upload");
1726
- var SelectOption = z17.object({
1727
- value: z17.string().describe("The value of the option"),
1728
- label: z17.union([z17.string(), TranslationConfig]).describe("The label of the option")
1654
+ var SelectOption = import_zod16.z.object({
1655
+ value: import_zod16.z.string().describe("The value of the option"),
1656
+ label: import_zod16.z.union([import_zod16.z.string(), TranslationConfig]).describe("The label of the option")
1729
1657
  });
1730
1658
  var NumberWithUnitField = BaseField.extend({
1731
- type: z17.literal(FieldType.NUMBER_WITH_UNIT),
1659
+ type: import_zod16.z.literal(FieldType.NUMBER_WITH_UNIT),
1732
1660
  defaultValue: NumberWithUnitFieldValue.optional(),
1733
- options: z17.array(SelectOption).describe("A list of options for the unit select"),
1734
- configuration: z17.object({
1735
- min: z17.number().optional().describe("Minimum value of the number field"),
1736
- max: z17.number().optional().describe("Maximum value of the number field"),
1661
+ options: import_zod16.z.array(SelectOption).describe("A list of options for the unit select"),
1662
+ configuration: import_zod16.z.object({
1663
+ min: import_zod16.z.number().optional().describe("Minimum value of the number field"),
1664
+ max: import_zod16.z.number().optional().describe("Maximum value of the number field"),
1737
1665
  numberFieldPlaceholder: TranslationConfig.optional().describe(
1738
1666
  "Placeholder for the number field"
1739
1667
  )
1740
1668
  }).optional()
1741
1669
  }).describe("Number with unit input");
1742
1670
  var RadioGroup = BaseField.extend({
1743
- type: z17.literal(FieldType.RADIO_GROUP),
1671
+ type: import_zod16.z.literal(FieldType.RADIO_GROUP),
1744
1672
  defaultValue: TextValue.optional(),
1745
- options: z17.array(SelectOption).describe("A list of options"),
1746
- configuration: z17.object({
1747
- styles: z17.object({
1748
- size: z17.enum(["NORMAL", "LARGE"]).optional()
1673
+ options: import_zod16.z.array(SelectOption).describe("A list of options"),
1674
+ configuration: import_zod16.z.object({
1675
+ styles: import_zod16.z.object({
1676
+ size: import_zod16.z.enum(["NORMAL", "LARGE"]).optional()
1749
1677
  }).optional()
1750
1678
  }).optional()
1751
1679
  }).describe("Grouped radio options");
1752
1680
  var BulletList = BaseField.extend({
1753
- type: z17.literal(FieldType.BULLET_LIST),
1681
+ type: import_zod16.z.literal(FieldType.BULLET_LIST),
1754
1682
  defaultValue: TextValue.optional(),
1755
- items: z17.array(TranslationConfig).describe("A list of items"),
1756
- configuration: z17.object({
1757
- styles: z17.object({
1683
+ items: import_zod16.z.array(TranslationConfig).describe("A list of items"),
1684
+ configuration: import_zod16.z.object({
1685
+ styles: import_zod16.z.object({
1758
1686
  fontVariant: HtmlFontVariant.optional()
1759
1687
  }).optional()
1760
1688
  }).default({})
1761
1689
  }).describe("A list of bullet points");
1762
1690
  var Select = BaseField.extend({
1763
- type: z17.literal(FieldType.SELECT),
1691
+ type: import_zod16.z.literal(FieldType.SELECT),
1764
1692
  defaultValue: TextValue.optional(),
1765
- options: z17.array(SelectOption).describe("A list of options"),
1693
+ options: import_zod16.z.array(SelectOption).describe("A list of options"),
1766
1694
  noOptionsMessage: TranslationConfig.optional().describe(
1767
1695
  `
1768
1696
  A translation configuration object used to display a message when no options are available.
@@ -1774,34 +1702,34 @@ var Select = BaseField.extend({
1774
1702
  `
1775
1703
  )
1776
1704
  }).describe("Select input");
1777
- var SelectDateRangeOption = z17.object({
1705
+ var SelectDateRangeOption = import_zod16.z.object({
1778
1706
  value: SelectDateRangeValue.describe("The value of the option"),
1779
1707
  label: TranslationConfig.describe("The label of the option")
1780
1708
  });
1781
1709
  var SelectDateRangeField = BaseField.extend({
1782
- type: z17.literal(FieldType.SELECT_DATE_RANGE),
1710
+ type: import_zod16.z.literal(FieldType.SELECT_DATE_RANGE),
1783
1711
  defaultValue: SelectDateRangeValue.optional(),
1784
- options: z17.array(SelectDateRangeOption).describe("A list of options")
1712
+ options: import_zod16.z.array(SelectDateRangeOption).describe("A list of options")
1785
1713
  }).describe("Select input with date range options");
1786
- var NameConfig = z17.object({
1787
- firstname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1788
- middlename: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1789
- surname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
1714
+ var NameConfig = import_zod16.z.object({
1715
+ firstname: import_zod16.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1716
+ middlename: import_zod16.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1717
+ surname: import_zod16.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
1790
1718
  });
1791
1719
  var NameField = BaseField.extend({
1792
- type: z17.literal(FieldType.NAME),
1793
- defaultValue: z17.object({
1720
+ type: import_zod16.z.literal(FieldType.NAME),
1721
+ defaultValue: import_zod16.z.object({
1794
1722
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1795
1723
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1796
1724
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1797
1725
  }).optional(),
1798
- configuration: z17.object({
1726
+ configuration: import_zod16.z.object({
1799
1727
  name: NameConfig.default({
1800
1728
  firstname: { required: true },
1801
1729
  surname: { required: true }
1802
1730
  }).optional(),
1803
- order: z17.array(z17.enum(["firstname", "middlename", "surname"])).optional(),
1804
- maxLength: z17.number().optional().describe("Maximum length of the text"),
1731
+ order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
1732
+ maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1805
1733
  prefix: TranslationConfig.optional(),
1806
1734
  postfix: TranslationConfig.optional()
1807
1735
  }).default({
@@ -1813,51 +1741,51 @@ var NameField = BaseField.extend({
1813
1741
  }).describe("Name input field");
1814
1742
  var PhoneField = BaseField.extend({
1815
1743
  defaultValue: NonEmptyTextValue.optional(),
1816
- type: z17.literal(FieldType.PHONE)
1744
+ type: import_zod16.z.literal(FieldType.PHONE)
1817
1745
  }).describe("Phone input field");
1818
1746
  var IdField = BaseField.extend({
1819
1747
  defaultValue: NonEmptyTextValue.optional(),
1820
- type: z17.literal(FieldType.ID)
1748
+ type: import_zod16.z.literal(FieldType.ID)
1821
1749
  }).describe("ID input field");
1822
1750
  var Checkbox = BaseField.extend({
1823
- type: z17.literal(FieldType.CHECKBOX),
1751
+ type: import_zod16.z.literal(FieldType.CHECKBOX),
1824
1752
  defaultValue: CheckboxFieldValue.default(false)
1825
1753
  }).describe("Boolean checkbox field");
1826
1754
  var Country = BaseField.extend({
1827
- type: z17.literal(FieldType.COUNTRY),
1755
+ type: import_zod16.z.literal(FieldType.COUNTRY),
1828
1756
  defaultValue: NonEmptyTextValue.optional()
1829
1757
  }).describe("Country select field");
1830
- var AdministrativeAreas = z17.enum([
1758
+ var AdministrativeAreas = import_zod16.z.enum([
1831
1759
  "ADMIN_STRUCTURE",
1832
1760
  "HEALTH_FACILITY",
1833
1761
  "CRVS_OFFICE"
1834
1762
  ]);
1835
- var AdministrativeAreaConfiguration = z17.object({
1836
- partOf: z17.object({
1837
- $declaration: z17.string()
1763
+ var AdministrativeAreaConfiguration = import_zod16.z.object({
1764
+ partOf: import_zod16.z.object({
1765
+ $declaration: import_zod16.z.string()
1838
1766
  }).optional().describe("Parent location"),
1839
1767
  type: AdministrativeAreas
1840
1768
  }).describe("Administrative area options");
1841
- var AdministrativeAreaField = BaseField.extend({
1842
- type: z17.literal(FieldType.ADMINISTRATIVE_AREA),
1769
+ var AdministrativeArea = BaseField.extend({
1770
+ type: import_zod16.z.literal(FieldType.ADMINISTRATIVE_AREA),
1843
1771
  defaultValue: NonEmptyTextValue.optional(),
1844
1772
  configuration: AdministrativeAreaConfiguration
1845
1773
  }).describe("Administrative area input field e.g. facility, office");
1846
1774
  var LocationInput = BaseField.extend({
1847
- type: z17.literal(FieldType.LOCATION),
1775
+ type: import_zod16.z.literal(FieldType.LOCATION),
1848
1776
  defaultValue: NonEmptyTextValue.optional(),
1849
- configuration: z17.object({
1850
- searchableResource: z17.array(z17.enum(["locations", "facilities", "offices"]))
1777
+ configuration: import_zod16.z.object({
1778
+ searchableResource: import_zod16.z.array(import_zod16.z.enum(["locations", "facilities", "offices"]))
1851
1779
  })
1852
1780
  }).describe("Input field for a location");
1853
1781
  var FileUploadWithOptions = BaseField.extend({
1854
- type: z17.literal(FieldType.FILE_WITH_OPTIONS),
1855
- options: z17.array(SelectOption).describe("A list of options"),
1782
+ type: import_zod16.z.literal(FieldType.FILE_WITH_OPTIONS),
1783
+ options: import_zod16.z.array(SelectOption).describe("A list of options"),
1856
1784
  defaultValue: FileFieldWithOptionValue.optional(),
1857
- configuration: z17.object({
1858
- maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1859
- maxImageSize: z17.object({
1860
- targetSize: z17.object({ width: z17.number(), height: z17.number() })
1785
+ configuration: import_zod16.z.object({
1786
+ maxFileSize: import_zod16.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1787
+ maxImageSize: import_zod16.z.object({
1788
+ targetSize: import_zod16.z.object({ width: import_zod16.z.number(), height: import_zod16.z.number() })
1861
1789
  }).optional(),
1862
1790
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1863
1791
  }).default({
@@ -1865,93 +1793,93 @@ var FileUploadWithOptions = BaseField.extend({
1865
1793
  })
1866
1794
  });
1867
1795
  var Facility = BaseField.extend({
1868
- type: z17.literal(FieldType.FACILITY),
1796
+ type: import_zod16.z.literal(FieldType.FACILITY),
1869
1797
  defaultValue: NonEmptyTextValue.optional()
1870
1798
  }).describe("Input field for a facility");
1871
1799
  var Office = BaseField.extend({
1872
- type: z17.literal(FieldType.OFFICE),
1800
+ type: import_zod16.z.literal(FieldType.OFFICE),
1873
1801
  defaultValue: NonEmptyTextValue.optional()
1874
1802
  }).describe("Input field for an office");
1875
1803
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
1876
- administrativeArea: z17.union([UUID, SerializedUserField]).optional()
1804
+ administrativeArea: import_zod16.z.union([UUID, SerializedUserField]).optional()
1877
1805
  });
1878
1806
  var Address = BaseField.extend({
1879
- type: z17.literal(FieldType.ADDRESS),
1880
- configuration: z17.object({
1881
- lineSeparator: z17.string().optional(),
1882
- fields: z17.array(z17.enum(["country", "administrativeArea"])).optional(),
1883
- administrativeLevels: z17.array(z17.string()).optional(),
1884
- streetAddressForm: z17.array(
1885
- z17.object({
1886
- id: z17.string(),
1807
+ type: import_zod16.z.literal(FieldType.ADDRESS),
1808
+ configuration: import_zod16.z.object({
1809
+ lineSeparator: import_zod16.z.string().optional(),
1810
+ fields: import_zod16.z.array(import_zod16.z.enum(["country", "administrativeArea"])).optional(),
1811
+ administrativeLevels: import_zod16.z.array(import_zod16.z.string()).optional(),
1812
+ streetAddressForm: import_zod16.z.array(
1813
+ import_zod16.z.object({
1814
+ id: import_zod16.z.string(),
1887
1815
  required: requiredSchema,
1888
1816
  label: TranslationConfig,
1889
- type: z17.literal(FieldType.TEXT),
1890
- conditionals: z17.array(FieldConditional).default([]).optional(),
1817
+ type: import_zod16.z.literal(FieldType.TEXT),
1818
+ conditionals: import_zod16.z.array(FieldConditional).default([]).optional(),
1891
1819
  parent: FieldReference.optional()
1892
1820
  })
1893
1821
  ).optional()
1894
1822
  }).optional(),
1895
1823
  defaultValue: DefaultAddressFieldValue.optional()
1896
1824
  }).describe("Address input field \u2013 a combination of location and text fields");
1897
- var StaticDataEntry = z17.object({
1898
- id: z17.string().describe("ID for the data entry."),
1825
+ var StaticDataEntry = import_zod16.z.object({
1826
+ id: import_zod16.z.string().describe("ID for the data entry."),
1899
1827
  label: TranslationConfig,
1900
- value: TranslationConfig.or(z17.string()).or(FieldReference)
1828
+ value: TranslationConfig.or(import_zod16.z.string()).or(FieldReference)
1901
1829
  }).describe("Static data entry");
1902
- var DataEntry = z17.union([StaticDataEntry, z17.object({ fieldId: z17.string() })]).describe(
1830
+ var DataEntry = import_zod16.z.union([StaticDataEntry, import_zod16.z.object({ fieldId: import_zod16.z.string() })]).describe(
1903
1831
  "Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
1904
1832
  );
1905
1833
  var DataField = BaseField.extend({
1906
- type: z17.literal(FieldType.DATA),
1907
- configuration: z17.object({
1834
+ type: import_zod16.z.literal(FieldType.DATA),
1835
+ configuration: import_zod16.z.object({
1908
1836
  subtitle: TranslationConfig.optional(),
1909
- data: z17.array(DataEntry)
1837
+ data: import_zod16.z.array(DataEntry)
1910
1838
  })
1911
1839
  }).describe("Data field for displaying read-only data");
1912
1840
  var ButtonField = BaseField.extend({
1913
- type: z17.literal(FieldType.BUTTON),
1841
+ type: import_zod16.z.literal(FieldType.BUTTON),
1914
1842
  defaultValue: ButtonFieldValue.optional(),
1915
- configuration: z17.object({
1916
- icon: z17.string().optional().describe(
1843
+ configuration: import_zod16.z.object({
1844
+ icon: import_zod16.z.string().optional().describe(
1917
1845
  "Icon for the button. You can find icons from OpenCRVS UI-Kit."
1918
1846
  ),
1919
- loading: z17.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1847
+ loading: import_zod16.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1920
1848
  text: TranslationConfig.describe("Text to display on the button")
1921
1849
  })
1922
1850
  }).describe("Generic button without any built-in functionality");
1923
1851
  var AlphaPrintButton = BaseField.extend({
1924
- type: z17.literal(FieldType.ALPHA_PRINT_BUTTON),
1925
- configuration: z17.object({
1926
- template: z17.string().describe("Template ID from countryconfig templates to use for printing"),
1852
+ type: import_zod16.z.literal(FieldType.ALPHA_PRINT_BUTTON),
1853
+ configuration: import_zod16.z.object({
1854
+ template: import_zod16.z.string().describe("Template ID from countryconfig templates to use for printing"),
1927
1855
  buttonLabel: TranslationConfig.optional().describe(
1928
1856
  "Label for the print button"
1929
1857
  )
1930
1858
  })
1931
1859
  }).describe("Print button field for printing certificates");
1932
1860
  var HttpField = BaseField.extend({
1933
- type: z17.literal(FieldType.HTTP),
1861
+ type: import_zod16.z.literal(FieldType.HTTP),
1934
1862
  defaultValue: HttpFieldValue.optional(),
1935
- configuration: z17.object({
1863
+ configuration: import_zod16.z.object({
1936
1864
  trigger: FieldReference,
1937
- url: z17.string().describe("URL to send the HTTP request to"),
1938
- method: z17.enum(["GET", "POST", "PUT", "DELETE"]),
1939
- headers: z17.record(z17.string(), z17.string()).optional(),
1940
- body: z17.record(z17.string(), z17.any()).optional(),
1941
- errorValue: z17.any().optional().describe("Value to set if the request fails"),
1942
- params: z17.record(z17.string(), z17.union([z17.string(), FieldReference])).optional(),
1943
- timeout: z17.number().default(15e3).describe("Request timeout in milliseconds")
1865
+ url: import_zod16.z.string().describe("URL to send the HTTP request to"),
1866
+ method: import_zod16.z.enum(["GET", "POST", "PUT", "DELETE"]),
1867
+ headers: import_zod16.z.record(import_zod16.z.string()).optional(),
1868
+ body: import_zod16.z.record(import_zod16.z.any()).optional(),
1869
+ errorValue: import_zod16.z.any().optional().describe("Value to set if the request fails"),
1870
+ params: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.union([import_zod16.z.string(), FieldReference])).optional(),
1871
+ timeout: import_zod16.z.number().default(15e3).describe("Request timeout in milliseconds")
1944
1872
  })
1945
1873
  }).describe("HTTP request function triggered by a button click or other event");
1946
1874
  var SearchField = HttpField.extend({
1947
- type: z17.literal(FieldType.SEARCH),
1875
+ type: import_zod16.z.literal(FieldType.SEARCH),
1948
1876
  configuration: SearchQuery.pick({
1949
1877
  query: true,
1950
1878
  limit: true,
1951
1879
  offset: true
1952
1880
  }).extend({
1953
1881
  validation: ValidationConfig,
1954
- indicators: z17.object({
1882
+ indicators: import_zod16.z.object({
1955
1883
  loading: TranslationConfig.optional().describe(
1956
1884
  "Text to display while the search is in progress"
1957
1885
  ),
@@ -1966,7 +1894,7 @@ var SearchField = HttpField.extend({
1966
1894
  ),
1967
1895
  confirmButton: TranslationConfig.optional(),
1968
1896
  clearButton: TranslationConfig.optional(),
1969
- clearModal: z17.object({
1897
+ clearModal: import_zod16.z.object({
1970
1898
  title: TranslationConfig.optional(),
1971
1899
  description: TranslationConfig.optional(),
1972
1900
  cancel: TranslationConfig.optional(),
@@ -1977,17 +1905,17 @@ var SearchField = HttpField.extend({
1977
1905
  })
1978
1906
  });
1979
1907
  var LinkButtonField = BaseField.extend({
1980
- type: z17.literal(FieldType.LINK_BUTTON),
1981
- configuration: z17.object({
1982
- url: z17.string().describe("URL to open"),
1908
+ type: import_zod16.z.literal(FieldType.LINK_BUTTON),
1909
+ configuration: import_zod16.z.object({
1910
+ url: import_zod16.z.string().describe("URL to open"),
1983
1911
  text: TranslationConfig.describe("Text to display on the button"),
1984
- icon: z17.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1912
+ icon: import_zod16.z.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1985
1913
  })
1986
1914
  }).describe("Button that opens a link");
1987
1915
  var VerificationStatus = BaseField.extend({
1988
- type: z17.literal(FieldType.VERIFICATION_STATUS),
1916
+ type: import_zod16.z.literal(FieldType.VERIFICATION_STATUS),
1989
1917
  defaultValue: VerificationStatusValue.optional(),
1990
- configuration: z17.object({
1918
+ configuration: import_zod16.z.object({
1991
1919
  status: TranslationConfig.describe("Text to display on the status pill."),
1992
1920
  description: TranslationConfig.describe(
1993
1921
  "Explaining text on the banner in form."
@@ -1995,55 +1923,38 @@ var VerificationStatus = BaseField.extend({
1995
1923
  })
1996
1924
  });
1997
1925
  var QueryParamReaderField = BaseField.extend({
1998
- type: z17.literal(FieldType.QUERY_PARAM_READER),
1999
- configuration: z17.object({
2000
- pickParams: z17.array(z17.string()).describe("List of query parameters to read from the URL")
1926
+ type: import_zod16.z.literal(FieldType.QUERY_PARAM_READER),
1927
+ configuration: import_zod16.z.object({
1928
+ pickParams: import_zod16.z.array(import_zod16.z.string()).describe("List of query parameters to read from the URL")
2001
1929
  })
2002
1930
  }).describe(
2003
1931
  "A field that maps URL query params into form values and clears them afterward"
2004
1932
  );
2005
1933
  var QrReaderField = BaseField.extend({
2006
- type: z17.literal(FieldType.QR_READER),
1934
+ type: import_zod16.z.literal(FieldType.QR_READER),
2007
1935
  defaultValue: QrReaderFieldValue.optional(),
2008
- configuration: z17.object({
2009
- validator: z17.any().meta({
2010
- description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
2011
- id: "QrReaderFieldValidator"
2012
- })
1936
+ configuration: import_zod16.z.object({
1937
+ validator: import_zod16.z.custom(
1938
+ (val) => typeof val === "object" && val !== null
1939
+ )
2013
1940
  }).optional()
2014
- }).meta({
2015
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2016
- id: "QrReaderField"
2017
1941
  });
2018
1942
  var IdReaderField = BaseField.extend({
2019
- type: z17.literal(FieldType.ID_READER),
1943
+ type: import_zod16.z.literal(FieldType.ID_READER),
2020
1944
  defaultValue: IdReaderFieldValue.optional(),
2021
- methods: z17.array(
2022
- z17.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1945
+ methods: import_zod16.z.array(
1946
+ import_zod16.z.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2023
1947
  )
2024
1948
  });
2025
- var CustomField = BaseField.extend({
2026
- type: z17.literal(FieldType._EXPERIMENTAL_CUSTOM),
2027
- defaultValue: CustomFieldValue.optional(),
2028
- src: z17.string().describe("Module source path for the custom field component"),
2029
- configuration: z17.unknown().optional()
2030
- });
2031
1949
  var LoaderField = BaseField.extend({
2032
- type: z17.literal(FieldType.LOADER),
2033
- configuration: z17.object({
1950
+ type: import_zod16.z.literal(FieldType.LOADER),
1951
+ configuration: import_zod16.z.object({
2034
1952
  text: TranslationConfig.describe("Display text above the loading spinner")
2035
1953
  })
2036
1954
  }).describe(
2037
1955
  "A non-interactive field that indicates an in progress operation in form"
2038
1956
  );
2039
- var HiddenField = BaseField.extend({
2040
- type: z17.literal(FieldType.ALPHA_HIDDEN),
2041
- required: z17.boolean().default(false).optional(),
2042
- defaultValue: TextValue.optional()
2043
- }).describe(
2044
- "A non-interactive, hidden field that only hold a value in the form"
2045
- );
2046
- var FieldConfig = z17.discriminatedUnion("type", [
1957
+ var FieldConfig = import_zod16.z.discriminatedUnion("type", [
2047
1958
  Address,
2048
1959
  TextField,
2049
1960
  NumberField,
@@ -2065,7 +1976,7 @@ var FieldConfig = z17.discriminatedUnion("type", [
2065
1976
  Checkbox,
2066
1977
  File,
2067
1978
  Country,
2068
- AdministrativeAreaField,
1979
+ AdministrativeArea,
2069
1980
  Divider,
2070
1981
  LocationInput,
2071
1982
  Facility,
@@ -2083,81 +1994,83 @@ var FieldConfig = z17.discriminatedUnion("type", [
2083
1994
  IdReaderField,
2084
1995
  QueryParamReaderField,
2085
1996
  LoaderField,
2086
- SearchField,
2087
- CustomField,
2088
- HiddenField
2089
- ]).meta({
1997
+ SearchField
1998
+ ]).openapi({
2090
1999
  description: "Form field configuration",
2091
- id: "FieldConfig"
2000
+ ref: "FieldConfig"
2092
2001
  });
2093
- var AnyFileField = z17.discriminatedUnion("type", [
2002
+ var AnyFileField = import_zod16.z.discriminatedUnion("type", [
2094
2003
  SignatureField,
2095
2004
  File,
2096
2005
  FileUploadWithOptions
2097
2006
  ]);
2098
2007
 
2099
2008
  // ../commons/src/events/FormConfig.ts
2100
- var z19 = __toESM(require("zod/v4"));
2009
+ var import_zod18 = require("zod");
2101
2010
 
2102
2011
  // ../commons/src/events/PageConfig.ts
2103
- var z18 = __toESM(require("zod/v4"));
2104
- var PageTypes = z18.enum(["FORM", "VERIFICATION"]);
2105
- var PageConfigBase = z18.object({
2106
- id: z18.string().describe("Unique identifier for the page"),
2012
+ var import_zod17 = require("zod");
2013
+ var import_zod_openapi7 = require("zod-openapi");
2014
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod17.z);
2015
+ var PageTypes = import_zod17.z.enum(["FORM", "VERIFICATION"]);
2016
+ var PageConfigBase = import_zod17.z.object({
2017
+ id: import_zod17.z.string().describe("Unique identifier for the page"),
2107
2018
  title: TranslationConfig.describe("Header title of the page"),
2108
- requireCompletionToContinue: z18.boolean().default(false).describe(
2019
+ requireCompletionToContinue: import_zod17.z.boolean().default(false).describe(
2109
2020
  "If true, all required fields must be filled before continuing to the next page"
2110
2021
  ),
2111
- fields: z18.array(FieldConfig).describe("Fields to be rendered on the page"),
2022
+ fields: import_zod17.z.array(FieldConfig).describe("Fields to be rendered on the page"),
2112
2023
  conditional: Conditional.optional().describe(
2113
2024
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2114
2025
  )
2115
- }).meta({
2026
+ }).openapi({
2116
2027
  description: "Form page configuration",
2117
- id: "FormPageConfig"
2028
+ ref: "FormPageConfig"
2118
2029
  });
2119
2030
  var FormPageConfig = PageConfigBase.extend({
2120
- type: z18.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2031
+ type: import_zod17.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2121
2032
  });
2122
- var VerificationActionConfig = z18.object({
2123
- verify: z18.object({ label: TranslationConfig }),
2124
- cancel: z18.object({
2033
+ var VerificationActionConfig = import_zod17.z.object({
2034
+ verify: import_zod17.z.object({ label: TranslationConfig }),
2035
+ cancel: import_zod17.z.object({
2125
2036
  label: TranslationConfig,
2126
- confirmation: z18.object({
2037
+ confirmation: import_zod17.z.object({
2127
2038
  title: TranslationConfig,
2128
2039
  body: TranslationConfig
2129
2040
  })
2130
2041
  })
2131
- }).describe("Actions available on the verification page").meta({
2042
+ }).describe("Actions available on the verification page").openapi({
2132
2043
  description: "Verification action configuration",
2133
- id: "VerificationActionConfig"
2044
+ ref: "VerificationActionConfig"
2134
2045
  });
2135
2046
  var VerificationPageConfig = FormPageConfig.extend({
2136
- type: z18.literal(PageTypes.enum.VERIFICATION),
2047
+ type: import_zod17.z.literal(PageTypes.enum.VERIFICATION),
2137
2048
  actions: VerificationActionConfig
2138
2049
  });
2139
- var PageConfig = z18.discriminatedUnion("type", [
2050
+ var PageConfig = import_zod17.z.discriminatedUnion("type", [
2140
2051
  FormPageConfig,
2141
2052
  VerificationPageConfig
2142
2053
  ]);
2143
2054
 
2144
2055
  // ../commons/src/events/FormConfig.ts
2145
- var DeclarationFormConfig = z19.object({
2056
+ var DeclarationFormConfig = import_zod18.z.object({
2146
2057
  label: TranslationConfig.describe("Human readable description of the form"),
2147
- pages: z19.array(FormPageConfig)
2058
+ pages: import_zod18.z.array(FormPageConfig)
2148
2059
  }).describe("Configuration of the declaration form.");
2149
- var ActionFormConfig = z19.object({
2060
+ var ActionFormConfig = import_zod18.z.object({
2150
2061
  label: TranslationConfig.describe("Human readable description of the form"),
2151
- pages: z19.array(PageConfig)
2062
+ pages: import_zod18.z.array(PageConfig)
2152
2063
  }).describe(
2153
2064
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2154
2065
  );
2155
- var FormConfig = z19.union([DeclarationFormConfig, ActionFormConfig]);
2066
+ var FormConfig = import_zod18.z.union([DeclarationFormConfig, ActionFormConfig]);
2156
2067
 
2157
2068
  // ../commons/src/events/DeduplicationConfig.ts
2158
- var z20 = __toESM(require("zod/v4"));
2159
- var FieldReference2 = z20.string();
2160
- var Matcher = z20.object({
2069
+ var import_zod19 = require("zod");
2070
+ var import_zod_openapi8 = require("zod-openapi");
2071
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
2072
+ var FieldReference2 = import_zod19.z.string();
2073
+ var Matcher = import_zod19.z.object({
2161
2074
  /**
2162
2075
  * Reference to the field used in matching.
2163
2076
  *
@@ -2165,68 +2078,68 @@ var Matcher = z20.object({
2165
2078
  * be used as the origin date to calculate the distance from.
2166
2079
  */
2167
2080
  fieldId: FieldReference2,
2168
- options: z20.object({
2169
- boost: z20.number().optional()
2081
+ options: import_zod19.z.object({
2082
+ boost: import_zod19.z.number().optional()
2170
2083
  }).optional().default({
2171
2084
  boost: 1
2172
2085
  })
2173
2086
  });
2174
2087
  var FuzzyMatcher = Matcher.extend({
2175
- type: z20.literal("fuzzy"),
2176
- options: z20.object({
2088
+ type: import_zod19.z.literal("fuzzy"),
2089
+ options: import_zod19.z.object({
2177
2090
  /**
2178
2091
  * Names of length 3 or less characters = 0 edits allowed
2179
2092
  * Names of length 4 - 6 characters = 1 edit allowed
2180
2093
  * Names of length >7 characters = 2 edits allowed
2181
2094
  */
2182
- fuzziness: z20.union([z20.string(), z20.number()]).optional().default("AUTO:4,7"),
2183
- boost: z20.number().optional().default(1)
2095
+ fuzziness: import_zod19.z.union([import_zod19.z.string(), import_zod19.z.number()]).optional().default("AUTO:4,7"),
2096
+ boost: import_zod19.z.number().optional().default(1)
2184
2097
  }).optional().default({
2185
2098
  fuzziness: "AUTO:4,7",
2186
2099
  boost: 1
2187
2100
  })
2188
2101
  });
2189
2102
  var StrictMatcher = Matcher.extend({
2190
- type: z20.literal("strict"),
2191
- options: z20.object({
2192
- boost: z20.number().optional().default(1),
2103
+ type: import_zod19.z.literal("strict"),
2104
+ options: import_zod19.z.object({
2105
+ boost: import_zod19.z.number().optional().default(1),
2193
2106
  /**
2194
2107
  * The constant value to be present in the field for both records
2195
2108
  */
2196
- value: z20.string().optional()
2109
+ value: import_zod19.z.string().optional()
2197
2110
  }).optional().default({
2198
2111
  boost: 1
2199
2112
  })
2200
2113
  });
2201
2114
  var DateRangeMatcher = Matcher.extend({
2202
- type: z20.literal("dateRange"),
2203
- options: z20.object({
2115
+ type: import_zod19.z.literal("dateRange"),
2116
+ options: import_zod19.z.object({
2204
2117
  /**
2205
2118
  * The distance pivot in days. Distance from the origin (the value of
2206
2119
  * fieldId) at which relevance scores receive half of the boost value
2207
2120
  */
2208
- pivot: z20.number().optional(),
2209
- days: z20.number(),
2210
- boost: z20.number().optional().default(1)
2121
+ pivot: import_zod19.z.number().optional(),
2122
+ days: import_zod19.z.number(),
2123
+ boost: import_zod19.z.number().optional().default(1)
2211
2124
  })
2212
2125
  });
2213
- var Not = z20.object({
2214
- type: z20.literal("not"),
2126
+ var Not = import_zod19.z.object({
2127
+ type: import_zod19.z.literal("not"),
2215
2128
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2216
- clause: z20.lazy(() => Clause)
2129
+ clause: import_zod19.z.lazy(() => Clause)
2217
2130
  });
2218
- var And = z20.object({
2219
- type: z20.literal("and"),
2131
+ var And = import_zod19.z.object({
2132
+ type: import_zod19.z.literal("and"),
2220
2133
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2221
- clauses: z20.lazy(() => Clause.array())
2134
+ clauses: import_zod19.z.lazy(() => Clause.array())
2222
2135
  });
2223
- var Or = z20.object({
2224
- type: z20.literal("or"),
2136
+ var Or = import_zod19.z.object({
2137
+ type: import_zod19.z.literal("or"),
2225
2138
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2226
- clauses: z20.lazy(() => Clause.array())
2139
+ clauses: import_zod19.z.lazy(() => Clause.array())
2227
2140
  });
2228
- var Clause = z20.lazy(
2229
- () => z20.discriminatedUnion("type", [
2141
+ var Clause = import_zod19.z.lazy(
2142
+ () => import_zod19.z.discriminatedUnion("type", [
2230
2143
  Not,
2231
2144
  And,
2232
2145
  Or,
@@ -2234,328 +2147,193 @@ var Clause = z20.lazy(
2234
2147
  StrictMatcher,
2235
2148
  DateRangeMatcher
2236
2149
  ])
2237
- ).meta({
2238
- id: "Clause"
2150
+ ).openapi({
2151
+ ref: "Clause"
2239
2152
  });
2240
- var DeduplicationConfig = z20.object({
2241
- id: z20.string(),
2153
+ var DeduplicationConfig = import_zod19.z.object({
2154
+ id: import_zod19.z.string(),
2242
2155
  label: TranslationConfig,
2243
2156
  query: Clause
2244
2157
  });
2245
2158
 
2246
- // ../commons/src/icons.ts
2247
- var z21 = __toESM(require("zod/v4"));
2248
- var AvailableIcons = z21.enum([
2249
- "Archived",
2250
- "Assigned",
2251
- "Briefcase",
2252
- "Certified",
2253
- "Close",
2254
- "Collapse",
2255
- "Draft",
2256
- "DuplicateYellow",
2257
- "Expand",
2258
- "ExternalValidate",
2259
- "FilledCheck",
2260
- "InReview",
2261
- "Offline",
2262
- "Registered",
2263
- "RequiresUpdates",
2264
- "Sent",
2265
- "Validated",
2266
- "WaitingApproval",
2267
- "ChartActivity",
2268
- "Activity",
2269
- "Archive",
2270
- "ArchiveTray",
2271
- "ArrowLeft",
2272
- "ArrowRight",
2273
- "Buildings",
2274
- "Circle",
2275
- "CaretDown",
2276
- "CaretLeft",
2277
- "CaretRight",
2278
- "ChartBar",
2279
- "ChartLine",
2280
- "ChatCircle",
2281
- "CheckSquare",
2282
- "Compass",
2283
- "Check",
2284
- "Copy",
2285
- "Database",
2286
- "DotsThreeVertical",
2287
- "ArrowCounterClockwise",
2288
- "MagnifyingGlassMinus",
2289
- "MagnifyingGlassPlus",
2290
- "Export",
2291
- "Eye",
2292
- "EyeSlash",
2293
- "Envelope",
2294
- "File",
2295
- "FileSearch",
2296
- "FileMinus",
2297
- "FilePlus",
2298
- "FileText",
2299
- "FileX",
2300
- "Handshake",
2301
- "Gear",
2302
- "GitBranch",
2303
- "IdentificationCard",
2304
- "List",
2305
- "ListBullets",
2306
- "Lock",
2307
- "MagnifyingGlass",
2308
- "MapPin",
2309
- "Medal",
2310
- "NotePencil",
2311
- "Paperclip",
2312
- "PaperPlaneTilt",
2313
- "Pen",
2314
- "PenNib",
2315
- "Pencil",
2316
- "PencilSimpleLine",
2317
- "Phone",
2318
- "Plus",
2319
- "Printer",
2320
- "SignOut",
2321
- "Stamp",
2322
- "Star",
2323
- "Target",
2324
- "TextT",
2325
- "Trash",
2326
- "UploadSimple",
2327
- "User",
2328
- "UserPlus",
2329
- "Users",
2330
- "WarningCircle",
2331
- "X",
2332
- "ChatText",
2333
- "CircleWavyCheck",
2334
- "CircleWavyQuestion",
2335
- "ArchiveBox",
2336
- "ArrowCircleDown",
2337
- "FileArrowUp",
2338
- "FileDotted",
2339
- "Files",
2340
- "PencilLine",
2341
- "PencilCircle",
2342
- "UserCircle",
2343
- "Clock",
2344
- "QrCode",
2345
- "Webcam",
2346
- "Sun",
2347
- "DeviceTabletCamera",
2348
- "Globe",
2349
- "Fingerprint",
2350
- "PushPin",
2351
- "Timer"
2352
- ]);
2353
-
2354
2159
  // ../commons/src/events/ActionConfig.ts
2355
- var DeclarationReviewConfig = z22.object({
2160
+ var import_zod_openapi9 = require("zod-openapi");
2161
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod20.z);
2162
+ var DeclarationReviewConfig = import_zod20.z.object({
2356
2163
  title: TranslationConfig.describe("Title of the review page"),
2357
- fields: z22.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2164
+ fields: import_zod20.z.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2358
2165
  }).describe(
2359
2166
  "Configuration of the declaration review page for collecting event-related metadata."
2360
2167
  );
2361
- var ActionConfigBase = z22.object({
2362
- label: TranslationConfig.describe("Human readable description of the action"),
2363
- flags: z22.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2364
- supportingCopy: TranslationConfig.optional().describe(
2365
- "Text displayed on the confirmation dialog"
2366
- ),
2367
- icon: AvailableIcons.describe("Icon representing the action").optional(),
2368
- conditionals: z22.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2168
+ var ActionConfigBase = import_zod20.z.object({
2169
+ label: TranslationConfig.describe("Human readable description of the action")
2369
2170
  });
2370
2171
  var DeclarationActionBase = ActionConfigBase.extend({
2172
+ review: DeclarationReviewConfig,
2371
2173
  deduplication: DeduplicationConfig.optional()
2372
2174
  });
2373
- var ReadActionConfig = ActionConfigBase.extend(
2374
- z22.object({
2375
- type: z22.literal(ActionType.READ),
2175
+ var ReadActionConfig = ActionConfigBase.merge(
2176
+ import_zod20.z.object({
2177
+ type: import_zod20.z.literal(ActionType.READ),
2376
2178
  review: DeclarationReviewConfig.describe(
2377
2179
  "Configuration of the review page for read-only view."
2378
- ),
2379
- conditionals: z22.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2380
- }).shape
2180
+ )
2181
+ })
2381
2182
  );
2382
- var DeclareConfig = DeclarationActionBase.extend(
2383
- z22.object({
2384
- type: z22.literal(ActionType.DECLARE),
2385
- review: DeclarationReviewConfig.describe(
2386
- "Configuration of the review page fields."
2387
- ),
2388
- dialogCopy: z22.object({
2389
- notify: TranslationConfig.describe(
2390
- "Confirmation text for the notify action"
2391
- ),
2392
- declare: TranslationConfig.describe(
2393
- "Confirmation text for the declare action"
2394
- ),
2395
- register: TranslationConfig.describe(
2396
- "Confirmation text for the register action"
2397
- )
2398
- }).optional()
2399
- }).shape
2183
+ var DeclareConfig = DeclarationActionBase.merge(
2184
+ import_zod20.z.object({
2185
+ type: import_zod20.z.literal(ActionType.DECLARE)
2186
+ })
2400
2187
  );
2401
- var ArchiveConfig = ActionConfigBase.extend(
2402
- z22.object({
2403
- type: z22.literal(ActionType.ARCHIVE)
2404
- }).shape
2188
+ var ValidateConfig = DeclarationActionBase.merge(
2189
+ import_zod20.z.object({
2190
+ type: import_zod20.z.literal(ActionType.VALIDATE)
2191
+ })
2405
2192
  );
2406
- var EditActionConfig = ActionConfigBase.extend(
2407
- z22.object({
2408
- type: z22.literal(ActionType.EDIT),
2409
- dialogCopy: z22.object({
2410
- notify: TranslationConfig.describe(
2411
- "Confirmation text for the notify with edits action"
2412
- ),
2413
- declare: TranslationConfig.describe(
2414
- "Confirmation text for the declare with edits action"
2415
- ),
2416
- register: TranslationConfig.describe(
2417
- "Confirmation text for the register with edits action"
2418
- )
2419
- })
2420
- }).shape
2193
+ var RegisterConfig = DeclarationActionBase.merge(
2194
+ import_zod20.z.object({
2195
+ type: import_zod20.z.literal(ActionType.REGISTER)
2196
+ })
2197
+ );
2198
+ var RejectDeclarationConfig = ActionConfigBase.merge(
2199
+ import_zod20.z.object({
2200
+ type: import_zod20.z.literal(ActionType.REJECT)
2201
+ })
2421
2202
  );
2422
- var RejectConfig = ActionConfigBase.extend(
2423
- z22.object({
2424
- type: z22.literal(ActionType.REJECT)
2425
- }).shape
2203
+ var ArchiveConfig = ActionConfigBase.merge(
2204
+ import_zod20.z.object({
2205
+ type: import_zod20.z.literal(ActionType.ARCHIVE)
2206
+ })
2426
2207
  );
2427
- var RegisterConfig = DeclarationActionBase.extend(
2428
- z22.object({
2429
- type: z22.literal(ActionType.REGISTER)
2430
- }).shape
2208
+ var DeleteConfig = ActionConfigBase.merge(
2209
+ import_zod20.z.object({
2210
+ type: import_zod20.z.literal(ActionType.DELETE)
2211
+ })
2431
2212
  );
2432
- var PrintCertificateActionConfig = ActionConfigBase.extend(
2433
- z22.object({
2434
- type: z22.literal(ActionType.PRINT_CERTIFICATE),
2213
+ var PrintCertificateActionConfig = ActionConfigBase.merge(
2214
+ import_zod20.z.object({
2215
+ type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE),
2435
2216
  printForm: ActionFormConfig
2436
- }).shape
2217
+ })
2437
2218
  );
2438
- var RequestCorrectionConfig = ActionConfigBase.extend(
2439
- z22.object({
2440
- type: z22.literal(ActionType.REQUEST_CORRECTION),
2219
+ var RequestCorrectionConfig = ActionConfigBase.merge(
2220
+ import_zod20.z.object({
2221
+ type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION),
2441
2222
  correctionForm: ActionFormConfig
2442
- }).shape
2223
+ })
2443
2224
  );
2444
- var CustomActionConfig = ActionConfigBase.merge(
2445
- z22.object({
2446
- type: z22.literal(ActionType.CUSTOM),
2447
- customActionType: z22.string().describe("Type identifier of the custom action."),
2448
- /** Custom action form configuration supports a simple array of field configs, which should be rendered on the action modal. In the future, we might add support for pages etc. */
2449
- form: z22.array(FieldConfig).describe(
2450
- "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2451
- ),
2452
- auditHistoryLabel: TranslationConfig.describe(
2453
- 'The label to show in audit history for this action. For example "Approved".'
2454
- )
2225
+ var RejectCorrectionConfig = ActionConfigBase.merge(
2226
+ import_zod20.z.object({
2227
+ type: import_zod20.z.literal(ActionType.REJECT_CORRECTION)
2455
2228
  })
2456
2229
  );
2457
- var ActionConfig = z22.discriminatedUnion("type", [
2230
+ var ApproveCorrectionConfig = ActionConfigBase.merge(
2231
+ import_zod20.z.object({
2232
+ type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION)
2233
+ })
2234
+ );
2235
+ var ActionConfig = import_zod20.z.discriminatedUnion("type", [
2458
2236
  /*
2459
2237
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2460
2238
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2461
2239
  */
2462
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2463
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2464
- RejectConfig.meta({ id: "RejectActionConfig" }),
2465
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2466
- PrintCertificateActionConfig.meta({
2467
- id: "PrintCertificateActionConfig"
2240
+ ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
2241
+ DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
2242
+ ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
2243
+ RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
2244
+ ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
2245
+ RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
2246
+ DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
2247
+ PrintCertificateActionConfig.openapi({
2248
+ ref: "PrintCertificateActionConfig"
2468
2249
  }),
2469
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2470
- EditActionConfig.meta({ id: "EditActionConfig" }),
2471
- ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2472
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2250
+ RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
2251
+ RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
2252
+ ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
2473
2253
  ]).describe(
2474
2254
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2475
- ).meta({ id: "ActionConfig" });
2476
- var actionConfigTypes = new Set(
2477
- ActionConfig.options.map((opt) => opt.shape.type.value)
2478
- );
2479
- var DeclarationActionConfig = z22.discriminatedUnion("type", [
2255
+ ).openapi({ ref: "ActionConfig" });
2256
+ var DeclarationActionConfig = import_zod20.z.discriminatedUnion("type", [
2480
2257
  DeclareConfig,
2258
+ ValidateConfig,
2481
2259
  RegisterConfig
2482
2260
  ]);
2483
2261
 
2484
2262
  // ../commons/src/events/offline/CertificateConfig.ts
2485
- var z23 = __toESM(require("zod/v4"));
2486
- var FontFamily = z23.object({
2487
- normal: z23.string(),
2488
- bold: z23.string(),
2489
- italics: z23.string(),
2490
- bolditalics: z23.string()
2491
- });
2492
- var CertificateConfig = z23.object({
2493
- id: z23.string(),
2494
- event: z23.string(),
2495
- isV2Template: z23.boolean().optional(),
2263
+ var import_zod21 = require("zod");
2264
+ var FontFamily = import_zod21.z.object({
2265
+ normal: import_zod21.z.string(),
2266
+ bold: import_zod21.z.string(),
2267
+ italics: import_zod21.z.string(),
2268
+ bolditalics: import_zod21.z.string()
2269
+ });
2270
+ var CertificateConfig = import_zod21.z.object({
2271
+ id: import_zod21.z.string(),
2272
+ event: import_zod21.z.string(),
2273
+ isV2Template: import_zod21.z.boolean().optional(),
2496
2274
  label: TranslationConfig,
2497
- isDefault: z23.boolean(),
2498
- fee: z23.object({
2499
- onTime: z23.number(),
2500
- late: z23.number(),
2501
- delayed: z23.number()
2275
+ isDefault: import_zod21.z.boolean(),
2276
+ fee: import_zod21.z.object({
2277
+ onTime: import_zod21.z.number(),
2278
+ late: import_zod21.z.number(),
2279
+ delayed: import_zod21.z.number()
2502
2280
  }),
2503
- svgUrl: z23.string(),
2504
- fonts: z23.record(z23.string(), FontFamily).optional(),
2505
- conditionals: z23.array(ShowConditional).optional()
2281
+ svgUrl: import_zod21.z.string(),
2282
+ fonts: import_zod21.z.record(FontFamily).optional(),
2283
+ conditionals: import_zod21.z.array(ShowConditional).optional()
2506
2284
  });
2507
2285
  var CertificateTemplateConfig = CertificateConfig.extend({
2508
- hash: z23.string().optional(),
2509
- svg: z23.string()
2286
+ hash: import_zod21.z.string().optional(),
2287
+ svg: import_zod21.z.string()
2510
2288
  });
2511
2289
 
2512
2290
  // ../commons/src/events/offline/LanguageConfig.ts
2513
- var z24 = __toESM(require("zod/v4"));
2514
- var LanguageConfig = z24.object({
2515
- lang: z24.string(),
2291
+ var import_zod22 = require("zod");
2292
+ var LanguageConfig = import_zod22.z.object({
2293
+ lang: import_zod22.z.string(),
2516
2294
  /**
2517
2295
  * client.csv contents
2518
2296
  */
2519
- messages: z24.record(z24.string(), z24.string())
2297
+ messages: import_zod22.z.record(import_zod22.z.string())
2520
2298
  });
2521
2299
 
2522
2300
  // ../commons/src/events/EventConfig.ts
2523
- var z30 = __toESM(require("zod/v4"));
2301
+ var import_zod27 = require("zod");
2524
2302
 
2525
2303
  // ../commons/src/events/SummaryConfig.ts
2526
- var z25 = __toESM(require("zod/v4"));
2527
- var BaseField2 = z25.object({
2304
+ var import_zod23 = require("zod");
2305
+ var BaseField2 = import_zod23.z.object({
2528
2306
  emptyValueMessage: TranslationConfig.optional().describe(
2529
2307
  "Default message displayed when the field value is empty."
2530
2308
  ),
2531
- conditionals: z25.array(ShowConditional).default([]).optional()
2309
+ conditionals: import_zod23.z.array(ShowConditional).default([]).optional()
2532
2310
  });
2533
2311
  var ReferenceField = BaseField2.extend({
2534
- fieldId: z25.string(),
2312
+ fieldId: import_zod23.z.string(),
2535
2313
  label: TranslationConfig.optional().describe(
2536
2314
  "Overrides the default label from the referenced field when provided."
2537
2315
  )
2538
2316
  }).describe("Field referencing existing event data by field ID.");
2539
2317
  var Field = BaseField2.extend({
2540
- id: z25.string().describe("Identifier of the summary field."),
2318
+ id: import_zod23.z.string().describe("Identifier of the summary field."),
2541
2319
  value: TranslationConfig.describe(
2542
2320
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
2543
2321
  ),
2544
2322
  label: TranslationConfig
2545
2323
  }).describe("Custom field defined for the summary view.");
2546
- var SummaryConfig = z25.object({
2547
- fields: z25.array(z25.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2324
+ var SummaryConfig = import_zod23.z.object({
2325
+ fields: import_zod23.z.array(import_zod23.z.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2548
2326
  }).describe("Configuration of the event summary section.");
2549
2327
 
2550
2328
  // ../commons/src/events/AdvancedSearchConfig.ts
2551
- var z26 = __toESM(require("zod/v4"));
2552
- var MatchType = z26.enum(["fuzzy", "exact", "range", "within"]);
2553
- var BaseField3 = z26.object({
2554
- config: z26.object({
2329
+ var import_zod24 = require("zod");
2330
+ var MatchType = import_zod24.z.enum(["fuzzy", "exact", "range", "within"]);
2331
+ var BaseField3 = import_zod24.z.object({
2332
+ config: import_zod24.z.object({
2555
2333
  type: MatchType.describe(
2556
2334
  "Determines the search type of field. How to match value."
2557
2335
  ),
2558
- searchFields: z26.array(z26.string()).optional().describe(
2336
+ searchFields: import_zod24.z.array(import_zod24.z.string()).optional().describe(
2559
2337
  `
2560
2338
  Defines multiple form fields that should be searched when this field has a value.
2561
2339
  All specified fields will be combined using OR logic.
@@ -2565,7 +2343,7 @@ var BaseField3 = z26.object({
2565
2343
  `
2566
2344
  )
2567
2345
  }),
2568
- type: z26.nativeEnum(FieldType).optional().describe(
2346
+ type: import_zod24.z.nativeEnum(FieldType).optional().describe(
2569
2347
  `
2570
2348
  Explicitly specify the field type for searchFields.
2571
2349
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -2579,7 +2357,7 @@ var BaseField3 = z26.object({
2579
2357
  This is required when searchFields is defined.
2580
2358
  `
2581
2359
  ),
2582
- options: z26.array(SelectOption).optional(),
2360
+ options: import_zod24.z.array(SelectOption).optional(),
2583
2361
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
2584
2362
  `
2585
2363
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -2600,7 +2378,7 @@ var BaseField3 = z26.object({
2600
2378
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2601
2379
  `
2602
2380
  ),
2603
- conditionals: z26.array(FieldConditional).optional().describe(
2381
+ conditionals: import_zod24.z.array(FieldConditional).default([]).optional().describe(
2604
2382
  `
2605
2383
  In advanced search, we sometimes need to override the default field visibility conditionals.
2606
2384
 
@@ -2614,20 +2392,20 @@ var BaseField3 = z26.object({
2614
2392
  are always rendered in the advanced search form.
2615
2393
  `
2616
2394
  ),
2617
- validations: z26.array(ValidationConfig).optional().describe(
2395
+ validations: import_zod24.z.array(ValidationConfig).default([]).optional().describe(
2618
2396
  `Option for overriding the field validations specifically for advanced search form.`
2619
2397
  )
2620
2398
  });
2621
- var SearchQueryParams = z26.object({
2622
- eventType: z26.string().optional().describe(
2399
+ var SearchQueryParams = import_zod24.z.object({
2400
+ eventType: import_zod24.z.string().optional().describe(
2623
2401
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
2624
2402
  )
2625
2403
  }).catchall(FieldValue);
2626
2404
  var FieldConfigSchema = BaseField3.extend({
2627
- fieldId: z26.string(),
2628
- fieldType: z26.literal("field")
2405
+ fieldId: import_zod24.z.string(),
2406
+ fieldType: import_zod24.z.literal("field")
2629
2407
  });
2630
- var EventFieldIdInput = z26.enum([
2408
+ var EventFieldIdInput = import_zod24.z.enum([
2631
2409
  "trackingId",
2632
2410
  "status",
2633
2411
  "legalStatuses.REGISTERED.acceptedAt",
@@ -2636,7 +2414,7 @@ var EventFieldIdInput = z26.enum([
2636
2414
  "updatedAt"
2637
2415
  ]);
2638
2416
  var METADATA_FIELD_PREFIX = "event.";
2639
- var EventFieldId = z26.enum([
2417
+ var EventFieldId = import_zod24.z.enum([
2640
2418
  `${METADATA_FIELD_PREFIX}trackingId`,
2641
2419
  `${METADATA_FIELD_PREFIX}status`,
2642
2420
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -2646,29 +2424,29 @@ var EventFieldId = z26.enum([
2646
2424
  ]);
2647
2425
  var EventFieldConfigSchema = BaseField3.extend({
2648
2426
  fieldId: EventFieldId,
2649
- fieldType: z26.literal("event")
2427
+ fieldType: import_zod24.z.literal("event")
2650
2428
  });
2651
- var AdvancedSearchField = z26.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2429
+ var AdvancedSearchField = import_zod24.z.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2652
2430
  if (data.config.searchFields && data.config.searchFields.length > 0) {
2653
2431
  if (!data.label) {
2654
2432
  ctx.addIssue({
2655
- code: z26.ZodIssueCode.custom,
2433
+ code: import_zod24.z.ZodIssueCode.custom,
2656
2434
  message: "label is required when config.searchFields is defined.",
2657
2435
  path: ["label"]
2658
2436
  });
2659
2437
  }
2660
2438
  if (!data.type) {
2661
2439
  ctx.addIssue({
2662
- code: z26.ZodIssueCode.custom,
2440
+ code: import_zod24.z.ZodIssueCode.custom,
2663
2441
  message: "type is required when config.searchFields is defined.",
2664
2442
  path: ["type"]
2665
2443
  });
2666
2444
  }
2667
2445
  }
2668
2446
  });
2669
- var AdvancedSearchConfig = z26.object({
2447
+ var AdvancedSearchConfig = import_zod24.z.object({
2670
2448
  title: TranslationConfig.describe("Advanced search tab title"),
2671
- fields: z26.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2449
+ fields: import_zod24.z.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2672
2450
  });
2673
2451
 
2674
2452
  // ../commons/src/events/utils.ts
@@ -2677,11 +2455,11 @@ var import_lodash = require("lodash");
2677
2455
  // ../commons/src/conditionals/validate.ts
2678
2456
  var import__ = __toESM(require("ajv/dist/2019"));
2679
2457
  var import_ajv_formats = __toESM(require("ajv-formats"));
2680
- var z28 = __toESM(require("zod/v4"));
2458
+ var import_zod26 = require("zod");
2681
2459
  var import_date_fns = require("date-fns");
2682
2460
 
2683
2461
  // ../commons/src/events/DynamicFieldValue.ts
2684
- var z27 = __toESM(require("zod/v4"));
2462
+ var import_zod25 = require("zod");
2685
2463
 
2686
2464
  // ../commons/src/conditionals/validate.ts
2687
2465
  var ajv = new import__.default({
@@ -2690,9 +2468,9 @@ var ajv = new import__.default({
2690
2468
  strict: false
2691
2469
  // Allow minContains and other newer features
2692
2470
  });
2693
- var DataContext = z28.object({
2694
- rootData: z28.object({
2695
- $leafAdminStructureLocationIds: z28.array(z28.object({ id: UUID }))
2471
+ var DataContext = import_zod26.z.object({
2472
+ rootData: import_zod26.z.object({
2473
+ $leafAdminStructureLocationIds: import_zod26.z.array(import_zod26.z.object({ id: UUID }))
2696
2474
  })
2697
2475
  });
2698
2476
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -2769,12 +2547,12 @@ ajv.addKeyword({
2769
2547
  });
2770
2548
 
2771
2549
  // ../commons/src/utils.ts
2772
- var z29 = __toESM(require("zod/v4"));
2773
- var FullNameV1 = z29.array(
2774
- z29.object({
2775
- use: z29.string(),
2776
- family: z29.string(),
2777
- given: z29.array(z29.string())
2550
+ var z27 = __toESM(require("zod"));
2551
+ var FullNameV1 = z27.array(
2552
+ z27.object({
2553
+ use: z27.string(),
2554
+ family: z27.string(),
2555
+ given: z27.array(z27.string())
2778
2556
  })
2779
2557
  );
2780
2558
  function omitKeyDeep(obj, keyToRemove) {
@@ -2795,6 +2573,9 @@ function omitKeyDeep(obj, keyToRemove) {
2795
2573
 
2796
2574
  // ../commons/src/events/utils.ts
2797
2575
  var import_date_fns2 = require("date-fns");
2576
+ function isDeclarationActionConfig(action) {
2577
+ return DeclarationActions.safeParse(action.type).success;
2578
+ }
2798
2579
  function getDeclarationFields(configuration) {
2799
2580
  return configuration.declaration.pages.flatMap(({ fields }) => fields);
2800
2581
  }
@@ -2805,10 +2586,7 @@ var getActionAnnotationFields = (actionConfig) => {
2805
2586
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2806
2587
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
2807
2588
  }
2808
- if (actionConfig.type === ActionType.CUSTOM) {
2809
- return actionConfig.form;
2810
- }
2811
- if ("review" in actionConfig) {
2589
+ if (isDeclarationActionConfig(actionConfig)) {
2812
2590
  return actionConfig.review.fields;
2813
2591
  }
2814
2592
  return [];
@@ -2828,8 +2606,38 @@ var EXCLUDED_ACTIONS = [
2828
2606
  ActionType.REJECT_CORRECTION
2829
2607
  ];
2830
2608
 
2831
- // ../commons/src/events/eventConfigValidation.ts
2832
- function validateAdvancedSearchConfig(event2, ctx) {
2609
+ // ../commons/src/events/EventConfig.ts
2610
+ var import_zod_openapi10 = require("zod-openapi");
2611
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod27.z);
2612
+ var EventConfig = import_zod27.z.object({
2613
+ id: import_zod27.z.string().describe(
2614
+ 'Machine-readable identifier of the event (e.g. "birth", "death").'
2615
+ ),
2616
+ dateOfEvent: FieldReference.optional().describe(
2617
+ "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
2618
+ ),
2619
+ title: TranslationConfig.describe(
2620
+ 'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
2621
+ ),
2622
+ fallbackTitle: TranslationConfig.optional().describe(
2623
+ "Fallback title shown when the main title resolves to an empty value."
2624
+ ),
2625
+ summary: SummaryConfig.describe(
2626
+ "Summary information displayed in the event overview."
2627
+ ),
2628
+ label: TranslationConfig.describe(
2629
+ "Human-readable label for the event type."
2630
+ ),
2631
+ actions: import_zod27.z.array(ActionConfig).describe(
2632
+ "Configuration of system-defined actions associated with the event."
2633
+ ),
2634
+ declaration: DeclarationFormConfig.describe(
2635
+ "Configuration of the form used to gather event data."
2636
+ ),
2637
+ advancedSearch: import_zod27.z.array(AdvancedSearchConfig).optional().default([]).describe(
2638
+ "Configuration of fields available in the advanced search feature."
2639
+ )
2640
+ }).superRefine((event2, ctx) => {
2833
2641
  const allFields = findAllFields(event2);
2834
2642
  const fieldIds = allFields.map((field3) => field3.id);
2835
2643
  const advancedSearchFields = event2.advancedSearch.flatMap(
@@ -2856,12 +2664,10 @@ function validateAdvancedSearchConfig(event2, ctx) {
2856
2664
  ctx.addIssue({
2857
2665
  code: "custom",
2858
2666
  message: `Advanced search id must match a field id of form fields or pre-defined metadata fields.
2859
- Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
2667
+ Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
2860
2668
  path: ["advancedSearch"]
2861
2669
  });
2862
2670
  }
2863
- }
2864
- function validateDateOfEvent(event2, ctx) {
2865
2671
  if (event2.dateOfEvent) {
2866
2672
  const eventDateFieldId = getDeclarationFields(event2).find(
2867
2673
  ({ id }) => id === event2.dateOfEvent?.$$field
@@ -2870,7 +2676,7 @@ function validateDateOfEvent(event2, ctx) {
2870
2676
  ctx.addIssue({
2871
2677
  code: "custom",
2872
2678
  message: `Date of event field id must match a field id in fields array.
2873
- Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
2679
+ Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
2874
2680
  path: ["dateOfEvent"]
2875
2681
  });
2876
2682
  } else if (eventDateFieldId.type !== FieldType.DATE) {
@@ -2881,105 +2687,8 @@ function validateDateOfEvent(event2, ctx) {
2881
2687
  });
2882
2688
  }
2883
2689
  }
2884
- }
2885
- function validatePlaceOfEvent(event2, ctx) {
2886
- if (event2.placeOfEvent) {
2887
- const eventPlaceFieldId = getDeclarationFields(event2).find(
2888
- ({ id }) => id === event2.placeOfEvent?.$$field
2889
- );
2890
- if (!eventPlaceFieldId) {
2891
- ctx.addIssue({
2892
- code: "custom",
2893
- message: `Place of event field id must match a field id in the event.declaration fields.
2894
- Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
2895
- path: ["placeOfEvent"]
2896
- });
2897
- }
2898
- }
2899
- }
2900
- function validateActionFlags(event2, ctx) {
2901
- const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
2902
- const configuredFlagIds = event2.flags.map((flag) => flag.id);
2903
- const actionFlagIds = event2.actions.flatMap(
2904
- (action) => action.flags.map((flag) => flag.id)
2905
- );
2906
- for (const actionFlagId of actionFlagIds) {
2907
- const isConfigured = configuredFlagIds.includes(actionFlagId);
2908
- const isInherent = isInherentFlag(actionFlagId);
2909
- if (!isConfigured && !isInherent) {
2910
- ctx.addIssue({
2911
- code: "custom",
2912
- message: `Action flag id must match an inherent flag or a configured flag in the flags array. Invalid action flag ID for event '${event2.id}': '${actionFlagId}'`,
2913
- path: ["actions"]
2914
- });
2915
- }
2916
- }
2917
- }
2918
- function validateActionOrder(event2, ctx) {
2919
- if (event2.actionOrder) {
2920
- const customActionTypes = event2.actions.filter((action) => action.type === ActionType.CUSTOM).map((action) => action.customActionType);
2921
- const validActionTypes = [
2922
- ...workqueueActions.options,
2923
- ...customActionTypes
2924
- ];
2925
- for (const actionType of event2.actionOrder) {
2926
- if (!validActionTypes.includes(actionType)) {
2927
- ctx.addIssue({
2928
- code: "custom",
2929
- message: `Invalid action type in action order: ${actionType}`,
2930
- path: ["actionOrder"]
2931
- });
2932
- }
2933
- }
2934
- }
2935
- }
2936
-
2937
- // ../commons/src/events/EventConfig.ts
2938
- var EventConfig = z30.object({
2939
- id: z30.string().describe(
2940
- 'Machine-readable identifier of the event (e.g. "birth", "death").'
2941
- ),
2942
- dateOfEvent: FieldReference.optional().describe(
2943
- "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
2944
- ),
2945
- placeOfEvent: FieldReference.optional().describe(
2946
- "Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
2947
- ),
2948
- title: TranslationConfig.describe(
2949
- 'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
2950
- ),
2951
- fallbackTitle: TranslationConfig.optional().describe(
2952
- "Fallback title shown when the main title resolves to an empty value."
2953
- ),
2954
- summary: SummaryConfig.describe(
2955
- "Summary information displayed in the event overview."
2956
- ),
2957
- label: TranslationConfig.describe(
2958
- "Human-readable label for the event type."
2959
- ),
2960
- actions: z30.array(ActionConfig).describe(
2961
- "Configuration of system-defined actions associated with the event."
2962
- ),
2963
- actionOrder: z30.array(z30.string()).optional().describe(
2964
- "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
2965
- ),
2966
- declaration: DeclarationFormConfig.describe(
2967
- "Configuration of the form used to gather event data."
2968
- ),
2969
- advancedSearch: z30.array(AdvancedSearchConfig).optional().default([]).describe(
2970
- "Configuration of fields available in the advanced search feature."
2971
- ),
2972
- flags: z30.array(FlagConfig).optional().default([]).describe(
2973
- "Configuration of flags associated with the actions of this event type."
2974
- )
2975
- }).superRefine((event2, ctx) => {
2976
- validateAdvancedSearchConfig(event2, ctx);
2977
- validateDateOfEvent(event2, ctx);
2978
- validatePlaceOfEvent(event2, ctx);
2979
- validateActionFlags(event2, ctx);
2980
- validateActionOrder(event2, ctx);
2981
- }).meta({
2982
- id: "EventConfig"
2690
+ }).openapi({
2691
+ ref: "EventConfig"
2983
2692
  }).describe("Configuration defining an event type.");
2984
2693
 
2985
2694
  // ../commons/src/events/EventConfigInput.ts
@@ -2988,7 +2697,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
2988
2697
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2989
2698
 
2990
2699
  // ../commons/src/events/WorkqueueConfig.ts
2991
- var z33 = __toESM(require("zod/v4"));
2700
+ var import_zod31 = require("zod");
2992
2701
 
2993
2702
  // ../commons/src/conditionals/conditionals.ts
2994
2703
  var objectHash = __toESM(require("object-hash"));
@@ -3026,7 +2735,7 @@ function not(condition) {
3026
2735
  required: []
3027
2736
  });
3028
2737
  }
3029
- function never2() {
2738
+ function never() {
3030
2739
  return not(alwaysTrue());
3031
2740
  }
3032
2741
  function jsonFieldPath(field3) {
@@ -3736,17 +3445,17 @@ var event = Object.assign(eventFn, {
3736
3445
  });
3737
3446
 
3738
3447
  // ../commons/src/events/WorkqueueColumnConfig.ts
3739
- var z31 = __toESM(require("zod/v4"));
3448
+ var import_zod28 = require("zod");
3740
3449
  var WorkqueueColumnKeysArray = [
3741
3450
  ...EventMetadataKeysArray,
3742
3451
  "title",
3743
3452
  "outbox"
3744
3453
  ];
3745
- var WorkqueueColumnKeys = z31.enum(WorkqueueColumnKeysArray);
3746
- var WorkqueueColumnValue = z31.object({
3454
+ var WorkqueueColumnKeys = import_zod28.z.enum(WorkqueueColumnKeysArray);
3455
+ var WorkqueueColumnValue = import_zod28.z.object({
3747
3456
  $event: WorkqueueColumnKeys
3748
3457
  });
3749
- var WorkqueueColumn = z31.object({
3458
+ var WorkqueueColumn = import_zod28.z.object({
3750
3459
  label: TranslationConfig,
3751
3460
  value: WorkqueueColumnValue
3752
3461
  });
@@ -3757,49 +3466,158 @@ function defineWorkqueuesColumns(workqueueColumns) {
3757
3466
  }
3758
3467
 
3759
3468
  // ../commons/src/events/CountryConfigQueryInput.ts
3760
- var z32 = __toESM(require("zod/v4"));
3761
- var SerializableExact = z32.object({
3762
- type: z32.literal("exact"),
3763
- term: z32.union([z32.string(), SerializedUserField])
3764
- });
3765
- var SerializableWithin = z32.object({
3766
- type: z32.literal("within"),
3767
- location: z32.union([z32.string(), SerializedUserField])
3768
- });
3769
- var SerializedQueryExpression = z32.object({
3770
- eventType: z32.string(),
3771
- status: z32.optional(z32.union([AnyOfStatus, ExactStatus])),
3772
- createdAt: z32.optional(DateCondition),
3773
- updatedAt: z32.optional(DateCondition),
3774
- "legalStatuses.REGISTERED.createdAt": z32.optional(DateCondition),
3775
- "legalStatuses.DECLARED.createdAtLocation": z32.optional(SerializableWithin),
3776
- "legalStatuses.REGISTERED.createdAtLocation": z32.optional(SerializableWithin),
3777
- "legalStatuses.REGISTERED.registrationNumber": z32.optional(Exact),
3778
- createdAtLocation: z32.optional(SerializableWithin),
3779
- updatedAtLocation: z32.optional(SerializableWithin),
3780
- assignedTo: z32.optional(SerializableExact),
3781
- createdBy: z32.optional(SerializableExact),
3469
+ var import_zod29 = require("zod");
3470
+ var SerializableExact = import_zod29.z.object({
3471
+ type: import_zod29.z.literal("exact"),
3472
+ term: import_zod29.z.union([import_zod29.z.string(), SerializedUserField])
3473
+ });
3474
+ var SerializableWithin = import_zod29.z.object({
3475
+ type: import_zod29.z.literal("within"),
3476
+ location: import_zod29.z.union([import_zod29.z.string(), SerializedUserField])
3477
+ });
3478
+ var SerializedQueryExpression = import_zod29.z.object({
3479
+ eventType: import_zod29.z.string(),
3480
+ status: import_zod29.z.optional(import_zod29.z.union([AnyOfStatus, ExactStatus])),
3481
+ createdAt: import_zod29.z.optional(DateCondition),
3482
+ updatedAt: import_zod29.z.optional(DateCondition),
3483
+ "legalStatuses.REGISTERED.createdAt": import_zod29.z.optional(DateCondition),
3484
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod29.z.optional(
3485
+ import_zod29.z.union([Within, Exact])
3486
+ ),
3487
+ "legalStatuses.REGISTERED.registrationNumber": import_zod29.z.optional(Exact),
3488
+ createdAtLocation: import_zod29.z.optional(
3489
+ import_zod29.z.union([SerializableWithin, SerializableExact])
3490
+ ),
3491
+ updatedAtLocation: import_zod29.z.optional(
3492
+ import_zod29.z.union([SerializableWithin, SerializableExact])
3493
+ ),
3494
+ assignedTo: import_zod29.z.optional(SerializableExact),
3495
+ createdBy: import_zod29.z.optional(SerializableExact),
3782
3496
  createdByUserType: ExactUserType,
3783
- updatedBy: z32.optional(SerializableExact),
3784
- trackingId: z32.optional(Exact),
3785
- flags: z32.optional(ContainsFlags),
3497
+ updatedBy: import_zod29.z.optional(SerializableExact),
3498
+ trackingId: import_zod29.z.optional(Exact),
3499
+ flags: import_zod29.z.optional(ContainsFlags),
3786
3500
  data: QueryInput
3787
3501
  }).partial();
3788
- var Or2 = z32.object({
3789
- type: z32.literal("or"),
3790
- clauses: z32.array(SerializedQueryExpression)
3502
+ var Or2 = import_zod29.z.object({
3503
+ type: import_zod29.z.literal("or"),
3504
+ clauses: import_zod29.z.array(SerializedQueryExpression)
3791
3505
  });
3792
- var And2 = z32.object({
3793
- type: z32.literal("and"),
3794
- clauses: z32.array(SerializedQueryExpression)
3506
+ var And2 = import_zod29.z.object({
3507
+ type: import_zod29.z.literal("and"),
3508
+ clauses: import_zod29.z.array(SerializedQueryExpression)
3795
3509
  });
3796
- var CountryConfigQueryType = z32.discriminatedUnion("type", [And2, Or2]);
3797
- var CountryConfigQueryInputType = z32.union([
3510
+ var CountryConfigQueryType = import_zod29.z.discriminatedUnion("type", [And2, Or2]);
3511
+ var CountryConfigQueryInputType = import_zod29.z.union([
3798
3512
  SerializedQueryExpression,
3799
3513
  And2,
3800
3514
  Or2
3801
3515
  ]);
3802
3516
 
3517
+ // ../commons/src/icons.ts
3518
+ var import_zod30 = require("zod");
3519
+ var AvailableIcons = import_zod30.z.enum([
3520
+ "Archived",
3521
+ "Assigned",
3522
+ "Certified",
3523
+ "Close",
3524
+ "Collapse",
3525
+ "Draft",
3526
+ "DuplicateYellow",
3527
+ "Expand",
3528
+ "ExternalValidate",
3529
+ "FilledCheck",
3530
+ "InReview",
3531
+ "Offline",
3532
+ "Registered",
3533
+ "RequiresUpdates",
3534
+ "Sent",
3535
+ "Validated",
3536
+ "WaitingApproval",
3537
+ "ChartActivity",
3538
+ "Activity",
3539
+ "Archive",
3540
+ "ArchiveTray",
3541
+ "ArrowLeft",
3542
+ "ArrowRight",
3543
+ "Buildings",
3544
+ "Circle",
3545
+ "CaretDown",
3546
+ "CaretLeft",
3547
+ "CaretRight",
3548
+ "ChartBar",
3549
+ "ChartLine",
3550
+ "ChatCircle",
3551
+ "CheckSquare",
3552
+ "Compass",
3553
+ "Check",
3554
+ "Copy",
3555
+ "Database",
3556
+ "DotsThreeVertical",
3557
+ "ArrowCounterClockwise",
3558
+ "MagnifyingGlassMinus",
3559
+ "MagnifyingGlassPlus",
3560
+ "Export",
3561
+ "Eye",
3562
+ "EyeSlash",
3563
+ "Envelope",
3564
+ "File",
3565
+ "FileSearch",
3566
+ "FileMinus",
3567
+ "FilePlus",
3568
+ "FileText",
3569
+ "FileX",
3570
+ "Handshake",
3571
+ "Gear",
3572
+ "GitBranch",
3573
+ "IdentificationCard",
3574
+ "List",
3575
+ "ListBullets",
3576
+ "Lock",
3577
+ "MagnifyingGlass",
3578
+ "MapPin",
3579
+ "Medal",
3580
+ "NotePencil",
3581
+ "Paperclip",
3582
+ "PaperPlaneTilt",
3583
+ "Pen",
3584
+ "Pencil",
3585
+ "PencilSimpleLine",
3586
+ "Phone",
3587
+ "Plus",
3588
+ "Printer",
3589
+ "SignOut",
3590
+ "Star",
3591
+ "Target",
3592
+ "TextT",
3593
+ "Trash",
3594
+ "UploadSimple",
3595
+ "User",
3596
+ "UserPlus",
3597
+ "Users",
3598
+ "WarningCircle",
3599
+ "X",
3600
+ "CircleWavyCheck",
3601
+ "CircleWavyQuestion",
3602
+ "ArchiveBox",
3603
+ "ArrowCircleDown",
3604
+ "FileArrowUp",
3605
+ "FileDotted",
3606
+ "Files",
3607
+ "PencilLine",
3608
+ "PencilCircle",
3609
+ "UserCircle",
3610
+ "Clock",
3611
+ "QrCode",
3612
+ "Webcam",
3613
+ "Sun",
3614
+ "DeviceTabletCamera",
3615
+ "Globe",
3616
+ "Fingerprint",
3617
+ "PushPin",
3618
+ "Timer"
3619
+ ]);
3620
+
3803
3621
  // ../commons/src/events/WorkqueueConfig.ts
3804
3622
  var mandatoryColumns = defineWorkqueuesColumns([
3805
3623
  {
@@ -3819,21 +3637,23 @@ var mandatoryColumns = defineWorkqueuesColumns([
3819
3637
  value: event.field("updatedAt")
3820
3638
  }
3821
3639
  ]);
3822
- var WorkqueueActionsWithDefault = z33.enum([
3640
+ var WorkqueueActionsWithDefault = import_zod31.z.enum([
3823
3641
  ...workqueueActions.options,
3824
- "DEFAULT",
3825
- ActionType.READ
3642
+ "DEFAULT"
3826
3643
  ]);
3827
- var WorkqueueConfig = z33.object({
3828
- slug: z33.string().describe("Determines the url of the workqueue."),
3644
+ var WorkqueueConfig = import_zod31.z.object({
3645
+ slug: import_zod31.z.string().describe("Determines the url of the workqueue."),
3829
3646
  name: TranslationConfig.describe(
3830
3647
  "Title of the workflow (both in navigation and on the page)"
3831
3648
  ),
3832
3649
  query: CountryConfigQueryType,
3833
- /** This action object used to contain a conditionals option, but it was not used anywhere.
3834
- * It's also debatable whether it should be an array, or just a single action. */
3835
- actions: z33.array(z33.object({ type: WorkqueueActionsWithDefault })).describe("Workqueue call-to-action button configuration."),
3836
- columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
3650
+ actions: import_zod31.z.array(
3651
+ import_zod31.z.object({
3652
+ type: WorkqueueActionsWithDefault,
3653
+ conditionals: import_zod31.z.array(Conditional).optional()
3654
+ })
3655
+ ),
3656
+ columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
3837
3657
  icon: AvailableIcons,
3838
3658
  emptyMessage: TranslationConfig.optional()
3839
3659
  }).describe("Configuration for workqueue.");
@@ -3841,21 +3661,26 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3841
3661
  query: true,
3842
3662
  columns: true
3843
3663
  });
3844
- var WorkqueueConfigInput = z33.object({
3845
- slug: z33.string().describe("Determines the url of the workqueue."),
3664
+ var WorkqueueConfigInput = import_zod31.z.object({
3665
+ slug: import_zod31.z.string().describe("Determines the url of the workqueue."),
3846
3666
  name: TranslationConfig.describe(
3847
3667
  "Title of the workflow (both in navigation and on the page)"
3848
3668
  ),
3849
3669
  query: CountryConfigQueryInputType,
3850
- actions: z33.array(z33.object({ type: WorkqueueActionsWithDefault })).describe("Workqueue call-to-action button configuration."),
3851
- columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
3670
+ actions: import_zod31.z.array(
3671
+ import_zod31.z.object({
3672
+ type: WorkqueueActionsWithDefault,
3673
+ conditionals: import_zod31.z.array(Conditional).optional()
3674
+ })
3675
+ ),
3676
+ columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
3852
3677
  icon: AvailableIcons,
3853
3678
  emptyMessage: TranslationConfig.optional()
3854
3679
  });
3855
- var WorkqueueCountInput = z33.array(
3856
- z33.object({ slug: z33.string(), query: QueryType })
3680
+ var WorkqueueCountInput = import_zod31.z.array(
3681
+ import_zod31.z.object({ slug: import_zod31.z.string(), query: QueryType })
3857
3682
  );
3858
- var WorkqueueCountOutput = z33.record(z33.string(), z33.number());
3683
+ var WorkqueueCountOutput = import_zod31.z.record(import_zod31.z.string(), import_zod31.z.number());
3859
3684
 
3860
3685
  // ../commons/src/events/workqueueDefaultColumns.ts
3861
3686
  var defaultWorkqueueColumns = [
@@ -3878,40 +3703,47 @@ var defaultWorkqueueColumns = [
3878
3703
  ];
3879
3704
 
3880
3705
  // ../commons/src/events/Draft.ts
3881
- var z35 = __toESM(require("zod/v4"));
3706
+ var import_zod33 = require("zod");
3882
3707
 
3883
3708
  // ../commons/src/events/ActionInput.ts
3884
- var z34 = __toESM(require("zod/v4"));
3885
- var BaseActionInput = z34.object({
3709
+ var import_zod32 = require("zod");
3710
+ var import_zod_openapi11 = require("zod-openapi");
3711
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod32.z);
3712
+ var BaseActionInput = import_zod32.z.object({
3886
3713
  eventId: UUID,
3887
- transactionId: z34.string(),
3714
+ transactionId: import_zod32.z.string(),
3888
3715
  declaration: ActionUpdate.default({}),
3889
3716
  annotation: ActionUpdate.optional(),
3890
3717
  originalActionId: UUID.optional(),
3891
3718
  // should not be part of base action.
3892
- keepAssignment: z34.boolean().optional(),
3719
+ keepAssignment: import_zod32.z.boolean().optional(),
3893
3720
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3894
3721
  createdAtLocation: CreatedAtLocation.describe(
3895
3722
  "A valid office location ID. This is required for system users performing actions. The provided location must be a leaf-location, i.e. it must not have any children locations."
3896
3723
  )
3897
3724
  });
3898
- var CreateActionInput = BaseActionInput.extend(
3899
- z34.object({
3900
- type: z34.literal(ActionType.CREATE).default(ActionType.CREATE),
3725
+ var CreateActionInput = BaseActionInput.merge(
3726
+ import_zod32.z.object({
3727
+ type: import_zod32.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3901
3728
  createdAtLocation: CreatedAtLocation
3902
- }).shape
3729
+ })
3903
3730
  );
3904
- var RegisterActionInput = BaseActionInput.extend(
3905
- z34.strictObject({
3906
- type: z34.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3907
- registrationNumber: z34.string().optional()
3908
- }).shape
3731
+ var RegisterActionInput = BaseActionInput.merge(
3732
+ import_zod32.z.object({
3733
+ type: import_zod32.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3734
+ registrationNumber: import_zod32.z.string().optional()
3735
+ })
3736
+ ).strict();
3737
+ var ValidateActionInput = BaseActionInput.merge(
3738
+ import_zod32.z.object({
3739
+ type: import_zod32.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
3740
+ })
3909
3741
  );
3910
- var NotifyActionInput = BaseActionInput.extend(
3911
- z34.object({
3912
- type: z34.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3913
- }).shape
3914
- ).meta({
3742
+ var NotifyActionInput = BaseActionInput.merge(
3743
+ import_zod32.z.object({
3744
+ type: import_zod32.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3745
+ })
3746
+ ).openapi({
3915
3747
  default: {
3916
3748
  eventId: "<event-id-here>",
3917
3749
  transactionId: getUUID(),
@@ -3920,150 +3752,135 @@ var NotifyActionInput = BaseActionInput.extend(
3920
3752
  type: ActionType.NOTIFY
3921
3753
  }
3922
3754
  });
3923
- var DeclareActionInput = BaseActionInput.extend(
3924
- z34.object({
3925
- type: z34.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3926
- }).shape
3927
- );
3928
- var EditActionInput = BaseActionInput.extend(
3929
- z34.object({
3930
- type: z34.literal(ActionType.EDIT).default(ActionType.EDIT),
3931
- content: z34.object({
3932
- comment: z34.string().describe("Comment for the edit action.").optional()
3933
- })
3934
- }).shape
3755
+ var DeclareActionInput = BaseActionInput.merge(
3756
+ import_zod32.z.object({
3757
+ type: import_zod32.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3758
+ })
3935
3759
  );
3936
- var PrintCertificateActionInput = BaseActionInput.extend(
3937
- z34.object({
3938
- type: z34.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3760
+ var PrintCertificateActionInput = BaseActionInput.merge(
3761
+ import_zod32.z.object({
3762
+ type: import_zod32.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3939
3763
  content: PrintContent.optional()
3940
- }).shape
3764
+ })
3941
3765
  );
3942
- var RejectDeclarationActionInput = BaseActionInput.extend(
3943
- z34.object({
3944
- type: z34.literal(ActionType.REJECT).default(ActionType.REJECT),
3766
+ var RejectDeclarationActionInput = BaseActionInput.merge(
3767
+ import_zod32.z.object({
3768
+ type: import_zod32.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3945
3769
  content: ReasonContent
3946
- }).shape
3770
+ })
3947
3771
  );
3948
- var DuplicateDetectedActionInput = BaseActionInput.extend(
3949
- z34.object({
3950
- type: z34.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3951
- content: z34.object({
3952
- duplicates: z34.array(PotentialDuplicate)
3772
+ var DuplicateDetectedActionInput = BaseActionInput.merge(
3773
+ import_zod32.z.object({
3774
+ type: import_zod32.z.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3775
+ content: import_zod32.z.object({
3776
+ duplicates: import_zod32.z.array(PotentialDuplicate)
3953
3777
  })
3954
- }).shape
3778
+ })
3955
3779
  );
3956
- var MarkAsDuplicateActionInput = BaseActionInput.extend(
3957
- z34.object({
3958
- type: z34.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3959
- content: z34.object({
3780
+ var MarkAsDuplicateActionInput = BaseActionInput.merge(
3781
+ import_zod32.z.object({
3782
+ type: import_zod32.z.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3783
+ content: import_zod32.z.object({
3960
3784
  duplicateOf: UUID
3961
3785
  }).optional()
3962
- }).shape
3786
+ })
3963
3787
  );
3964
- var MarkNotDuplicateActionInput = BaseActionInput.extend(
3965
- z34.object({
3966
- type: z34.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3967
- }).shape
3788
+ var MarkNotDuplicateActionInput = BaseActionInput.merge(
3789
+ import_zod32.z.object({
3790
+ type: import_zod32.z.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3791
+ })
3968
3792
  );
3969
- var ArchiveActionInput = BaseActionInput.extend(
3970
- z34.object({
3971
- type: z34.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3793
+ var ArchiveActionInput = BaseActionInput.merge(
3794
+ import_zod32.z.object({
3795
+ type: import_zod32.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3972
3796
  content: ReasonContent
3973
- }).shape
3797
+ })
3974
3798
  );
3975
- var AssignActionInput = BaseActionInput.extend(
3976
- z34.object({
3977
- type: z34.literal(ActionType.ASSIGN),
3978
- assignedTo: z34.string()
3979
- }).shape
3799
+ var AssignActionInput = BaseActionInput.merge(
3800
+ import_zod32.z.object({
3801
+ type: import_zod32.z.literal(ActionType.ASSIGN),
3802
+ assignedTo: import_zod32.z.string()
3803
+ })
3980
3804
  );
3981
- var UnassignActionInput = BaseActionInput.extend(
3982
- z34.object({
3983
- type: z34.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3984
- assignedTo: z34.literal(null).default(null)
3985
- }).shape
3805
+ var UnassignActionInput = BaseActionInput.merge(
3806
+ import_zod32.z.object({
3807
+ type: import_zod32.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3808
+ assignedTo: import_zod32.z.literal(null).default(null)
3809
+ })
3986
3810
  );
3987
- var RequestCorrectionActionInput = BaseActionInput.extend(
3988
- z34.object({
3989
- type: z34.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3990
- }).shape
3811
+ var RequestCorrectionActionInput = BaseActionInput.merge(
3812
+ import_zod32.z.object({
3813
+ type: import_zod32.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3814
+ })
3991
3815
  );
3992
- var RejectCorrectionActionInput = BaseActionInput.extend(
3993
- z34.object({
3994
- requestId: z34.string(),
3995
- type: z34.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3816
+ var RejectCorrectionActionInput = BaseActionInput.merge(
3817
+ import_zod32.z.object({
3818
+ requestId: import_zod32.z.string(),
3819
+ type: import_zod32.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3996
3820
  content: ReasonContent
3997
- }).shape
3998
- );
3999
- var ApproveCorrectionActionInput = BaseActionInput.extend(
4000
- z34.object({
4001
- requestId: z34.string(),
4002
- type: z34.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4003
- }).shape
3821
+ })
4004
3822
  );
4005
- var ReadActionInput = BaseActionInput.extend(
4006
- z34.object({
4007
- type: z34.literal(ActionType.READ).default(ActionType.READ)
4008
- }).shape
3823
+ var ApproveCorrectionActionInput = BaseActionInput.merge(
3824
+ import_zod32.z.object({
3825
+ requestId: import_zod32.z.string(),
3826
+ type: import_zod32.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3827
+ })
4009
3828
  );
4010
- var DeleteActionInput = z34.object({ eventId: UUID });
4011
- var CustomActionInput = BaseActionInput.extend(
4012
- z34.object({
4013
- type: z34.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
4014
- customActionType: z34.string().describe("Name of the custom action.")
4015
- }).shape
3829
+ var ReadActionInput = BaseActionInput.merge(
3830
+ import_zod32.z.object({
3831
+ type: import_zod32.z.literal(ActionType.READ).default(ActionType.READ)
3832
+ })
4016
3833
  );
4017
- var ActionInput = z34.discriminatedUnion("type", [
4018
- CreateActionInput.meta({ id: "CreateActionInput" }),
4019
- RegisterActionInput.meta({ id: "RegisterActionInput" }),
4020
- NotifyActionInput.meta({ id: "NotifyActionInput" }),
4021
- DeclareActionInput.meta({ id: "DeclareActionInput" }),
4022
- RejectDeclarationActionInput.meta({
4023
- id: "RejectDeclarationActionInput"
3834
+ var DeleteActionInput = import_zod32.z.object({ eventId: UUID });
3835
+ var ActionInput = import_zod32.z.discriminatedUnion("type", [
3836
+ CreateActionInput.openapi({ ref: "CreateActionInput" }),
3837
+ ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3838
+ RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
3839
+ NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
3840
+ DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
3841
+ RejectDeclarationActionInput.openapi({
3842
+ ref: "RejectDeclarationActionInput"
4024
3843
  }),
4025
- DuplicateDetectedActionInput.meta({
4026
- id: "DuplicateDetectedActionInput"
3844
+ DuplicateDetectedActionInput.openapi({
3845
+ ref: "DuplicateDetectedActionInput"
4027
3846
  }),
4028
- MarkAsDuplicateActionInput.meta({
4029
- id: "MarkAsDuplicateActionInput"
3847
+ MarkAsDuplicateActionInput.openapi({
3848
+ ref: "MarkAsDuplicateActionInput"
4030
3849
  }),
4031
- MarkNotDuplicateActionInput.meta({
4032
- id: "MarkNotDuplicateActionInput"
3850
+ MarkNotDuplicateActionInput.openapi({
3851
+ ref: "MarkNotDuplicateActionInput"
4033
3852
  }),
4034
- ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4035
- AssignActionInput.meta({ id: "AssignActionInput" }),
4036
- UnassignActionInput.meta({ id: "UnassignActionInput" }),
4037
- PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
4038
- RequestCorrectionActionInput.meta({
4039
- id: "RequestCorrectionActionInput"
3853
+ ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
3854
+ AssignActionInput.openapi({ ref: "AssignActionInput" }),
3855
+ UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
3856
+ PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
3857
+ RequestCorrectionActionInput.openapi({
3858
+ ref: "RequestCorrectionActionInput"
4040
3859
  }),
4041
- RejectCorrectionActionInput.meta({ id: "RejectCorrectionActionInput" }),
4042
- ApproveCorrectionActionInput.meta({
4043
- id: "ApproveCorrectionActionInput"
3860
+ RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
3861
+ ApproveCorrectionActionInput.openapi({
3862
+ ref: "ApproveCorrectionActionInput"
4044
3863
  }),
4045
- ReadActionInput.meta({ id: "ReadActionInput" }),
4046
- CustomActionInput.meta({ id: "CustomActionInput" }),
4047
- EditActionInput.meta({ id: "EditActionInput" })
4048
- ]).meta({
4049
- id: "ActionInput"
3864
+ ReadActionInput.openapi({ ref: "ReadActionInput" })
3865
+ ]).openapi({
3866
+ ref: "ActionInput"
4050
3867
  });
4051
3868
 
4052
3869
  // ../commons/src/events/Draft.ts
4053
- var Draft = z35.object({
3870
+ var Draft = import_zod33.z.object({
4054
3871
  id: UUID,
4055
3872
  eventId: UUID,
4056
- transactionId: z35.string(),
4057
- createdAt: z35.string().datetime(),
3873
+ transactionId: import_zod33.z.string(),
3874
+ createdAt: import_zod33.z.string().datetime(),
4058
3875
  action: ActionBase.extend({
4059
- type: ActionTypes.exclude([ActionTypes.enum.DELETE])
3876
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
4060
3877
  }).omit({ id: true, createdAtLocation: true })
4061
3878
  }).describe(
4062
3879
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
4063
3880
  );
4064
3881
  var DraftInput = BaseActionInput.extend({
4065
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4066
- status: z35.enum([
3882
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
3883
+ status: import_zod33.z.enum([
4067
3884
  ActionStatus.Requested,
4068
3885
  ActionStatus.Accepted,
4069
3886
  ActionStatus.Rejected
@@ -4071,30 +3888,32 @@ var DraftInput = BaseActionInput.extend({
4071
3888
  });
4072
3889
 
4073
3890
  // ../commons/src/events/EventInput.ts
4074
- var z36 = __toESM(require("zod/v4"));
3891
+ var import_zod34 = require("zod");
4075
3892
  var import_uuid10 = require("uuid");
4076
- var EventInput = z36.object({
4077
- transactionId: z36.string(),
4078
- type: z36.string()
4079
- }).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
3893
+ var EventInput = import_zod34.z.object({
3894
+ transactionId: import_zod34.z.string(),
3895
+ type: import_zod34.z.string()
3896
+ }).openapi({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
4080
3897
 
4081
3898
  // ../commons/src/events/EventDocument.ts
4082
- var z37 = __toESM(require("zod/v4"));
4083
- var EventDocument = z37.object({
3899
+ var import_zod35 = require("zod");
3900
+ var import_zod_openapi12 = require("zod-openapi");
3901
+ (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod35.z);
3902
+ var EventDocument = import_zod35.z.object({
4084
3903
  id: UUID.describe("Unique identifier of the event."),
4085
- type: z37.string().describe("Type of the event (e.g. birth, death, marriage)."),
4086
- createdAt: z37.string().datetime().describe("Timestamp indicating when the event was created."),
4087
- updatedAt: z37.string().datetime().describe(
3904
+ type: import_zod35.z.string().describe("Type of the event (e.g. birth, death, marriage)."),
3905
+ createdAt: import_zod35.z.string().datetime().describe("Timestamp indicating when the event was created."),
3906
+ updatedAt: import_zod35.z.string().datetime().describe(
4088
3907
  "Timestamp of the last update, excluding changes from actions."
4089
3908
  ),
4090
- actions: z37.array(Action).describe("Ordered list of actions associated with the event."),
4091
- trackingId: z37.string().describe(
3909
+ actions: import_zod35.z.array(Action).describe("Ordered list of actions associated with the event."),
3910
+ trackingId: import_zod35.z.string().describe(
4092
3911
  "System-generated tracking identifier used to look up the event."
4093
3912
  )
4094
- }).meta({ id: "EventDocument" });
3913
+ }).openapi({ ref: "EventDocument" });
4095
3914
 
4096
3915
  // ../commons/src/events/state/index.ts
4097
- var import_lodash4 = require("lodash");
3916
+ var import_lodash3 = require("lodash");
4098
3917
 
4099
3918
  // ../commons/src/events/state/utils.ts
4100
3919
  var import_lodash2 = require("lodash");
@@ -4102,18 +3921,14 @@ var updateActions = ActionTypes.extract([
4102
3921
  ActionType.CREATE,
4103
3922
  ActionType.NOTIFY,
4104
3923
  ActionType.DECLARE,
3924
+ ActionType.VALIDATE,
4105
3925
  ActionType.REGISTER,
4106
3926
  ActionType.REJECT,
4107
3927
  ActionType.ARCHIVE,
4108
3928
  ActionType.PRINT_CERTIFICATE,
4109
- ActionType.REQUEST_CORRECTION,
4110
- ActionType.CUSTOM
3929
+ ActionType.REQUEST_CORRECTION
4111
3930
  ]);
4112
3931
 
4113
- // ../commons/src/events/state/flags.ts
4114
- var import_lodash3 = require("lodash");
4115
- var import_date_fns3 = require("date-fns");
4116
-
4117
3932
  // ../commons/src/events/defineConfig.ts
4118
3933
  var defineConfig = (config) => {
4119
3934
  const input = EventConfig.parse(config);
@@ -4121,7 +3936,7 @@ var defineConfig = (config) => {
4121
3936
  };
4122
3937
 
4123
3938
  // ../commons/src/events/test.utils.ts
4124
- var import_lodash5 = require("lodash");
3939
+ var import_lodash4 = require("lodash");
4125
3940
  var import_date_fns4 = require("date-fns");
4126
3941
 
4127
3942
  // ../commons/src/field-config/field-configuration.ts
@@ -4143,6 +3958,7 @@ function field(fieldId, options = {}) {
4143
3958
  }
4144
3959
 
4145
3960
  // ../commons/src/fixtures/forms.ts
3961
+ var import_date_fns3 = require("date-fns");
4146
3962
  var PRINT_CERTIFICATE_FORM = defineActionForm({
4147
3963
  label: {
4148
3964
  id: "event.tennis-club-membership.action.certificate.form.label",
@@ -4942,7 +4758,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4942
4758
  conditionals: [
4943
4759
  {
4944
4760
  type: ConditionalType.DISPLAY_ON_REVIEW,
4945
- conditional: never2()
4761
+ conditional: never()
4946
4762
  }
4947
4763
  ]
4948
4764
  },
@@ -5325,16 +5141,119 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5325
5141
  }
5326
5142
  }
5327
5143
  ],
5328
- conditional: not(never2())
5144
+ conditional: not(never())
5329
5145
  // Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
5330
5146
  }
5331
5147
  ]
5332
5148
  });
5149
+ var statusOptions = [
5150
+ {
5151
+ value: "ALL",
5152
+ label: {
5153
+ defaultMessage: "Any status",
5154
+ description: "Option for form field: status of record",
5155
+ id: "advancedSearch.form.recordStatusAny"
5156
+ }
5157
+ },
5158
+ {
5159
+ value: EventStatus.enum.CREATED,
5160
+ label: {
5161
+ defaultMessage: "Draft",
5162
+ description: "Option for form field: status of record",
5163
+ id: "advancedSearch.form.recordStatusCreated"
5164
+ }
5165
+ },
5166
+ {
5167
+ value: EventStatus.enum.NOTIFIED,
5168
+ label: {
5169
+ defaultMessage: "Notified",
5170
+ description: "Option for form field: status of record",
5171
+ id: "advancedSearch.form.recordStatusNotified"
5172
+ }
5173
+ },
5174
+ {
5175
+ value: EventStatus.enum.DECLARED,
5176
+ label: {
5177
+ defaultMessage: "Declared",
5178
+ description: "Option for form field: status of record",
5179
+ id: "advancedSearch.form.recordStatusDeclared"
5180
+ }
5181
+ },
5182
+ {
5183
+ value: EventStatus.enum.VALIDATED,
5184
+ label: {
5185
+ defaultMessage: "Validated",
5186
+ description: "Option for form field: status of record",
5187
+ id: "advancedSearch.form.recordStatusValidated"
5188
+ }
5189
+ },
5190
+ {
5191
+ value: EventStatus.enum.REGISTERED,
5192
+ label: {
5193
+ defaultMessage: "Registered",
5194
+ description: "Option for form field: status of record",
5195
+ id: "advancedSearch.form.recordStatusRegistered"
5196
+ }
5197
+ },
5198
+ {
5199
+ value: EventStatus.enum.ARCHIVED,
5200
+ label: {
5201
+ defaultMessage: "Archived",
5202
+ description: "Option for form field: status of record",
5203
+ id: "advancedSearch.form.recordStatusArchived"
5204
+ }
5205
+ }
5206
+ ];
5207
+ var timePeriodOptions = [
5208
+ {
5209
+ label: {
5210
+ defaultMessage: "Last 7 days",
5211
+ description: "Label for option of time period select: last 7 days",
5212
+ id: "form.section.label.timePeriodLast7Days"
5213
+ },
5214
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5215
+ /* @__PURE__ */ new Date(),
5216
+ "yyyy-MM-dd"
5217
+ )}`
5218
+ },
5219
+ {
5220
+ label: {
5221
+ defaultMessage: "Last 30 days",
5222
+ description: "Label for option of time period select: last 30 days",
5223
+ id: "form.section.label.timePeriodLast30Days"
5224
+ },
5225
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5226
+ /* @__PURE__ */ new Date(),
5227
+ "yyyy-MM-dd"
5228
+ )}`
5229
+ },
5230
+ {
5231
+ label: {
5232
+ defaultMessage: "Last 90 days",
5233
+ description: "Label for option of time period select: last 90 days",
5234
+ id: "form.section.label.timePeriodLast90Days"
5235
+ },
5236
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5237
+ /* @__PURE__ */ new Date(),
5238
+ "yyyy-MM-dd"
5239
+ )}`
5240
+ },
5241
+ {
5242
+ label: {
5243
+ defaultMessage: "Last year",
5244
+ description: "Label for option of time period select: last year",
5245
+ id: "form.section.label.timePeriodLastYear"
5246
+ },
5247
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5248
+ /* @__PURE__ */ new Date(),
5249
+ "yyyy-MM-dd"
5250
+ )}`
5251
+ }
5252
+ ];
5333
5253
 
5334
5254
  // ../commons/src/fixtures/tennis-club-membership-event.ts
5335
5255
  var tennisClubMembershipEvent = defineConfig({
5336
5256
  id: TENNIS_CLUB_MEMBERSHIP,
5337
- declaration: TENNIS_CLUB_DECLARATION_FORM,
5338
5257
  label: {
5339
5258
  defaultMessage: "Tennis club membership application",
5340
5259
  description: "This is what this event is referred as in the system",
@@ -5385,12 +5304,13 @@ var tennisClubMembershipEvent = defineConfig({
5385
5304
  review: TENNIS_CLUB_DECLARATION_REVIEW
5386
5305
  },
5387
5306
  {
5388
- type: ActionType.REJECT,
5307
+ type: ActionType.VALIDATE,
5389
5308
  label: {
5390
- defaultMessage: "Reject",
5309
+ defaultMessage: "Validate",
5391
5310
  description: "This is shown as the action name anywhere the user can trigger the action from",
5392
- id: "event.tennis-club-membership.action.reject.label"
5393
- }
5311
+ id: "event.tennis-club-membership.action.validate.label"
5312
+ },
5313
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5394
5314
  },
5395
5315
  {
5396
5316
  type: ActionType.REGISTER,
@@ -5398,7 +5318,8 @@ var tennisClubMembershipEvent = defineConfig({
5398
5318
  defaultMessage: "Register",
5399
5319
  description: "This is shown as the action name anywhere the user can trigger the action from",
5400
5320
  id: "event.tennis-club-membership.action.register.label"
5401
- }
5321
+ },
5322
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5402
5323
  },
5403
5324
  {
5404
5325
  type: ActionType.REQUEST_CORRECTION,
@@ -5601,6 +5522,14 @@ var tennisClubMembershipEvent = defineConfig({
5601
5522
  ]
5602
5523
  }
5603
5524
  },
5525
+ {
5526
+ type: ActionType.APPROVE_CORRECTION,
5527
+ label: {
5528
+ defaultMessage: "Approve correction",
5529
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5530
+ id: "event.tennis-club-membership.action.correction.approve.label"
5531
+ }
5532
+ },
5604
5533
  {
5605
5534
  type: ActionType.PRINT_CERTIFICATE,
5606
5535
  label: {
@@ -5609,6 +5538,22 @@ var tennisClubMembershipEvent = defineConfig({
5609
5538
  description: "This is shown as the action name anywhere the user can trigger the action from"
5610
5539
  },
5611
5540
  printForm: PRINT_CERTIFICATE_FORM
5541
+ },
5542
+ {
5543
+ type: ActionType.ARCHIVE,
5544
+ label: {
5545
+ id: "event.tennis-club-membership.action.archive.label",
5546
+ defaultMessage: "Archive",
5547
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5548
+ }
5549
+ },
5550
+ {
5551
+ type: ActionType.REJECT,
5552
+ label: {
5553
+ id: "event.tennis-club-membership.action.reject.label",
5554
+ defaultMessage: "Reject",
5555
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5556
+ }
5612
5557
  }
5613
5558
  ],
5614
5559
  advancedSearch: [
@@ -5645,7 +5590,8 @@ var tennisClubMembershipEvent = defineConfig({
5645
5590
  },
5646
5591
  fields: [field("recommender.name").fuzzy()]
5647
5592
  }
5648
- ]
5593
+ ],
5594
+ declaration: TENNIS_CLUB_DECLARATION_FORM
5649
5595
  });
5650
5596
 
5651
5597
  // ../commons/src/fixtures/football-club-membership-event.ts
@@ -5713,13 +5659,23 @@ var footballClubMembershipEvent = defineConfig({
5713
5659
  },
5714
5660
  review: TENNIS_CLUB_DECLARATION_REVIEW
5715
5661
  },
5662
+ {
5663
+ type: ActionType.VALIDATE,
5664
+ label: {
5665
+ defaultMessage: "Validate",
5666
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5667
+ id: "event.football-club-membership.action.validate.label"
5668
+ },
5669
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5670
+ },
5716
5671
  {
5717
5672
  type: ActionType.REGISTER,
5718
5673
  label: {
5719
5674
  defaultMessage: "Register",
5720
5675
  description: "This is shown as the action name anywhere the user can trigger the action from",
5721
5676
  id: "event.football-club-membership.action.register.label"
5722
- }
5677
+ },
5678
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5723
5679
  },
5724
5680
  {
5725
5681
  type: ActionType.REQUEST_CORRECTION,
@@ -5925,6 +5881,14 @@ var footballClubMembershipEvent = defineConfig({
5925
5881
  ]
5926
5882
  }
5927
5883
  },
5884
+ {
5885
+ type: ActionType.APPROVE_CORRECTION,
5886
+ label: {
5887
+ defaultMessage: "Approve correction",
5888
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5889
+ id: "event.football-club-membership.action.correction.approve.label"
5890
+ }
5891
+ },
5928
5892
  {
5929
5893
  type: ActionType.PRINT_CERTIFICATE,
5930
5894
  label: {
@@ -5933,6 +5897,22 @@ var footballClubMembershipEvent = defineConfig({
5933
5897
  description: "This is shown as the action name anywhere the user can trigger the action from"
5934
5898
  },
5935
5899
  printForm: PRINT_CERTIFICATE_FORM
5900
+ },
5901
+ {
5902
+ type: ActionType.ARCHIVE,
5903
+ label: {
5904
+ id: "event.football-club-membership.action.archive.label",
5905
+ defaultMessage: "Archive",
5906
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5907
+ }
5908
+ },
5909
+ {
5910
+ type: ActionType.REJECT,
5911
+ label: {
5912
+ id: "event.football-club-membership.action.reject.label",
5913
+ defaultMessage: "Reject",
5914
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5915
+ }
5936
5916
  }
5937
5917
  ],
5938
5918
  advancedSearch: [
@@ -6032,7 +6012,7 @@ var libraryMembershipEvent = defineConfig({
6032
6012
  declaration: libraryMembershipForm
6033
6013
  });
6034
6014
 
6035
- // ../commons/src/fixtures/child-onboarding-event.ts
6015
+ // ../commons/src/fixtures/v2-birth-event.ts
6036
6016
  function generateTranslationConfig(message) {
6037
6017
  return {
6038
6018
  defaultMessage: message,
@@ -6061,61 +6041,6 @@ var child = defineFormPage({
6061
6041
  secured: true,
6062
6042
  validation: [],
6063
6043
  label: generateTranslationConfig("Date of birth")
6064
- },
6065
- {
6066
- id: "child.placeOfBirth",
6067
- analytics: true,
6068
- type: FieldType.SELECT,
6069
- required: true,
6070
- secured: true,
6071
- label: {
6072
- defaultMessage: "Place of delivery",
6073
- description: "This is the label for the field",
6074
- id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
6075
- },
6076
- options: [
6077
- {
6078
- value: "child.placeOfBirth-SELECT-2",
6079
- label: generateTranslationConfig("Health Institution")
6080
- },
6081
- {
6082
- value: "PRIVATE_HOME",
6083
- label: generateTranslationConfig("Residential address")
6084
- }
6085
- ]
6086
- },
6087
- {
6088
- id: "child.birthLocation",
6089
- analytics: true,
6090
- type: "FACILITY",
6091
- required: true,
6092
- secured: true,
6093
- label: generateTranslationConfig("Health Institution"),
6094
- conditionals: [
6095
- {
6096
- type: "SHOW",
6097
- conditional: field("child.placeOfBirth").isEqualTo(
6098
- "child.placeOfBirth-SELECT-2"
6099
- )
6100
- }
6101
- ]
6102
- },
6103
- {
6104
- id: "child.birthLocation.privateHome",
6105
- analytics: true,
6106
- type: FieldType.ADDRESS,
6107
- secured: true,
6108
- hideLabel: true,
6109
- label: generateTranslationConfig("Child's address"),
6110
- conditionals: [
6111
- {
6112
- type: "SHOW",
6113
- conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
6114
- }
6115
- ],
6116
- configuration: {
6117
- streetAddressForm: []
6118
- }
6119
6044
  }
6120
6045
  ]
6121
6046
  });
@@ -6192,7 +6117,7 @@ var mother = defineFormPage({
6192
6117
  }
6193
6118
  ]
6194
6119
  });
6195
- var CHILD_ONBOARDING_DECLARATION_REVIEW = {
6120
+ var BIRTH_DECLARATION_REVIEW = {
6196
6121
  title: generateTranslationConfig(
6197
6122
  "{child.name.firstname, select, __EMPTY__ {Birth declaration} other {{child.name.surname, select, __EMPTY__ {Birth declaration for {child.name.firstname}} other {Birth declaration for {child.name.firstname} {child.name.surname}}}}}"
6198
6123
  ),
@@ -6212,12 +6137,12 @@ var CHILD_ONBOARDING_DECLARATION_REVIEW = {
6212
6137
  }
6213
6138
  ]
6214
6139
  };
6215
- var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
6140
+ var BIRTH_DECLARATION_FORM = defineDeclarationForm({
6216
6141
  label: generateTranslationConfig("Birth decalration form"),
6217
6142
  pages: [child, mother]
6218
6143
  });
6219
- var ChildOnboardingEvent = defineConfig({
6220
- id: CHILD_ONBOARDING_EVENT,
6144
+ var v2BirthEvent = defineConfig({
6145
+ id: BIRTH_EVENT,
6221
6146
  title: generateTranslationConfig(
6222
6147
  "{child.name.firstname} {child.name.surname}"
6223
6148
  ),
@@ -6225,21 +6150,27 @@ var ChildOnboardingEvent = defineConfig({
6225
6150
  summary: {
6226
6151
  fields: []
6227
6152
  },
6228
- declaration: CHILD_ONBOARDING_DECLARATION_FORM,
6153
+ declaration: BIRTH_DECLARATION_FORM,
6229
6154
  actions: [
6230
6155
  {
6231
6156
  type: ActionType.READ,
6232
6157
  label: generateTranslationConfig("Read"),
6233
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
6158
+ review: BIRTH_DECLARATION_REVIEW
6234
6159
  },
6235
6160
  {
6236
6161
  type: ActionType.DECLARE,
6237
6162
  label: generateTranslationConfig("Declare"),
6238
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
6163
+ review: BIRTH_DECLARATION_REVIEW
6164
+ },
6165
+ {
6166
+ type: ActionType.VALIDATE,
6167
+ label: generateTranslationConfig("Validate"),
6168
+ review: BIRTH_DECLARATION_REVIEW
6239
6169
  },
6240
6170
  {
6241
6171
  type: ActionType.REGISTER,
6242
- label: generateTranslationConfig("Register")
6172
+ label: generateTranslationConfig("Register"),
6173
+ review: BIRTH_DECLARATION_REVIEW
6243
6174
  }
6244
6175
  ],
6245
6176
  advancedSearch: []
@@ -6327,7 +6258,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6327
6258
  conditionals: [
6328
6259
  {
6329
6260
  type: ConditionalType.ENABLE,
6330
- conditional: never2()
6261
+ conditional: never()
6331
6262
  },
6332
6263
  {
6333
6264
  type: ConditionalType.SHOW,
@@ -6354,7 +6285,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6354
6285
  conditionals: [
6355
6286
  {
6356
6287
  type: ConditionalType.ENABLE,
6357
- conditional: never2()
6288
+ conditional: never()
6358
6289
  },
6359
6290
  {
6360
6291
  type: ConditionalType.SHOW,
@@ -6382,7 +6313,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6382
6313
  conditionals: [
6383
6314
  {
6384
6315
  type: ConditionalType.ENABLE,
6385
- conditional: never2()
6316
+ conditional: never()
6386
6317
  }
6387
6318
  ],
6388
6319
  value: field("identity.http-fetch").get("data.certificateId")
@@ -6460,8 +6391,8 @@ var digitalIdentityEvent = defineConfig({
6460
6391
  });
6461
6392
 
6462
6393
  // ../commons/src/events/test.utils.ts
6463
- var z38 = __toESM(require("zod/v4"));
6464
- var TestUserRole = z38.enum([
6394
+ var import_zod36 = require("zod");
6395
+ var TestUserRole = import_zod36.z.enum([
6465
6396
  "FIELD_AGENT",
6466
6397
  "LOCAL_REGISTRAR",
6467
6398
  "LOCAL_SYSTEM_ADMIN",
@@ -6472,14 +6403,18 @@ var TestUserRole = z38.enum([
6472
6403
  ]);
6473
6404
 
6474
6405
  // ../commons/src/events/scopes.ts
6475
- var import_lodash6 = require("lodash");
6406
+ var import_lodash5 = require("lodash");
6476
6407
  var ACTION_SCOPE_MAP = {
6477
6408
  [ActionType.READ]: ["record.read"],
6478
6409
  [ActionType.CREATE]: ["record.create"],
6479
6410
  [ActionType.NOTIFY]: ["record.notify"],
6480
- [ActionType.DECLARE]: ["record.declare", "record.register"],
6481
- [ActionType.EDIT]: ["record.declared.edit"],
6411
+ [ActionType.DECLARE]: [
6412
+ "record.declare",
6413
+ "record.declared.validate",
6414
+ "record.register"
6415
+ ],
6482
6416
  [ActionType.DELETE]: ["record.declare"],
6417
+ [ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
6483
6418
  [ActionType.REGISTER]: ["record.register"],
6484
6419
  [ActionType.PRINT_CERTIFICATE]: ["record.registered.print-certified-copies"],
6485
6420
  [ActionType.REQUEST_CORRECTION]: [
@@ -6497,8 +6432,7 @@ var ACTION_SCOPE_MAP = {
6497
6432
  [ActionType.REJECT]: ["record.declared.reject"],
6498
6433
  [ActionType.ASSIGN]: null,
6499
6434
  [ActionType.UNASSIGN]: null,
6500
- [ActionType.DUPLICATE_DETECTED]: [],
6501
- [ActionType.CUSTOM]: []
6435
+ [ActionType.DUPLICATE_DETECTED]: []
6502
6436
  };
6503
6437
 
6504
6438
  // ../commons/src/events/state/availableActions.ts
@@ -6507,25 +6441,28 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6507
6441
  ActionType.READ,
6508
6442
  ActionType.DECLARE,
6509
6443
  ActionType.NOTIFY,
6510
- ActionType.DELETE,
6511
- ActionType.CUSTOM
6444
+ ActionType.DELETE
6512
6445
  ],
6513
6446
  [EventStatus.enum.NOTIFIED]: [
6514
6447
  ActionType.READ,
6515
- ActionType.EDIT,
6448
+ ActionType.DECLARE,
6516
6449
  ActionType.MARK_AS_DUPLICATE,
6517
6450
  ActionType.ARCHIVE,
6518
- ActionType.REJECT,
6519
- ActionType.CUSTOM
6451
+ ActionType.REJECT
6520
6452
  ],
6521
6453
  [EventStatus.enum.DECLARED]: [
6454
+ ActionType.READ,
6455
+ ActionType.VALIDATE,
6456
+ ActionType.MARK_AS_DUPLICATE,
6457
+ ActionType.ARCHIVE,
6458
+ ActionType.REJECT
6459
+ ],
6460
+ [EventStatus.enum.VALIDATED]: [
6522
6461
  ActionType.READ,
6523
6462
  ActionType.REGISTER,
6524
6463
  ActionType.MARK_AS_DUPLICATE,
6525
6464
  ActionType.ARCHIVE,
6526
- ActionType.REJECT,
6527
- ActionType.CUSTOM,
6528
- ActionType.EDIT
6465
+ ActionType.REJECT
6529
6466
  ],
6530
6467
  [EventStatus.enum.REGISTERED]: [
6531
6468
  ActionType.READ,
@@ -6533,14 +6470,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6533
6470
  ActionType.REQUEST_CORRECTION,
6534
6471
  ActionType.APPROVE_CORRECTION,
6535
6472
  ActionType.REJECT_CORRECTION,
6536
- ActionType.CUSTOM,
6537
6473
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
6538
6474
  ],
6539
6475
  [EventStatus.enum.ARCHIVED]: [
6540
6476
  ActionType.READ,
6541
6477
  ActionType.ASSIGN,
6542
- ActionType.UNASSIGN,
6543
- ActionType.CUSTOM
6478
+ ActionType.UNASSIGN
6544
6479
  ]
6545
6480
  };
6546
6481
  var ACTION_FILTERS = {
@@ -6550,41 +6485,32 @@ var ACTION_FILTERS = {
6550
6485
  [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6551
6486
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6552
6487
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6553
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6488
+ [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6554
6489
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6555
6490
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
6556
6491
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6557
6492
  };
6558
6493
 
6559
6494
  // ../commons/src/events/FileUtils.ts
6560
- var import_lodash7 = require("lodash");
6495
+ var import_lodash6 = require("lodash");
6561
6496
 
6562
6497
  // ../commons/src/events/locations.ts
6563
- var z39 = __toESM(require("zod/v4"));
6564
- var LocationTypeV1 = z39.enum([
6498
+ var import_zod37 = require("zod");
6499
+ var LocationType = import_zod37.z.enum([
6565
6500
  "ADMIN_STRUCTURE",
6566
6501
  "CRVS_OFFICE",
6567
6502
  "HEALTH_FACILITY"
6568
6503
  ]);
6569
- var LocationType = z39.enum(["CRVS_OFFICE", "HEALTH_FACILITY"]);
6570
- var AdministrativeArea = z39.object({
6504
+ var Location = import_zod37.z.object({
6571
6505
  id: UUID,
6572
- name: z39.string(),
6573
- externalId: z39.string().nullish(),
6506
+ name: import_zod37.z.string(),
6574
6507
  parentId: UUID.nullable(),
6575
- validUntil: z39.iso.datetime().nullable()
6576
- });
6577
- var Location = z39.object({
6578
- id: UUID,
6579
- name: z39.string(),
6580
- externalId: z39.string().nullish(),
6581
- administrativeAreaId: UUID.nullable(),
6582
- validUntil: z39.iso.datetime().nullable(),
6583
- locationType: z39.string().nullable()
6508
+ validUntil: import_zod37.z.string().datetime().nullable(),
6509
+ locationType: LocationType.nullable()
6584
6510
  });
6585
6511
 
6586
6512
  // ../commons/src/notification/UserNotifications.ts
6587
- var z40 = __toESM(require("zod/v4"));
6513
+ var import_zod38 = require("zod");
6588
6514
  var TriggerEvent = {
6589
6515
  USER_CREATED: "user-created",
6590
6516
  USER_UPDATED: "user-updated",
@@ -6596,50 +6522,50 @@ var TriggerEvent = {
6596
6522
  CHANGE_PHONE_NUMBER: "change-phone-number",
6597
6523
  CHANGE_EMAIL_ADDRESS: "change-email-address"
6598
6524
  };
6599
- var Recipient = z40.object({
6525
+ var Recipient = import_zod38.z.object({
6600
6526
  name: NameFieldValue.optional(),
6601
- mobile: z40.string().optional(),
6602
- email: z40.string().optional(),
6603
- bcc: z40.array(z40.string()).optional()
6527
+ mobile: import_zod38.z.string().optional(),
6528
+ email: import_zod38.z.string().optional(),
6529
+ bcc: import_zod38.z.array(import_zod38.z.string()).optional()
6604
6530
  });
6605
- var BasePayload = z40.object({
6531
+ var BasePayload = import_zod38.z.object({
6606
6532
  recipient: Recipient
6607
6533
  });
6608
6534
  var TriggerPayload = {
6609
6535
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
6610
- username: z40.string(),
6611
- temporaryPassword: z40.string()
6536
+ username: import_zod38.z.string(),
6537
+ temporaryPassword: import_zod38.z.string()
6612
6538
  }),
6613
6539
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
6614
- oldUsername: z40.string(),
6615
- newUsername: z40.string()
6540
+ oldUsername: import_zod38.z.string(),
6541
+ newUsername: import_zod38.z.string()
6616
6542
  }),
6617
6543
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
6618
- username: z40.string()
6544
+ username: import_zod38.z.string()
6619
6545
  }),
6620
6546
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
6621
- code: z40.string()
6547
+ code: import_zod38.z.string()
6622
6548
  }),
6623
6549
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
6624
- temporaryPassword: z40.string(),
6625
- admin: z40.object({
6626
- id: z40.string(),
6550
+ temporaryPassword: import_zod38.z.string(),
6551
+ admin: import_zod38.z.object({
6552
+ id: import_zod38.z.string(),
6627
6553
  name: NameFieldValue,
6628
- role: z40.string()
6554
+ role: import_zod38.z.string()
6629
6555
  })
6630
6556
  }),
6631
6557
  [TriggerEvent.TWO_FA]: BasePayload.extend({
6632
- code: z40.string()
6558
+ code: import_zod38.z.string()
6633
6559
  }),
6634
6560
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
6635
- subject: z40.string(),
6636
- body: z40.string()
6561
+ subject: import_zod38.z.string(),
6562
+ body: import_zod38.z.string()
6637
6563
  }),
6638
6564
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
6639
- code: z40.string()
6565
+ code: import_zod38.z.string()
6640
6566
  }),
6641
6567
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
6642
- code: z40.string()
6568
+ code: import_zod38.z.string()
6643
6569
  })
6644
6570
  };
6645
6571
  async function triggerUserEventNotification({
@@ -6661,6 +6587,3 @@ function parseUserEventTrigger(event2, body) {
6661
6587
  const schema = TriggerPayload[event2];
6662
6588
  return schema.parse(body);
6663
6589
  }
6664
-
6665
- // src/notification/index.ts
6666
- z41.globalRegistry.clear();