@opencrvs/toolkit 1.9.3-rc.5fc5dc2 → 1.9.3-rc.6644269

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 +2428 -28200
  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 +1547 -23121
  5. package/dist/commons/events/ActionDocument.d.ts +1849 -840
  6. package/dist/commons/events/ActionInput.d.ts +1066 -290
  7. package/dist/commons/events/ActionType.d.ts +8 -91
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -222
  9. package/dist/commons/events/CompositeFieldValue.d.ts +176 -25
  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 +4169 -931
  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 -72
  16. package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
  17. package/dist/commons/events/EventConfig.d.ts +2120 -18321
  18. package/dist/commons/events/EventConfigInput.d.ts +1 -1
  19. package/dist/commons/events/EventDocument.d.ts +1326 -336
  20. package/dist/commons/events/EventIndex.d.ts +967 -197
  21. package/dist/commons/events/EventInput.d.ts +8 -2
  22. package/dist/commons/events/EventMetadata.d.ts +346 -106
  23. package/dist/commons/events/FieldConfig.d.ts +11773 -4168
  24. package/dist/commons/events/FieldType.d.ts +4 -9
  25. package/dist/commons/events/FieldTypeMapping.d.ts +811 -172
  26. package/dist/commons/events/FieldValue.d.ts +355 -82
  27. package/dist/commons/events/FormConfig.d.ts +721 -12876
  28. package/dist/commons/events/PageConfig.d.ts +319 -8604
  29. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  30. package/dist/commons/events/TemplateConfig.d.ts +3 -3
  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 +7080 -1619
  34. package/dist/commons/events/deduplication.d.ts +3 -3
  35. package/dist/commons/events/defineConfig.d.ts +163 -25171
  36. package/dist/commons/events/event.d.ts +4 -4
  37. package/dist/commons/events/index.d.ts +0 -1
  38. package/dist/commons/events/locations.d.ts +19 -15
  39. package/dist/commons/events/scopes.d.ts +1 -3
  40. package/dist/commons/events/state/availableActions.d.ts +1 -2
  41. package/dist/commons/events/state/flags.d.ts +3 -21
  42. package/dist/commons/events/state/index.d.ts +19 -23
  43. package/dist/commons/events/state/utils.d.ts +110 -142
  44. package/dist/commons/events/test.utils.d.ts +6 -23
  45. package/dist/commons/events/transactions.d.ts +1 -1
  46. package/dist/commons/events/utils.d.ts +374 -50385
  47. package/dist/commons/notification/UserNotifications.d.ts +636 -55
  48. package/dist/conditionals/index.d.ts.map +1 -1
  49. package/dist/conditionals/index.js +5 -38
  50. package/dist/events/deduplication.d.ts +3 -3
  51. package/dist/events/index.js +1709 -1813
  52. package/dist/notification/index.d.ts.map +1 -1
  53. package/dist/notification/index.js +1640 -1500
  54. package/dist/scopes/index.d.ts +138 -138
  55. package/dist/scopes/index.d.ts.map +1 -1
  56. package/dist/scopes/index.js +93 -123
  57. package/package.json +5 -5
  58. package/dist/commons/events/Flag.d.ts +0 -70
