@opencrvs/toolkit 1.9.6-rc.5fa8b99 → 1.9.6-rc.6358b7f

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