@opencrvs/toolkit 1.9.7-rc.47e0d0f → 1.9.7-rc.480775d

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