@@ -38,7 +38,6 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z40 = __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 z21 = __toESM(require("zod/v4"));
53
+ var import_zod19 = 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",
@@ -79,7 +80,6 @@ var ActionType = {
79
80
  DECLARE: "DECLARE",
80
81
  VALIDATE: "VALIDATE",
81
82
  REGISTER: "REGISTER",
82
- EDIT: "EDIT",
83
83
  // Declaration system actions. Non-configurable.
84
84
  DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
85
85
  REJECT: "REJECT",
@@ -95,14 +95,11 @@ var ActionType = {
95
95
  // General actions
96
96
  READ: "READ",
97
97
  ASSIGN: "ASSIGN",
98
- UNASSIGN: "UNASSIGN",
99
- // Custom action
100
- CUSTOM: "CUSTOM"
98
+ UNASSIGN: "UNASSIGN"
101
99
  };
102
100
  var ConfirmableActions = [
103
101
  ActionType.NOTIFY,
104
102
  ActionType.DECLARE,
105
- ActionType.EDIT,
106
103
  ActionType.VALIDATE,
107
104
  ActionType.REGISTER,
108
105
  ActionType.REJECT,
@@ -110,15 +107,13 @@ var ConfirmableActions = [
110
107
  ActionType.PRINT_CERTIFICATE,
111
108
  ActionType.REQUEST_CORRECTION,
112
109
  ActionType.APPROVE_CORRECTION,
113
- ActionType.REJECT_CORRECTION,
114
- ActionType.CUSTOM
110
+ ActionType.REJECT_CORRECTION
115
111
  ];
116
- var ActionTypes = z2.enum([
112
+ var ActionTypes = import_zod2.z.enum([
117
113
  "DELETE",
118
114
  "CREATE",
119
115
  "NOTIFY",
120
116
  "DECLARE",
121
- "EDIT",
122
117
  "VALIDATE",
123
118
  "REGISTER",
124
119
  "DUPLICATE_DETECTED",
@@ -132,15 +127,13 @@ var ActionTypes = z2.enum([
132
127
  "APPROVE_CORRECTION",
133
128
  "READ",
134
129
  "ASSIGN",
135
- "UNASSIGN",
136
- "CUSTOM"
130
+ "UNASSIGN"
137
131
  ]);
138
132
  var ClientSpecificAction = {
139
133
  REVIEW_CORRECTION_REQUEST: "REVIEW_CORRECTION_REQUEST"
140
134
  };
141
135
  var declarationActionValues = [
142
136
  ActionTypes.enum.DECLARE,
143
- ActionTypes.enum.EDIT,
144
137
  ActionTypes.enum.VALIDATE,
145
138
  ActionTypes.enum.REGISTER,
146
139
  ActionTypes.enum.NOTIFY,
@@ -162,14 +155,13 @@ var writeActions = ActionTypes.exclude([
162
155
  ActionType.UNASSIGN
163
156
  ]);
164
157
  var workqueueActions = ActionTypes.exclude([
165
- ActionType.READ,
166
158
  ActionType.CREATE,
167
159
  ActionType.NOTIFY,
168
160
  ActionType.DUPLICATE_DETECTED,
161
+ ActionType.REJECT,
169
162
  ActionType.MARK_AS_NOT_DUPLICATE,
170
163
  ActionType.REJECT_CORRECTION,
171
- ActionType.APPROVE_CORRECTION,
172
- ActionType.CUSTOM
164
+ ActionType.APPROVE_CORRECTION
173
165
  ]);
174
166
  var META_ACTIONS = [
175
167
  ActionType.ASSIGN,
@@ -178,57 +170,59 @@ var META_ACTIONS = [
178
170
  ];
179
171
 
180
172
  // ../commons/src/events/FieldConfig.ts
181
- var z16 = __toESM(require("zod/v4"));
173
+ var import_zod15 = require("zod");
182
174
 
183
175
  // ../commons/src/events/Conditional.ts
184
- var z3 = __toESM(require("zod/v4"));
185
- 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({
186
180
  description: "JSON schema conditional configuration",
187
- id: "Conditional"
181
+ ref: "Conditional"
188
182
  });
189
183
  var ConditionalType = {
190
184
  SHOW: "SHOW",
191
185
  ENABLE: "ENABLE",
192
186
  DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
193
187
  };
194
- var ShowConditional = z3.object({
195
- type: z3.literal(ConditionalType.SHOW),
188
+ var ShowConditional = import_zod3.z.object({
189
+ type: import_zod3.z.literal(ConditionalType.SHOW),
196
190
  conditional: Conditional
197
191
  }).describe(
198
192
  "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
199
193
  );
200
- var EnableConditional = z3.object({
201
- type: z3.literal(ConditionalType.ENABLE),
194
+ var EnableConditional = import_zod3.z.object({
195
+ type: import_zod3.z.literal(ConditionalType.ENABLE),
202
196
  conditional: Conditional
203
197
  }).describe(
204
198
  "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
205
199
  );
206
- var ActionConditional = z3.discriminatedUnion("type", [
200
+ var ActionConditional = import_zod3.z.discriminatedUnion("type", [
207
201
  // Action can be shown / hidden
208
202
  ShowConditional,
209
203
  // Action can be shown to the user in the list but as disabled
210
204
  EnableConditional
211
205
  ]);
212
- var DisplayOnReviewConditional = z3.object({
213
- type: z3.literal(ConditionalType.DISPLAY_ON_REVIEW),
206
+ var DisplayOnReviewConditional = import_zod3.z.object({
207
+ type: import_zod3.z.literal(ConditionalType.DISPLAY_ON_REVIEW),
214
208
  conditional: Conditional
215
209
  }).describe(
216
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."
217
211
  );
218
- var FieldConditional = z3.discriminatedUnion("type", [
212
+ var FieldConditional = import_zod3.z.discriminatedUnion("type", [
219
213
  // Field input can be shown / hidden
220
214
  ShowConditional,
221
215
  // Field input can be shown to the user but as disabled
222
216
  EnableConditional,
223
217
  // Field output can be shown / hidden on the review page
224
218
  DisplayOnReviewConditional
225
- ]).meta({
219
+ ]).openapi({
226
220
  description: "Field conditional configuration",
227
- id: "FieldConditional"
221
+ ref: "FieldConditional"
228
222
  });
229
223
 
230
224
  // ../commons/src/events/FieldType.ts
231
- var z4 = __toESM(require("zod/v4"));
225
+ var import_zod4 = require("zod");
232
226
  var FieldType = {
233
227
  NAME: "NAME",
234
228
  PHONE: "PHONE",
@@ -270,10 +264,9 @@ var FieldType = {
270
264
  QUERY_PARAM_READER: "QUERY_PARAM_READER",
271
265
  QR_READER: "QR_READER",
272
266
  ID_READER: "ID_READER",
273
- LOADER: "LOADER",
274
- ALPHA_HIDDEN: "ALPHA_HIDDEN"
267
+ LOADER: "LOADER"
275
268
  };
276
- var FileFieldType = z4.enum([
269
+ var FileFieldType = import_zod4.z.enum([
277
270
  FieldType.FILE,
278
271
  FieldType.FILE_WITH_OPTIONS,
279
272
  FieldType.SIGNATURE
@@ -296,146 +289,146 @@ var FieldTypesToHideInReview = [
296
289
  FieldType.LOADER,
297
290
  FieldType.HTTP,
298
291
  FieldType.QUERY_PARAM_READER,
299
- FieldType.DATA,
300
- FieldType.ALPHA_HIDDEN
292
+ FieldType.DATA
301
293
  ];
302
294
 
303
295
  // ../commons/src/events/FieldValue.ts
304
- var z7 = __toESM(require("zod/v4"));
296
+ var import_zod7 = require("zod");
305
297
 
306
298
  // ../commons/src/documents.ts
307
- var z5 = __toESM(require("zod/v4"));
308
- var FullDocumentUrl = z5.string().brand("FullDocumentUrl").describe(
299
+ var import_zod5 = require("zod");
300
+ var import_zod_openapi3 = require("zod-openapi");
301
+ (0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
302
+ var FullDocumentUrl = import_zod5.z.string().brand("FullDocumentUrl").describe(
309
303
  "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"
310
304
  );
311
- var FullDocumentPath = z5.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
305
+ var FullDocumentPath = import_zod5.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
312
306
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
313
307
  );
314
- var DocumentPath = z5.string().brand("DocumentPath").describe(
308
+ var DocumentPath = import_zod5.z.string().brand("DocumentPath").describe(
315
309
  "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"
316
310
  );
317
311
 
318
312
  // ../commons/src/events/CompositeFieldValue.ts
319
- var z6 = __toESM(require("zod/v4"));
313
+ var import_zod6 = require("zod");
320
314
  var AddressType = {
321
315
  DOMESTIC: "DOMESTIC",
322
316
  INTERNATIONAL: "INTERNATIONAL"
323
317
  };
324
- var FileFieldValue = z6.object({
318
+ var FileFieldValue = import_zod6.z.object({
325
319
  path: FullDocumentPath,
326
- originalFilename: z6.string(),
327
- type: z6.string()
320
+ originalFilename: import_zod6.z.string(),
321
+ type: import_zod6.z.string()
328
322
  });
329
- var NameFieldValue = z6.object({
330
- firstname: z6.string(),
331
- surname: z6.string(),
332
- middlename: z6.string().optional()
323
+ var NameFieldValue = import_zod6.z.object({
324
+ firstname: import_zod6.z.string(),
325
+ surname: import_zod6.z.string(),
326
+ middlename: import_zod6.z.string().optional()
333
327
  });
334
- var NameFieldUpdateValue = z6.object({
335
- firstname: z6.string().nullish(),
336
- surname: z6.string().nullish(),
337
- middlename: z6.string().nullish()
338
- }).or(z6.null()).or(z6.undefined());
339
- var StreetLevelDetailsValue = z6.record(z6.string(), z6.string()).optional();
340
- var StreetLevelDetailsUpdateValue = z6.record(z6.string(), z6.string().nullable()).nullish();
341
- var BaseAddressFieldValue = z6.object({
342
- country: z6.string(),
328
+ var NameFieldUpdateValue = import_zod6.z.object({
329
+ firstname: import_zod6.z.string().nullish(),
330
+ surname: import_zod6.z.string().nullish(),
331
+ middlename: import_zod6.z.string().nullish()
332
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
333
+ var StreetLevelDetailsValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional();
334
+ var StreetLevelDetailsUpdateValue = import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string().nullable()).nullish();
335
+ var BaseAddressFieldValue = import_zod6.z.object({
336
+ country: import_zod6.z.string(),
343
337
  streetLevelDetails: StreetLevelDetailsValue
344
338
  });
345
- var BaseAddressFieldUpdateValue = z6.object({
346
- country: z6.string().nullish(),
339
+ var BaseAddressFieldUpdateValue = import_zod6.z.object({
340
+ country: import_zod6.z.string().nullish(),
347
341
  streetLevelDetails: StreetLevelDetailsUpdateValue
348
342
  });
349
343
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
350
- addressType: z6.literal(AddressType.DOMESTIC),
351
- administrativeArea: z6.string().uuid()
344
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
345
+ administrativeArea: import_zod6.z.string().uuid()
352
346
  });
353
347
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
354
- addressType: z6.literal(AddressType.INTERNATIONAL)
348
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
355
349
  });
356
- var AddressFieldValue = z6.discriminatedUnion("addressType", [
350
+ var AddressFieldValue = import_zod6.z.discriminatedUnion("addressType", [
357
351
  DomesticAddressFieldValue,
358
352
  InternationalAddressFieldValue
359
353
  ]);
360
354
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
361
- addressType: z6.literal(AddressType.DOMESTIC),
362
- administrativeArea: z6.string().uuid().nullish()
355
+ addressType: import_zod6.z.literal(AddressType.DOMESTIC),
356
+ administrativeArea: import_zod6.z.string().uuid().nullish()
363
357
  /* Leaf level admin structure */
364
358
  });
365
359
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
366
360
  {
367
- addressType: z6.literal(AddressType.INTERNATIONAL)
361
+ addressType: import_zod6.z.literal(AddressType.INTERNATIONAL)
368
362
  }
369
363
  );
370
- var AddressFieldUpdateValue = z6.discriminatedUnion("addressType", [
364
+ var AddressFieldUpdateValue = import_zod6.z.discriminatedUnion("addressType", [
371
365
  DomesticAddressUpdateFieldValue,
372
366
  InternationalAddressUpdateFieldValue
373
367
  ]).nullish();
374
- var FileFieldValueWithOption = z6.object({
368
+ var FileFieldValueWithOption = import_zod6.z.object({
375
369
  path: FullDocumentPath,
376
- originalFilename: z6.string(),
377
- type: z6.string(),
378
- option: z6.string()
370
+ originalFilename: import_zod6.z.string(),
371
+ type: import_zod6.z.string(),
372
+ option: import_zod6.z.string()
379
373
  });
380
- var FileFieldWithOptionValue = z6.array(FileFieldValueWithOption);
381
- var HttpFieldValue = z6.object({
382
- loading: z6.boolean(),
383
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
384
- data: z6.any()
374
+ var FileFieldWithOptionValue = import_zod6.z.array(FileFieldValueWithOption);
375
+ var HttpFieldValue = import_zod6.z.object({
376
+ loading: import_zod6.z.boolean(),
377
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
378
+ data: import_zod6.z.any()
385
379
  });
386
- var HttpFieldUpdateValue = z6.object({
387
- loading: z6.boolean().nullish(),
388
- error: z6.object({ statusCode: z6.number(), message: z6.string() }).nullish(),
389
- data: z6.any().nullish()
390
- }).or(z6.null()).or(z6.undefined());
391
- var QueryParamReaderFieldValue = z6.object({
392
- data: z6.record(z6.string(), z6.string())
380
+ var HttpFieldUpdateValue = import_zod6.z.object({
381
+ loading: import_zod6.z.boolean().nullish(),
382
+ error: import_zod6.z.object({ statusCode: import_zod6.z.number(), message: import_zod6.z.string() }).nullish(),
383
+ data: import_zod6.z.any().nullish()
384
+ }).or(import_zod6.z.null()).or(import_zod6.z.undefined());
385
+ var QueryParamReaderFieldValue = import_zod6.z.object({
386
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
393
387
  }).nullish();
394
- var QueryParamReaderFieldUpdateValue = z6.object({
395
- data: z6.record(z6.string(), z6.string())
388
+ var QueryParamReaderFieldUpdateValue = import_zod6.z.object({
389
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())
396
390
  });
397
- var ReadDataValue = z6.object({
398
- data: z6.any()
391
+ var ReadDataValue = import_zod6.z.object({
392
+ data: import_zod6.z.any()
399
393
  });
400
394
  var QrReaderFieldValue = ReadDataValue;
401
395
  var IdReaderFieldValue = ReadDataValue;
402
396
 
403
397
  // ../commons/src/events/FieldValue.ts
404
- var TextValue = z7.string();
405
- var HiddenFieldValue = z7.string();
398
+ var TextValue = import_zod7.z.string();
406
399
  var NonEmptyTextValue = TextValue.min(1);
407
- var DateValue = z7.iso.date().describe("Date in the format YYYY-MM-DD");
408
- var AgeValue = z7.object({
409
- age: z7.number(),
410
- asOfDateRef: z7.string()
400
+ var DateValue = import_zod7.z.string().date().describe("Date in the format YYYY-MM-DD");
401
+ var AgeValue = import_zod7.z.object({
402
+ age: import_zod7.z.number(),
403
+ asOfDateRef: import_zod7.z.string()
411
404
  });
412
405
  var AgeUpdateValue = AgeValue.optional().nullable();
413
- var TimeValue = z7.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
414
- var DatetimeValue = z7.iso.datetime();
415
- var SelectDateRangeValue = z7.enum([
406
+ var TimeValue = import_zod7.z.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
407
+ var DatetimeValue = import_zod7.z.string().datetime();
408
+ var SelectDateRangeValue = import_zod7.z.enum([
416
409
  "last7Days",
417
410
  "last30Days",
418
411
  "last90Days",
419
412
  "last365Days"
420
413
  ]);
421
- var DateRangeFieldValue = z7.object({
414
+ var DateRangeFieldValue = import_zod7.z.object({
422
415
  start: DateValue,
423
416
  end: DateValue
424
417
  }).or(DateValue).describe(
425
418
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
426
419
  );
427
- var EmailValue = z7.email();
428
- var CheckboxFieldValue = z7.boolean();
429
- var NumberFieldValue = z7.number();
430
- var SignatureFieldValue = z7.string();
431
- var ButtonFieldValue = z7.number();
432
- var VerificationStatusValue = z7.enum([
420
+ var EmailValue = import_zod7.z.string().email();
421
+ var CheckboxFieldValue = import_zod7.z.boolean();
422
+ var NumberFieldValue = import_zod7.z.number();
423
+ var SignatureFieldValue = import_zod7.z.string();
424
+ var ButtonFieldValue = import_zod7.z.number();
425
+ var VerificationStatusValue = import_zod7.z.enum([
433
426
  "verified",
434
427
  "authenticated",
435
428
  "failed",
436
429
  "pending"
437
430
  ]);
438
- var FieldValuesWithoutDataField = z7.union([
431
+ var FieldValuesWithoutDataField = import_zod7.z.union([
439
432
  AddressFieldValue,
440
433
  TextValue,
441
434
  DateValue,
@@ -456,10 +449,10 @@ var FieldValuesWithoutDataField = z7.union([
456
449
  QrReaderFieldValue,
457
450
  IdReaderFieldValue
458
451
  ]);
459
- var DataFieldValue = z7.object({
460
- data: z7.record(z7.string(), FieldValuesWithoutDataField)
452
+ var DataFieldValue = import_zod7.z.object({
453
+ data: import_zod7.z.record(import_zod7.z.string(), FieldValuesWithoutDataField)
461
454
  }).nullish();
462
- var FieldValue = z7.union([
455
+ var FieldValue = import_zod7.z.union([
463
456
  FieldValuesWithoutDataField,
464
457
  DataFieldValue
465
458
  ]);
@@ -479,38 +472,22 @@ var PRIORITY_ORDER = [
479
472
  "DataFieldValue"
480
473
  ];
481
474
  function schemaPriority(schema) {
482
- const name = schema.description;
483
- if (!name) {
484
- return 9999;
485
- }
475
+ const name = schema._def?.description;
486
476
  const idx = PRIORITY_ORDER.indexOf(name);
487
477
  return idx === -1 ? 9999 : idx;
488
478
  }
489
479
  function safeUnion(schemas) {
490
- return z7.any().superRefine((val, ctx) => {
480
+ return import_zod7.z.custom((val) => {
491
481
  const successful = schemas.filter((s) => s.safeParse(val).success);
492
482
  if (successful.length === 1) {
493
- return;
483
+ return true;
494
484
  }
495
485
  if (successful.length === 0) {
496
- ctx.addIssue({
497
- code: "invalid_type",
498
- expected: "custom",
499
- message: "Value does not match any schema"
500
- });
501
- return;
486
+ return false;
502
487
  }
503
488
  successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
504
489
  const best = successful[0];
505
- if (!best.safeParse(val).success) {
506
- ctx.addIssue({
507
- expected: "custom",
508
- code: "invalid_type",
509
- message: "Value did not match the best schema"
510
- });
511
- }
512
- }).meta({
513
- description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
490
+ return best.safeParse(val).success;
514
491
  });
515
492
  }
516
493
  var FieldUpdateValue = safeUnion([
@@ -528,22 +505,24 @@ var FieldUpdateValue = safeUnion([
528
505
  DataFieldValue.describe("DataFieldValue"),
529
506
  NameFieldUpdateValue.describe("NameFieldUpdateValue"),
530
507
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
531
- QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
532
- HiddenFieldValue.describe("HiddenFieldValue")
508
+ QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue")
533
509
  ]);
534
510
 
511
+ // ../commons/src/events/FieldConfig.ts
512
+ var import_zod_openapi6 = require("zod-openapi");
513
+
535
514
  // ../commons/src/uuid.ts
536
515
  var import_uuid = require("uuid");
537
- var z8 = __toESM(require("zod/v4"));
538
- var UUID = z8.uuid().brand("UUID");
516
+ var import_zod8 = require("zod");
517
+ var UUID = import_zod8.z.string().uuid().brand("UUID");
539
518
  function getUUID() {
540
519
  return (0, import_uuid.v4)();
541
520
  }
542
521
 
543
522
  // ../commons/src/events/serializers/user/serializer.ts
544
- var z9 = __toESM(require("zod/v4"));
545
- var SerializedUserField = z9.object({
546
- $userField: z9.enum([
523
+ var import_zod9 = require("zod");
524
+ var SerializedUserField = import_zod9.z.object({
525
+ $userField: import_zod9.z.enum([
547
526
  "id",
548
527
  "name",
549
528
  "role",
@@ -551,7 +530,7 @@ var SerializedUserField = z9.object({
551
530
  "avatar",
552
531
  "primaryOfficeId"
553
532
  ]),
554
- $location: z9.string().optional()
533
+ $location: import_zod9.z.string().optional()
555
534
  });
556
535
  function userSerializer(userField) {
557
536
  return {
@@ -571,23 +550,24 @@ function userSerializer(userField) {
571
550
  }
572
551
 
573
552
  // ../commons/src/events/EventIndex.ts
574
- var import_v4 = require("zod/v4");
553
+ var import_zod14 = require("zod");
575
554
 
576
555
  // ../commons/src/events/EventMetadata.ts
577
- var z14 = __toESM(require("zod/v4"));
556
+ var import_zod13 = require("zod");
578
557
 
579
558
  // ../commons/src/events/ActionDocument.ts
580
- var z12 = __toESM(require("zod/v4"));
559
+ var import_zod12 = require("zod");
560
+ var import_zod_openapi4 = require("zod-openapi");
581
561
 
582
562
  // ../commons/src/events/CreatedAtLocation.ts
583
563
  var CreatedAtLocation = UUID.nullish();
584
564
 
585
565
  // ../commons/src/authentication.ts
586
566
  var import_jwt_decode = __toESM(require("jwt-decode"));
587
- var z11 = __toESM(require("zod/v4"));
567
+ var import_zod11 = require("zod");
588
568
 
589
569
  // ../commons/src/scopes.ts
590
- var z10 = __toESM(require("zod/v4"));
570
+ var import_zod10 = require("zod");
591
571
  var SCOPES = {
592
572
  // TODO v1.8 legacy scopes
593
573
  BYPASSRATELIMIT: "bypassratelimit",
@@ -666,91 +646,91 @@ var SCOPES = {
666
646
  // data seeding
667
647
  USER_DATA_SEEDING: "user.data-seeding"
668
648
  };
669
- var LegacyScopes = z10.union([
670
- z10.literal(SCOPES.BYPASSRATELIMIT),
671
- z10.literal(SCOPES.REGISTER),
672
- z10.literal(SCOPES.DEMO),
673
- z10.literal(SCOPES.CONFIG)
649
+ var LegacyScopes = import_zod10.z.union([
650
+ import_zod10.z.literal(SCOPES.BYPASSRATELIMIT),
651
+ import_zod10.z.literal(SCOPES.REGISTER),
652
+ import_zod10.z.literal(SCOPES.DEMO),
653
+ import_zod10.z.literal(SCOPES.CONFIG)
674
654
  ]);
675
- var IntegrationScopes = z10.union([
676
- z10.literal(SCOPES.WEBHOOK),
677
- z10.literal(SCOPES.NATIONALID),
678
- z10.literal(SCOPES.NOTIFICATION_API),
679
- z10.literal(SCOPES.RECORDSEARCH)
655
+ var IntegrationScopes = import_zod10.z.union([
656
+ import_zod10.z.literal(SCOPES.WEBHOOK),
657
+ import_zod10.z.literal(SCOPES.NATIONALID),
658
+ import_zod10.z.literal(SCOPES.NOTIFICATION_API),
659
+ import_zod10.z.literal(SCOPES.RECORDSEARCH)
680
660
  ]);
681
- var InternalOperationsScopes = z10.union([
682
- z10.literal(SCOPES.RECORD_REINDEX),
683
- z10.literal(SCOPES.RECORD_IMPORT)
661
+ var InternalOperationsScopes = import_zod10.z.union([
662
+ import_zod10.z.literal(SCOPES.RECORD_REINDEX),
663
+ import_zod10.z.literal(SCOPES.RECORD_IMPORT)
684
664
  ]);
685
- var DeclareScopes = z10.union([
686
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH),
687
- z10.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
688
- z10.literal(SCOPES.RECORD_DECLARE_DEATH),
689
- z10.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
690
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
691
- z10.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
692
- z10.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
693
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
665
+ var DeclareScopes = import_zod10.z.union([
666
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
667
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
668
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH),
669
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
670
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
671
+ import_zod10.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
672
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
673
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
694
674
  ]);
695
- var UnassignScope = z10.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
696
- var ValidateScopes = z10.union([
697
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
698
- z10.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
699
- z10.literal(SCOPES.RECORD_DECLARATION_EDIT),
700
- z10.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
701
- z10.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
702
- z10.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
675
+ var UnassignScope = import_zod10.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
676
+ var ValidateScopes = import_zod10.z.union([
677
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
678
+ import_zod10.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
679
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
680
+ import_zod10.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
681
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
682
+ import_zod10.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
703
683
  ]);
704
- var RegisterScope = z10.literal(SCOPES.RECORD_REGISTER);
705
- var CorrectionScopes = z10.union([
706
- z10.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
707
- z10.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
708
- z10.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
709
- z10.literal(SCOPES.RECORD_REJECT_REGISTRATION)
684
+ var RegisterScope = import_zod10.z.literal(SCOPES.RECORD_REGISTER);
685
+ var CorrectionScopes = import_zod10.z.union([
686
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
687
+ import_zod10.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
688
+ import_zod10.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
689
+ import_zod10.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
710
690
  ]);
711
- var SearchScopes = z10.union([
712
- z10.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
713
- z10.literal(SCOPES.SEARCH_BIRTH),
714
- z10.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
715
- z10.literal(SCOPES.SEARCH_DEATH),
716
- z10.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
717
- z10.literal(SCOPES.SEARCH_MARRIAGE)
691
+ var SearchScopes = import_zod10.z.union([
692
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
693
+ import_zod10.z.literal(SCOPES.SEARCH_BIRTH),
694
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
695
+ import_zod10.z.literal(SCOPES.SEARCH_DEATH),
696
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
697
+ import_zod10.z.literal(SCOPES.SEARCH_MARRIAGE)
718
698
  ]);
719
- var AuditScopes = z10.literal(SCOPES.RECORD_READ);
720
- var PerformanceScopes = z10.union([
721
- z10.literal(SCOPES.PERFORMANCE_READ),
722
- z10.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
723
- z10.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
699
+ var AuditScopes = import_zod10.z.literal(SCOPES.RECORD_READ);
700
+ var PerformanceScopes = import_zod10.z.union([
701
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ),
702
+ import_zod10.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
703
+ import_zod10.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
724
704
  ]);
725
- var OrganisationScopes = z10.union([
726
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
727
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
728
- z10.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
705
+ var OrganisationScopes = import_zod10.z.union([
706
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
707
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
708
+ import_zod10.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
729
709
  ]);
730
- var UserScopes = z10.union([
731
- z10.literal(SCOPES.USER_READ),
732
- z10.literal(SCOPES.USER_READ_MY_OFFICE),
733
- z10.literal(SCOPES.USER_READ_MY_JURISDICTION),
734
- z10.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
735
- z10.literal(SCOPES.USER_CREATE),
736
- z10.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
737
- z10.literal(SCOPES.USER_UPDATE),
738
- z10.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
710
+ var UserScopes = import_zod10.z.union([
711
+ import_zod10.z.literal(SCOPES.USER_READ),
712
+ import_zod10.z.literal(SCOPES.USER_READ_MY_OFFICE),
713
+ import_zod10.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
714
+ import_zod10.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
715
+ import_zod10.z.literal(SCOPES.USER_CREATE),
716
+ import_zod10.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
717
+ import_zod10.z.literal(SCOPES.USER_UPDATE),
718
+ import_zod10.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
739
719
  ]);
740
- var ConfigScope = z10.literal(SCOPES.CONFIG_UPDATE_ALL);
741
- var DataSeedingScope = z10.literal(SCOPES.USER_DATA_SEEDING);
742
- var LiteralScopes = z10.union([
720
+ var ConfigScope = import_zod10.z.literal(SCOPES.CONFIG_UPDATE_ALL);
721
+ var DataSeedingScope = import_zod10.z.literal(SCOPES.USER_DATA_SEEDING);
722
+ var LiteralScopes = import_zod10.z.union([
743
723
  LegacyScopes,
744
724
  IntegrationScopes,
745
725
  UnassignScope,
746
726
  DeclareScopes,
747
727
  ValidateScopes,
748
728
  RegisterScope,
749
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
729
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
750
730
  CorrectionScopes,
751
731
  SearchScopes,
752
732
  AuditScopes,
753
- z10.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
733
+ import_zod10.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
754
734
  PerformanceScopes,
755
735
  OrganisationScopes,
756
736
  UserScopes,
@@ -759,38 +739,37 @@ var LiteralScopes = z10.union([
759
739
  InternalOperationsScopes
760
740
  ]);
761
741
  var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
762
- var rawConfigurableScope = z10.string().regex(rawConfigurableScopeRegex);
763
- var CreateUserScope = z10.object({
764
- type: z10.literal("user.create"),
765
- options: z10.object({
766
- role: z10.array(z10.string())
742
+ var rawConfigurableScope = import_zod10.z.string().regex(rawConfigurableScopeRegex);
743
+ var CreateUserScope = import_zod10.z.object({
744
+ type: import_zod10.z.literal("user.create"),
745
+ options: import_zod10.z.object({
746
+ role: import_zod10.z.array(import_zod10.z.string())
767
747
  })
768
748
  });
769
- var EditUserScope = z10.object({
770
- type: z10.literal("user.edit"),
771
- options: z10.object({
772
- role: z10.array(z10.string())
749
+ var EditUserScope = import_zod10.z.object({
750
+ type: import_zod10.z.literal("user.edit"),
751
+ options: import_zod10.z.object({
752
+ role: import_zod10.z.array(import_zod10.z.string())
773
753
  })
774
754
  });
775
- var WorkqueueScope = z10.object({
776
- type: z10.literal("workqueue"),
777
- options: z10.object({
778
- id: z10.array(z10.string())
755
+ var WorkqueueScope = import_zod10.z.object({
756
+ type: import_zod10.z.literal("workqueue"),
757
+ options: import_zod10.z.object({
758
+ id: import_zod10.z.array(import_zod10.z.string())
779
759
  })
780
760
  });
781
- var SearchScope = z10.object({
782
- type: z10.literal("search"),
783
- options: z10.object({
784
- event: z10.array(z10.string()).length(1),
785
- access: z10.array(z10.enum(["my-jurisdiction", "all"])).length(1)
761
+ var SearchScope = import_zod10.z.object({
762
+ type: import_zod10.z.literal("search"),
763
+ options: import_zod10.z.object({
764
+ event: import_zod10.z.array(import_zod10.z.string()).length(1),
765
+ access: import_zod10.z.array(import_zod10.z.enum(["my-jurisdiction", "all"])).length(1)
786
766
  })
787
767
  });
788
- var RecordScopeType = z10.enum([
768
+ var RecordScopeType = import_zod10.z.enum([
789
769
  "record.create",
790
770
  "record.read",
791
771
  "record.declare",
792
772
  "record.notify",
793
- "record.declared.edit",
794
773
  "record.declared.validate",
795
774
  "record.declared.reject",
796
775
  "record.declared.archive",
@@ -801,40 +780,27 @@ var RecordScopeType = z10.enum([
801
780
  "record.registered.correct",
802
781
  "record.unassign-others"
803
782
  ]);
804
- var RecordScope = z10.object({
783
+ var RecordScope = import_zod10.z.object({
805
784
  type: RecordScopeType,
806
- options: z10.object({
807
- event: z10.array(z10.string()).describe("Event type, e.g. birth, death")
785
+ options: import_zod10.z.object({
786
+ event: import_zod10.z.array(import_zod10.z.string()).describe("Event type, e.g. birth, death")
808
787
  })
809
788
  }).describe(
810
789
  "Scopes used to check user's permission to perform actions on a record."
811
790
  );
812
- var CustomActionScope = z10.object({
813
- type: z10.literal("record.custom-action"),
814
- options: z10.object({
815
- event: z10.array(z10.string()).describe("Allowed event type, e.g. birth, death"),
816
- customActionType: z10.array(z10.string()).describe("Allowed custom action types")
817
- })
818
- });
819
- var ConfigurableRawScopes = z10.discriminatedUnion("type", [
791
+ var ConfigurableRawScopes = import_zod10.z.discriminatedUnion("type", [
820
792
  SearchScope,
821
793
  CreateUserScope,
822
794
  EditUserScope,
823
795
  WorkqueueScope,
824
- RecordScope,
825
- CustomActionScope
826
- ]);
827
- var ConfigurableActionScopes = z10.discriminatedUnion("type", [
828
- // @TODO - Record scope holds non-action scopes as well e.g., `record.read`
829
- RecordScope,
830
- CustomActionScope
796
+ RecordScope
831
797
  ]);
832
798
  var scopes = Object.values(SCOPES);
833
- var ActionScopes = z10.union([
799
+ var ActionScopes = import_zod10.z.union([
834
800
  DeclareScopes,
835
801
  ValidateScopes,
836
802
  RegisterScope,
837
- z10.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
803
+ import_zod10.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
838
804
  CorrectionScopes
839
805
  ]);
840
806
 
@@ -968,14 +934,15 @@ var DEFAULT_ROLES_DEFINITION = [
968
934
  ]
969
935
  }
970
936
  ];
971
- var TokenUserType = z11.enum(["user", "system"]);
972
- var TokenWithBearer = z11.string().regex(/^Bearer\s/);
937
+ var TokenUserType = import_zod11.z.enum(["user", "system"]);
938
+ var TokenWithBearer = import_zod11.z.string().regex(/^Bearer\s/);
973
939
 
974
940
  // ../commons/src/events/ActionDocument.ts
975
- var ActionUpdate = z12.record(z12.string(), FieldUpdateValue).describe(
941
+ (0, import_zod_openapi4.extendZodWithOpenApi)(import_zod12.z);
942
+ var ActionUpdate = import_zod12.z.record(import_zod12.z.string(), FieldUpdateValue).describe(
976
943
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
977
944
  );
978
- var EventState = z12.record(z12.string(), FieldValue).describe(
945
+ var EventState = import_zod12.z.record(import_zod12.z.string(), FieldValue).describe(
979
946
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
980
947
  );
981
948
  var ActionStatus = {
@@ -983,16 +950,16 @@ var ActionStatus = {
983
950
  Accepted: "Accepted",
984
951
  Rejected: "Rejected"
985
952
  };
986
- var ActionBase = z12.object({
953
+ var ActionBase = import_zod12.z.object({
987
954
  id: UUID.describe("Unique identifier of the action."),
988
- transactionId: z12.string().describe("Unique identifier of the transaction."),
955
+ transactionId: import_zod12.z.string().describe("Unique identifier of the transaction."),
989
956
  createdByUserType: TokenUserType.describe(
990
957
  "Indicates whether the action was created by a human-user or by a system-user."
991
958
  ),
992
- createdAt: z12.string().datetime().describe("Timestamp indicating when the action was created."),
993
- createdBy: z12.string().describe("Identifier of the user who created the action."),
994
- createdByRole: z12.string().describe("Role of the user who created the action."),
995
- createdBySignature: z12.string().nullish().describe("Reference to the signature of the user who created the action."),
959
+ createdAt: import_zod12.z.string().datetime().describe("Timestamp indicating when the action was created."),
960
+ createdBy: import_zod12.z.string().describe("Identifier of the user who created the action."),
961
+ createdByRole: import_zod12.z.string().describe("Role of the user who created the action."),
962
+ createdBySignature: import_zod12.z.string().nullish().describe("Reference to the signature of the user who created the action."),
996
963
  createdAtLocation: CreatedAtLocation.describe(
997
964
  "Reference to the location of the user who created the action."
998
965
  ),
@@ -1000,7 +967,7 @@ var ActionBase = z12.object({
1000
967
  "Declaration data defined by the ActionConfig. Supports partial updates."
1001
968
  ),
1002
969
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1003
- status: z12.enum([
970
+ status: import_zod12.z.enum([
1004
971
  ActionStatus.Requested,
1005
972
  ActionStatus.Accepted,
1006
973
  ActionStatus.Rejected
@@ -1011,188 +978,172 @@ var ActionBase = z12.object({
1011
978
  "Reference to the original action asynchronously accepted or rejected by a third-party integration."
1012
979
  )
1013
980
  });
1014
- var AssignedAction = ActionBase.extend(
1015
- z12.object({
1016
- type: z12.literal(ActionType.ASSIGN),
1017
- assignedTo: z12.string().describe("Identifier of the user to whom the action is assigned.")
981
+ var AssignedAction = ActionBase.merge(
982
+ import_zod12.z.object({
983
+ type: import_zod12.z.literal(ActionType.ASSIGN),
984
+ assignedTo: import_zod12.z.string().describe("Identifier of the user to whom the action is assigned.")
1018
985
  // TODO move into 'content' property
1019
- }).shape
986
+ })
1020
987
  );
1021
- var UnassignedAction = ActionBase.extend(
1022
- z12.object({
1023
- type: z12.literal(ActionType.UNASSIGN)
1024
- }).shape
988
+ var UnassignedAction = ActionBase.merge(
989
+ import_zod12.z.object({
990
+ type: import_zod12.z.literal(ActionType.UNASSIGN)
991
+ })
1025
992
  );
1026
- var RegisterAction = ActionBase.extend(
1027
- z12.object({
1028
- type: z12.literal(ActionType.REGISTER),
1029
- registrationNumber: z12.string().optional().describe(
993
+ var RegisterAction = ActionBase.merge(
994
+ import_zod12.z.object({
995
+ type: import_zod12.z.literal(ActionType.REGISTER),
996
+ registrationNumber: import_zod12.z.string().optional().describe(
1030
997
  "Registration number of the event. Always present for accepted registrations."
1031
998
  )
1032
999
  // TODO move into 'content' property
1033
- }).shape
1000
+ })
1034
1001
  );
1035
- var DeclareAction = ActionBase.extend(
1036
- z12.object({
1037
- type: z12.literal(ActionType.DECLARE)
1038
- }).shape
1002
+ var DeclareAction = ActionBase.merge(
1003
+ import_zod12.z.object({
1004
+ type: import_zod12.z.literal(ActionType.DECLARE)
1005
+ })
1039
1006
  );
1040
- var ValidateAction = ActionBase.extend(
1041
- z12.object({
1042
- type: z12.literal(ActionType.VALIDATE)
1043
- }).shape
1007
+ var ValidateAction = ActionBase.merge(
1008
+ import_zod12.z.object({
1009
+ type: import_zod12.z.literal(ActionType.VALIDATE)
1010
+ })
1044
1011
  );
1045
- var ReasonContent = z12.object({
1046
- reason: z12.string().min(1, { error: "Message cannot be empty" }).describe(
1012
+ var ReasonContent = import_zod12.z.object({
1013
+ reason: import_zod12.z.string().min(1, { message: "Message cannot be empty" }).describe(
1047
1014
  "Message describing the reason for rejecting or archiving the event."
1048
1015
  )
1049
1016
  });
1050
- var RejectAction = ActionBase.extend(
1051
- z12.object({
1052
- type: z12.literal(ActionType.REJECT),
1017
+ var RejectAction = ActionBase.merge(
1018
+ import_zod12.z.object({
1019
+ type: import_zod12.z.literal(ActionType.REJECT),
1053
1020
  content: ReasonContent
1054
- }).shape
1021
+ })
1055
1022
  );
1056
- var PotentialDuplicate = z12.object({
1023
+ var PotentialDuplicate = import_zod12.z.object({
1057
1024
  id: UUID,
1058
- trackingId: z12.string()
1025
+ trackingId: import_zod12.z.string()
1059
1026
  });
1060
- var DuplicateDetectedAction = ActionBase.extend(
1061
- z12.object({
1062
- type: z12.literal(ActionType.DUPLICATE_DETECTED),
1063
- content: z12.object({
1064
- duplicates: z12.array(PotentialDuplicate)
1027
+ var DuplicateDetectedAction = ActionBase.merge(
1028
+ import_zod12.z.object({
1029
+ type: import_zod12.z.literal(ActionType.DUPLICATE_DETECTED),
1030
+ content: import_zod12.z.object({
1031
+ duplicates: import_zod12.z.array(PotentialDuplicate)
1065
1032
  })
1066
- }).shape
1033
+ })
1067
1034
  );
1068
- var MarkNotDuplicateAction = ActionBase.extend(
1069
- z12.object({
1070
- type: z12.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1071
- }).shape
1035
+ var MarkNotDuplicateAction = ActionBase.merge(
1036
+ import_zod12.z.object({
1037
+ type: import_zod12.z.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1038
+ })
1072
1039
  );
1073
- var MarkAsDuplicateAction = ActionBase.extend(
1074
- z12.object({
1075
- type: z12.literal(ActionType.MARK_AS_DUPLICATE),
1076
- content: z12.object({
1040
+ var MarkAsDuplicateAction = ActionBase.merge(
1041
+ import_zod12.z.object({
1042
+ type: import_zod12.z.literal(ActionType.MARK_AS_DUPLICATE),
1043
+ content: import_zod12.z.object({
1077
1044
  duplicateOf: UUID
1078
1045
  }).optional()
1079
- }).shape
1046
+ })
1080
1047
  );
1081
- var ArchiveAction = ActionBase.extend(
1082
- z12.object({
1083
- type: z12.literal(ActionType.ARCHIVE),
1048
+ var ArchiveAction = ActionBase.merge(
1049
+ import_zod12.z.object({
1050
+ type: import_zod12.z.literal(ActionType.ARCHIVE),
1084
1051
  content: ReasonContent
1085
- }).shape
1086
- );
1087
- var CreatedAction = ActionBase.extend(
1088
- z12.object({
1089
- type: z12.literal(ActionType.CREATE)
1090
- }).shape
1052
+ })
1091
1053
  );
1092
- var NotifiedAction = ActionBase.extend(
1093
- z12.object({
1094
- type: z12.literal(ActionType.NOTIFY)
1095
- }).shape
1054
+ var CreatedAction = ActionBase.merge(
1055
+ import_zod12.z.object({
1056
+ type: import_zod12.z.literal(ActionType.CREATE)
1057
+ })
1096
1058
  );
1097
- var EditAction = ActionBase.extend(
1098
- z12.object({
1099
- type: z12.literal(ActionType.EDIT),
1100
- content: z12.object({
1101
- comment: z12.string().describe("Comment for the edit action.").optional()
1102
- })
1103
- }).shape
1059
+ var NotifiedAction = ActionBase.merge(
1060
+ import_zod12.z.object({
1061
+ type: import_zod12.z.literal(ActionType.NOTIFY)
1062
+ })
1104
1063
  );
1105
- var PrintContent = z12.object({
1106
- templateId: z12.string().optional()
1064
+ var PrintContent = import_zod12.z.object({
1065
+ templateId: import_zod12.z.string().optional()
1107
1066
  });
1108
- var PrintCertificateAction = ActionBase.extend(
1109
- z12.object({
1110
- type: z12.literal(ActionType.PRINT_CERTIFICATE),
1067
+ var PrintCertificateAction = ActionBase.merge(
1068
+ import_zod12.z.object({
1069
+ type: import_zod12.z.literal(ActionType.PRINT_CERTIFICATE),
1111
1070
  content: PrintContent.optional().nullable()
1112
- }).shape
1071
+ })
1113
1072
  );
1114
- var RequestedCorrectionAction = ActionBase.extend(
1115
- z12.object({
1116
- type: z12.literal(ActionType.REQUEST_CORRECTION)
1117
- }).shape
1073
+ var RequestedCorrectionAction = ActionBase.merge(
1074
+ import_zod12.z.object({
1075
+ type: import_zod12.z.literal(ActionType.REQUEST_CORRECTION)
1076
+ })
1118
1077
  );
1119
- var ApprovedCorrectionAction = ActionBase.extend(
1120
- z12.object({
1121
- type: z12.literal(ActionType.APPROVE_CORRECTION),
1122
- requestId: z12.string()
1078
+ var ApprovedCorrectionAction = ActionBase.merge(
1079
+ import_zod12.z.object({
1080
+ type: import_zod12.z.literal(ActionType.APPROVE_CORRECTION),
1081
+ requestId: import_zod12.z.string()
1123
1082
  // TODO move into 'content' property
1124
- }).shape
1083
+ })
1125
1084
  );
1126
- var RejectedCorrectionAction = ActionBase.extend(
1127
- z12.object({
1128
- type: z12.literal(ActionType.REJECT_CORRECTION),
1129
- requestId: z12.string(),
1085
+ var RejectedCorrectionAction = ActionBase.merge(
1086
+ import_zod12.z.object({
1087
+ type: import_zod12.z.literal(ActionType.REJECT_CORRECTION),
1088
+ requestId: import_zod12.z.string(),
1130
1089
  // TODO move into 'content' property
1131
1090
  content: ReasonContent
1132
- }).shape
1133
- );
1134
- var ReadAction = ActionBase.extend(
1135
- z12.object({
1136
- type: z12.literal(ActionType.READ)
1137
- }).shape
1091
+ })
1138
1092
  );
1139
- var CustomAction = ActionBase.merge(
1140
- z12.object({
1141
- type: z12.literal(ActionType.CUSTOM),
1142
- customActionType: z12.string()
1093
+ var ReadAction = ActionBase.merge(
1094
+ import_zod12.z.object({
1095
+ type: import_zod12.z.literal(ActionType.READ)
1143
1096
  })
1144
1097
  );
1145
- var ActionDocument = z12.discriminatedUnion("type", [
1146
- CreatedAction.meta({ id: "CreatedAction" }),
1147
- ValidateAction.meta({ id: "ValidateAction" }),
1148
- RejectAction.meta({ id: "RejectAction" }),
1149
- DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
1150
- MarkNotDuplicateAction.meta({ id: "MarkNotDuplicateAction" }),
1151
- MarkAsDuplicateAction.meta({ id: "MarkAsDuplicateAction" }),
1152
- ArchiveAction.meta({ id: "ArchiveAction" }),
1153
- NotifiedAction.meta({ id: "NotifiedAction" }),
1154
- RegisterAction.meta({ id: "RegisterAction" }),
1155
- DeclareAction.meta({ id: "DeclareAction" }),
1156
- AssignedAction.meta({ id: "AssignedAction" }),
1157
- RequestedCorrectionAction.meta({ id: "RequestedCorrectionAction" }),
1158
- ApprovedCorrectionAction.meta({ id: "ApprovedCorrectionAction" }),
1159
- RejectedCorrectionAction.meta({ id: "RejectedCorrectionAction" }),
1160
- UnassignedAction.meta({ id: "UnassignedAction" }),
1161
- PrintCertificateAction.meta({ id: "PrintCertificateAction" }),
1162
- ReadAction.meta({ id: "ReadAction" }),
1163
- EditAction.meta({ id: "EditAction" }),
1164
- CustomAction.meta({ id: "CustomAction" })
1165
- ]).meta({
1166
- id: "ActionDocument"
1098
+ var ActionDocument = import_zod12.z.discriminatedUnion("type", [
1099
+ CreatedAction.openapi({ ref: "CreatedAction" }),
1100
+ ValidateAction.openapi({ ref: "ValidateAction" }),
1101
+ RejectAction.openapi({ ref: "RejectAction" }),
1102
+ DuplicateDetectedAction.openapi({ ref: "DuplicateDetectedAction" }),
1103
+ MarkNotDuplicateAction.openapi({ ref: "MarkNotDuplicateAction" }),
1104
+ MarkAsDuplicateAction.openapi({ ref: "MarkAsDuplicateAction" }),
1105
+ ArchiveAction.openapi({ ref: "ArchiveAction" }),
1106
+ NotifiedAction.openapi({ ref: "NotifiedAction" }),
1107
+ RegisterAction.openapi({ ref: "RegisterAction" }),
1108
+ DeclareAction.openapi({ ref: "DeclareAction" }),
1109
+ AssignedAction.openapi({ ref: "AssignedAction" }),
1110
+ RequestedCorrectionAction.openapi({ ref: "RequestedCorrectionAction" }),
1111
+ ApprovedCorrectionAction.openapi({ ref: "ApprovedCorrectionAction" }),
1112
+ RejectedCorrectionAction.openapi({ ref: "RejectedCorrectionAction" }),
1113
+ UnassignedAction.openapi({ ref: "UnassignedAction" }),
1114
+ PrintCertificateAction.openapi({ ref: "PrintCertificateAction" }),
1115
+ ReadAction.openapi({ ref: "ReadAction" })
1116
+ ]).openapi({
1117
+ ref: "ActionDocument"
1167
1118
  });
1168
1119
  var AsyncRejectActionDocument = ActionBase.omit({
1169
1120
  declaration: true,
1170
1121
  annotation: true
1171
- }).extend(
1172
- z12.object({
1173
- type: z12.enum(ConfirmableActions),
1174
- status: z12.literal(ActionStatus.Rejected)
1175
- }).shape
1122
+ }).merge(
1123
+ import_zod12.z.object({
1124
+ type: import_zod12.z.enum(ConfirmableActions),
1125
+ status: import_zod12.z.literal(ActionStatus.Rejected)
1126
+ })
1176
1127
  );
1177
- var Action = z12.union([ActionDocument, AsyncRejectActionDocument]);
1128
+ var Action = import_zod12.z.union([ActionDocument, AsyncRejectActionDocument]);
1178
1129
 
1179
- // ../commons/src/events/Flag.ts
1180
- var z13 = __toESM(require("zod/v4"));
1130
+ // ../commons/src/events/EventMetadata.ts
1131
+ var EventStatus = import_zod13.z.enum([
1132
+ "CREATED",
1133
+ "NOTIFIED",
1134
+ "DECLARED",
1135
+ "VALIDATED",
1136
+ "REGISTERED",
1137
+ "ARCHIVED"
1138
+ ]);
1181
1139
  var InherentFlags = {
1182
1140
  PENDING_CERTIFICATION: "pending-certification",
1183
1141
  INCOMPLETE: "incomplete",
1184
1142
  REJECTED: "rejected",
1185
1143
  CORRECTION_REQUESTED: "correction-requested",
1186
- POTENTIAL_DUPLICATE: "potential-duplicate",
1187
- /**
1188
- * This flag is set by the Edit-action and removed after the declaration or registration.
1189
- * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
1190
- *
1191
- * We only use this flag to determine that a DECLARE or REGISTER action is allowed next.
1192
- */
1193
- EDIT_IN_PROGRESS: "edit-in-progress"
1144
+ POTENTIAL_DUPLICATE: "potential-duplicate"
1194
1145
  };
1195
- var ActionFlag = z13.string().regex(
1146
+ var ActionFlag = import_zod13.z.string().regex(
1196
1147
  new RegExp(
1197
1148
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1198
1149
  ActionStatus
@@ -1200,90 +1151,59 @@ var ActionFlag = z13.string().regex(
1200
1151
  ),
1201
1152
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1202
1153
  );
1203
- var CustomFlag = z13.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1204
- message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1205
- InherentFlags
1206
- ).join(", ")}`
1207
- }).refine((val) => !ActionFlag.safeParse(val).success, {
1208
- message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1209
- }).describe("Custom flag identifier defined by the country config.");
1210
- var Flag = ActionFlag.or(z13.enum(InherentFlags)).or(CustomFlag);
1211
- var FlagConfig = z13.object({
1212
- id: CustomFlag,
1213
- requiresAction: z13.boolean().describe(
1214
- "Indicates if this flag expects an action to be performed to be cleared."
1215
- ),
1216
- label: TranslationConfig.describe("Human readable label of the flag.")
1217
- });
1218
- var ActionFlagConfig = z13.object({
1219
- id: Flag,
1220
- operation: z13.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1221
- conditional: Conditional.optional().describe(
1222
- "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1223
- )
1224
- });
1225
-
1226
- // ../commons/src/events/EventMetadata.ts
1227
- var EventStatus = z14.enum([
1228
- "CREATED",
1229
- "NOTIFIED",
1230
- "DECLARED",
1231
- "REGISTERED",
1232
- "ARCHIVED"
1233
- ]);
1234
- var ZodDate = z14.iso.date();
1235
- var ActionCreationMetadata = z14.object({
1236
- createdAt: z14.iso.datetime().describe("The timestamp when the action request was created."),
1237
- createdBy: z14.string().describe("ID of the user who created the action request."),
1154
+ var Flag = ActionFlag.or(import_zod13.z.nativeEnum(InherentFlags));
1155
+ var ZodDate = import_zod13.z.string().date();
1156
+ var ActionCreationMetadata = import_zod13.z.object({
1157
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the action request was created."),
1158
+ createdBy: import_zod13.z.string().describe("ID of the user who created the action request."),
1238
1159
  createdAtLocation: CreatedAtLocation.describe(
1239
1160
  "Location of the user who created the action request."
1240
1161
  ),
1241
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1242
- acceptedAt: z14.iso.datetime().describe("Timestamp when the action request was accepted."),
1243
- createdByRole: z14.string().describe("Role of the user at the time of action request creation."),
1244
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the action request.")
1162
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1163
+ acceptedAt: import_zod13.z.string().datetime().describe("Timestamp when the action request was accepted."),
1164
+ createdByRole: import_zod13.z.string().describe("Role of the user at the time of action request creation."),
1165
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the action request.")
1245
1166
  });
1246
1167
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1247
- registrationNumber: z14.string().describe(
1168
+ registrationNumber: import_zod13.z.string().describe(
1248
1169
  "Registration number of the event. Always present for accepted registrations."
1249
1170
  )
1250
1171
  });
1251
- var LegalStatuses = z14.object({
1172
+ var LegalStatuses = import_zod13.z.object({
1252
1173
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1253
1174
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1254
1175
  });
1255
- var EventMetadata = z14.object({
1176
+ var EventMetadata = import_zod13.z.object({
1256
1177
  id: UUID,
1257
- type: z14.string().describe("The type of event, such as birth, death, or marriage."),
1178
+ type: import_zod13.z.string().describe("The type of event, such as birth, death, or marriage."),
1258
1179
  status: EventStatus,
1259
1180
  legalStatuses: LegalStatuses.describe(
1260
1181
  "Metadata related to the legal registration of the event, such as who registered it and when."
1261
1182
  ),
1262
- createdAt: z14.iso.datetime().describe("The timestamp when the event was first created and saved."),
1183
+ createdAt: import_zod13.z.string().datetime().describe("The timestamp when the event was first created and saved."),
1263
1184
  dateOfEvent: ZodDate.nullish(),
1264
- placeOfEvent: CreatedAtLocation,
1265
- createdBy: z14.string().describe("ID of the user who created the event."),
1266
- createdByUserType: z14.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1267
- updatedByUserRole: z14.string().describe("Role of the user who last changed the status."),
1185
+ createdBy: import_zod13.z.string().describe("ID of the user who created the event."),
1186
+ createdByUserType: import_zod13.z.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1187
+ updatedByUserRole: import_zod13.z.string().describe("Role of the user who last changed the status."),
1268
1188
  createdAtLocation: CreatedAtLocation.describe(
1269
1189
  "Location of the user who created the event."
1270
1190
  ),
1271
- createdBySignature: z14.string().nullish().describe("Signature of the user who created the event."),
1191
+ createdBySignature: import_zod13.z.string().nullish().describe("Signature of the user who created the event."),
1272
1192
  updatedAtLocation: UUID.nullish().describe(
1273
1193
  "Location of the user who last changed the status."
1274
1194
  ),
1275
- updatedAt: z14.iso.datetime().describe(
1195
+ updatedAt: import_zod13.z.string().datetime().describe(
1276
1196
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1277
1197
  ),
1278
- assignedTo: z14.string().nullish().describe("ID of the user currently assigned to the event."),
1279
- updatedBy: z14.string().nullish().describe("ID of the user who last changed the status."),
1280
- trackingId: z14.string().describe(
1198
+ assignedTo: import_zod13.z.string().nullish().describe("ID of the user currently assigned to the event."),
1199
+ updatedBy: import_zod13.z.string().nullish().describe("ID of the user who last changed the status."),
1200
+ trackingId: import_zod13.z.string().describe(
1281
1201
  "System-generated tracking ID used by informants or registrars to look up the event."
1282
1202
  ),
1283
- potentialDuplicates: z14.array(PotentialDuplicate).describe(
1203
+ potentialDuplicates: import_zod13.z.array(PotentialDuplicate).describe(
1284
1204
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1285
1205
  ),
1286
- flags: z14.array(Flag)
1206
+ flags: import_zod13.z.array(Flag)
1287
1207
  });
1288
1208
  var EventMetadataKeysArray = [
1289
1209
  "id",
@@ -1291,7 +1211,6 @@ var EventMetadataKeysArray = [
1291
1211
  "status",
1292
1212
  "createdAt",
1293
1213
  "dateOfEvent",
1294
- "placeOfEvent",
1295
1214
  "createdBy",
1296
1215
  "createdByUserType",
1297
1216
  "updatedByUserRole",
@@ -1304,128 +1223,130 @@ var EventMetadataKeysArray = [
1304
1223
  "legalStatuses",
1305
1224
  "flags"
1306
1225
  ];
1307
- var EventMetadataKeys = z14.enum(EventMetadataKeysArray);
1226
+ var EventMetadataKeys = import_zod13.z.enum(EventMetadataKeysArray);
1308
1227
 
1309
1228
  // ../commons/src/events/EventIndex.ts
1229
+ var import_zod_openapi5 = require("zod-openapi");
1230
+ (0, import_zod_openapi5.extendZodWithOpenApi)(import_zod14.z);
1310
1231
  var EventIndex = EventMetadata.extend({
1311
1232
  declaration: EventState
1312
- }).meta({
1313
- id: "EventIndex"
1233
+ }).openapi({
1234
+ ref: "EventIndex"
1314
1235
  });
1315
- var EventSearchIndex = import_v4.z.record(import_v4.z.string(), import_v4.z.any()).and(
1316
- import_v4.z.object({
1317
- type: import_v4.z.string()
1236
+ var EventSearchIndex = import_zod14.z.record(import_zod14.z.string(), import_zod14.z.any()).and(
1237
+ import_zod14.z.object({
1238
+ type: import_zod14.z.string()
1318
1239
  // Ensures "type" (event-id) exists and is a string
1319
1240
  })
1320
- ).meta({
1321
- id: "EventSearchIndex"
1241
+ ).openapi({
1242
+ ref: "EventSearchIndex"
1322
1243
  });
1323
- var Fuzzy = import_v4.z.object({ type: import_v4.z.literal("fuzzy"), term: import_v4.z.string() }).meta({
1324
- id: "Fuzzy"
1244
+ var Fuzzy = import_zod14.z.object({ type: import_zod14.z.literal("fuzzy"), term: import_zod14.z.string() }).openapi({
1245
+ ref: "Fuzzy"
1325
1246
  });
1326
- var Exact = import_v4.z.object({ type: import_v4.z.literal("exact"), term: import_v4.z.string() }).meta({
1327
- id: "Exact"
1247
+ var Exact = import_zod14.z.object({ type: import_zod14.z.literal("exact"), term: import_zod14.z.string() }).openapi({
1248
+ ref: "Exact"
1328
1249
  });
1329
- var ExactStatus = import_v4.z.object({
1330
- type: import_v4.z.literal("exact"),
1250
+ var ExactStatus = import_zod14.z.object({
1251
+ type: import_zod14.z.literal("exact"),
1331
1252
  term: EventStatus
1332
- }).meta({
1333
- id: "ExactStatus"
1253
+ }).openapi({
1254
+ ref: "ExactStatus"
1334
1255
  });
1335
- var ExactUserType = import_v4.z.object({
1336
- type: import_v4.z.literal("exact"),
1256
+ var ExactUserType = import_zod14.z.object({
1257
+ type: import_zod14.z.literal("exact"),
1337
1258
  term: TokenUserType
1338
- }).meta({
1339
- id: "ExactUserType"
1259
+ }).openapi({
1260
+ ref: "ExactUserType"
1340
1261
  });
1341
- var AnyOf = import_v4.z.object({
1342
- type: import_v4.z.literal("anyOf"),
1343
- terms: import_v4.z.array(import_v4.z.string())
1344
- }).meta({
1345
- id: "AnyOf"
1262
+ var AnyOf = import_zod14.z.object({
1263
+ type: import_zod14.z.literal("anyOf"),
1264
+ terms: import_zod14.z.array(import_zod14.z.string())
1265
+ }).openapi({
1266
+ ref: "AnyOf"
1346
1267
  });
1347
- var AnyOfStatus = import_v4.z.object({
1348
- type: import_v4.z.literal("anyOf"),
1349
- terms: import_v4.z.array(EventStatus)
1350
- }).meta({
1351
- id: "AnyOfStatus"
1268
+ var AnyOfStatus = import_zod14.z.object({
1269
+ type: import_zod14.z.literal("anyOf"),
1270
+ terms: import_zod14.z.array(EventStatus)
1271
+ }).openapi({
1272
+ ref: "AnyOfStatus"
1352
1273
  });
1353
- var Range = import_v4.z.object({
1354
- type: import_v4.z.literal("range"),
1355
- gte: import_v4.z.string(),
1356
- lte: import_v4.z.string()
1357
- }).meta({
1358
- id: "Range"
1274
+ var Range = import_zod14.z.object({
1275
+ type: import_zod14.z.literal("range"),
1276
+ gte: import_zod14.z.string(),
1277
+ lte: import_zod14.z.string()
1278
+ }).openapi({
1279
+ ref: "Range"
1359
1280
  });
1360
- var ContainsFlags = import_v4.z.object({
1361
- anyOf: import_v4.z.array(Flag).optional(),
1362
- noneOf: import_v4.z.array(Flag).optional()
1363
- }).meta({
1364
- id: "ContainsFlags"
1281
+ var ContainsFlags = import_zod14.z.object({
1282
+ anyOf: import_zod14.z.array(Flag).optional(),
1283
+ noneOf: import_zod14.z.array(Flag).optional()
1284
+ }).openapi({
1285
+ ref: "ContainsFlags"
1365
1286
  });
1366
- var Within = import_v4.z.object({ type: import_v4.z.literal("within"), location: import_v4.z.string() }).meta({
1367
- id: "Within"
1287
+ var Within = import_zod14.z.object({ type: import_zod14.z.literal("within"), location: import_zod14.z.string() }).openapi({
1288
+ ref: "Within"
1368
1289
  });
1369
- var RangeDate = import_v4.z.object({
1370
- type: import_v4.z.literal("range"),
1371
- gte: import_v4.z.iso.date().or(import_v4.z.iso.datetime()),
1372
- lte: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1373
- }).meta({ id: "RangeDate" });
1290
+ var RangeDate = import_zod14.z.object({
1291
+ type: import_zod14.z.literal("range"),
1292
+ gte: import_zod14.z.string().date().or(import_zod14.z.string().datetime()),
1293
+ lte: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1294
+ }).openapi({ ref: "RangeDate" });
1374
1295
  var ExactDate = Exact.extend({
1375
- term: import_v4.z.iso.date().or(import_v4.z.iso.datetime())
1376
- }).meta({
1377
- id: "ExactDate"
1296
+ term: import_zod14.z.string().date().or(import_zod14.z.string().datetime())
1297
+ }).openapi({
1298
+ ref: "ExactDate"
1378
1299
  });
1379
- var TimePeriod = import_v4.z.object({
1380
- type: import_v4.z.literal("timePeriod"),
1300
+ var TimePeriod = import_zod14.z.object({
1301
+ type: import_zod14.z.literal("timePeriod"),
1381
1302
  term: SelectDateRangeValue
1382
- }).meta({
1383
- id: "TimePeriod"
1303
+ }).openapi({
1304
+ ref: "TimePeriod"
1384
1305
  });
1385
- var DateCondition = import_v4.z.union([ExactDate, RangeDate, TimePeriod]).meta({
1386
- id: "DateCondition"
1306
+ var DateCondition = import_zod14.z.union([ExactDate, RangeDate, TimePeriod]).openapi({
1307
+ ref: "DateCondition"
1387
1308
  });
1388
- var QueryInput = import_v4.z.lazy(
1389
- () => import_v4.z.union([
1390
- import_v4.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1391
- import_v4.z.record(import_v4.z.string(), QueryInput)
1309
+ var QueryInput = import_zod14.z.lazy(
1310
+ () => import_zod14.z.union([
1311
+ import_zod14.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf]),
1312
+ import_zod14.z.record(import_zod14.z.string(), QueryInput)
1392
1313
  ])
1393
- ).meta({
1394
- id: "QueryInput"
1314
+ ).openapi({
1315
+ ref: "QueryInput"
1395
1316
  });
1396
- var QueryExpression = import_v4.z.object({
1397
- id: import_v4.z.optional(import_v4.z.string()),
1398
- eventType: import_v4.z.string(),
1399
- status: import_v4.z.optional(import_v4.z.union([AnyOfStatus, ExactStatus])),
1400
- createdAt: import_v4.z.optional(DateCondition),
1401
- updatedAt: import_v4.z.optional(DateCondition),
1402
- "legalStatuses.REGISTERED.acceptedAt": import_v4.z.optional(DateCondition),
1403
- "legalStatuses.DECLARED.createdAtLocation": import_v4.z.optional(
1404
- import_v4.z.union([Within, Exact])
1317
+ var QueryExpression = import_zod14.z.object({
1318
+ id: import_zod14.z.optional(import_zod14.z.string()),
1319
+ eventType: import_zod14.z.string(),
1320
+ status: import_zod14.z.optional(import_zod14.z.union([AnyOfStatus, ExactStatus])),
1321
+ createdAt: import_zod14.z.optional(DateCondition),
1322
+ updatedAt: import_zod14.z.optional(DateCondition),
1323
+ "legalStatuses.REGISTERED.acceptedAt": import_zod14.z.optional(DateCondition),
1324
+ "legalStatuses.DECLARED.createdAtLocation": import_zod14.z.optional(
1325
+ import_zod14.z.union([Within, Exact])
1405
1326
  ),
1406
- "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(
1407
- import_v4.z.union([Within, Exact])
1327
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod14.z.optional(
1328
+ import_zod14.z.union([Within, Exact])
1408
1329
  ),
1409
- "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1410
- createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1411
- updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1412
- assignedTo: import_v4.z.optional(Exact),
1413
- createdByUserType: import_v4.z.optional(ExactUserType),
1414
- createdBy: import_v4.z.optional(Exact),
1415
- updatedBy: import_v4.z.optional(Exact),
1416
- trackingId: import_v4.z.optional(Exact),
1417
- flags: import_v4.z.optional(ContainsFlags),
1330
+ "legalStatuses.REGISTERED.registrationNumber": import_zod14.z.optional(Exact),
1331
+ createdAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1332
+ updatedAtLocation: import_zod14.z.optional(import_zod14.z.union([Within, Exact])),
1333
+ assignedTo: import_zod14.z.optional(Exact),
1334
+ createdByUserType: import_zod14.z.optional(ExactUserType),
1335
+ createdBy: import_zod14.z.optional(Exact),
1336
+ updatedBy: import_zod14.z.optional(Exact),
1337
+ trackingId: import_zod14.z.optional(Exact),
1338
+ flags: import_zod14.z.optional(ContainsFlags),
1418
1339
  // @todo: The type for this comes out as "any"
1419
1340
  data: QueryInput
1420
1341
  }).partial().refine((obj) => Object.values(obj).some((val) => val !== void 0), {
1421
- error: "At least one query field must be specified."
1422
- }).meta({
1423
- id: "QueryExpression"
1342
+ message: "At least one query field must be specified."
1343
+ }).openapi({
1344
+ ref: "QueryExpression"
1424
1345
  });
1425
- var QueryType = import_v4.z.lazy(
1426
- () => import_v4.z.object({
1427
- type: import_v4.z.literal("and").or(import_v4.z.literal("or")).meta({ default: "and" }),
1428
- clauses: import_v4.z.array(import_v4.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").meta({
1346
+ var QueryType = import_zod14.z.lazy(
1347
+ () => import_zod14.z.object({
1348
+ type: import_zod14.z.literal("and").or(import_zod14.z.literal("or")).openapi({ default: "and" }),
1349
+ clauses: import_zod14.z.array(import_zod14.z.union([QueryExpression, QueryType])).nonempty("At least one clause is required.").openapi({
1429
1350
  default: [
1430
1351
  {
1431
1352
  eventType: TENNIS_CLUB_MEMBERSHIP,
@@ -1443,8 +1364,8 @@ var QueryType = import_v4.z.lazy(
1443
1364
  ]
1444
1365
  })
1445
1366
  })
1446
- ).meta({
1447
- id: "QueryType"
1367
+ ).openapi({
1368
+ ref: "QueryType"
1448
1369
  });
1449
1370
  function parseStringifiedQueryField(val) {
1450
1371
  if (typeof val === "string") {
@@ -1452,8 +1373,8 @@ function parseStringifiedQueryField(val) {
1452
1373
  }
1453
1374
  return val;
1454
1375
  }
1455
- var SearchQuery = import_v4.z.object({
1456
- query: import_v4.z.preprocess(parseStringifiedQueryField, QueryType).meta({
1376
+ var SearchQuery = import_zod14.z.object({
1377
+ query: import_zod14.z.preprocess(parseStringifiedQueryField, QueryType).openapi({
1457
1378
  default: {
1458
1379
  type: "and",
1459
1380
  clauses: [
@@ -1473,184 +1394,190 @@ var SearchQuery = import_v4.z.object({
1473
1394
  ]
1474
1395
  }
1475
1396
  }),
1476
- limit: import_v4.z.number().optional().default(100),
1477
- offset: import_v4.z.number().optional().default(0),
1478
- sort: import_v4.z.preprocess(
1397
+ limit: import_zod14.z.number().optional().default(100),
1398
+ offset: import_zod14.z.number().optional().default(0),
1399
+ sort: import_zod14.z.preprocess(
1479
1400
  parseStringifiedQueryField,
1480
- import_v4.z.array(
1481
- import_v4.z.object({
1482
- field: import_v4.z.string(),
1483
- direction: import_v4.z.enum(["asc", "desc"]).default("asc")
1401
+ import_zod14.z.array(
1402
+ import_zod14.z.object({
1403
+ field: import_zod14.z.string(),
1404
+ direction: import_zod14.z.enum(["asc", "desc"]).default("asc")
1484
1405
  })
1485
1406
  )
1486
1407
  ).optional()
1487
- }).meta({
1488
- id: "SearchQuery"
1408
+ }).openapi({
1409
+ ref: "SearchQuery"
1489
1410
  });
1490
1411
 
1491
1412
  // ../commons/src/events/FieldConfig.ts
1492
- var FieldId = z16.string().superRefine((val, ctx) => {
1493
- if (val.includes("_")) {
1494
- ctx.addIssue({
1495
- code: z16.ZodIssueCode.custom,
1496
- message: `id: '${val}' must not contain underscores '_'`
1497
- });
1498
- }
1499
- }).describe("Unique identifier for the field");
1500
- var FieldReference = z16.object({
1413
+ (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod15.z);
1414
+ var FieldId = import_zod15.z.string().refine(
1415
+ /*
1416
+ * Disallow underscores '_' in field ids.
1417
+ * Why? Theres two reasons:
1418
+ * 1. We transform dots to underscores as separator in Formik field ids, so this avoids any issues with the Formik transformations.
1419
+ * 2. On Kysely-SQL queries, we use the CamelCasePlugin. This plugin transforms snake_case to camelCase also on nested (jsonb) object keys.
1420
+ * 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.
1421
+ */
1422
+ (val) => !val.includes("_"),
1423
+ (val) => ({
1424
+ message: `id: '${val}' must not contain underscores '_'`
1425
+ })
1426
+ ).describe("Unique identifier for the field");
1427
+ var FieldReference = import_zod15.z.object({
1501
1428
  $$field: FieldId,
1502
- $$subfield: z16.array(z16.string()).optional().describe(
1429
+ $$subfield: import_zod15.z.array(import_zod15.z.string()).optional().describe(
1503
1430
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1504
1431
  )
1505
1432
  }).describe("Reference to a field by its ID");
1506
- var ValidationConfig = z16.object({
1433
+ var ValidationConfig = import_zod15.z.object({
1507
1434
  validator: Conditional,
1508
1435
  message: TranslationConfig
1509
1436
  });
1510
- var requiredSchema = z16.union([
1511
- z16.boolean(),
1512
- z16.object({
1437
+ var requiredSchema = import_zod15.z.union([
1438
+ import_zod15.z.boolean(),
1439
+ import_zod15.z.object({
1513
1440
  message: TranslationConfig.describe("Custom required validation message")
1514
1441
  })
1515
1442
  ]).default(false).optional();
1516
- var BaseField = z16.object({
1443
+ var BaseField = import_zod15.z.object({
1517
1444
  id: FieldId.describe("Unique identifier of the field."),
1518
1445
  label: TranslationConfig.describe("Human-readable label of the field."),
1519
- parent: FieldReference.or(z16.array(FieldReference)).optional().describe(
1446
+ parent: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
1520
1447
  "Reference to the parent field or fields. When a parent field changes, this field is reset."
1521
1448
  ),
1522
1449
  required: requiredSchema.describe(
1523
1450
  "Indicates whether the field is mandatory."
1524
1451
  ),
1525
- conditionals: z16.array(FieldConditional).default([]).optional().describe(
1452
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional().describe(
1526
1453
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1527
1454
  ),
1528
- secured: z16.boolean().default(false).optional().describe(
1455
+ secured: import_zod15.z.boolean().default(false).optional().describe(
1529
1456
  "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1530
1457
  ),
1531
1458
  placeholder: TranslationConfig.optional(),
1532
- validation: z16.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1459
+ validation: import_zod15.z.array(ValidationConfig).default([]).optional().describe("Additional validation rules applied to the field."),
1533
1460
  helperText: TranslationConfig.optional(),
1534
- hideLabel: z16.boolean().default(false).optional(),
1535
- uncorrectable: z16.boolean().default(false).optional().describe(
1461
+ hideLabel: import_zod15.z.boolean().default(false).optional(),
1462
+ uncorrectable: import_zod15.z.boolean().default(false).optional().describe(
1536
1463
  "Indicates whether the field can be modified during record correction."
1537
1464
  ),
1538
- value: FieldReference.or(z16.array(FieldReference)).optional().describe(
1465
+ value: FieldReference.or(import_zod15.z.array(FieldReference)).optional().describe(
1539
1466
  "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."
1540
1467
  ),
1541
- analytics: z16.boolean().default(false).optional().describe(
1468
+ analytics: import_zod15.z.boolean().default(false).optional().describe(
1542
1469
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
1543
1470
  )
1544
1471
  }).describe("Common properties shared across all field types.");
1545
1472
  var Divider = BaseField.extend({
1546
- type: z16.literal(FieldType.DIVIDER)
1473
+ type: import_zod15.z.literal(FieldType.DIVIDER)
1547
1474
  });
1548
1475
  var TextField = BaseField.extend({
1549
- type: z16.literal(FieldType.TEXT),
1476
+ type: import_zod15.z.literal(FieldType.TEXT),
1550
1477
  defaultValue: NonEmptyTextValue.optional(),
1551
- configuration: z16.object({
1552
- maxLength: z16.number().optional().describe("Maximum length of the text"),
1553
- type: z16.enum(["text", "password"]).optional(),
1478
+ configuration: import_zod15.z.object({
1479
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
1480
+ type: import_zod15.z.enum(["text", "password"]).optional(),
1554
1481
  prefix: TranslationConfig.optional(),
1555
1482
  postfix: TranslationConfig.optional()
1556
1483
  }).default({ type: "text" }).optional()
1557
1484
  }).describe("Text input");
1558
1485
  var NumberField = BaseField.extend({
1559
- type: z16.literal(FieldType.NUMBER),
1486
+ type: import_zod15.z.literal(FieldType.NUMBER),
1560
1487
  defaultValue: NumberFieldValue.optional(),
1561
- configuration: z16.object({
1562
- min: z16.number().optional().describe("Minimum value"),
1563
- max: z16.number().optional().describe("Maximum value"),
1488
+ configuration: import_zod15.z.object({
1489
+ min: import_zod15.z.number().optional().describe("Minimum value"),
1490
+ max: import_zod15.z.number().optional().describe("Maximum value"),
1564
1491
  prefix: TranslationConfig.optional(),
1565
1492
  postfix: TranslationConfig.optional()
1566
1493
  }).optional()
1567
1494
  }).describe("Number input");
1568
1495
  var TextAreaField = BaseField.extend({
1569
- type: z16.literal(FieldType.TEXTAREA),
1496
+ type: import_zod15.z.literal(FieldType.TEXTAREA),
1570
1497
  defaultValue: NonEmptyTextValue.optional(),
1571
- configuration: z16.object({
1572
- maxLength: z16.number().optional().describe("Maximum length of the text"),
1573
- rows: z16.number().optional().describe("Number of visible text lines"),
1574
- cols: z16.number().optional().describe("Number of visible columns"),
1498
+ configuration: import_zod15.z.object({
1499
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
1500
+ rows: import_zod15.z.number().optional().describe("Number of visible text lines"),
1501
+ cols: import_zod15.z.number().optional().describe("Number of visible columns"),
1575
1502
  prefix: TranslationConfig.optional(),
1576
1503
  postfix: TranslationConfig.optional()
1577
1504
  }).default({ rows: 4 }).optional()
1578
1505
  }).describe("Multiline text input");
1579
- var ImageMimeType = z16.enum([
1506
+ var ImageMimeType = import_zod15.z.enum([
1580
1507
  "image/png",
1581
1508
  "image/jpg",
1582
1509
  "image/jpeg",
1583
1510
  "image/svg+xml"
1584
1511
  ]);
1585
- var DocumentMimeType = z16.enum([
1512
+ var DocumentMimeType = import_zod15.z.enum([
1586
1513
  "application/pdf",
1587
1514
  "application/msword",
1588
1515
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1589
1516
  "application/vnd.oasis.opendocument.text"
1590
1517
  ]);
1591
- var MimeType = z16.enum([
1518
+ var MimeType = import_zod15.z.enum([
1592
1519
  ...ImageMimeType.options,
1593
1520
  ...DocumentMimeType.options
1594
1521
  ]);
1595
1522
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
1596
1523
  var SignatureField = BaseField.extend({
1597
- type: z16.literal(FieldType.SIGNATURE),
1524
+ type: import_zod15.z.literal(FieldType.SIGNATURE),
1598
1525
  signaturePromptLabel: TranslationConfig.describe(
1599
1526
  "Title of the signature modal"
1600
1527
  ),
1601
1528
  defaultValue: SignatureFieldValue.optional(),
1602
- configuration: z16.object({
1603
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1529
+ configuration: import_zod15.z.object({
1530
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1604
1531
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1605
1532
  }).default({
1606
1533
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1607
1534
  })
1608
1535
  }).describe("Signature input field");
1609
1536
  var EmailField = BaseField.extend({
1610
- type: z16.literal(FieldType.EMAIL),
1611
- configuration: z16.object({
1612
- maxLength: z16.number().optional().describe("Maximum length of the text")
1613
- }).default({ maxLength: 255 }).optional(),
1537
+ type: import_zod15.z.literal(FieldType.EMAIL),
1538
+ configuration: import_zod15.z.object({
1539
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text")
1540
+ }).default({ maxLength: 10 }).optional(),
1614
1541
  defaultValue: NonEmptyTextValue.optional()
1615
1542
  });
1616
1543
  var DateField = BaseField.extend({
1617
- type: z16.literal(FieldType.DATE),
1544
+ type: import_zod15.z.literal(FieldType.DATE),
1618
1545
  defaultValue: DateValue.optional(),
1619
- configuration: z16.object({
1546
+ configuration: import_zod15.z.object({
1620
1547
  notice: TranslationConfig.describe(
1621
1548
  "Text to display above the date input"
1622
1549
  ).optional()
1623
1550
  }).optional()
1624
1551
  }).describe("A single date input (yyyy-MM-dd)");
1625
1552
  var AgeField = BaseField.extend({
1626
- type: z16.literal(FieldType.AGE),
1553
+ type: import_zod15.z.literal(FieldType.AGE),
1627
1554
  defaultValue: NumberFieldValue.optional(),
1628
- configuration: z16.object({
1555
+ configuration: import_zod15.z.object({
1629
1556
  asOfDate: FieldReference,
1630
1557
  prefix: TranslationConfig.optional(),
1631
1558
  postfix: TranslationConfig.optional()
1632
1559
  })
1633
1560
  }).describe("An age input field which uses the current date as the asOfDate");
1634
1561
  var TimeField = BaseField.extend({
1635
- type: z16.literal(FieldType.TIME),
1562
+ type: import_zod15.z.literal(FieldType.TIME),
1636
1563
  defaultValue: TimeValue.optional(),
1637
- configuration: z16.object({
1638
- use12HourFormat: z16.boolean().optional().describe("Whether to use 12-hour format"),
1564
+ configuration: import_zod15.z.object({
1565
+ use12HourFormat: import_zod15.z.boolean().optional().describe("Whether to use 12-hour format"),
1639
1566
  notice: TranslationConfig.describe(
1640
1567
  "Text to display above the time input"
1641
1568
  ).optional()
1642
1569
  }).optional()
1643
1570
  }).describe("A single date input (HH-mm)");
1644
1571
  var DateRangeField = BaseField.extend({
1645
- type: z16.literal(FieldType.DATE_RANGE),
1572
+ type: import_zod15.z.literal(FieldType.DATE_RANGE),
1646
1573
  defaultValue: DateRangeFieldValue.optional(),
1647
- configuration: z16.object({
1574
+ configuration: import_zod15.z.object({
1648
1575
  notice: TranslationConfig.describe(
1649
1576
  "Text to display above the date input"
1650
1577
  ).optional()
1651
1578
  }).optional()
1652
1579
  }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1653
- var HtmlFontVariant = z16.enum([
1580
+ var HtmlFontVariant = import_zod15.z.enum([
1654
1581
  "reg12",
1655
1582
  "reg14",
1656
1583
  "reg16",
@@ -1660,31 +1587,31 @@ var HtmlFontVariant = z16.enum([
1660
1587
  "h2",
1661
1588
  "h1"
1662
1589
  ]);
1663
- var ParagraphConfiguration = z16.object({
1664
- styles: z16.object({
1590
+ var ParagraphConfiguration = import_zod15.z.object({
1591
+ styles: import_zod15.z.object({
1665
1592
  fontVariant: HtmlFontVariant.optional().describe(
1666
1593
  "Font variant to use for the paragraph text"
1667
1594
  ),
1668
- hint: z16.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
1595
+ hint: import_zod15.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
1669
1596
  }).optional()
1670
1597
  }).default({});
1671
1598
  var Paragraph = BaseField.extend({
1672
- type: z16.literal(FieldType.PARAGRAPH),
1599
+ type: import_zod15.z.literal(FieldType.PARAGRAPH),
1673
1600
  defaultValue: NonEmptyTextValue.optional(),
1674
1601
  configuration: ParagraphConfiguration
1675
1602
  }).describe("A read-only HTML <p> paragraph");
1676
1603
  var PageHeader = BaseField.extend({
1677
- type: z16.literal(FieldType.PAGE_HEADER),
1604
+ type: import_zod15.z.literal(FieldType.PAGE_HEADER),
1678
1605
  defaultValue: NonEmptyTextValue.optional()
1679
1606
  }).describe("A read-only header component for form pages");
1680
1607
  var File = BaseField.extend({
1681
- type: z16.literal(FieldType.FILE),
1608
+ type: import_zod15.z.literal(FieldType.FILE),
1682
1609
  defaultValue: FileFieldValue.optional(),
1683
- configuration: z16.object({
1684
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1610
+ configuration: import_zod15.z.object({
1611
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1685
1612
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
1686
- style: z16.object({
1687
- width: z16.enum(["full", "auto"]).optional().describe(
1613
+ style: import_zod15.z.object({
1614
+ width: import_zod15.z.enum(["full", "auto"]).optional().describe(
1688
1615
  "Whether the file upload button should take the full width of the container or not"
1689
1616
  )
1690
1617
  }).optional(),
@@ -1693,34 +1620,34 @@ var File = BaseField.extend({
1693
1620
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1694
1621
  })
1695
1622
  }).describe("File upload");
1696
- var SelectOption = z16.object({
1697
- value: z16.string().describe("The value of the option"),
1698
- label: z16.union([z16.string(), TranslationConfig]).describe("The label of the option")
1623
+ var SelectOption = import_zod15.z.object({
1624
+ value: import_zod15.z.string().describe("The value of the option"),
1625
+ label: import_zod15.z.union([import_zod15.z.string(), TranslationConfig]).describe("The label of the option")
1699
1626
  });
1700
1627
  var RadioGroup = BaseField.extend({
1701
- type: z16.literal(FieldType.RADIO_GROUP),
1628
+ type: import_zod15.z.literal(FieldType.RADIO_GROUP),
1702
1629
  defaultValue: TextValue.optional(),
1703
- options: z16.array(SelectOption).describe("A list of options"),
1704
- configuration: z16.object({
1705
- styles: z16.object({
1706
- size: z16.enum(["NORMAL", "LARGE"]).optional()
1630
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
1631
+ configuration: import_zod15.z.object({
1632
+ styles: import_zod15.z.object({
1633
+ size: import_zod15.z.enum(["NORMAL", "LARGE"]).optional()
1707
1634
  }).optional()
1708
1635
  }).optional()
1709
1636
  }).describe("Grouped radio options");
1710
1637
  var BulletList = BaseField.extend({
1711
- type: z16.literal(FieldType.BULLET_LIST),
1638
+ type: import_zod15.z.literal(FieldType.BULLET_LIST),
1712
1639
  defaultValue: TextValue.optional(),
1713
- items: z16.array(TranslationConfig).describe("A list of items"),
1714
- configuration: z16.object({
1715
- styles: z16.object({
1640
+ items: import_zod15.z.array(TranslationConfig).describe("A list of items"),
1641
+ configuration: import_zod15.z.object({
1642
+ styles: import_zod15.z.object({
1716
1643
  fontVariant: HtmlFontVariant.optional()
1717
1644
  }).optional()
1718
1645
  }).default({})
1719
1646
  }).describe("A list of bullet points");
1720
1647
  var Select = BaseField.extend({
1721
- type: z16.literal(FieldType.SELECT),
1648
+ type: import_zod15.z.literal(FieldType.SELECT),
1722
1649
  defaultValue: TextValue.optional(),
1723
- options: z16.array(SelectOption).describe("A list of options"),
1650
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
1724
1651
  noOptionsMessage: TranslationConfig.optional().describe(
1725
1652
  `
1726
1653
  A translation configuration object used to display a message when no options are available.
@@ -1732,34 +1659,34 @@ var Select = BaseField.extend({
1732
1659
  `
1733
1660
  )
1734
1661
  }).describe("Select input");
1735
- var SelectDateRangeOption = z16.object({
1662
+ var SelectDateRangeOption = import_zod15.z.object({
1736
1663
  value: SelectDateRangeValue.describe("The value of the option"),
1737
1664
  label: TranslationConfig.describe("The label of the option")
1738
1665
  });
1739
1666
  var SelectDateRangeField = BaseField.extend({
1740
- type: z16.literal(FieldType.SELECT_DATE_RANGE),
1667
+ type: import_zod15.z.literal(FieldType.SELECT_DATE_RANGE),
1741
1668
  defaultValue: SelectDateRangeValue.optional(),
1742
- options: z16.array(SelectDateRangeOption).describe("A list of options")
1669
+ options: import_zod15.z.array(SelectDateRangeOption).describe("A list of options")
1743
1670
  }).describe("Select input with date range options");
1744
- var NameConfig = z16.object({
1745
- firstname: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1746
- middlename: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1747
- surname: z16.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
1671
+ var NameConfig = import_zod15.z.object({
1672
+ firstname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1673
+ middlename: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1674
+ surname: import_zod15.z.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
1748
1675
  });
1749
1676
  var NameField = BaseField.extend({
1750
- type: z16.literal(FieldType.NAME),
1751
- defaultValue: z16.object({
1677
+ type: import_zod15.z.literal(FieldType.NAME),
1678
+ defaultValue: import_zod15.z.object({
1752
1679
  firstname: NonEmptyTextValue.optional(),
1753
1680
  middlename: NonEmptyTextValue.optional(),
1754
1681
  surname: NonEmptyTextValue.optional()
1755
1682
  }).optional(),
1756
- configuration: z16.object({
1683
+ configuration: import_zod15.z.object({
1757
1684
  name: NameConfig.default({
1758
1685
  firstname: { required: true },
1759
1686
  surname: { required: true }
1760
1687
  }).optional(),
1761
- order: z16.array(z16.enum(["firstname", "middlename", "surname"])).optional(),
1762
- maxLength: z16.number().optional().describe("Maximum length of the text"),
1688
+ order: import_zod15.z.array(import_zod15.z.enum(["firstname", "middlename", "surname"])).optional(),
1689
+ maxLength: import_zod15.z.number().optional().describe("Maximum length of the text"),
1763
1690
  prefix: TranslationConfig.optional(),
1764
1691
  postfix: TranslationConfig.optional()
1765
1692
  }).default({
@@ -1771,142 +1698,142 @@ var NameField = BaseField.extend({
1771
1698
  }).describe("Name input field");
1772
1699
  var PhoneField = BaseField.extend({
1773
1700
  defaultValue: NonEmptyTextValue.optional(),
1774
- type: z16.literal(FieldType.PHONE)
1701
+ type: import_zod15.z.literal(FieldType.PHONE)
1775
1702
  }).describe("Phone input field");
1776
1703
  var IdField = BaseField.extend({
1777
1704
  defaultValue: NonEmptyTextValue.optional(),
1778
- type: z16.literal(FieldType.ID)
1705
+ type: import_zod15.z.literal(FieldType.ID)
1779
1706
  }).describe("ID input field");
1780
1707
  var Checkbox = BaseField.extend({
1781
- type: z16.literal(FieldType.CHECKBOX),
1708
+ type: import_zod15.z.literal(FieldType.CHECKBOX),
1782
1709
  defaultValue: CheckboxFieldValue.default(false)
1783
1710
  }).describe("Boolean checkbox field");
1784
1711
  var Country = BaseField.extend({
1785
- type: z16.literal(FieldType.COUNTRY),
1712
+ type: import_zod15.z.literal(FieldType.COUNTRY),
1786
1713
  defaultValue: NonEmptyTextValue.optional()
1787
1714
  }).describe("Country select field");
1788
- var AdministrativeAreas = z16.enum([
1715
+ var AdministrativeAreas = import_zod15.z.enum([
1789
1716
  "ADMIN_STRUCTURE",
1790
1717
  "HEALTH_FACILITY",
1791
1718
  "CRVS_OFFICE"
1792
1719
  ]);
1793
- var AdministrativeAreaConfiguration = z16.object({
1794
- partOf: z16.object({
1795
- $declaration: z16.string()
1720
+ var AdministrativeAreaConfiguration = import_zod15.z.object({
1721
+ partOf: import_zod15.z.object({
1722
+ $declaration: import_zod15.z.string()
1796
1723
  }).optional().describe("Parent location"),
1797
1724
  type: AdministrativeAreas
1798
1725
  }).describe("Administrative area options");
1799
1726
  var AdministrativeArea = BaseField.extend({
1800
- type: z16.literal(FieldType.ADMINISTRATIVE_AREA),
1727
+ type: import_zod15.z.literal(FieldType.ADMINISTRATIVE_AREA),
1801
1728
  defaultValue: NonEmptyTextValue.optional(),
1802
1729
  configuration: AdministrativeAreaConfiguration
1803
1730
  }).describe("Administrative area input field e.g. facility, office");
1804
1731
  var LocationInput = BaseField.extend({
1805
- type: z16.literal(FieldType.LOCATION),
1732
+ type: import_zod15.z.literal(FieldType.LOCATION),
1806
1733
  defaultValue: NonEmptyTextValue.optional(),
1807
- configuration: z16.object({
1808
- searchableResource: z16.array(z16.enum(["locations", "facilities", "offices"]))
1734
+ configuration: import_zod15.z.object({
1735
+ searchableResource: import_zod15.z.array(import_zod15.z.enum(["locations", "facilities", "offices"]))
1809
1736
  })
1810
1737
  }).describe("Input field for a location");
1811
1738
  var FileUploadWithOptions = BaseField.extend({
1812
- type: z16.literal(FieldType.FILE_WITH_OPTIONS),
1813
- options: z16.array(SelectOption).describe("A list of options"),
1739
+ type: import_zod15.z.literal(FieldType.FILE_WITH_OPTIONS),
1740
+ options: import_zod15.z.array(SelectOption).describe("A list of options"),
1814
1741
  defaultValue: FileFieldWithOptionValue.optional(),
1815
- configuration: z16.object({
1816
- maxFileSize: z16.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1742
+ configuration: import_zod15.z.object({
1743
+ maxFileSize: import_zod15.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1817
1744
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1818
1745
  }).default({
1819
1746
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1820
1747
  })
1821
1748
  });
1822
1749
  var Facility = BaseField.extend({
1823
- type: z16.literal(FieldType.FACILITY),
1750
+ type: import_zod15.z.literal(FieldType.FACILITY),
1824
1751
  defaultValue: NonEmptyTextValue.optional()
1825
1752
  }).describe("Input field for a facility");
1826
1753
  var Office = BaseField.extend({
1827
- type: z16.literal(FieldType.OFFICE),
1754
+ type: import_zod15.z.literal(FieldType.OFFICE),
1828
1755
  defaultValue: NonEmptyTextValue.optional()
1829
1756
  }).describe("Input field for an office");
1830
1757
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
1831
- administrativeArea: z16.union([UUID, SerializedUserField]).optional()
1758
+ administrativeArea: import_zod15.z.union([UUID, SerializedUserField]).optional()
1832
1759
  });
1833
1760
  var Address = BaseField.extend({
1834
- type: z16.literal(FieldType.ADDRESS),
1835
- configuration: z16.object({
1836
- lineSeparator: z16.string().optional(),
1837
- fields: z16.array(z16.enum(["country", "administrativeArea"])).optional(),
1838
- administrativeLevels: z16.array(z16.string()).optional(),
1839
- streetAddressForm: z16.array(
1840
- z16.object({
1841
- id: z16.string(),
1761
+ type: import_zod15.z.literal(FieldType.ADDRESS),
1762
+ configuration: import_zod15.z.object({
1763
+ lineSeparator: import_zod15.z.string().optional(),
1764
+ fields: import_zod15.z.array(import_zod15.z.enum(["country", "administrativeArea"])).optional(),
1765
+ administrativeLevels: import_zod15.z.array(import_zod15.z.string()).optional(),
1766
+ streetAddressForm: import_zod15.z.array(
1767
+ import_zod15.z.object({
1768
+ id: import_zod15.z.string(),
1842
1769
  required: requiredSchema,
1843
1770
  label: TranslationConfig,
1844
- type: z16.literal(FieldType.TEXT),
1845
- conditionals: z16.array(FieldConditional).default([]).optional(),
1771
+ type: import_zod15.z.literal(FieldType.TEXT),
1772
+ conditionals: import_zod15.z.array(FieldConditional).default([]).optional(),
1846
1773
  parent: FieldReference.optional()
1847
1774
  })
1848
1775
  ).optional()
1849
1776
  }).optional(),
1850
1777
  defaultValue: DefaultAddressFieldValue.optional()
1851
1778
  }).describe("Address input field \u2013 a combination of location and text fields");
1852
- var StaticDataEntry = z16.object({
1853
- id: z16.string().describe("ID for the data entry."),
1779
+ var StaticDataEntry = import_zod15.z.object({
1780
+ id: import_zod15.z.string().describe("ID for the data entry."),
1854
1781
  label: TranslationConfig,
1855
- value: TranslationConfig.or(z16.string()).or(FieldReference)
1782
+ value: TranslationConfig.or(import_zod15.z.string()).or(FieldReference)
1856
1783
  }).describe("Static data entry");
1857
- var DataEntry = z16.union([StaticDataEntry, z16.object({ fieldId: z16.string() })]).describe(
1784
+ var DataEntry = import_zod15.z.union([StaticDataEntry, import_zod15.z.object({ fieldId: import_zod15.z.string() })]).describe(
1858
1785
  "Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
1859
1786
  );
1860
1787
  var DataField = BaseField.extend({
1861
- type: z16.literal(FieldType.DATA),
1862
- configuration: z16.object({
1788
+ type: import_zod15.z.literal(FieldType.DATA),
1789
+ configuration: import_zod15.z.object({
1863
1790
  subtitle: TranslationConfig.optional(),
1864
- data: z16.array(DataEntry)
1791
+ data: import_zod15.z.array(DataEntry)
1865
1792
  })
1866
1793
  }).describe("Data field for displaying read-only data");
1867
1794
  var ButtonField = BaseField.extend({
1868
- type: z16.literal(FieldType.BUTTON),
1795
+ type: import_zod15.z.literal(FieldType.BUTTON),
1869
1796
  defaultValue: ButtonFieldValue.optional(),
1870
- configuration: z16.object({
1871
- icon: z16.string().optional().describe(
1797
+ configuration: import_zod15.z.object({
1798
+ icon: import_zod15.z.string().optional().describe(
1872
1799
  "Icon for the button. You can find icons from OpenCRVS UI-Kit."
1873
1800
  ),
1874
- loading: z16.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1801
+ loading: import_zod15.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1875
1802
  text: TranslationConfig.describe("Text to display on the button")
1876
1803
  })
1877
1804
  }).describe("Generic button without any built-in functionality");
1878
1805
  var AlphaPrintButton = BaseField.extend({
1879
- type: z16.literal(FieldType.ALPHA_PRINT_BUTTON),
1880
- configuration: z16.object({
1881
- template: z16.string().describe("Template ID from countryconfig templates to use for printing"),
1806
+ type: import_zod15.z.literal(FieldType.ALPHA_PRINT_BUTTON),
1807
+ configuration: import_zod15.z.object({
1808
+ template: import_zod15.z.string().describe("Template ID from countryconfig templates to use for printing"),
1882
1809
  buttonLabel: TranslationConfig.optional().describe(
1883
1810
  "Label for the print button"
1884
1811
  )
1885
1812
  })
1886
1813
  }).describe("Print button field for printing certificates");
1887
1814
  var HttpField = BaseField.extend({
1888
- type: z16.literal(FieldType.HTTP),
1815
+ type: import_zod15.z.literal(FieldType.HTTP),
1889
1816
  defaultValue: HttpFieldValue.optional(),
1890
- configuration: z16.object({
1817
+ configuration: import_zod15.z.object({
1891
1818
  trigger: FieldReference,
1892
- url: z16.string().describe("URL to send the HTTP request to"),
1893
- method: z16.enum(["GET", "POST", "PUT", "DELETE"]),
1894
- headers: z16.record(z16.string(), z16.string()).optional(),
1895
- body: z16.record(z16.string(), z16.any()).optional(),
1896
- errorValue: z16.any().optional().describe("Value to set if the request fails"),
1897
- params: z16.record(z16.string(), z16.union([z16.string(), FieldReference])).optional(),
1898
- timeout: z16.number().default(15e3).describe("Request timeout in milliseconds")
1819
+ url: import_zod15.z.string().describe("URL to send the HTTP request to"),
1820
+ method: import_zod15.z.enum(["GET", "POST", "PUT", "DELETE"]),
1821
+ headers: import_zod15.z.record(import_zod15.z.string()).optional(),
1822
+ body: import_zod15.z.record(import_zod15.z.any()).optional(),
1823
+ errorValue: import_zod15.z.any().optional().describe("Value to set if the request fails"),
1824
+ params: import_zod15.z.record(import_zod15.z.string(), import_zod15.z.union([import_zod15.z.string(), FieldReference])).optional(),
1825
+ timeout: import_zod15.z.number().default(15e3).describe("Request timeout in milliseconds")
1899
1826
  })
1900
1827
  }).describe("HTTP request function triggered by a button click or other event");
1901
1828
  var SearchField = HttpField.extend({
1902
- type: z16.literal(FieldType.SEARCH),
1829
+ type: import_zod15.z.literal(FieldType.SEARCH),
1903
1830
  configuration: SearchQuery.pick({
1904
1831
  query: true,
1905
1832
  limit: true,
1906
1833
  offset: true
1907
1834
  }).extend({
1908
1835
  validation: ValidationConfig,
1909
- indicators: z16.object({
1836
+ indicators: import_zod15.z.object({
1910
1837
  loading: TranslationConfig.optional().describe(
1911
1838
  "Text to display while the search is in progress"
1912
1839
  ),
@@ -1921,7 +1848,7 @@ var SearchField = HttpField.extend({
1921
1848
  ),
1922
1849
  confirmButton: TranslationConfig.optional(),
1923
1850
  clearButton: TranslationConfig.optional(),
1924
- clearModal: z16.object({
1851
+ clearModal: import_zod15.z.object({
1925
1852
  title: TranslationConfig.optional(),
1926
1853
  description: TranslationConfig.optional(),
1927
1854
  cancel: TranslationConfig.optional(),
@@ -1932,17 +1859,17 @@ var SearchField = HttpField.extend({
1932
1859
  })
1933
1860
  });
1934
1861
  var LinkButtonField = BaseField.extend({
1935
- type: z16.literal(FieldType.LINK_BUTTON),
1936
- configuration: z16.object({
1937
- url: z16.string().describe("URL to open"),
1862
+ type: import_zod15.z.literal(FieldType.LINK_BUTTON),
1863
+ configuration: import_zod15.z.object({
1864
+ url: import_zod15.z.string().describe("URL to open"),
1938
1865
  text: TranslationConfig.describe("Text to display on the button"),
1939
- icon: z16.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1866
+ icon: import_zod15.z.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1940
1867
  })
1941
1868
  }).describe("Button that opens a link");
1942
1869
  var VerificationStatus = BaseField.extend({
1943
- type: z16.literal(FieldType.VERIFICATION_STATUS),
1870
+ type: import_zod15.z.literal(FieldType.VERIFICATION_STATUS),
1944
1871
  defaultValue: VerificationStatusValue.optional(),
1945
- configuration: z16.object({
1872
+ configuration: import_zod15.z.object({
1946
1873
  status: TranslationConfig.describe("Text to display on the status pill."),
1947
1874
  description: TranslationConfig.describe(
1948
1875
  "Explaining text on the banner in form."
@@ -1950,49 +1877,38 @@ var VerificationStatus = BaseField.extend({
1950
1877
  })
1951
1878
  });
1952
1879
  var QueryParamReaderField = BaseField.extend({
1953
- type: z16.literal(FieldType.QUERY_PARAM_READER),
1954
- configuration: z16.object({
1955
- pickParams: z16.array(z16.string()).describe("List of query parameters to read from the URL")
1880
+ type: import_zod15.z.literal(FieldType.QUERY_PARAM_READER),
1881
+ configuration: import_zod15.z.object({
1882
+ pickParams: import_zod15.z.array(import_zod15.z.string()).describe("List of query parameters to read from the URL")
1956
1883
  })
1957
1884
  }).describe(
1958
1885
  "A field that maps URL query params into form values and clears them afterward"
1959
1886
  );
1960
1887
  var QrReaderField = BaseField.extend({
1961
- type: z16.literal(FieldType.QR_READER),
1888
+ type: import_zod15.z.literal(FieldType.QR_READER),
1962
1889
  defaultValue: QrReaderFieldValue.optional(),
1963
- configuration: z16.object({
1964
- validator: z16.any().meta({
1965
- description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
1966
- id: "QrReaderFieldValidator"
1967
- })
1890
+ configuration: import_zod15.z.object({
1891
+ validator: import_zod15.z.custom(
1892
+ (val) => typeof val === "object" && val !== null
1893
+ )
1968
1894
  }).optional()
1969
- }).meta({
1970
- description: "Configuration for QR code reader field, including optional JSON Schema validator.",
1971
- id: "QrReaderField"
1972
1895
  });
1973
1896
  var IdReaderField = BaseField.extend({
1974
- type: z16.literal(FieldType.ID_READER),
1897
+ type: import_zod15.z.literal(FieldType.ID_READER),
1975
1898
  defaultValue: IdReaderFieldValue.optional(),
1976
- methods: z16.array(
1977
- z16.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1899
+ methods: import_zod15.z.array(
1900
+ import_zod15.z.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1978
1901
  )
1979
1902
  });
1980
1903
  var LoaderField = BaseField.extend({
1981
- type: z16.literal(FieldType.LOADER),
1982
- configuration: z16.object({
1904
+ type: import_zod15.z.literal(FieldType.LOADER),
1905
+ configuration: import_zod15.z.object({
1983
1906
  text: TranslationConfig.describe("Display text above the loading spinner")
1984
1907
  })
1985
1908
  }).describe(
1986
1909
  "A non-interactive field that indicates an in progress operation in form"
1987
1910
  );
1988
- var HiddenField = BaseField.extend({
1989
- type: z16.literal(FieldType.ALPHA_HIDDEN),
1990
- required: z16.boolean().default(false).optional(),
1991
- defaultValue: TextValue.optional()
1992
- }).describe(
1993
- "A non-interactive, hidden field that only hold a value in the form"
1994
- );
1995
- var FieldConfig = z16.discriminatedUnion("type", [
1911
+ var FieldConfig = import_zod15.z.discriminatedUnion("type", [
1996
1912
  Address,
1997
1913
  TextField,
1998
1914
  NumberField,
@@ -2031,80 +1947,83 @@ var FieldConfig = z16.discriminatedUnion("type", [
2031
1947
  IdReaderField,
2032
1948
  QueryParamReaderField,
2033
1949
  LoaderField,
2034
- SearchField,
2035
- HiddenField
2036
- ]).meta({
1950
+ SearchField
1951
+ ]).openapi({
2037
1952
  description: "Form field configuration",
2038
- id: "FieldConfig"
1953
+ ref: "FieldConfig"
2039
1954
  });
2040
- var AnyFileField = z16.discriminatedUnion("type", [
1955
+ var AnyFileField = import_zod15.z.discriminatedUnion("type", [
2041
1956
  SignatureField,
2042
1957
  File,
2043
1958
  FileUploadWithOptions
2044
1959
  ]);
2045
1960
 
2046
1961
  // ../commons/src/events/FormConfig.ts
2047
- var z18 = __toESM(require("zod/v4"));
1962
+ var import_zod17 = require("zod");
2048
1963
 
2049
1964
  // ../commons/src/events/PageConfig.ts
2050
- var z17 = __toESM(require("zod/v4"));
2051
- var PageTypes = z17.enum(["FORM", "VERIFICATION"]);
2052
- var PageConfigBase = z17.object({
2053
- id: z17.string().describe("Unique identifier for the page"),
1965
+ var import_zod16 = require("zod");
1966
+ var import_zod_openapi7 = require("zod-openapi");
1967
+ (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
1968
+ var PageTypes = import_zod16.z.enum(["FORM", "VERIFICATION"]);
1969
+ var PageConfigBase = import_zod16.z.object({
1970
+ id: import_zod16.z.string().describe("Unique identifier for the page"),
2054
1971
  title: TranslationConfig.describe("Header title of the page"),
2055
- requireCompletionToContinue: z17.boolean().default(false).describe(
1972
+ requireCompletionToContinue: import_zod16.z.boolean().default(false).describe(
2056
1973
  "If true, all required fields must be filled before continuing to the next page"
2057
1974
  ),
2058
- fields: z17.array(FieldConfig).describe("Fields to be rendered on the page"),
1975
+ fields: import_zod16.z.array(FieldConfig).describe("Fields to be rendered on the page"),
2059
1976
  conditional: Conditional.optional().describe(
2060
1977
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2061
1978
  )
2062
- }).meta({
1979
+ }).openapi({
2063
1980
  description: "Form page configuration",
2064
- id: "FormPageConfig"
1981
+ ref: "FormPageConfig"
2065
1982
  });
2066
1983
  var FormPageConfig = PageConfigBase.extend({
2067
- type: z17.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
1984
+ type: import_zod16.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2068
1985
  });
2069
- var VerificationActionConfig = z17.object({
2070
- verify: z17.object({ label: TranslationConfig }),
2071
- cancel: z17.object({
1986
+ var VerificationActionConfig = import_zod16.z.object({
1987
+ verify: import_zod16.z.object({ label: TranslationConfig }),
1988
+ cancel: import_zod16.z.object({
2072
1989
  label: TranslationConfig,
2073
- confirmation: z17.object({
1990
+ confirmation: import_zod16.z.object({
2074
1991
  title: TranslationConfig,
2075
1992
  body: TranslationConfig
2076
1993
  })
2077
1994
  })
2078
- }).describe("Actions available on the verification page").meta({
1995
+ }).describe("Actions available on the verification page").openapi({
2079
1996
  description: "Verification action configuration",
2080
- id: "VerificationActionConfig"
1997
+ ref: "VerificationActionConfig"
2081
1998
  });
2082
1999
  var VerificationPageConfig = FormPageConfig.extend({
2083
- type: z17.literal(PageTypes.enum.VERIFICATION),
2000
+ type: import_zod16.z.literal(PageTypes.enum.VERIFICATION),
2084
2001
  actions: VerificationActionConfig
2085
2002
  });
2086
- var PageConfig = z17.discriminatedUnion("type", [
2003
+ var PageConfig = import_zod16.z.discriminatedUnion("type", [
2087
2004
  FormPageConfig,
2088
2005
  VerificationPageConfig
2089
2006
  ]);
2090
2007
 
2091
2008
  // ../commons/src/events/FormConfig.ts
2092
- var DeclarationFormConfig = z18.object({
2009
+ var DeclarationFormConfig = import_zod17.z.object({
2093
2010
  label: TranslationConfig.describe("Human readable description of the form"),
2094
- pages: z18.array(FormPageConfig)
2011
+ pages: import_zod17.z.array(FormPageConfig)
2095
2012
  }).describe("Configuration of the declaration form.");
2096
- var ActionFormConfig = z18.object({
2013
+ var ActionFormConfig = import_zod17.z.object({
2097
2014
  label: TranslationConfig.describe("Human readable description of the form"),
2098
- pages: z18.array(PageConfig)
2015
+ pages: import_zod17.z.array(PageConfig)
2099
2016
  }).describe(
2100
2017
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2101
2018
  );
2102
- var FormConfig = z18.union([DeclarationFormConfig, ActionFormConfig]);
2019
+ var FormConfig = import_zod17.z.union([DeclarationFormConfig, ActionFormConfig]);
2103
2020
 
2104
2021
  // ../commons/src/events/DeduplicationConfig.ts
2105
- var z19 = __toESM(require("zod/v4"));
2106
- var FieldReference2 = z19.string();
2107
- var Matcher = z19.object({
2022
+ var import_zod18 = require("zod");
2023
+ var import_zod_openapi8 = require("zod-openapi");
2024
+ (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
2025
+ var FieldReference2 = import_zod18.z.string();
2026
+ var Matcher = import_zod18.z.object({
2108
2027
  /**
2109
2028
  * Reference to the field used in matching.
2110
2029
  *
@@ -2112,68 +2031,68 @@ var Matcher = z19.object({
2112
2031
  * be used as the origin date to calculate the distance from.
2113
2032
  */
2114
2033
  fieldId: FieldReference2,
2115
- options: z19.object({
2116
- boost: z19.number().optional()
2034
+ options: import_zod18.z.object({
2035
+ boost: import_zod18.z.number().optional()
2117
2036
  }).optional().default({
2118
2037
  boost: 1
2119
2038
  })
2120
2039
  });
2121
2040
  var FuzzyMatcher = Matcher.extend({
2122
- type: z19.literal("fuzzy"),
2123
- options: z19.object({
2041
+ type: import_zod18.z.literal("fuzzy"),
2042
+ options: import_zod18.z.object({
2124
2043
  /**
2125
2044
  * Names of length 3 or less characters = 0 edits allowed
2126
2045
  * Names of length 4 - 6 characters = 1 edit allowed
2127
2046
  * Names of length >7 characters = 2 edits allowed
2128
2047
  */
2129
- fuzziness: z19.union([z19.string(), z19.number()]).optional().default("AUTO:4,7"),
2130
- boost: z19.number().optional().default(1)
2048
+ fuzziness: import_zod18.z.union([import_zod18.z.string(), import_zod18.z.number()]).optional().default("AUTO:4,7"),
2049
+ boost: import_zod18.z.number().optional().default(1)
2131
2050
  }).optional().default({
2132
2051
  fuzziness: "AUTO:4,7",
2133
2052
  boost: 1
2134
2053
  })
2135
2054
  });
2136
2055
  var StrictMatcher = Matcher.extend({
2137
- type: z19.literal("strict"),
2138
- options: z19.object({
2139
- boost: z19.number().optional().default(1),
2056
+ type: import_zod18.z.literal("strict"),
2057
+ options: import_zod18.z.object({
2058
+ boost: import_zod18.z.number().optional().default(1),
2140
2059
  /**
2141
2060
  * The constant value to be present in the field for both records
2142
2061
  */
2143
- value: z19.string().optional()
2062
+ value: import_zod18.z.string().optional()
2144
2063
  }).optional().default({
2145
2064
  boost: 1
2146
2065
  })
2147
2066
  });
2148
2067
  var DateRangeMatcher = Matcher.extend({
2149
- type: z19.literal("dateRange"),
2150
- options: z19.object({
2068
+ type: import_zod18.z.literal("dateRange"),
2069
+ options: import_zod18.z.object({
2151
2070
  /**
2152
2071
  * The distance pivot in days. Distance from the origin (the value of
2153
2072
  * fieldId) at which relevance scores receive half of the boost value
2154
2073
  */
2155
- pivot: z19.number().optional(),
2156
- days: z19.number(),
2157
- boost: z19.number().optional().default(1)
2074
+ pivot: import_zod18.z.number().optional(),
2075
+ days: import_zod18.z.number(),
2076
+ boost: import_zod18.z.number().optional().default(1)
2158
2077
  })
2159
2078
  });
2160
- var Not = z19.object({
2161
- type: z19.literal("not"),
2079
+ var Not = import_zod18.z.object({
2080
+ type: import_zod18.z.literal("not"),
2162
2081
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2163
- clause: z19.lazy(() => Clause)
2082
+ clause: import_zod18.z.lazy(() => Clause)
2164
2083
  });
2165
- var And = z19.object({
2166
- type: z19.literal("and"),
2084
+ var And = import_zod18.z.object({
2085
+ type: import_zod18.z.literal("and"),
2167
2086
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2168
- clauses: z19.lazy(() => Clause.array())
2087
+ clauses: import_zod18.z.lazy(() => Clause.array())
2169
2088
  });
2170
- var Or = z19.object({
2171
- type: z19.literal("or"),
2089
+ var Or = import_zod18.z.object({
2090
+ type: import_zod18.z.literal("or"),
2172
2091
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2173
- clauses: z19.lazy(() => Clause.array())
2092
+ clauses: import_zod18.z.lazy(() => Clause.array())
2174
2093
  });
2175
- var Clause = z19.lazy(
2176
- () => z19.discriminatedUnion("type", [
2094
+ var Clause = import_zod18.z.lazy(
2095
+ () => import_zod18.z.discriminatedUnion("type", [
2177
2096
  Not,
2178
2097
  And,
2179
2098
  Or,
@@ -2181,299 +2100,193 @@ var Clause = z19.lazy(
2181
2100
  StrictMatcher,
2182
2101
  DateRangeMatcher
2183
2102
  ])
2184
- ).meta({
2185
- id: "Clause"
2103
+ ).openapi({
2104
+ ref: "Clause"
2186
2105
  });
2187
- var DeduplicationConfig = z19.object({
2188
- id: z19.string(),
2106
+ var DeduplicationConfig = import_zod18.z.object({
2107
+ id: import_zod18.z.string(),
2189
2108
  label: TranslationConfig,
2190
2109
  query: Clause
2191
2110
  });
2192
2111
 
2193
- // ../commons/src/icons.ts
2194
- var z20 = __toESM(require("zod/v4"));
2195
- var AvailableIcons = z20.enum([
2196
- "Archived",
2197
- "Assigned",
2198
- "Certified",
2199
- "Close",
2200
- "Collapse",
2201
- "Draft",
2202
- "DuplicateYellow",
2203
- "Expand",
2204
- "ExternalValidate",
2205
- "FilledCheck",
2206
- "InReview",
2207
- "Offline",
2208
- "Registered",
2209
- "RequiresUpdates",
2210
- "Sent",
2211
- "Validated",
2212
- "WaitingApproval",
2213
- "ChartActivity",
2214
- "Activity",
2215
- "Archive",
2216
- "ArchiveTray",
2217
- "ArrowLeft",
2218
- "ArrowRight",
2219
- "Buildings",
2220
- "Circle",
2221
- "CaretDown",
2222
- "CaretLeft",
2223
- "CaretRight",
2224
- "ChartBar",
2225
- "ChartLine",
2226
- "ChatCircle",
2227
- "CheckSquare",
2228
- "Compass",
2229
- "Check",
2230
- "Copy",
2231
- "Database",
2232
- "DotsThreeVertical",
2233
- "ArrowCounterClockwise",
2234
- "MagnifyingGlassMinus",
2235
- "MagnifyingGlassPlus",
2236
- "Export",
2237
- "Eye",
2238
- "EyeSlash",
2239
- "Envelope",
2240
- "File",
2241
- "FileSearch",
2242
- "FileMinus",
2243
- "FilePlus",
2244
- "FileText",
2245
- "FileX",
2246
- "Handshake",
2247
- "Gear",
2248
- "GitBranch",
2249
- "IdentificationCard",
2250
- "List",
2251
- "ListBullets",
2252
- "Lock",
2253
- "MagnifyingGlass",
2254
- "MapPin",
2255
- "Medal",
2256
- "NotePencil",
2257
- "Paperclip",
2258
- "PaperPlaneTilt",
2259
- "Pen",
2260
- "Pencil",
2261
- "PencilSimpleLine",
2262
- "Phone",
2263
- "Plus",
2264
- "Printer",
2265
- "SignOut",
2266
- "Stamp",
2267
- "Star",
2268
- "Target",
2269
- "TextT",
2270
- "Trash",
2271
- "UploadSimple",
2272
- "User",
2273
- "UserPlus",
2274
- "Users",
2275
- "WarningCircle",
2276
- "X",
2277
- "ChatText",
2278
- "CircleWavyCheck",
2279
- "CircleWavyQuestion",
2280
- "ArchiveBox",
2281
- "ArrowCircleDown",
2282
- "FileArrowUp",
2283
- "FileDotted",
2284
- "Files",
2285
- "PencilLine",
2286
- "PencilCircle",
2287
- "UserCircle",
2288
- "Clock",
2289
- "QrCode",
2290
- "Webcam",
2291
- "Sun",
2292
- "DeviceTabletCamera",
2293
- "Globe",
2294
- "Fingerprint",
2295
- "PushPin",
2296
- "Timer"
2297
- ]);
2298
-
2299
2112
  // ../commons/src/events/ActionConfig.ts
2300
- var DeclarationReviewConfig = z21.object({
2113
+ var import_zod_openapi9 = require("zod-openapi");
2114
+ (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod19.z);
2115
+ var DeclarationReviewConfig = import_zod19.z.object({
2301
2116
  title: TranslationConfig.describe("Title of the review page"),
2302
- fields: z21.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2117
+ fields: import_zod19.z.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2303
2118
  }).describe(
2304
2119
  "Configuration of the declaration review page for collecting event-related metadata."
2305
2120
  );
2306
- var ActionConfigBase = z21.object({
2307
- label: TranslationConfig.describe("Human readable description of the action"),
2308
- flags: z21.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2309
- auditHistoryLabel: TranslationConfig.describe(
2310
- 'The label to show in audit history for this action. For example "Approved".'
2311
- ).optional(),
2312
- supportingCopy: TranslationConfig.optional().describe(
2313
- "Text displayed on the confirmation"
2314
- ),
2315
- icon: AvailableIcons.describe("Icon representing the action").optional(),
2316
- conditionals: z21.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2121
+ var ActionConfigBase = import_zod19.z.object({
2122
+ label: TranslationConfig.describe("Human readable description of the action")
2317
2123
  });
2318
2124
  var DeclarationActionBase = ActionConfigBase.extend({
2125
+ review: DeclarationReviewConfig,
2319
2126
  deduplication: DeduplicationConfig.optional()
2320
2127
  });
2321
- var ReadActionConfig = ActionConfigBase.extend(
2322
- z21.object({
2323
- type: z21.literal(ActionType.READ),
2128
+ var ReadActionConfig = ActionConfigBase.merge(
2129
+ import_zod19.z.object({
2130
+ type: import_zod19.z.literal(ActionType.READ),
2324
2131
  review: DeclarationReviewConfig.describe(
2325
2132
  "Configuration of the review page for read-only view."
2326
- ),
2327
- conditionals: z21.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2328
- }).shape
2329
- );
2330
- var DeclareConfig = DeclarationActionBase.extend(
2331
- z21.object({
2332
- type: z21.literal(ActionType.DECLARE),
2333
- review: DeclarationReviewConfig.describe(
2334
- "Configuration of the review page fields."
2335
2133
  )
2336
- }).shape
2134
+ })
2135
+ );
2136
+ var DeclareConfig = DeclarationActionBase.merge(
2137
+ import_zod19.z.object({
2138
+ type: import_zod19.z.literal(ActionType.DECLARE)
2139
+ })
2140
+ );
2141
+ var ValidateConfig = DeclarationActionBase.merge(
2142
+ import_zod19.z.object({
2143
+ type: import_zod19.z.literal(ActionType.VALIDATE)
2144
+ })
2145
+ );
2146
+ var RegisterConfig = DeclarationActionBase.merge(
2147
+ import_zod19.z.object({
2148
+ type: import_zod19.z.literal(ActionType.REGISTER)
2149
+ })
2337
2150
  );
2338
- var RejectConfig = ActionConfigBase.extend(
2339
- z21.object({
2340
- type: z21.literal(ActionType.REJECT)
2341
- }).shape
2151
+ var RejectDeclarationConfig = ActionConfigBase.merge(
2152
+ import_zod19.z.object({
2153
+ type: import_zod19.z.literal(ActionType.REJECT)
2154
+ })
2342
2155
  );
2343
- var ValidateConfig = DeclarationActionBase.extend(
2344
- z21.object({
2345
- type: z21.literal(ActionType.VALIDATE)
2346
- }).shape
2156
+ var ArchiveConfig = ActionConfigBase.merge(
2157
+ import_zod19.z.object({
2158
+ type: import_zod19.z.literal(ActionType.ARCHIVE)
2159
+ })
2347
2160
  );
2348
- var RegisterConfig = DeclarationActionBase.extend(
2349
- z21.object({
2350
- type: z21.literal(ActionType.REGISTER)
2351
- }).shape
2161
+ var DeleteConfig = ActionConfigBase.merge(
2162
+ import_zod19.z.object({
2163
+ type: import_zod19.z.literal(ActionType.DELETE)
2164
+ })
2352
2165
  );
2353
- var PrintCertificateActionConfig = ActionConfigBase.extend(
2354
- z21.object({
2355
- type: z21.literal(ActionType.PRINT_CERTIFICATE),
2166
+ var PrintCertificateActionConfig = ActionConfigBase.merge(
2167
+ import_zod19.z.object({
2168
+ type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
2356
2169
  printForm: ActionFormConfig
2357
- }).shape
2170
+ })
2358
2171
  );
2359
- var RequestCorrectionConfig = ActionConfigBase.extend(
2360
- z21.object({
2361
- type: z21.literal(ActionType.REQUEST_CORRECTION),
2172
+ var RequestCorrectionConfig = ActionConfigBase.merge(
2173
+ import_zod19.z.object({
2174
+ type: import_zod19.z.literal(ActionType.REQUEST_CORRECTION),
2362
2175
  correctionForm: ActionFormConfig
2363
- }).shape
2176
+ })
2364
2177
  );
2365
- var CustomActionConfig = ActionConfigBase.merge(
2366
- z21.object({
2367
- type: z21.literal(ActionType.CUSTOM),
2368
- customActionType: z21.string().describe("Type identifier of the custom action."),
2369
- /** 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. */
2370
- form: z21.array(FieldConfig).describe(
2371
- "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2372
- )
2178
+ var RejectCorrectionConfig = ActionConfigBase.merge(
2179
+ import_zod19.z.object({
2180
+ type: import_zod19.z.literal(ActionType.REJECT_CORRECTION)
2181
+ })
2182
+ );
2183
+ var ApproveCorrectionConfig = ActionConfigBase.merge(
2184
+ import_zod19.z.object({
2185
+ type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION)
2373
2186
  })
2374
2187
  );
2375
- var ActionConfig = z21.discriminatedUnion("type", [
2188
+ var ActionConfig = import_zod19.z.discriminatedUnion("type", [
2376
2189
  /*
2377
2190
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2378
2191
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2379
2192
  */
2380
- ReadActionConfig.meta({ id: "ReadActionConfig" }),
2381
- DeclareConfig.meta({ id: "DeclareActionConfig" }),
2382
- RejectConfig.meta({ id: "RejectActionConfig" }),
2383
- ValidateConfig.meta({ id: "ValidateActionConfig" }),
2384
- RegisterConfig.meta({ id: "RegisterActionConfig" }),
2385
- PrintCertificateActionConfig.meta({
2386
- id: "PrintCertificateActionConfig"
2193
+ ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
2194
+ DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
2195
+ ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
2196
+ RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
2197
+ ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
2198
+ RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
2199
+ DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
2200
+ PrintCertificateActionConfig.openapi({
2201
+ ref: "PrintCertificateActionConfig"
2387
2202
  }),
2388
- RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2389
- CustomActionConfig.meta({ id: "CustomActionConfig" })
2203
+ RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
2204
+ RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
2205
+ ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
2390
2206
  ]).describe(
2391
2207
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2392
- ).meta({ id: "ActionConfig" });
2393
- var actionConfigTypes = new Set(
2394
- ActionConfig.options.map((opt) => opt.shape.type.value)
2395
- );
2396
- var DeclarationActionConfig = z21.discriminatedUnion("type", [
2208
+ ).openapi({ ref: "ActionConfig" });
2209
+ var DeclarationActionConfig = import_zod19.z.discriminatedUnion("type", [
2397
2210
  DeclareConfig,
2398
2211
  ValidateConfig,
2399
2212
  RegisterConfig
2400
2213
  ]);
2401
2214
 
2402
2215
  // ../commons/src/events/offline/CertificateConfig.ts
2403
- var z22 = __toESM(require("zod/v4"));
2404
- var FontFamily = z22.object({
2405
- normal: z22.string(),
2406
- bold: z22.string(),
2407
- italics: z22.string(),
2408
- bolditalics: z22.string()
2216
+ var import_zod20 = require("zod");
2217
+ var FontFamily = import_zod20.z.object({
2218
+ normal: import_zod20.z.string(),
2219
+ bold: import_zod20.z.string(),
2220
+ italics: import_zod20.z.string(),
2221
+ bolditalics: import_zod20.z.string()
2409
2222
  });
2410
- var CertificateConfig = z22.object({
2411
- id: z22.string(),
2412
- event: z22.string(),
2413
- isV2Template: z22.boolean().optional(),
2223
+ var CertificateConfig = import_zod20.z.object({
2224
+ id: import_zod20.z.string(),
2225
+ event: import_zod20.z.string(),
2226
+ isV2Template: import_zod20.z.boolean().optional(),
2414
2227
  label: TranslationConfig,
2415
- isDefault: z22.boolean(),
2416
- fee: z22.object({
2417
- onTime: z22.number(),
2418
- late: z22.number(),
2419
- delayed: z22.number()
2228
+ isDefault: import_zod20.z.boolean(),
2229
+ fee: import_zod20.z.object({
2230
+ onTime: import_zod20.z.number(),
2231
+ late: import_zod20.z.number(),
2232
+ delayed: import_zod20.z.number()
2420
2233
  }),
2421
- svgUrl: z22.string(),
2422
- fonts: z22.record(z22.string(), FontFamily).optional(),
2423
- conditionals: z22.array(ShowConditional).optional()
2234
+ svgUrl: import_zod20.z.string(),
2235
+ fonts: import_zod20.z.record(FontFamily).optional(),
2236
+ conditionals: import_zod20.z.array(ShowConditional).optional()
2424
2237
  });
2425
2238
  var CertificateTemplateConfig = CertificateConfig.extend({
2426
- hash: z22.string().optional(),
2427
- svg: z22.string()
2239
+ hash: import_zod20.z.string().optional(),
2240
+ svg: import_zod20.z.string()
2428
2241
  });
2429
2242
 
2430
2243
  // ../commons/src/events/offline/LanguageConfig.ts
2431
- var z23 = __toESM(require("zod/v4"));
2432
- var LanguageConfig = z23.object({
2433
- lang: z23.string(),
2244
+ var import_zod21 = require("zod");
2245
+ var LanguageConfig = import_zod21.z.object({
2246
+ lang: import_zod21.z.string(),
2434
2247
  /**
2435
2248
  * client.csv contents
2436
2249
  */
2437
- messages: z23.record(z23.string(), z23.string())
2250
+ messages: import_zod21.z.record(import_zod21.z.string())
2438
2251
  });
2439
2252
 
2440
2253
  // ../commons/src/events/EventConfig.ts
2441
- var z29 = __toESM(require("zod/v4"));
2254
+ var import_zod26 = require("zod");
2442
2255
 
2443
2256
  // ../commons/src/events/SummaryConfig.ts
2444
- var z24 = __toESM(require("zod/v4"));
2445
- var BaseField2 = z24.object({
2257
+ var import_zod22 = require("zod");
2258
+ var BaseField2 = import_zod22.z.object({
2446
2259
  emptyValueMessage: TranslationConfig.optional().describe(
2447
2260
  "Default message displayed when the field value is empty."
2448
2261
  ),
2449
- conditionals: z24.array(ShowConditional).default([]).optional()
2262
+ conditionals: import_zod22.z.array(ShowConditional).default([]).optional()
2450
2263
  });
2451
2264
  var ReferenceField = BaseField2.extend({
2452
- fieldId: z24.string(),
2265
+ fieldId: import_zod22.z.string(),
2453
2266
  label: TranslationConfig.optional().describe(
2454
2267
  "Overrides the default label from the referenced field when provided."
2455
2268
  )
2456
2269
  }).describe("Field referencing existing event data by field ID.");
2457
2270
  var Field = BaseField2.extend({
2458
- id: z24.string().describe("Identifier of the summary field."),
2271
+ id: import_zod22.z.string().describe("Identifier of the summary field."),
2459
2272
  value: TranslationConfig.describe(
2460
2273
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
2461
2274
  ),
2462
2275
  label: TranslationConfig
2463
2276
  }).describe("Custom field defined for the summary view.");
2464
- var SummaryConfig = z24.object({
2465
- fields: z24.array(z24.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2277
+ var SummaryConfig = import_zod22.z.object({
2278
+ fields: import_zod22.z.array(import_zod22.z.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2466
2279
  }).describe("Configuration of the event summary section.");
2467
2280
 
2468
2281
  // ../commons/src/events/AdvancedSearchConfig.ts
2469
- var z25 = __toESM(require("zod/v4"));
2470
- var MatchType = z25.enum(["fuzzy", "exact", "range", "within"]);
2471
- var BaseField3 = z25.object({
2472
- config: z25.object({
2282
+ var import_zod23 = require("zod");
2283
+ var MatchType = import_zod23.z.enum(["fuzzy", "exact", "range", "within"]);
2284
+ var BaseField3 = import_zod23.z.object({
2285
+ config: import_zod23.z.object({
2473
2286
  type: MatchType.describe(
2474
2287
  "Determines the search type of field. How to match value."
2475
2288
  ),
2476
- searchFields: z25.array(z25.string()).optional().describe(
2289
+ searchFields: import_zod23.z.array(import_zod23.z.string()).optional().describe(
2477
2290
  `
2478
2291
  Defines multiple form fields that should be searched when this field has a value.
2479
2292
  All specified fields will be combined using OR logic.
@@ -2483,7 +2296,7 @@ var BaseField3 = z25.object({
2483
2296
  `
2484
2297
  )
2485
2298
  }),
2486
- type: z25.nativeEnum(FieldType).optional().describe(
2299
+ type: import_zod23.z.nativeEnum(FieldType).optional().describe(
2487
2300
  `
2488
2301
  Explicitly specify the field type for searchFields.
2489
2302
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -2497,7 +2310,7 @@ var BaseField3 = z25.object({
2497
2310
  This is required when searchFields is defined.
2498
2311
  `
2499
2312
  ),
2500
- options: z25.array(SelectOption).optional(),
2313
+ options: import_zod23.z.array(SelectOption).optional(),
2501
2314
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
2502
2315
  `
2503
2316
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -2518,7 +2331,7 @@ var BaseField3 = z25.object({
2518
2331
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2519
2332
  `
2520
2333
  ),
2521
- conditionals: z25.array(FieldConditional).optional().describe(
2334
+ conditionals: import_zod23.z.array(FieldConditional).default([]).optional().describe(
2522
2335
  `
2523
2336
  In advanced search, we sometimes need to override the default field visibility conditionals.
2524
2337
 
@@ -2532,61 +2345,59 @@ var BaseField3 = z25.object({
2532
2345
  are always rendered in the advanced search form.
2533
2346
  `
2534
2347
  ),
2535
- validations: z25.array(ValidationConfig).optional().describe(
2348
+ validations: import_zod23.z.array(ValidationConfig).default([]).optional().describe(
2536
2349
  `Option for overriding the field validations specifically for advanced search form.`
2537
2350
  )
2538
2351
  });
2539
- var SearchQueryParams = z25.object({
2540
- eventType: z25.string().optional().describe(
2352
+ var SearchQueryParams = import_zod23.z.object({
2353
+ eventType: import_zod23.z.string().optional().describe(
2541
2354
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
2542
2355
  )
2543
2356
  }).catchall(FieldValue);
2544
2357
  var FieldConfigSchema = BaseField3.extend({
2545
- fieldId: z25.string(),
2546
- fieldType: z25.literal("field")
2358
+ fieldId: import_zod23.z.string(),
2359
+ fieldType: import_zod23.z.literal("field")
2547
2360
  });
2548
- var EventFieldIdInput = z25.enum([
2361
+ var EventFieldIdInput = import_zod23.z.enum([
2549
2362
  "trackingId",
2550
2363
  "status",
2551
2364
  "legalStatuses.REGISTERED.acceptedAt",
2552
2365
  "legalStatuses.REGISTERED.createdAtLocation",
2553
- "legalStatuses.REGISTERED.registrationNumber",
2554
2366
  "updatedAt"
2555
2367
  ]);
2556
2368
  var METADATA_FIELD_PREFIX = "event.";
2557
- var EventFieldId = z25.enum([
2369
+ var EventFieldId = import_zod23.z.enum([
2558
2370
  `${METADATA_FIELD_PREFIX}trackingId`,
2559
2371
  `${METADATA_FIELD_PREFIX}status`,
2560
2372
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
2561
2373
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
2562
- `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.registrationNumber`,
2563
2374
  `${METADATA_FIELD_PREFIX}updatedAt`
2564
2375
  ]);
2565
2376
  var EventFieldConfigSchema = BaseField3.extend({
2566
2377
  fieldId: EventFieldId,
2567
- fieldType: z25.literal("event")
2378
+ fieldType: import_zod23.z.literal("event")
2568
2379
  });
2569
- var AdvancedSearchField = z25.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2380
+ var AdvancedSearchField = import_zod23.z.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2570
2381
  if (data.config.searchFields && data.config.searchFields.length > 0) {
2571
2382
  if (!data.label) {
2572
2383
  ctx.addIssue({
2573
- code: z25.ZodIssueCode.custom,
2384
+ code: import_zod23.z.ZodIssueCode.custom,
2574
2385
  message: "label is required when config.searchFields is defined.",
2575
2386
  path: ["label"]
2576
2387
  });
2577
2388
  }
2578
2389
  if (!data.type) {
2579
2390
  ctx.addIssue({
2580
- code: z25.ZodIssueCode.custom,
2391
+ code: import_zod23.z.ZodIssueCode.custom,
2581
2392
  message: "type is required when config.searchFields is defined.",
2582
2393
  path: ["type"]
2583
2394
  });
2584
2395
  }
2585
2396
  }
2586
2397
  });
2587
- var AdvancedSearchConfig = z25.object({
2398
+ var AdvancedSearchConfig = import_zod23.z.object({
2588
2399
  title: TranslationConfig.describe("Advanced search tab title"),
2589
- fields: z25.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2400
+ fields: import_zod23.z.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2590
2401
  });
2591
2402
 
2592
2403
  // ../commons/src/events/utils.ts
@@ -2595,11 +2406,11 @@ var import_lodash = require("lodash");
2595
2406
  // ../commons/src/conditionals/validate.ts
2596
2407
  var import__ = __toESM(require("ajv/dist/2019"));
2597
2408
  var import_ajv_formats = __toESM(require("ajv-formats"));
2598
- var z27 = __toESM(require("zod/v4"));
2409
+ var import_zod25 = require("zod");
2599
2410
  var import_date_fns = require("date-fns");
2600
2411
 
2601
2412
  // ../commons/src/events/DynamicFieldValue.ts
2602
- var z26 = __toESM(require("zod/v4"));
2413
+ var import_zod24 = require("zod");
2603
2414
 
2604
2415
  // ../commons/src/conditionals/validate.ts
2605
2416
  var ajv = new import__.default({
@@ -2608,9 +2419,9 @@ var ajv = new import__.default({
2608
2419
  strict: false
2609
2420
  // Allow minContains and other newer features
2610
2421
  });
2611
- var DataContext = z27.object({
2612
- rootData: z27.object({
2613
- $leafAdminStructureLocationIds: z27.array(z27.object({ id: UUID }))
2422
+ var DataContext = import_zod25.z.object({
2423
+ rootData: import_zod25.z.object({
2424
+ $leafAdminStructureLocationIds: import_zod25.z.array(import_zod25.z.object({ id: UUID }))
2614
2425
  })
2615
2426
  });
2616
2427
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -2687,12 +2498,12 @@ ajv.addKeyword({
2687
2498
  });
2688
2499
 
2689
2500
  // ../commons/src/utils.ts
2690
- var z28 = __toESM(require("zod/v4"));
2691
- var FullNameV1 = z28.array(
2692
- z28.object({
2693
- use: z28.string(),
2694
- family: z28.string(),
2695
- given: z28.array(z28.string())
2501
+ var z26 = __toESM(require("zod"));
2502
+ var FullNameV1 = z26.array(
2503
+ z26.object({
2504
+ use: z26.string(),
2505
+ family: z26.string(),
2506
+ given: z26.array(z26.string())
2696
2507
  })
2697
2508
  );
2698
2509
  function omitKeyDeep(obj, keyToRemove) {
@@ -2713,6 +2524,9 @@ function omitKeyDeep(obj, keyToRemove) {
2713
2524
 
2714
2525
  // ../commons/src/events/utils.ts
2715
2526
  var import_date_fns2 = require("date-fns");
2527
+ function isDeclarationActionConfig(action) {
2528
+ return DeclarationActions.safeParse(action.type).success;
2529
+ }
2716
2530
  function getDeclarationFields(configuration) {
2717
2531
  return configuration.declaration.pages.flatMap(({ fields }) => fields);
2718
2532
  }
@@ -2723,7 +2537,7 @@ var getActionAnnotationFields = (actionConfig) => {
2723
2537
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2724
2538
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
2725
2539
  }
2726
- if ("review" in actionConfig) {
2540
+ if (isDeclarationActionConfig(actionConfig)) {
2727
2541
  return actionConfig.review.fields;
2728
2542
  }
2729
2543
  return [];
@@ -2744,16 +2558,15 @@ var EXCLUDED_ACTIONS = [
2744
2558
  ];
2745
2559
 
2746
2560
  // ../commons/src/events/EventConfig.ts
2747
- var EventConfig = z29.object({
2748
- id: z29.string().describe(
2561
+ var import_zod_openapi10 = require("zod-openapi");
2562
+ (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
2563
+ var EventConfig = import_zod26.z.object({
2564
+ id: import_zod26.z.string().describe(
2749
2565
  'Machine-readable identifier of the event (e.g. "birth", "death").'
2750
2566
  ),
2751
2567
  dateOfEvent: FieldReference.optional().describe(
2752
2568
  "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
2753
2569
  ),
2754
- placeOfEvent: FieldReference.optional().describe(
2755
- "Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
2756
- ),
2757
2570
  title: TranslationConfig.describe(
2758
2571
  'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
2759
2572
  ),
@@ -2766,17 +2579,14 @@ var EventConfig = z29.object({
2766
2579
  label: TranslationConfig.describe(
2767
2580
  "Human-readable label for the event type."
2768
2581
  ),
2769
- actions: z29.array(ActionConfig).describe(
2582
+ actions: import_zod26.z.array(ActionConfig).describe(
2770
2583
  "Configuration of system-defined actions associated with the event."
2771
2584
  ),
2772
2585
  declaration: DeclarationFormConfig.describe(
2773
2586
  "Configuration of the form used to gather event data."
2774
2587
  ),
2775
- advancedSearch: z29.array(AdvancedSearchConfig).optional().default([]).describe(
2588
+ advancedSearch: import_zod26.z.array(AdvancedSearchConfig).optional().default([]).describe(
2776
2589
  "Configuration of fields available in the advanced search feature."
2777
- ),
2778
- flags: z29.array(FlagConfig).optional().default([]).describe(
2779
- "Configuration of flags associated with the actions of this event type."
2780
2590
  )
2781
2591
  }).superRefine((event2, ctx) => {
2782
2592
  const allFields = findAllFields(event2);
@@ -2828,37 +2638,8 @@ var EventConfig = z29.object({
2828
2638
  });
2829
2639
  }
2830
2640
  }
2831
- if (event2.placeOfEvent) {
2832
- const eventPlaceFieldId = getDeclarationFields(event2).find(
2833
- ({ id }) => id === event2.placeOfEvent?.$$field
2834
- );
2835
- if (!eventPlaceFieldId) {
2836
- ctx.addIssue({
2837
- code: "custom",
2838
- message: `Place of event field id must match a field id in the event.declaration fields.
2839
- Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
2840
- path: ["placeOfEvent"]
2841
- });
2842
- }
2843
- }
2844
- const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
2845
- const configuredFlagIds = event2.flags.map((flag2) => flag2.id);
2846
- const actionFlagIds = event2.actions.flatMap(
2847
- (action) => action.flags.map((flag2) => flag2.id)
2848
- );
2849
- for (const actionFlagId of actionFlagIds) {
2850
- const isConfigured = configuredFlagIds.includes(actionFlagId);
2851
- const isInherent = isInherentFlag(actionFlagId);
2852
- if (!isConfigured && !isInherent) {
2853
- ctx.addIssue({
2854
- code: "custom",
2855
- 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}'`,
2856
- path: ["actions"]
2857
- });
2858
- }
2859
- }
2860
- }).meta({
2861
- id: "EventConfig"
2641
+ }).openapi({
2642
+ ref: "EventConfig"
2862
2643
  }).describe("Configuration defining an event type.");
2863
2644
 
2864
2645
  // ../commons/src/events/EventConfigInput.ts
@@ -2867,7 +2648,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
2867
2648
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2868
2649
 
2869
2650
  // ../commons/src/events/WorkqueueConfig.ts
2870
- var z32 = __toESM(require("zod/v4"));
2651
+ var import_zod30 = require("zod");
2871
2652
 
2872
2653
  // ../commons/src/conditionals/conditionals.ts
2873
2654
  var objectHash = __toESM(require("object-hash"));
@@ -2905,7 +2686,7 @@ function not(condition) {
2905
2686
  required: []
2906
2687
  });
2907
2688
  }
2908
- function never2() {
2689
+ function never() {
2909
2690
  return not(alwaysTrue());
2910
2691
  }
2911
2692
  function jsonFieldPath(field3) {
@@ -3075,21 +2856,6 @@ function defineComparison(field3, value, keyword) {
3075
2856
  required: [field3.$$field]
3076
2857
  });
3077
2858
  }
3078
- function flag(flagvalue) {
3079
- return defineConditional({
3080
- type: "object",
3081
- properties: {
3082
- $flags: {
3083
- type: "array",
3084
- contains: {
3085
- type: "string",
3086
- const: flagvalue
3087
- }
3088
- }
3089
- },
3090
- required: ["$flags"]
3091
- });
3092
- }
3093
2859
  function createFieldConditionals(fieldId) {
3094
2860
  const getDayRange = (field3, days, clause, referenceDate) => ({
3095
2861
  type: "object",
@@ -3629,17 +3395,17 @@ var event = Object.assign(eventFn, {
3629
3395
  });
3630
3396
 
3631
3397
  // ../commons/src/events/WorkqueueColumnConfig.ts
3632
- var z30 = __toESM(require("zod/v4"));
3398
+ var import_zod27 = require("zod");
3633
3399
  var WorkqueueColumnKeysArray = [
3634
3400
  ...EventMetadataKeysArray,
3635
3401
  "title",
3636
3402
  "outbox"
3637
3403
  ];
3638
- var WorkqueueColumnKeys = z30.enum(WorkqueueColumnKeysArray);
3639
- var WorkqueueColumnValue = z30.object({
3404
+ var WorkqueueColumnKeys = import_zod27.z.enum(WorkqueueColumnKeysArray);
3405
+ var WorkqueueColumnValue = import_zod27.z.object({
3640
3406
  $event: WorkqueueColumnKeys
3641
3407
  });
3642
- var WorkqueueColumn = z30.object({
3408
+ var WorkqueueColumn = import_zod27.z.object({
3643
3409
  label: TranslationConfig,
3644
3410
  value: WorkqueueColumnValue
3645
3411
  });
@@ -3650,118 +3416,221 @@ function defineWorkqueuesColumns(workqueueColumns) {
3650
3416
  }
3651
3417
 
3652
3418
  // ../commons/src/events/CountryConfigQueryInput.ts
3653
- var z31 = __toESM(require("zod/v4"));
3654
- var SerializableExact = z31.object({
3655
- type: z31.literal("exact"),
3656
- term: z31.union([z31.string(), SerializedUserField])
3419
+ var import_zod28 = require("zod");
3420
+ var SerializableExact = import_zod28.z.object({
3421
+ type: import_zod28.z.literal("exact"),
3422
+ term: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
3657
3423
  });
3658
- var SerializableWithin = z31.object({
3659
- type: z31.literal("within"),
3660
- location: z31.union([z31.string(), SerializedUserField])
3424
+ var SerializableWithin = import_zod28.z.object({
3425
+ type: import_zod28.z.literal("within"),
3426
+ location: import_zod28.z.union([import_zod28.z.string(), SerializedUserField])
3661
3427
  });
3662
- var SerializedQueryExpression = z31.object({
3663
- eventType: z31.string(),
3664
- status: z31.optional(z31.union([AnyOfStatus, ExactStatus])),
3665
- createdAt: z31.optional(DateCondition),
3666
- updatedAt: z31.optional(DateCondition),
3667
- "legalStatuses.REGISTERED.createdAt": z31.optional(DateCondition),
3668
- "legalStatuses.REGISTERED.createdAtLocation": z31.optional(
3669
- z31.union([Within, Exact])
3428
+ var SerializedQueryExpression = import_zod28.z.object({
3429
+ eventType: import_zod28.z.string(),
3430
+ status: import_zod28.z.optional(import_zod28.z.union([AnyOfStatus, ExactStatus])),
3431
+ createdAt: import_zod28.z.optional(DateCondition),
3432
+ updatedAt: import_zod28.z.optional(DateCondition),
3433
+ "legalStatuses.REGISTERED.createdAt": import_zod28.z.optional(DateCondition),
3434
+ "legalStatuses.REGISTERED.createdAtLocation": import_zod28.z.optional(
3435
+ import_zod28.z.union([Within, Exact])
3670
3436
  ),
3671
- "legalStatuses.REGISTERED.registrationNumber": z31.optional(Exact),
3672
- createdAtLocation: z31.optional(
3673
- z31.union([SerializableWithin, SerializableExact])
3437
+ "legalStatuses.REGISTERED.registrationNumber": import_zod28.z.optional(Exact),
3438
+ createdAtLocation: import_zod28.z.optional(
3439
+ import_zod28.z.union([SerializableWithin, SerializableExact])
3674
3440
  ),
3675
- updatedAtLocation: z31.optional(
3676
- z31.union([SerializableWithin, SerializableExact])
3441
+ updatedAtLocation: import_zod28.z.optional(
3442
+ import_zod28.z.union([SerializableWithin, SerializableExact])
3677
3443
  ),
3678
- assignedTo: z31.optional(SerializableExact),
3679
- createdBy: z31.optional(SerializableExact),
3444
+ assignedTo: import_zod28.z.optional(SerializableExact),
3445
+ createdBy: import_zod28.z.optional(SerializableExact),
3680
3446
  createdByUserType: ExactUserType,
3681
- updatedBy: z31.optional(SerializableExact),
3682
- trackingId: z31.optional(Exact),
3683
- flags: z31.optional(ContainsFlags),
3447
+ updatedBy: import_zod28.z.optional(SerializableExact),
3448
+ trackingId: import_zod28.z.optional(Exact),
3449
+ flags: import_zod28.z.optional(ContainsFlags),
3684
3450
  data: QueryInput
3685
3451
  }).partial();
3686
- var Or2 = z31.object({
3687
- type: z31.literal("or"),
3688
- clauses: z31.array(SerializedQueryExpression)
3452
+ var Or2 = import_zod28.z.object({
3453
+ type: import_zod28.z.literal("or"),
3454
+ clauses: import_zod28.z.array(SerializedQueryExpression)
3689
3455
  });
3690
- var And2 = z31.object({
3691
- type: z31.literal("and"),
3692
- clauses: z31.array(SerializedQueryExpression)
3456
+ var And2 = import_zod28.z.object({
3457
+ type: import_zod28.z.literal("and"),
3458
+ clauses: import_zod28.z.array(SerializedQueryExpression)
3693
3459
  });
3694
- var CountryConfigQueryType = z31.discriminatedUnion("type", [And2, Or2]);
3695
- var CountryConfigQueryInputType = z31.union([
3460
+ var CountryConfigQueryType = import_zod28.z.discriminatedUnion("type", [And2, Or2]);
3461
+ var CountryConfigQueryInputType = import_zod28.z.union([
3696
3462
  SerializedQueryExpression,
3697
3463
  And2,
3698
3464
  Or2
3699
3465
  ]);
3700
3466
 
3701
- // ../commons/src/events/WorkqueueConfig.ts
3702
- var mandatoryColumns = defineWorkqueuesColumns([
3703
- {
3704
- label: {
3705
- id: "workqueues.dateOfEvent",
3706
- defaultMessage: "Date of Event",
3707
- description: "Label for workqueue column: dateOfEvent"
3708
- },
3709
- value: event.field("dateOfEvent")
3710
- },
3711
- {
3712
- label: {
3713
- defaultMessage: "Last updated",
3714
- description: "This is the label for the workqueue column",
3715
- id: "workqueue.default.column.modifiedAt"
3716
- },
3717
- value: event.field("updatedAt")
3718
- }
3719
- ]);
3720
- var WorkqueueActionsWithDefault = z32.enum([
3721
- ...workqueueActions.options,
3722
- "DEFAULT",
3723
- ActionType.READ
3724
- ]);
3725
- var WorkqueueConfig = z32.object({
3726
- slug: z32.string().describe("Determines the url of the workqueue."),
3727
- name: TranslationConfig.describe(
3728
- "Title of the workflow (both in navigation and on the page)"
3729
- ),
3730
- query: CountryConfigQueryType,
3731
- actions: z32.array(
3732
- z32.object({
3733
- type: WorkqueueActionsWithDefault,
3734
- conditionals: z32.array(Conditional).optional()
3735
- })
3736
- ),
3737
- columns: z32.array(WorkqueueColumn).default(mandatoryColumns),
3738
- icon: AvailableIcons,
3739
- emptyMessage: TranslationConfig.optional()
3740
- }).describe("Configuration for workqueue.");
3741
- var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3742
- query: true,
3743
- columns: true
3744
- });
3745
- var WorkqueueConfigInput = z32.object({
3746
- slug: z32.string().describe("Determines the url of the workqueue."),
3747
- name: TranslationConfig.describe(
3748
- "Title of the workflow (both in navigation and on the page)"
3749
- ),
3467
+ // ../commons/src/icons.ts
3468
+ var import_zod29 = require("zod");
3469
+ var AvailableIcons = import_zod29.z.enum([
3470
+ "Archived",
3471
+ "Assigned",
3472
+ "Certified",
3473
+ "Close",
3474
+ "Collapse",
3475
+ "Draft",
3476
+ "DuplicateYellow",
3477
+ "Expand",
3478
+ "ExternalValidate",
3479
+ "FilledCheck",
3480
+ "InReview",
3481
+ "Offline",
3482
+ "Registered",
3483
+ "RequiresUpdates",
3484
+ "Sent",
3485
+ "Validated",
3486
+ "WaitingApproval",
3487
+ "ChartActivity",
3488
+ "Activity",
3489
+ "Archive",
3490
+ "ArchiveTray",
3491
+ "ArrowLeft",
3492
+ "ArrowRight",
3493
+ "Buildings",
3494
+ "Circle",
3495
+ "CaretDown",
3496
+ "CaretLeft",
3497
+ "CaretRight",
3498
+ "ChartBar",
3499
+ "ChartLine",
3500
+ "ChatCircle",
3501
+ "CheckSquare",
3502
+ "Compass",
3503
+ "Check",
3504
+ "Copy",
3505
+ "Database",
3506
+ "DotsThreeVertical",
3507
+ "ArrowCounterClockwise",
3508
+ "MagnifyingGlassMinus",
3509
+ "MagnifyingGlassPlus",
3510
+ "Export",
3511
+ "Eye",
3512
+ "EyeSlash",
3513
+ "Envelope",
3514
+ "File",
3515
+ "FileSearch",
3516
+ "FileMinus",
3517
+ "FilePlus",
3518
+ "FileText",
3519
+ "FileX",
3520
+ "Handshake",
3521
+ "Gear",
3522
+ "GitBranch",
3523
+ "IdentificationCard",
3524
+ "List",
3525
+ "ListBullets",
3526
+ "Lock",
3527
+ "MagnifyingGlass",
3528
+ "MapPin",
3529
+ "Medal",
3530
+ "NotePencil",
3531
+ "Paperclip",
3532
+ "PaperPlaneTilt",
3533
+ "Pen",
3534
+ "Pencil",
3535
+ "PencilSimpleLine",
3536
+ "Phone",
3537
+ "Plus",
3538
+ "Printer",
3539
+ "SignOut",
3540
+ "Star",
3541
+ "Target",
3542
+ "TextT",
3543
+ "Trash",
3544
+ "UploadSimple",
3545
+ "User",
3546
+ "UserPlus",
3547
+ "Users",
3548
+ "WarningCircle",
3549
+ "X",
3550
+ "CircleWavyCheck",
3551
+ "CircleWavyQuestion",
3552
+ "ArchiveBox",
3553
+ "ArrowCircleDown",
3554
+ "FileArrowUp",
3555
+ "FileDotted",
3556
+ "Files",
3557
+ "PencilLine",
3558
+ "PencilCircle",
3559
+ "UserCircle",
3560
+ "Clock",
3561
+ "QrCode",
3562
+ "Webcam",
3563
+ "Sun",
3564
+ "DeviceTabletCamera",
3565
+ "Globe",
3566
+ "Fingerprint",
3567
+ "PushPin",
3568
+ "Timer"
3569
+ ]);
3570
+
3571
+ // ../commons/src/events/WorkqueueConfig.ts
3572
+ var mandatoryColumns = defineWorkqueuesColumns([
3573
+ {
3574
+ label: {
3575
+ id: "workqueues.dateOfEvent",
3576
+ defaultMessage: "Date of Event",
3577
+ description: "Label for workqueue column: dateOfEvent"
3578
+ },
3579
+ value: event.field("dateOfEvent")
3580
+ },
3581
+ {
3582
+ label: {
3583
+ defaultMessage: "Last updated",
3584
+ description: "This is the label for the workqueue column",
3585
+ id: "workqueue.default.column.modifiedAt"
3586
+ },
3587
+ value: event.field("updatedAt")
3588
+ }
3589
+ ]);
3590
+ var WorkqueueActionsWithDefault = import_zod30.z.enum([
3591
+ ...workqueueActions.options,
3592
+ "DEFAULT"
3593
+ ]);
3594
+ var WorkqueueConfig = import_zod30.z.object({
3595
+ slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
3596
+ name: TranslationConfig.describe(
3597
+ "Title of the workflow (both in navigation and on the page)"
3598
+ ),
3599
+ query: CountryConfigQueryType,
3600
+ actions: import_zod30.z.array(
3601
+ import_zod30.z.object({
3602
+ type: WorkqueueActionsWithDefault,
3603
+ conditionals: import_zod30.z.array(Conditional).optional()
3604
+ })
3605
+ ),
3606
+ columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
3607
+ icon: AvailableIcons,
3608
+ emptyMessage: TranslationConfig.optional()
3609
+ }).describe("Configuration for workqueue.");
3610
+ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3611
+ query: true,
3612
+ columns: true
3613
+ });
3614
+ var WorkqueueConfigInput = import_zod30.z.object({
3615
+ slug: import_zod30.z.string().describe("Determines the url of the workqueue."),
3616
+ name: TranslationConfig.describe(
3617
+ "Title of the workflow (both in navigation and on the page)"
3618
+ ),
3750
3619
  query: CountryConfigQueryInputType,
3751
- actions: z32.array(
3752
- z32.object({
3620
+ actions: import_zod30.z.array(
3621
+ import_zod30.z.object({
3753
3622
  type: WorkqueueActionsWithDefault,
3754
- conditionals: z32.array(Conditional).optional()
3623
+ conditionals: import_zod30.z.array(Conditional).optional()
3755
3624
  })
3756
3625
  ),
3757
- columns: z32.array(WorkqueueColumn).default(mandatoryColumns),
3626
+ columns: import_zod30.z.array(WorkqueueColumn).default(mandatoryColumns),
3758
3627
  icon: AvailableIcons,
3759
3628
  emptyMessage: TranslationConfig.optional()
3760
3629
  });
3761
- var WorkqueueCountInput = z32.array(
3762
- z32.object({ slug: z32.string(), query: QueryType })
3630
+ var WorkqueueCountInput = import_zod30.z.array(
3631
+ import_zod30.z.object({ slug: import_zod30.z.string(), query: QueryType })
3763
3632
  );
3764
- var WorkqueueCountOutput = z32.record(z32.string(), z32.number());
3633
+ var WorkqueueCountOutput = import_zod30.z.record(import_zod30.z.string(), import_zod30.z.number());
3765
3634
 
3766
3635
  // ../commons/src/events/workqueueDefaultColumns.ts
3767
3636
  var defaultWorkqueueColumns = [
@@ -3784,45 +3653,47 @@ var defaultWorkqueueColumns = [
3784
3653
  ];
3785
3654
 
3786
3655
  // ../commons/src/events/Draft.ts
3787
- var z34 = __toESM(require("zod/v4"));
3656
+ var import_zod32 = require("zod");
3788
3657
 
3789
3658
  // ../commons/src/events/ActionInput.ts
3790
- var z33 = __toESM(require("zod/v4"));
3791
- var BaseActionInput = z33.object({
3659
+ var import_zod31 = require("zod");
3660
+ var import_zod_openapi11 = require("zod-openapi");
3661
+ (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod31.z);
3662
+ var BaseActionInput = import_zod31.z.object({
3792
3663
  eventId: UUID,
3793
- transactionId: z33.string(),
3664
+ transactionId: import_zod31.z.string(),
3794
3665
  declaration: ActionUpdate.default({}),
3795
3666
  annotation: ActionUpdate.optional(),
3796
3667
  originalActionId: UUID.optional(),
3797
3668
  // should not be part of base action.
3798
- keepAssignment: z33.boolean().optional(),
3669
+ keepAssignment: import_zod31.z.boolean().optional(),
3799
3670
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3800
3671
  createdAtLocation: CreatedAtLocation.describe(
3801
3672
  "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."
3802
3673
  )
3803
3674
  });
3804
- var CreateActionInput = BaseActionInput.extend(
3805
- z33.object({
3806
- type: z33.literal(ActionType.CREATE).default(ActionType.CREATE),
3675
+ var CreateActionInput = BaseActionInput.merge(
3676
+ import_zod31.z.object({
3677
+ type: import_zod31.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3807
3678
  createdAtLocation: CreatedAtLocation
3808
- }).shape
3809
- );
3810
- var RegisterActionInput = BaseActionInput.extend(
3811
- z33.strictObject({
3812
- type: z33.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3813
- registrationNumber: z33.string().optional()
3814
- }).shape
3679
+ })
3815
3680
  );
3816
- var ValidateActionInput = BaseActionInput.extend(
3817
- z33.object({
3818
- type: z33.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
3819
- }).shape
3681
+ var RegisterActionInput = BaseActionInput.merge(
3682
+ import_zod31.z.object({
3683
+ type: import_zod31.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3684
+ registrationNumber: import_zod31.z.string().optional()
3685
+ })
3686
+ ).strict();
3687
+ var ValidateActionInput = BaseActionInput.merge(
3688
+ import_zod31.z.object({
3689
+ type: import_zod31.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
3690
+ })
3820
3691
  );
3821
- var NotifyActionInput = BaseActionInput.extend(
3822
- z33.object({
3823
- type: z33.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3824
- }).shape
3825
- ).meta({
3692
+ var NotifyActionInput = BaseActionInput.merge(
3693
+ import_zod31.z.object({
3694
+ type: import_zod31.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3695
+ })
3696
+ ).openapi({
3826
3697
  default: {
3827
3698
  eventId: "<event-id-here>",
3828
3699
  transactionId: getUUID(),
@@ -3831,151 +3702,135 @@ var NotifyActionInput = BaseActionInput.extend(
3831
3702
  type: ActionType.NOTIFY
3832
3703
  }
3833
3704
  });
3834
- var DeclareActionInput = BaseActionInput.extend(
3835
- z33.object({
3836
- type: z33.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3837
- }).shape
3838
- );
3839
- var EditActionInput = BaseActionInput.extend(
3840
- z33.object({
3841
- type: z33.literal(ActionType.EDIT).default(ActionType.EDIT),
3842
- content: z33.object({
3843
- comment: z33.string().describe("Comment for the edit action.").optional()
3844
- })
3845
- }).shape
3705
+ var DeclareActionInput = BaseActionInput.merge(
3706
+ import_zod31.z.object({
3707
+ type: import_zod31.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3708
+ })
3846
3709
  );
3847
- var PrintCertificateActionInput = BaseActionInput.extend(
3848
- z33.object({
3849
- type: z33.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3710
+ var PrintCertificateActionInput = BaseActionInput.merge(
3711
+ import_zod31.z.object({
3712
+ type: import_zod31.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3850
3713
  content: PrintContent.optional()
3851
- }).shape
3714
+ })
3852
3715
  );
3853
- var RejectDeclarationActionInput = BaseActionInput.extend(
3854
- z33.object({
3855
- type: z33.literal(ActionType.REJECT).default(ActionType.REJECT),
3716
+ var RejectDeclarationActionInput = BaseActionInput.merge(
3717
+ import_zod31.z.object({
3718
+ type: import_zod31.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3856
3719
  content: ReasonContent
3857
- }).shape
3720
+ })
3858
3721
  );
3859
- var DuplicateDetectedActionInput = BaseActionInput.extend(
3860
- z33.object({
3861
- type: z33.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3862
- content: z33.object({
3863
- duplicates: z33.array(PotentialDuplicate)
3722
+ var DuplicateDetectedActionInput = BaseActionInput.merge(
3723
+ import_zod31.z.object({
3724
+ type: import_zod31.z.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3725
+ content: import_zod31.z.object({
3726
+ duplicates: import_zod31.z.array(PotentialDuplicate)
3864
3727
  })
3865
- }).shape
3728
+ })
3866
3729
  );
3867
- var MarkAsDuplicateActionInput = BaseActionInput.extend(
3868
- z33.object({
3869
- type: z33.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3870
- content: z33.object({
3730
+ var MarkAsDuplicateActionInput = BaseActionInput.merge(
3731
+ import_zod31.z.object({
3732
+ type: import_zod31.z.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3733
+ content: import_zod31.z.object({
3871
3734
  duplicateOf: UUID
3872
3735
  }).optional()
3873
- }).shape
3736
+ })
3874
3737
  );
3875
- var MarkNotDuplicateActionInput = BaseActionInput.extend(
3876
- z33.object({
3877
- type: z33.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3878
- }).shape
3738
+ var MarkNotDuplicateActionInput = BaseActionInput.merge(
3739
+ import_zod31.z.object({
3740
+ type: import_zod31.z.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3741
+ })
3879
3742
  );
3880
- var ArchiveActionInput = BaseActionInput.extend(
3881
- z33.object({
3882
- type: z33.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3743
+ var ArchiveActionInput = BaseActionInput.merge(
3744
+ import_zod31.z.object({
3745
+ type: import_zod31.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3883
3746
  content: ReasonContent
3884
- }).shape
3747
+ })
3885
3748
  );
3886
- var AssignActionInput = BaseActionInput.extend(
3887
- z33.object({
3888
- type: z33.literal(ActionType.ASSIGN),
3889
- assignedTo: z33.string()
3890
- }).shape
3749
+ var AssignActionInput = BaseActionInput.merge(
3750
+ import_zod31.z.object({
3751
+ type: import_zod31.z.literal(ActionType.ASSIGN),
3752
+ assignedTo: import_zod31.z.string()
3753
+ })
3891
3754
  );
3892
- var UnassignActionInput = BaseActionInput.extend(
3893
- z33.object({
3894
- type: z33.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3895
- assignedTo: z33.literal(null).default(null)
3896
- }).shape
3755
+ var UnassignActionInput = BaseActionInput.merge(
3756
+ import_zod31.z.object({
3757
+ type: import_zod31.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3758
+ assignedTo: import_zod31.z.literal(null).default(null)
3759
+ })
3897
3760
  );
3898
- var RequestCorrectionActionInput = BaseActionInput.extend(
3899
- z33.object({
3900
- type: z33.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3901
- }).shape
3761
+ var RequestCorrectionActionInput = BaseActionInput.merge(
3762
+ import_zod31.z.object({
3763
+ type: import_zod31.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3764
+ })
3902
3765
  );
3903
- var RejectCorrectionActionInput = BaseActionInput.extend(
3904
- z33.object({
3905
- requestId: z33.string(),
3906
- type: z33.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3766
+ var RejectCorrectionActionInput = BaseActionInput.merge(
3767
+ import_zod31.z.object({
3768
+ requestId: import_zod31.z.string(),
3769
+ type: import_zod31.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3907
3770
  content: ReasonContent
3908
- }).shape
3909
- );
3910
- var ApproveCorrectionActionInput = BaseActionInput.extend(
3911
- z33.object({
3912
- requestId: z33.string(),
3913
- type: z33.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3914
- }).shape
3771
+ })
3915
3772
  );
3916
- var ReadActionInput = BaseActionInput.extend(
3917
- z33.object({
3918
- type: z33.literal(ActionType.READ).default(ActionType.READ)
3919
- }).shape
3773
+ var ApproveCorrectionActionInput = BaseActionInput.merge(
3774
+ import_zod31.z.object({
3775
+ requestId: import_zod31.z.string(),
3776
+ type: import_zod31.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3777
+ })
3920
3778
  );
3921
- var DeleteActionInput = z33.object({ eventId: UUID });
3922
- var CustomActionInput = BaseActionInput.extend(
3923
- z33.object({
3924
- type: z33.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
3925
- customActionType: z33.string().describe("Name of the custom action.")
3926
- }).shape
3779
+ var ReadActionInput = BaseActionInput.merge(
3780
+ import_zod31.z.object({
3781
+ type: import_zod31.z.literal(ActionType.READ).default(ActionType.READ)
3782
+ })
3927
3783
  );
3928
- var ActionInput = z33.discriminatedUnion("type", [
3929
- CreateActionInput.meta({ id: "CreateActionInput" }),
3930
- ValidateActionInput.meta({ id: "ValidateActionInput" }),
3931
- RegisterActionInput.meta({ id: "RegisterActionInput" }),
3932
- NotifyActionInput.meta({ id: "NotifyActionInput" }),
3933
- DeclareActionInput.meta({ id: "DeclareActionInput" }),
3934
- RejectDeclarationActionInput.meta({
3935
- id: "RejectDeclarationActionInput"
3784
+ var DeleteActionInput = import_zod31.z.object({ eventId: UUID });
3785
+ var ActionInput = import_zod31.z.discriminatedUnion("type", [
3786
+ CreateActionInput.openapi({ ref: "CreateActionInput" }),
3787
+ ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3788
+ RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
3789
+ NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
3790
+ DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
3791
+ RejectDeclarationActionInput.openapi({
3792
+ ref: "RejectDeclarationActionInput"
3936
3793
  }),
3937
- DuplicateDetectedActionInput.meta({
3938
- id: "DuplicateDetectedActionInput"
3794
+ DuplicateDetectedActionInput.openapi({
3795
+ ref: "DuplicateDetectedActionInput"
3939
3796
  }),
3940
- MarkAsDuplicateActionInput.meta({
3941
- id: "MarkAsDuplicateActionInput"
3797
+ MarkAsDuplicateActionInput.openapi({
3798
+ ref: "MarkAsDuplicateActionInput"
3942
3799
  }),
3943
- MarkNotDuplicateActionInput.meta({
3944
- id: "MarkNotDuplicateActionInput"
3800
+ MarkNotDuplicateActionInput.openapi({
3801
+ ref: "MarkNotDuplicateActionInput"
3945
3802
  }),
3946
- ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
3947
- AssignActionInput.meta({ id: "AssignActionInput" }),
3948
- UnassignActionInput.meta({ id: "UnassignActionInput" }),
3949
- PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
3950
- RequestCorrectionActionInput.meta({
3951
- id: "RequestCorrectionActionInput"
3803
+ ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
3804
+ AssignActionInput.openapi({ ref: "AssignActionInput" }),
3805
+ UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
3806
+ PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
3807
+ RequestCorrectionActionInput.openapi({
3808
+ ref: "RequestCorrectionActionInput"
3952
3809
  }),
3953
- RejectCorrectionActionInput.meta({ id: "RejectCorrectionActionInput" }),
3954
- ApproveCorrectionActionInput.meta({
3955
- id: "ApproveCorrectionActionInput"
3810
+ RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
3811
+ ApproveCorrectionActionInput.openapi({
3812
+ ref: "ApproveCorrectionActionInput"
3956
3813
  }),
3957
- ReadActionInput.meta({ id: "ReadActionInput" }),
3958
- CustomActionInput.meta({ id: "CustomActionInput" }),
3959
- EditActionInput.meta({ id: "EditActionInput" })
3960
- ]).meta({
3961
- id: "ActionInput"
3814
+ ReadActionInput.openapi({ ref: "ReadActionInput" })
3815
+ ]).openapi({
3816
+ ref: "ActionInput"
3962
3817
  });
3963
3818
 
3964
3819
  // ../commons/src/events/Draft.ts
3965
- var Draft = z34.object({
3820
+ var Draft = import_zod32.z.object({
3966
3821
  id: UUID,
3967
3822
  eventId: UUID,
3968
- transactionId: z34.string(),
3969
- createdAt: z34.string().datetime(),
3823
+ transactionId: import_zod32.z.string(),
3824
+ createdAt: import_zod32.z.string().datetime(),
3970
3825
  action: ActionBase.extend({
3971
- type: ActionTypes.exclude([ActionTypes.enum.DELETE])
3826
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
3972
3827
  }).omit({ id: true, createdAtLocation: true })
3973
3828
  }).describe(
3974
3829
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
3975
3830
  );
3976
3831
  var DraftInput = BaseActionInput.extend({
3977
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
3978
- status: z34.enum([
3832
+ type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
3833
+ status: import_zod32.z.enum([
3979
3834
  ActionStatus.Requested,
3980
3835
  ActionStatus.Accepted,
3981
3836
  ActionStatus.Rejected
@@ -3983,30 +3838,32 @@ var DraftInput = BaseActionInput.extend({
3983
3838
  });
3984
3839
 
3985
3840
  // ../commons/src/events/EventInput.ts
3986
- var z35 = __toESM(require("zod/v4"));
3841
+ var import_zod33 = require("zod");
3987
3842
  var import_uuid10 = require("uuid");
3988
- var EventInput = z35.object({
3989
- transactionId: z35.string(),
3990
- type: z35.string()
3991
- }).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
3843
+ var EventInput = import_zod33.z.object({
3844
+ transactionId: import_zod33.z.string(),
3845
+ type: import_zod33.z.string()
3846
+ }).openapi({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
3992
3847
 
3993
3848
  // ../commons/src/events/EventDocument.ts
3994
- var z36 = __toESM(require("zod/v4"));
3995
- var EventDocument = z36.object({
3849
+ var import_zod34 = require("zod");
3850
+ var import_zod_openapi12 = require("zod-openapi");
3851
+ (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod34.z);
3852
+ var EventDocument = import_zod34.z.object({
3996
3853
  id: UUID.describe("Unique identifier of the event."),
3997
- type: z36.string().describe("Type of the event (e.g. birth, death, marriage)."),
3998
- createdAt: z36.string().datetime().describe("Timestamp indicating when the event was created."),
3999
- updatedAt: z36.string().datetime().describe(
3854
+ type: import_zod34.z.string().describe("Type of the event (e.g. birth, death, marriage)."),
3855
+ createdAt: import_zod34.z.string().datetime().describe("Timestamp indicating when the event was created."),
3856
+ updatedAt: import_zod34.z.string().datetime().describe(
4000
3857
  "Timestamp of the last update, excluding changes from actions."
4001
3858
  ),
4002
- actions: z36.array(Action).describe("Ordered list of actions associated with the event."),
4003
- trackingId: z36.string().describe(
3859
+ actions: import_zod34.z.array(Action).describe("Ordered list of actions associated with the event."),
3860
+ trackingId: import_zod34.z.string().describe(
4004
3861
  "System-generated tracking identifier used to look up the event."
4005
3862
  )
4006
- }).meta({ id: "EventDocument" });
3863
+ }).openapi({ ref: "EventDocument" });
4007
3864
 
4008
3865
  // ../commons/src/events/state/index.ts
4009
- var import_lodash4 = require("lodash");
3866
+ var import_lodash3 = require("lodash");
4010
3867
 
4011
3868
  // ../commons/src/events/state/utils.ts
4012
3869
  var import_lodash2 = require("lodash");
@@ -4019,14 +3876,9 @@ var updateActions = ActionTypes.extract([
4019
3876
  ActionType.REJECT,
4020
3877
  ActionType.ARCHIVE,
4021
3878
  ActionType.PRINT_CERTIFICATE,
4022
- ActionType.REQUEST_CORRECTION,
4023
- ActionType.CUSTOM
3879
+ ActionType.REQUEST_CORRECTION
4024
3880
  ]);
4025
3881
 
4026
- // ../commons/src/events/state/flags.ts
4027
- var import_lodash3 = require("lodash");
4028
- var import_date_fns3 = require("date-fns");
4029
-
4030
3882
  // ../commons/src/events/defineConfig.ts
4031
3883
  var defineConfig = (config) => {
4032
3884
  const input = EventConfig.parse(config);
@@ -4034,7 +3886,7 @@ var defineConfig = (config) => {
4034
3886
  };
4035
3887
 
4036
3888
  // ../commons/src/events/test.utils.ts
4037
- var import_lodash5 = require("lodash");
3889
+ var import_lodash4 = require("lodash");
4038
3890
  var import_date_fns4 = require("date-fns");
4039
3891
 
4040
3892
  // ../commons/src/field-config/field-configuration.ts
@@ -4056,6 +3908,7 @@ function field(fieldId, options = {}) {
4056
3908
  }
4057
3909
 
4058
3910
  // ../commons/src/fixtures/forms.ts
3911
+ var import_date_fns3 = require("date-fns");
4059
3912
  var PRINT_CERTIFICATE_FORM = defineActionForm({
4060
3913
  label: {
4061
3914
  id: "event.tennis-club-membership.action.certificate.form.label",
@@ -4855,7 +4708,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4855
4708
  conditionals: [
4856
4709
  {
4857
4710
  type: ConditionalType.DISPLAY_ON_REVIEW,
4858
- conditional: never2()
4711
+ conditional: never()
4859
4712
  }
4860
4713
  ]
4861
4714
  },
@@ -5238,16 +5091,119 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5238
5091
  }
5239
5092
  }
5240
5093
  ],
5241
- conditional: not(never2())
5094
+ conditional: not(never())
5242
5095
  // Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
5243
5096
  }
5244
5097
  ]
5245
5098
  });
5099
+ var statusOptions = [
5100
+ {
5101
+ value: "ALL",
5102
+ label: {
5103
+ defaultMessage: "Any status",
5104
+ description: "Option for form field: status of record",
5105
+ id: "advancedSearch.form.recordStatusAny"
5106
+ }
5107
+ },
5108
+ {
5109
+ value: EventStatus.enum.CREATED,
5110
+ label: {
5111
+ defaultMessage: "Draft",
5112
+ description: "Option for form field: status of record",
5113
+ id: "advancedSearch.form.recordStatusCreated"
5114
+ }
5115
+ },
5116
+ {
5117
+ value: EventStatus.enum.NOTIFIED,
5118
+ label: {
5119
+ defaultMessage: "Notified",
5120
+ description: "Option for form field: status of record",
5121
+ id: "advancedSearch.form.recordStatusNotified"
5122
+ }
5123
+ },
5124
+ {
5125
+ value: EventStatus.enum.DECLARED,
5126
+ label: {
5127
+ defaultMessage: "Declared",
5128
+ description: "Option for form field: status of record",
5129
+ id: "advancedSearch.form.recordStatusDeclared"
5130
+ }
5131
+ },
5132
+ {
5133
+ value: EventStatus.enum.VALIDATED,
5134
+ label: {
5135
+ defaultMessage: "Validated",
5136
+ description: "Option for form field: status of record",
5137
+ id: "advancedSearch.form.recordStatusValidated"
5138
+ }
5139
+ },
5140
+ {
5141
+ value: EventStatus.enum.REGISTERED,
5142
+ label: {
5143
+ defaultMessage: "Registered",
5144
+ description: "Option for form field: status of record",
5145
+ id: "advancedSearch.form.recordStatusRegistered"
5146
+ }
5147
+ },
5148
+ {
5149
+ value: EventStatus.enum.ARCHIVED,
5150
+ label: {
5151
+ defaultMessage: "Archived",
5152
+ description: "Option for form field: status of record",
5153
+ id: "advancedSearch.form.recordStatusArchived"
5154
+ }
5155
+ }
5156
+ ];
5157
+ var timePeriodOptions = [
5158
+ {
5159
+ label: {
5160
+ defaultMessage: "Last 7 days",
5161
+ description: "Label for option of time period select: last 7 days",
5162
+ id: "form.section.label.timePeriodLast7Days"
5163
+ },
5164
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5165
+ /* @__PURE__ */ new Date(),
5166
+ "yyyy-MM-dd"
5167
+ )}`
5168
+ },
5169
+ {
5170
+ label: {
5171
+ defaultMessage: "Last 30 days",
5172
+ description: "Label for option of time period select: last 30 days",
5173
+ id: "form.section.label.timePeriodLast30Days"
5174
+ },
5175
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5176
+ /* @__PURE__ */ new Date(),
5177
+ "yyyy-MM-dd"
5178
+ )}`
5179
+ },
5180
+ {
5181
+ label: {
5182
+ defaultMessage: "Last 90 days",
5183
+ description: "Label for option of time period select: last 90 days",
5184
+ id: "form.section.label.timePeriodLast90Days"
5185
+ },
5186
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5187
+ /* @__PURE__ */ new Date(),
5188
+ "yyyy-MM-dd"
5189
+ )}`
5190
+ },
5191
+ {
5192
+ label: {
5193
+ defaultMessage: "Last year",
5194
+ description: "Label for option of time period select: last year",
5195
+ id: "form.section.label.timePeriodLastYear"
5196
+ },
5197
+ value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5198
+ /* @__PURE__ */ new Date(),
5199
+ "yyyy-MM-dd"
5200
+ )}`
5201
+ }
5202
+ ];
5246
5203
 
5247
5204
  // ../commons/src/fixtures/tennis-club-membership-event.ts
5248
5205
  var tennisClubMembershipEvent = defineConfig({
5249
5206
  id: TENNIS_CLUB_MEMBERSHIP,
5250
- declaration: TENNIS_CLUB_DECLARATION_FORM,
5251
5207
  label: {
5252
5208
  defaultMessage: "Tennis club membership application",
5253
5209
  description: "This is what this event is referred as in the system",
@@ -5278,17 +5234,6 @@ var tennisClubMembershipEvent = defineConfig({
5278
5234
  }
5279
5235
  ]
5280
5236
  },
5281
- flags: [
5282
- {
5283
- id: "validated",
5284
- label: {
5285
- id: "event.tennis-club-membership.flag.validated",
5286
- defaultMessage: "Validated",
5287
- description: "Flag label for validated"
5288
- },
5289
- requiresAction: true
5290
- }
5291
- ],
5292
5237
  actions: [
5293
5238
  {
5294
5239
  type: ActionType.READ,
@@ -5315,19 +5260,7 @@ var tennisClubMembershipEvent = defineConfig({
5315
5260
  description: "This is shown as the action name anywhere the user can trigger the action from",
5316
5261
  id: "event.tennis-club-membership.action.validate.label"
5317
5262
  },
5318
- flags: [{ id: "validated", operation: "add" }],
5319
- conditionals: [
5320
- { type: ConditionalType.SHOW, conditional: not(flag("validated")) }
5321
- ]
5322
- },
5323
- {
5324
- type: ActionType.REJECT,
5325
- label: {
5326
- defaultMessage: "Reject",
5327
- description: "This is shown as the action name anywhere the user can trigger the action from",
5328
- id: "event.tennis-club-membership.action.reject.label"
5329
- },
5330
- flags: [{ id: "validated", operation: "remove" }]
5263
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5331
5264
  },
5332
5265
  {
5333
5266
  type: ActionType.REGISTER,
@@ -5335,7 +5268,8 @@ var tennisClubMembershipEvent = defineConfig({
5335
5268
  defaultMessage: "Register",
5336
5269
  description: "This is shown as the action name anywhere the user can trigger the action from",
5337
5270
  id: "event.tennis-club-membership.action.register.label"
5338
- }
5271
+ },
5272
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5339
5273
  },
5340
5274
  {
5341
5275
  type: ActionType.REQUEST_CORRECTION,
@@ -5538,6 +5472,14 @@ var tennisClubMembershipEvent = defineConfig({
5538
5472
  ]
5539
5473
  }
5540
5474
  },
5475
+ {
5476
+ type: ActionType.APPROVE_CORRECTION,
5477
+ label: {
5478
+ defaultMessage: "Approve correction",
5479
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5480
+ id: "event.tennis-club-membership.action.correction.approve.label"
5481
+ }
5482
+ },
5541
5483
  {
5542
5484
  type: ActionType.PRINT_CERTIFICATE,
5543
5485
  label: {
@@ -5546,6 +5488,22 @@ var tennisClubMembershipEvent = defineConfig({
5546
5488
  description: "This is shown as the action name anywhere the user can trigger the action from"
5547
5489
  },
5548
5490
  printForm: PRINT_CERTIFICATE_FORM
5491
+ },
5492
+ {
5493
+ type: ActionType.ARCHIVE,
5494
+ label: {
5495
+ id: "event.tennis-club-membership.action.archive.label",
5496
+ defaultMessage: "Archive",
5497
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5498
+ }
5499
+ },
5500
+ {
5501
+ type: ActionType.REJECT,
5502
+ label: {
5503
+ id: "event.tennis-club-membership.action.reject.label",
5504
+ defaultMessage: "Reject",
5505
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5506
+ }
5549
5507
  }
5550
5508
  ],
5551
5509
  advancedSearch: [
@@ -5582,7 +5540,8 @@ var tennisClubMembershipEvent = defineConfig({
5582
5540
  },
5583
5541
  fields: [field("recommender.name").fuzzy()]
5584
5542
  }
5585
- ]
5543
+ ],
5544
+ declaration: TENNIS_CLUB_DECLARATION_FORM
5586
5545
  });
5587
5546
 
5588
5547
  // ../commons/src/fixtures/football-club-membership-event.ts
@@ -5656,7 +5615,8 @@ var footballClubMembershipEvent = defineConfig({
5656
5615
  defaultMessage: "Validate",
5657
5616
  description: "This is shown as the action name anywhere the user can trigger the action from",
5658
5617
  id: "event.football-club-membership.action.validate.label"
5659
- }
5618
+ },
5619
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5660
5620
  },
5661
5621
  {
5662
5622
  type: ActionType.REGISTER,
@@ -5664,7 +5624,8 @@ var footballClubMembershipEvent = defineConfig({
5664
5624
  defaultMessage: "Register",
5665
5625
  description: "This is shown as the action name anywhere the user can trigger the action from",
5666
5626
  id: "event.football-club-membership.action.register.label"
5667
- }
5627
+ },
5628
+ review: TENNIS_CLUB_DECLARATION_REVIEW
5668
5629
  },
5669
5630
  {
5670
5631
  type: ActionType.REQUEST_CORRECTION,
@@ -5870,6 +5831,14 @@ var footballClubMembershipEvent = defineConfig({
5870
5831
  ]
5871
5832
  }
5872
5833
  },
5834
+ {
5835
+ type: ActionType.APPROVE_CORRECTION,
5836
+ label: {
5837
+ defaultMessage: "Approve correction",
5838
+ description: "This is shown as the action name anywhere the user can trigger the action from",
5839
+ id: "event.football-club-membership.action.correction.approve.label"
5840
+ }
5841
+ },
5873
5842
  {
5874
5843
  type: ActionType.PRINT_CERTIFICATE,
5875
5844
  label: {
@@ -5878,6 +5847,22 @@ var footballClubMembershipEvent = defineConfig({
5878
5847
  description: "This is shown as the action name anywhere the user can trigger the action from"
5879
5848
  },
5880
5849
  printForm: PRINT_CERTIFICATE_FORM
5850
+ },
5851
+ {
5852
+ type: ActionType.ARCHIVE,
5853
+ label: {
5854
+ id: "event.football-club-membership.action.archive.label",
5855
+ defaultMessage: "Archive",
5856
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5857
+ }
5858
+ },
5859
+ {
5860
+ type: ActionType.REJECT,
5861
+ label: {
5862
+ id: "event.football-club-membership.action.reject.label",
5863
+ defaultMessage: "Reject",
5864
+ description: "This is shown as the action name anywhere the user can trigger the action from"
5865
+ }
5881
5866
  }
5882
5867
  ],
5883
5868
  advancedSearch: [
@@ -5977,7 +5962,7 @@ var libraryMembershipEvent = defineConfig({
5977
5962
  declaration: libraryMembershipForm
5978
5963
  });
5979
5964
 
5980
- // ../commons/src/fixtures/child-onboarding-event.ts
5965
+ // ../commons/src/fixtures/v2-birth-event.ts
5981
5966
  function generateTranslationConfig(message) {
5982
5967
  return {
5983
5968
  defaultMessage: message,
@@ -6006,61 +5991,6 @@ var child = defineFormPage({
6006
5991
  secured: true,
6007
5992
  validation: [],
6008
5993
  label: generateTranslationConfig("Date of birth")
6009
- },
6010
- {
6011
- id: "child.placeOfBirth",
6012
- analytics: true,
6013
- type: FieldType.SELECT,
6014
- required: true,
6015
- secured: true,
6016
- label: {
6017
- defaultMessage: "Place of delivery",
6018
- description: "This is the label for the field",
6019
- id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
6020
- },
6021
- options: [
6022
- {
6023
- value: "child.placeOfBirth-SELECT-2",
6024
- label: generateTranslationConfig("Health Institution")
6025
- },
6026
- {
6027
- value: "PRIVATE_HOME",
6028
- label: generateTranslationConfig("Residential address")
6029
- }
6030
- ]
6031
- },
6032
- {
6033
- id: "child.birthLocation",
6034
- analytics: true,
6035
- type: "FACILITY",
6036
- required: true,
6037
- secured: true,
6038
- label: generateTranslationConfig("Health Institution"),
6039
- conditionals: [
6040
- {
6041
- type: "SHOW",
6042
- conditional: field("child.placeOfBirth").isEqualTo(
6043
- "child.placeOfBirth-SELECT-2"
6044
- )
6045
- }
6046
- ]
6047
- },
6048
- {
6049
- id: "child.birthLocation.privateHome",
6050
- analytics: true,
6051
- type: FieldType.ADDRESS,
6052
- secured: true,
6053
- hideLabel: true,
6054
- label: generateTranslationConfig("Child's address"),
6055
- conditionals: [
6056
- {
6057
- type: "SHOW",
6058
- conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
6059
- }
6060
- ],
6061
- configuration: {
6062
- streetAddressForm: []
6063
- }
6064
5994
  }
6065
5995
  ]
6066
5996
  });
@@ -6137,7 +6067,7 @@ var mother = defineFormPage({
6137
6067
  }
6138
6068
  ]
6139
6069
  });
6140
- var CHILD_ONBOARDING_DECLARATION_REVIEW = {
6070
+ var BIRTH_DECLARATION_REVIEW = {
6141
6071
  title: generateTranslationConfig(
6142
6072
  "{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}}}}}"
6143
6073
  ),
@@ -6157,12 +6087,12 @@ var CHILD_ONBOARDING_DECLARATION_REVIEW = {
6157
6087
  }
6158
6088
  ]
6159
6089
  };
6160
- var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
6090
+ var BIRTH_DECLARATION_FORM = defineDeclarationForm({
6161
6091
  label: generateTranslationConfig("Birth decalration form"),
6162
6092
  pages: [child, mother]
6163
6093
  });
6164
- var ChildOnboardingEvent = defineConfig({
6165
- id: CHILD_ONBOARDING_EVENT,
6094
+ var v2BirthEvent = defineConfig({
6095
+ id: BIRTH_EVENT,
6166
6096
  title: generateTranslationConfig(
6167
6097
  "{child.name.firstname} {child.name.surname}"
6168
6098
  ),
@@ -6170,33 +6100,249 @@ var ChildOnboardingEvent = defineConfig({
6170
6100
  summary: {
6171
6101
  fields: []
6172
6102
  },
6173
- declaration: CHILD_ONBOARDING_DECLARATION_FORM,
6103
+ declaration: BIRTH_DECLARATION_FORM,
6174
6104
  actions: [
6175
6105
  {
6176
6106
  type: ActionType.READ,
6177
6107
  label: generateTranslationConfig("Read"),
6178
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
6108
+ review: BIRTH_DECLARATION_REVIEW
6179
6109
  },
6180
6110
  {
6181
6111
  type: ActionType.DECLARE,
6182
6112
  label: generateTranslationConfig("Declare"),
6183
- review: CHILD_ONBOARDING_DECLARATION_REVIEW
6113
+ review: BIRTH_DECLARATION_REVIEW
6184
6114
  },
6185
6115
  {
6186
6116
  type: ActionType.VALIDATE,
6187
- label: generateTranslationConfig("Validate")
6117
+ label: generateTranslationConfig("Validate"),
6118
+ review: BIRTH_DECLARATION_REVIEW
6188
6119
  },
6189
6120
  {
6190
6121
  type: ActionType.REGISTER,
6191
- label: generateTranslationConfig("Register")
6122
+ label: generateTranslationConfig("Register"),
6123
+ review: BIRTH_DECLARATION_REVIEW
6192
6124
  }
6193
6125
  ],
6194
6126
  advancedSearch: []
6195
6127
  });
6196
6128
 
6129
+ // ../commons/src/fixtures/digital-identity-issuance-event.ts
6130
+ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6131
+ label: {
6132
+ id: "event.digital-identity.action.certificate.form.label",
6133
+ defaultMessage: "Digital identity certificate printer",
6134
+ description: "This is what this form is referred as in the system"
6135
+ },
6136
+ pages: [
6137
+ {
6138
+ id: "collector",
6139
+ type: PageTypes.enum.FORM,
6140
+ title: {
6141
+ id: "event.tennis-club-membership.action.certificate.form.section.who.title",
6142
+ defaultMessage: "Print certified copy",
6143
+ description: "This is the title of the section"
6144
+ },
6145
+ fields: [
6146
+ {
6147
+ id: "identity.http-fetch",
6148
+ type: FieldType.HTTP,
6149
+ label: {
6150
+ defaultMessage: "Digital identity certificate",
6151
+ description: "Fetch printable digital identity certificate",
6152
+ id: "event.digital-identity.certificate.fetch.label"
6153
+ },
6154
+ configuration: {
6155
+ trigger: field("identity.http-button"),
6156
+ url: "/api/digital-identity/certificate",
6157
+ timeout: 5e3,
6158
+ method: "POST",
6159
+ headers: {
6160
+ "Content-Type": "application/json"
6161
+ },
6162
+ body: {
6163
+ subjectId: "$event.subject.id"
6164
+ }
6165
+ }
6166
+ },
6167
+ {
6168
+ id: "identity.http-button",
6169
+ type: FieldType.BUTTON,
6170
+ label: {
6171
+ defaultMessage: "Certificate",
6172
+ description: "Certificate",
6173
+ id: "event.digital-identity.certificate.button.label"
6174
+ },
6175
+ conditionals: [
6176
+ {
6177
+ type: ConditionalType.ENABLE,
6178
+ conditional: and(
6179
+ field("identity.http-fetch").isUndefined(),
6180
+ user.isOnline()
6181
+ )
6182
+ },
6183
+ {
6184
+ type: ConditionalType.SHOW,
6185
+ conditional: and(
6186
+ field("identity.http-fetch").get("loading").isFalsy(),
6187
+ field("identity.http-fetch").get("data").isFalsy()
6188
+ )
6189
+ }
6190
+ ],
6191
+ configuration: {
6192
+ icon: "IdentificationCard",
6193
+ text: {
6194
+ defaultMessage: "Fetch certificate",
6195
+ description: "Fetch certificate",
6196
+ id: "event.digital-identity.certificate.fetch.text"
6197
+ }
6198
+ }
6199
+ },
6200
+ {
6201
+ id: "identity.http-button",
6202
+ type: FieldType.BUTTON,
6203
+ label: {
6204
+ defaultMessage: "Certificate",
6205
+ description: "Certificate",
6206
+ id: "event.digital-identity.certificate.button.label"
6207
+ },
6208
+ conditionals: [
6209
+ {
6210
+ type: ConditionalType.ENABLE,
6211
+ conditional: never()
6212
+ },
6213
+ {
6214
+ type: ConditionalType.SHOW,
6215
+ conditional: field("identity.http-fetch").get("loading").isEqualTo(true)
6216
+ }
6217
+ ],
6218
+ configuration: {
6219
+ loading: true,
6220
+ text: {
6221
+ defaultMessage: "Fetching certificate\u2026",
6222
+ description: "Fetching certificate\u2026",
6223
+ id: "event.digital-identity.certificate.fetching.text"
6224
+ }
6225
+ }
6226
+ },
6227
+ {
6228
+ id: "identity.http-button",
6229
+ type: FieldType.BUTTON,
6230
+ label: {
6231
+ defaultMessage: "Certificate",
6232
+ description: "Certificate",
6233
+ id: "event.digital-identity.certificate.button.label"
6234
+ },
6235
+ conditionals: [
6236
+ {
6237
+ type: ConditionalType.ENABLE,
6238
+ conditional: never()
6239
+ },
6240
+ {
6241
+ type: ConditionalType.SHOW,
6242
+ conditional: not(field("identity.certificateId").isFalsy())
6243
+ }
6244
+ ],
6245
+ configuration: {
6246
+ icon: "Check",
6247
+ text: {
6248
+ defaultMessage: "Certificate ready",
6249
+ description: "Certificate ready",
6250
+ id: "event.digital-identity.certificate.ready.text"
6251
+ }
6252
+ }
6253
+ },
6254
+ {
6255
+ id: "identity.certificateId",
6256
+ type: FieldType.TEXT,
6257
+ parent: field("identity.http-fetch"),
6258
+ label: {
6259
+ defaultMessage: "Certificate ID",
6260
+ description: "Issued digital identity certificate identifier",
6261
+ id: "event.digital-identity.certificate.id.label"
6262
+ },
6263
+ conditionals: [
6264
+ {
6265
+ type: ConditionalType.ENABLE,
6266
+ conditional: never()
6267
+ }
6268
+ ],
6269
+ value: field("identity.http-fetch").get("data.certificateId")
6270
+ }
6271
+ ]
6272
+ }
6273
+ ]
6274
+ });
6275
+ var digitalIdentityForm = defineDeclarationForm({
6276
+ label: {
6277
+ id: "event.digital-identity.action.declare.form.label",
6278
+ defaultMessage: "Digital identity issuance",
6279
+ description: "This is what this form is referred as in the system"
6280
+ },
6281
+ pages: [
6282
+ {
6283
+ id: "subject",
6284
+ title: {
6285
+ id: "event.digital-identity.action.declare.form.section.who.title",
6286
+ defaultMessage: "Who is the digital identity issued to?",
6287
+ description: "This is the title of the section"
6288
+ },
6289
+ fields: [
6290
+ {
6291
+ id: "subject.firstname",
6292
+ type: FieldType.TEXT,
6293
+ required: true,
6294
+ conditionals: [],
6295
+ label: {
6296
+ defaultMessage: "Subject's first name",
6297
+ description: "This is the label for the field",
6298
+ id: "event.digital-identity.action.declare.form.section.who.field.firstname.label"
6299
+ }
6300
+ },
6301
+ {
6302
+ id: "subject.surname",
6303
+ type: FieldType.TEXT,
6304
+ required: true,
6305
+ conditionals: [],
6306
+ label: {
6307
+ defaultMessage: "Subject's surname",
6308
+ description: "This is the label for the field",
6309
+ id: "event.digital-identity.action.declare.form.section.who.field.surname.label"
6310
+ }
6311
+ }
6312
+ ]
6313
+ }
6314
+ ]
6315
+ });
6316
+ var digitalIdentityEvent = defineConfig({
6317
+ id: "digital-identity",
6318
+ label: {
6319
+ defaultMessage: "Digital identity issuance",
6320
+ description: "This is what this event is referred as in the system",
6321
+ id: "event.digital-identity.label"
6322
+ },
6323
+ title: {
6324
+ defaultMessage: "{subject.firstname} {subject.surname}",
6325
+ description: "This is the title of the summary",
6326
+ id: "event.digital-identity.title"
6327
+ },
6328
+ summary: { fields: [] },
6329
+ actions: [
6330
+ {
6331
+ type: ActionType.PRINT_CERTIFICATE,
6332
+ label: {
6333
+ id: "event.football-club-membership.action.collect-certificate.label",
6334
+ defaultMessage: "Print certificate",
6335
+ description: "This is shown as the action name anywhere the user can trigger the action from"
6336
+ },
6337
+ printForm: PRINT_DIGITAL_ID_CERTIFICATE_FORM
6338
+ }
6339
+ ],
6340
+ declaration: digitalIdentityForm
6341
+ });
6342
+
6197
6343
  // ../commons/src/events/test.utils.ts
6198
- var z37 = __toESM(require("zod/v4"));
6199
- var TestUserRole = z37.enum([
6344
+ var import_zod35 = require("zod");
6345
+ var TestUserRole = import_zod35.z.enum([
6200
6346
  "FIELD_AGENT",
6201
6347
  "LOCAL_REGISTRAR",
6202
6348
  "LOCAL_SYSTEM_ADMIN",
@@ -6207,7 +6353,7 @@ var TestUserRole = z37.enum([
6207
6353
  ]);
6208
6354
 
6209
6355
  // ../commons/src/events/scopes.ts
6210
- var import_lodash6 = require("lodash");
6356
+ var import_lodash5 = require("lodash");
6211
6357
  var ACTION_SCOPE_MAP = {
6212
6358
  [ActionType.READ]: ["record.read"],
6213
6359
  [ActionType.CREATE]: ["record.create"],
@@ -6217,7 +6363,6 @@ var ACTION_SCOPE_MAP = {
6217
6363
  "record.declared.validate",
6218
6364
  "record.register"
6219
6365
  ],
6220
- [ActionType.EDIT]: ["record.declared.edit"],
6221
6366
  [ActionType.DELETE]: ["record.declare"],
6222
6367
  [ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
6223
6368
  [ActionType.REGISTER]: ["record.register"],
@@ -6237,8 +6382,7 @@ var ACTION_SCOPE_MAP = {
6237
6382
  [ActionType.REJECT]: ["record.declared.reject"],
6238
6383
  [ActionType.ASSIGN]: null,
6239
6384
  [ActionType.UNASSIGN]: null,
6240
- [ActionType.DUPLICATE_DETECTED]: [],
6241
- [ActionType.CUSTOM]: []
6385
+ [ActionType.DUPLICATE_DETECTED]: []
6242
6386
  };
6243
6387
 
6244
6388
  // ../commons/src/events/state/availableActions.ts
@@ -6247,26 +6391,28 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6247
6391
  ActionType.READ,
6248
6392
  ActionType.DECLARE,
6249
6393
  ActionType.NOTIFY,
6250
- ActionType.DELETE,
6251
- ActionType.CUSTOM
6394
+ ActionType.DELETE
6252
6395
  ],
6253
6396
  [EventStatus.enum.NOTIFIED]: [
6254
6397
  ActionType.READ,
6255
6398
  ActionType.DECLARE,
6256
6399
  ActionType.MARK_AS_DUPLICATE,
6257
6400
  ActionType.ARCHIVE,
6258
- ActionType.REJECT,
6259
- ActionType.CUSTOM
6401
+ ActionType.REJECT
6260
6402
  ],
6261
6403
  [EventStatus.enum.DECLARED]: [
6262
6404
  ActionType.READ,
6263
6405
  ActionType.VALIDATE,
6406
+ ActionType.MARK_AS_DUPLICATE,
6407
+ ActionType.ARCHIVE,
6408
+ ActionType.REJECT
6409
+ ],
6410
+ [EventStatus.enum.VALIDATED]: [
6411
+ ActionType.READ,
6264
6412
  ActionType.REGISTER,
6265
6413
  ActionType.MARK_AS_DUPLICATE,
6266
6414
  ActionType.ARCHIVE,
6267
- ActionType.REJECT,
6268
- ActionType.CUSTOM,
6269
- ActionType.EDIT
6415
+ ActionType.REJECT
6270
6416
  ],
6271
6417
  [EventStatus.enum.REGISTERED]: [
6272
6418
  ActionType.READ,
@@ -6274,50 +6420,47 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6274
6420
  ActionType.REQUEST_CORRECTION,
6275
6421
  ActionType.APPROVE_CORRECTION,
6276
6422
  ActionType.REJECT_CORRECTION,
6277
- ActionType.CUSTOM,
6278
6423
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
6279
6424
  ],
6280
6425
  [EventStatus.enum.ARCHIVED]: [
6281
6426
  ActionType.READ,
6282
6427
  ActionType.ASSIGN,
6283
- ActionType.UNASSIGN,
6284
- ActionType.CUSTOM
6428
+ ActionType.UNASSIGN
6285
6429
  ]
6286
6430
  };
6287
6431
  var ACTION_FILTERS = {
6288
- [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6289
- [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6290
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6291
- [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6292
- [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6293
- [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6294
- [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6295
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6296
- [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
6297
- [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
6298
- [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
6432
+ [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6433
+ [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6434
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6435
+ [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6436
+ [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6437
+ [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6438
+ [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6439
+ [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6440
+ [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
6441
+ [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6299
6442
  };
6300
6443
 
6301
6444
  // ../commons/src/events/FileUtils.ts
6302
- var import_lodash7 = require("lodash");
6445
+ var import_lodash6 = require("lodash");
6303
6446
 
6304
6447
  // ../commons/src/events/locations.ts
6305
- var z38 = __toESM(require("zod/v4"));
6306
- var LocationType = z38.enum([
6448
+ var import_zod36 = require("zod");
6449
+ var LocationType = import_zod36.z.enum([
6307
6450
  "ADMIN_STRUCTURE",
6308
6451
  "CRVS_OFFICE",
6309
6452
  "HEALTH_FACILITY"
6310
6453
  ]);
6311
- var Location = z38.object({
6454
+ var Location = import_zod36.z.object({
6312
6455
  id: UUID,
6313
- name: z38.string(),
6456
+ name: import_zod36.z.string(),
6314
6457
  parentId: UUID.nullable(),
6315
- validUntil: z38.iso.datetime().nullable(),
6458
+ validUntil: import_zod36.z.string().datetime().nullable(),
6316
6459
  locationType: LocationType.nullable()
6317
6460
  });
6318
6461
 
6319
6462
  // ../commons/src/notification/UserNotifications.ts
6320
- var z39 = __toESM(require("zod/v4"));
6463
+ var import_zod37 = require("zod");
6321
6464
  var TriggerEvent = {
6322
6465
  USER_CREATED: "user-created",
6323
6466
  USER_UPDATED: "user-updated",
@@ -6329,50 +6472,50 @@ var TriggerEvent = {
6329
6472
  CHANGE_PHONE_NUMBER: "change-phone-number",
6330
6473
  CHANGE_EMAIL_ADDRESS: "change-email-address"
6331
6474
  };
6332
- var Recipient = z39.object({
6475
+ var Recipient = import_zod37.z.object({
6333
6476
  name: NameFieldValue.optional(),
6334
- mobile: z39.string().optional(),
6335
- email: z39.string().optional(),
6336
- bcc: z39.array(z39.string()).optional()
6477
+ mobile: import_zod37.z.string().optional(),
6478
+ email: import_zod37.z.string().optional(),
6479
+ bcc: import_zod37.z.array(import_zod37.z.string()).optional()
6337
6480
  });
6338
- var BasePayload = z39.object({
6481
+ var BasePayload = import_zod37.z.object({
6339
6482
  recipient: Recipient
6340
6483
  });
6341
6484
  var TriggerPayload = {
6342
6485
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
6343
- username: z39.string(),
6344
- temporaryPassword: z39.string()
6486
+ username: import_zod37.z.string(),
6487
+ temporaryPassword: import_zod37.z.string()
6345
6488
  }),
6346
6489
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
6347
- oldUsername: z39.string(),
6348
- newUsername: z39.string()
6490
+ oldUsername: import_zod37.z.string(),
6491
+ newUsername: import_zod37.z.string()
6349
6492
  }),
6350
6493
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
6351
- username: z39.string()
6494
+ username: import_zod37.z.string()
6352
6495
  }),
6353
6496
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
6354
- code: z39.string()
6497
+ code: import_zod37.z.string()
6355
6498
  }),
6356
6499
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
6357
- temporaryPassword: z39.string(),
6358
- admin: z39.object({
6359
- id: z39.string(),
6500
+ temporaryPassword: import_zod37.z.string(),
6501
+ admin: import_zod37.z.object({
6502
+ id: import_zod37.z.string(),
6360
6503
  name: NameFieldValue,
6361
- role: z39.string()
6504
+ role: import_zod37.z.string()
6362
6505
  })
6363
6506
  }),
6364
6507
  [TriggerEvent.TWO_FA]: BasePayload.extend({
6365
- code: z39.string()
6508
+ code: import_zod37.z.string()
6366
6509
  }),
6367
6510
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
6368
- subject: z39.string(),
6369
- body: z39.string()
6511
+ subject: import_zod37.z.string(),
6512
+ body: import_zod37.z.string()
6370
6513
  }),
6371
6514
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
6372
- code: z39.string()
6515
+ code: import_zod37.z.string()
6373
6516
  }),
6374
6517
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
6375
- code: z39.string()
6518
+ code: import_zod37.z.string()
6376
6519
  })
6377
6520
  };
6378
6521
  async function triggerUserEventNotification({
@@ -6394,6 +6537,3 @@ function parseUserEventTrigger(event2, body) {
6394
6537
  const schema = TriggerPayload[event2];
6395
6538
  return schema.parse(body);
6396
6539
  }
6397
-
6398
- // src/notification/index.ts
6399
- z40.globalRegistry.clear();