@opencrvs/toolkit 1.9.7-rc.84e4901 → 1.9.7-rc.86a0d2b

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 +29431 -2353
  2. package/dist/commons/conditionals/conditionals.d.ts +10 -1
  3. package/dist/commons/conditionals/validate.d.ts +13 -14
  4. package/dist/commons/events/ActionConfig.d.ts +25043 -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 -171
  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 +19988 -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 +4546 -12304
  23. package/dist/commons/events/FieldType.d.ts +20 -4
  24. package/dist/commons/events/FieldTypeMapping.d.ts +193 -897
  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 +14022 -721
  28. package/dist/commons/events/PageConfig.d.ts +9368 -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 +26571 -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 +53180 -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 +45 -11
  50. package/dist/events/deduplication.d.ts +3 -3
  51. package/dist/events/index.js +2046 -1742
  52. package/dist/notification/index.d.ts.map +1 -1
  53. package/dist/notification/index.js +1663 -1576
  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,200 +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.object({
1434
- $$now: import_zod15.z.literal(true)
1510
+ var import_zod = require("zod");
1511
+ var SerializedNowDateTime = import_zod.z.object({
1512
+ $$now: import_zod.z.literal(true)
1435
1513
  });
1436
1514
  function todayDateTimeValueSerializer() {
1437
1515
  return { $$now: true };
1438
1516
  }
1439
1517
 
1440
1518
  // ../commons/src/events/FieldConfig.ts
1441
- (0, import_zod_openapi6.extendZodWithOpenApi)(import_zod16.z);
1442
- var FieldId = import_zod16.z.string().refine(
1443
- /*
1444
- * Disallow underscores '_' in field ids.
1445
- * Why? Theres two reasons:
1446
- * 1. We transform dots to underscores as separator in Formik field ids, so this avoids any issues with the Formik transformations.
1447
- * 2. On Kysely-SQL queries, we use the CamelCasePlugin. This plugin transforms snake_case to camelCase also on nested (jsonb) object keys.
1448
- * This could be disabled via 'maintainNestedObjectKeys: true', but this would also affect SQL queries which use e.g. json_agg() or to_jsonb() to aggregate results.
1449
- */
1450
- (val) => !val.includes("_"),
1451
- (val) => ({
1452
- message: `id: '${val}' must not contain underscores '_'`
1453
- })
1454
- ).describe("Unique identifier for the field");
1455
- var FieldReference = import_zod16.z.object({
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({
1456
1528
  $$field: FieldId,
1457
- $$subfield: import_zod16.z.array(import_zod16.z.string()).optional().describe(
1529
+ $$subfield: z17.array(z17.string()).optional().describe(
1458
1530
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1459
1531
  )
1460
1532
  }).describe("Reference to a field by its ID");
1461
- var ValidationConfig = import_zod16.z.object({
1533
+ var ValidationConfig = z17.object({
1462
1534
  validator: Conditional,
1463
1535
  message: TranslationConfig
1464
1536
  });
1465
- var RequiredSchema = import_zod16.z.union([
1466
- import_zod16.z.boolean(),
1467
- import_zod16.z.object({
1537
+ var requiredSchema = z17.union([
1538
+ z17.boolean(),
1539
+ z17.object({
1468
1540
  message: TranslationConfig.describe("Custom required validation message")
1469
1541
  })
1470
1542
  ]).default(false).optional();
1471
- var BaseField = import_zod16.z.object({
1543
+ var BaseField = z17.object({
1472
1544
  id: FieldId.describe("Unique identifier of the field."),
1473
1545
  label: TranslationConfig.describe("Human-readable label of the field."),
1474
- parent: FieldReference.or(import_zod16.z.array(FieldReference)).optional().describe(
1546
+ parent: FieldReference.or(z17.array(FieldReference)).optional().describe(
1475
1547
  "Reference to the parent field or fields. When a parent field changes, this field is reset."
1476
1548
  ),
1477
- required: RequiredSchema.describe(
1549
+ required: requiredSchema.describe(
1478
1550
  "Indicates whether the field is mandatory."
1479
1551
  ),
1480
- conditionals: import_zod16.z.array(FieldConditional).default([]).optional().describe(
1552
+ conditionals: z17.array(FieldConditional).default([]).optional().describe(
1481
1553
  "Conditions determining when the field is shown or enabled. By default, the field is always shown and enabled."
1482
1554
  ),
1483
- secured: import_zod16.z.boolean().default(false).optional().describe(
1555
+ secured: z17.boolean().default(false).optional().describe(
1484
1556
  "Indicates whether the field is secured. Secured fields are not indexed for search and are only visible when explicitly assigned."
1485
1557
  ),
1486
1558
  placeholder: TranslationConfig.optional(),
1487
- 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."),
1488
1560
  helperText: TranslationConfig.optional(),
1489
- hideLabel: import_zod16.z.boolean().default(false).optional(),
1490
- uncorrectable: import_zod16.z.boolean().default(false).optional().describe(
1561
+ hideLabel: z17.boolean().default(false).optional(),
1562
+ uncorrectable: z17.boolean().default(false).optional().describe(
1491
1563
  "Indicates whether the field can be modified during record correction."
1492
1564
  ),
1493
- value: FieldReference.or(import_zod16.z.array(FieldReference)).optional().describe(
1565
+ value: FieldReference.or(z17.array(FieldReference)).optional().describe(
1494
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."
1495
1567
  ),
1496
- analytics: import_zod16.z.boolean().default(false).optional().describe(
1568
+ analytics: z17.boolean().default(false).optional().describe(
1497
1569
  "Indicates whether the field is included in analytics. When enabled, its value becomes available in the analytics dashboard."
1498
1570
  )
1499
1571
  }).describe("Common properties shared across all field types.");
1500
1572
  var Divider = BaseField.extend({
1501
- type: import_zod16.z.literal(FieldType.DIVIDER)
1502
- });
1503
- var TextFieldConfiguration = import_zod16.z.object({
1504
- maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1505
- type: import_zod16.z.enum(["text", "password"]).optional(),
1506
- prefix: TranslationConfig.optional(),
1507
- postfix: TranslationConfig.optional()
1573
+ type: z17.literal(FieldType.DIVIDER)
1508
1574
  });
1509
1575
  var TextField = BaseField.extend({
1510
- type: import_zod16.z.literal(FieldType.TEXT),
1511
- defaultValue: import_zod16.z.union([NonEmptyTextValue, SerializedUserField]).optional(),
1512
- configuration: TextFieldConfiguration.default({ type: "text" }).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(),
1581
+ prefix: TranslationConfig.optional(),
1582
+ postfix: TranslationConfig.optional()
1583
+ }).default({ type: "text" }).optional()
1513
1584
  }).describe("Text input");
1514
1585
  var NumberField = BaseField.extend({
1515
- type: import_zod16.z.literal(FieldType.NUMBER),
1586
+ type: z17.literal(FieldType.NUMBER),
1516
1587
  defaultValue: NumberFieldValue.optional(),
1517
- configuration: import_zod16.z.object({
1518
- min: import_zod16.z.number().optional().describe("Minimum value"),
1519
- max: import_zod16.z.number().optional().describe("Maximum value"),
1588
+ configuration: z17.object({
1589
+ min: z17.number().optional().describe("Minimum value"),
1590
+ max: z17.number().optional().describe("Maximum value"),
1520
1591
  prefix: TranslationConfig.optional(),
1521
1592
  postfix: TranslationConfig.optional()
1522
1593
  }).optional()
1523
1594
  }).describe("Number input");
1524
1595
  var TextAreaField = BaseField.extend({
1525
- type: import_zod16.z.literal(FieldType.TEXTAREA),
1596
+ type: z17.literal(FieldType.TEXTAREA),
1526
1597
  defaultValue: NonEmptyTextValue.optional(),
1527
- configuration: import_zod16.z.object({
1528
- maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1529
- rows: import_zod16.z.number().optional().describe("Number of visible text lines"),
1530
- cols: import_zod16.z.number().optional().describe("Number of visible columns"),
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"),
1531
1602
  prefix: TranslationConfig.optional(),
1532
1603
  postfix: TranslationConfig.optional()
1533
1604
  }).default({ rows: 4 }).optional()
1534
1605
  }).describe("Multiline text input");
1535
- var ImageMimeType = import_zod16.z.enum([
1606
+ var ImageMimeType = z17.enum([
1536
1607
  "image/png",
1537
1608
  "image/jpg",
1538
1609
  "image/jpeg",
1539
1610
  "image/svg+xml"
1540
1611
  ]);
1541
- var DocumentMimeType = import_zod16.z.enum([
1612
+ var DocumentMimeType = z17.enum([
1542
1613
  "application/pdf",
1543
1614
  "application/msword",
1544
1615
  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1545
1616
  "application/vnd.oasis.opendocument.text"
1546
1617
  ]);
1547
- var MimeType = import_zod16.z.enum([
1618
+ var MimeType = z17.enum([
1548
1619
  ...ImageMimeType.options,
1549
1620
  ...DocumentMimeType.options
1550
1621
  ]);
1551
1622
  var DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
1552
1623
  var SignatureField = BaseField.extend({
1553
- type: import_zod16.z.literal(FieldType.SIGNATURE),
1624
+ type: z17.literal(FieldType.SIGNATURE),
1554
1625
  signaturePromptLabel: TranslationConfig.describe(
1555
1626
  "Title of the signature modal"
1556
1627
  ),
1557
1628
  defaultValue: SignatureFieldValue.optional(),
1558
- configuration: import_zod16.z.object({
1559
- 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),
1560
1631
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1561
1632
  }).default({
1562
1633
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1563
1634
  })
1564
1635
  }).describe("Signature input field");
1565
1636
  var EmailField = BaseField.extend({
1566
- type: import_zod16.z.literal(FieldType.EMAIL),
1567
- configuration: import_zod16.z.object({
1568
- maxLength: import_zod16.z.number().optional().describe("Maximum length of the text")
1569
- }).default({ maxLength: 10 }).optional(),
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(),
1570
1641
  defaultValue: NonEmptyTextValue.optional()
1571
1642
  });
1572
1643
  var DateField = BaseField.extend({
1573
- type: import_zod16.z.literal(FieldType.DATE),
1574
- defaultValue: SerializedNowDateTime.or(DateValue).optional().openapi({ effectType: "input", type: "string" }).describe("Default date value(yyyy-MM-dd)"),
1575
- configuration: import_zod16.z.object({
1644
+ type: z17.literal(FieldType.DATE),
1645
+ defaultValue: SerializedNowDateTime.or(DateValue).optional().describe("Default date value(yyyy-MM-dd)"),
1646
+ configuration: z17.object({
1576
1647
  notice: TranslationConfig.describe(
1577
1648
  "Text to display above the date input"
1578
1649
  ).optional()
1579
1650
  }).optional()
1580
1651
  }).describe("A single date input (yyyy-MM-dd)");
1581
1652
  var AgeField = BaseField.extend({
1582
- type: import_zod16.z.literal(FieldType.AGE),
1653
+ type: z17.literal(FieldType.AGE),
1583
1654
  defaultValue: NumberFieldValue.optional(),
1584
- configuration: import_zod16.z.object({
1655
+ configuration: z17.object({
1585
1656
  asOfDate: FieldReference,
1586
1657
  prefix: TranslationConfig.optional(),
1587
1658
  postfix: TranslationConfig.optional()
1588
1659
  })
1589
1660
  }).describe("An age input field which uses the current date as the asOfDate");
1590
1661
  var TimeField = BaseField.extend({
1591
- type: import_zod16.z.literal(FieldType.TIME),
1592
- defaultValue: SerializedNowDateTime.or(TimeValue).optional().openapi({ effectType: "input", type: "object" }).describe("Default time value (HH-mm)"),
1593
- configuration: import_zod16.z.object({
1594
- use12HourFormat: import_zod16.z.boolean().optional().describe("Whether to use 12-hour format"),
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"),
1595
1666
  notice: TranslationConfig.describe(
1596
1667
  "Text to display above the time input"
1597
1668
  ).optional()
1598
1669
  }).optional()
1599
1670
  }).describe("A single date input (HH-mm)");
1600
1671
  var DateRangeField = BaseField.extend({
1601
- type: import_zod16.z.literal(FieldType.DATE_RANGE),
1672
+ type: z17.literal(FieldType.DATE_RANGE),
1602
1673
  defaultValue: DateRangeFieldValue.optional(),
1603
- configuration: import_zod16.z.object({
1674
+ configuration: z17.object({
1604
1675
  notice: TranslationConfig.describe(
1605
1676
  "Text to display above the date input"
1606
1677
  ).optional()
1607
1678
  }).optional()
1608
1679
  }).describe("A date range input ({ start: yyyy-MM-dd, end: yyyy-MM-dd })");
1609
- var HtmlFontVariant = import_zod16.z.enum([
1680
+ var HtmlFontVariant = z17.enum([
1610
1681
  "reg12",
1611
1682
  "reg14",
1612
1683
  "reg16",
@@ -1616,34 +1687,38 @@ var HtmlFontVariant = import_zod16.z.enum([
1616
1687
  "h2",
1617
1688
  "h1"
1618
1689
  ]);
1619
- var ParagraphConfiguration = import_zod16.z.object({
1620
- styles: import_zod16.z.object({
1690
+ var ParagraphTextAlign = z17.enum(["left", "center", "right", "start", "end"]);
1691
+ var ParagraphConfiguration = z17.object({
1692
+ styles: z17.object({
1621
1693
  fontVariant: HtmlFontVariant.optional().describe(
1622
1694
  "Font variant to use for the paragraph text"
1623
1695
  ),
1624
- hint: import_zod16.z.boolean().optional().describe("When true, paragraph is styled as a hint with grey color")
1696
+ hint: z17.boolean().optional().describe("When true, paragraph is styled as a hint with grey color"),
1697
+ textAlign: ParagraphTextAlign.optional().describe(
1698
+ "Text alignment for the paragraph"
1699
+ )
1625
1700
  }).optional()
1626
1701
  }).default({});
1627
1702
  var Paragraph = BaseField.extend({
1628
- type: import_zod16.z.literal(FieldType.PARAGRAPH),
1703
+ type: z17.literal(FieldType.PARAGRAPH),
1629
1704
  defaultValue: NonEmptyTextValue.optional(),
1630
1705
  configuration: ParagraphConfiguration
1631
1706
  }).describe("A read-only HTML <p> paragraph");
1632
1707
  var PageHeader = BaseField.extend({
1633
- type: import_zod16.z.literal(FieldType.PAGE_HEADER),
1708
+ type: z17.literal(FieldType.PAGE_HEADER),
1634
1709
  defaultValue: NonEmptyTextValue.optional()
1635
1710
  }).describe("A read-only header component for form pages");
1636
1711
  var File = BaseField.extend({
1637
- type: import_zod16.z.literal(FieldType.FILE),
1712
+ type: z17.literal(FieldType.FILE),
1638
1713
  defaultValue: FileFieldValue.optional(),
1639
- configuration: import_zod16.z.object({
1640
- maxFileSize: import_zod16.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1714
+ configuration: z17.object({
1715
+ maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1641
1716
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
1642
- maxImageSize: import_zod16.z.object({
1643
- targetSize: import_zod16.z.object({ width: import_zod16.z.number(), height: import_zod16.z.number() })
1717
+ maxImageSize: z17.object({
1718
+ targetSize: z17.object({ width: z17.number(), height: z17.number() })
1644
1719
  }).optional(),
1645
- style: import_zod16.z.object({
1646
- width: import_zod16.z.enum(["full", "auto"]).optional().describe(
1720
+ style: z17.object({
1721
+ width: z17.enum(["full", "auto"]).optional().describe(
1647
1722
  "Whether the file upload button should take the full width of the container or not"
1648
1723
  )
1649
1724
  }).optional(),
@@ -1652,46 +1727,46 @@ var File = BaseField.extend({
1652
1727
  maxFileSize: DEFAULT_MAX_FILE_SIZE_BYTES
1653
1728
  })
1654
1729
  }).describe("File upload");
1655
- var SelectOption = import_zod16.z.object({
1656
- value: import_zod16.z.string().describe("The value of the option"),
1657
- label: import_zod16.z.union([import_zod16.z.string(), TranslationConfig]).describe("The label of the option")
1730
+ var SelectOption = z17.object({
1731
+ value: z17.string().describe("The value of the option"),
1732
+ label: z17.union([z17.string(), TranslationConfig]).describe("The label of the option")
1658
1733
  });
1659
1734
  var NumberWithUnitField = BaseField.extend({
1660
- type: import_zod16.z.literal(FieldType.NUMBER_WITH_UNIT),
1735
+ type: z17.literal(FieldType.NUMBER_WITH_UNIT),
1661
1736
  defaultValue: NumberWithUnitFieldValue.optional(),
1662
- options: import_zod16.z.array(SelectOption).describe("A list of options for the unit select"),
1663
- configuration: import_zod16.z.object({
1664
- min: import_zod16.z.number().optional().describe("Minimum value of the number field"),
1665
- max: import_zod16.z.number().optional().describe("Maximum value of the number field"),
1737
+ options: z17.array(SelectOption).describe("A list of options for the unit select"),
1738
+ configuration: z17.object({
1739
+ min: z17.number().optional().describe("Minimum value of the number field"),
1740
+ max: z17.number().optional().describe("Maximum value of the number field"),
1666
1741
  numberFieldPlaceholder: TranslationConfig.optional().describe(
1667
1742
  "Placeholder for the number field"
1668
1743
  )
1669
1744
  }).optional()
1670
1745
  }).describe("Number with unit input");
1671
1746
  var RadioGroup = BaseField.extend({
1672
- type: import_zod16.z.literal(FieldType.RADIO_GROUP),
1747
+ type: z17.literal(FieldType.RADIO_GROUP),
1673
1748
  defaultValue: TextValue.optional(),
1674
- options: import_zod16.z.array(SelectOption).describe("A list of options"),
1675
- configuration: import_zod16.z.object({
1676
- styles: import_zod16.z.object({
1677
- size: import_zod16.z.enum(["NORMAL", "LARGE"]).optional()
1749
+ options: z17.array(SelectOption).describe("A list of options"),
1750
+ configuration: z17.object({
1751
+ styles: z17.object({
1752
+ size: z17.enum(["NORMAL", "LARGE"]).optional()
1678
1753
  }).optional()
1679
1754
  }).optional()
1680
1755
  }).describe("Grouped radio options");
1681
1756
  var BulletList = BaseField.extend({
1682
- type: import_zod16.z.literal(FieldType.BULLET_LIST),
1757
+ type: z17.literal(FieldType.BULLET_LIST),
1683
1758
  defaultValue: TextValue.optional(),
1684
- items: import_zod16.z.array(TranslationConfig).describe("A list of items"),
1685
- configuration: import_zod16.z.object({
1686
- styles: import_zod16.z.object({
1759
+ items: z17.array(TranslationConfig).describe("A list of items"),
1760
+ configuration: z17.object({
1761
+ styles: z17.object({
1687
1762
  fontVariant: HtmlFontVariant.optional()
1688
1763
  }).optional()
1689
1764
  }).default({})
1690
1765
  }).describe("A list of bullet points");
1691
1766
  var Select = BaseField.extend({
1692
- type: import_zod16.z.literal(FieldType.SELECT),
1767
+ type: z17.literal(FieldType.SELECT),
1693
1768
  defaultValue: TextValue.optional(),
1694
- options: import_zod16.z.array(SelectOption).describe("A list of options"),
1769
+ options: z17.array(SelectOption).describe("A list of options"),
1695
1770
  noOptionsMessage: TranslationConfig.optional().describe(
1696
1771
  `
1697
1772
  A translation configuration object used to display a message when no options are available.
@@ -1703,34 +1778,34 @@ var Select = BaseField.extend({
1703
1778
  `
1704
1779
  )
1705
1780
  }).describe("Select input");
1706
- var SelectDateRangeOption = import_zod16.z.object({
1781
+ var SelectDateRangeOption = z17.object({
1707
1782
  value: SelectDateRangeValue.describe("The value of the option"),
1708
1783
  label: TranslationConfig.describe("The label of the option")
1709
1784
  });
1710
1785
  var SelectDateRangeField = BaseField.extend({
1711
- type: import_zod16.z.literal(FieldType.SELECT_DATE_RANGE),
1786
+ type: z17.literal(FieldType.SELECT_DATE_RANGE),
1712
1787
  defaultValue: SelectDateRangeValue.optional(),
1713
- options: import_zod16.z.array(SelectDateRangeOption).describe("A list of options")
1788
+ options: z17.array(SelectDateRangeOption).describe("A list of options")
1714
1789
  }).describe("Select input with date range options");
1715
- var NameConfig = import_zod16.z.object({
1716
- firstname: import_zod16.z.object({ required: RequiredSchema, label: TranslationConfig.optional() }).optional(),
1717
- middlename: import_zod16.z.object({ required: RequiredSchema, label: TranslationConfig.optional() }).optional(),
1718
- surname: import_zod16.z.object({ required: RequiredSchema, label: TranslationConfig.optional() }).optional()
1790
+ var NameConfig = z17.object({
1791
+ firstname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1792
+ middlename: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional(),
1793
+ surname: z17.object({ required: requiredSchema, label: TranslationConfig.optional() }).optional()
1719
1794
  });
1720
1795
  var NameField = BaseField.extend({
1721
- type: import_zod16.z.literal(FieldType.NAME),
1722
- defaultValue: import_zod16.z.object({
1796
+ type: z17.literal(FieldType.NAME),
1797
+ defaultValue: z17.object({
1723
1798
  firstname: SerializedUserField.or(NonEmptyTextValue).optional(),
1724
1799
  middlename: SerializedUserField.or(NonEmptyTextValue).optional(),
1725
1800
  surname: SerializedUserField.or(NonEmptyTextValue).optional()
1726
1801
  }).optional(),
1727
- configuration: import_zod16.z.object({
1802
+ configuration: z17.object({
1728
1803
  name: NameConfig.default({
1729
1804
  firstname: { required: true },
1730
1805
  surname: { required: true }
1731
1806
  }).optional(),
1732
- order: import_zod16.z.array(import_zod16.z.enum(["firstname", "middlename", "surname"])).optional(),
1733
- maxLength: import_zod16.z.number().optional().describe("Maximum length of the text"),
1807
+ order: z17.array(z17.enum(["firstname", "middlename", "surname"])).optional(),
1808
+ maxLength: z17.number().optional().describe("Maximum length of the text"),
1734
1809
  prefix: TranslationConfig.optional(),
1735
1810
  postfix: TranslationConfig.optional()
1736
1811
  }).default({
@@ -1742,51 +1817,51 @@ var NameField = BaseField.extend({
1742
1817
  }).describe("Name input field");
1743
1818
  var PhoneField = BaseField.extend({
1744
1819
  defaultValue: NonEmptyTextValue.optional(),
1745
- type: import_zod16.z.literal(FieldType.PHONE)
1820
+ type: z17.literal(FieldType.PHONE)
1746
1821
  }).describe("Phone input field");
1747
1822
  var IdField = BaseField.extend({
1748
1823
  defaultValue: NonEmptyTextValue.optional(),
1749
- type: import_zod16.z.literal(FieldType.ID)
1824
+ type: z17.literal(FieldType.ID)
1750
1825
  }).describe("ID input field");
1751
1826
  var Checkbox = BaseField.extend({
1752
- type: import_zod16.z.literal(FieldType.CHECKBOX),
1827
+ type: z17.literal(FieldType.CHECKBOX),
1753
1828
  defaultValue: CheckboxFieldValue.default(false)
1754
1829
  }).describe("Boolean checkbox field");
1755
1830
  var Country = BaseField.extend({
1756
- type: import_zod16.z.literal(FieldType.COUNTRY),
1831
+ type: z17.literal(FieldType.COUNTRY),
1757
1832
  defaultValue: NonEmptyTextValue.optional()
1758
1833
  }).describe("Country select field");
1759
- var AdministrativeAreas = import_zod16.z.enum([
1834
+ var AdministrativeAreas = z17.enum([
1760
1835
  "ADMIN_STRUCTURE",
1761
1836
  "HEALTH_FACILITY",
1762
1837
  "CRVS_OFFICE"
1763
1838
  ]);
1764
- var AdministrativeAreaConfiguration = import_zod16.z.object({
1765
- partOf: import_zod16.z.object({
1766
- $declaration: import_zod16.z.string()
1839
+ var AdministrativeAreaConfiguration = z17.object({
1840
+ partOf: z17.object({
1841
+ $declaration: z17.string()
1767
1842
  }).optional().describe("Parent location"),
1768
1843
  type: AdministrativeAreas
1769
1844
  }).describe("Administrative area options");
1770
- var AdministrativeArea = BaseField.extend({
1771
- type: import_zod16.z.literal(FieldType.ADMINISTRATIVE_AREA),
1845
+ var AdministrativeAreaField = BaseField.extend({
1846
+ type: z17.literal(FieldType.ADMINISTRATIVE_AREA),
1772
1847
  defaultValue: NonEmptyTextValue.optional(),
1773
1848
  configuration: AdministrativeAreaConfiguration
1774
1849
  }).describe("Administrative area input field e.g. facility, office");
1775
1850
  var LocationInput = BaseField.extend({
1776
- type: import_zod16.z.literal(FieldType.LOCATION),
1851
+ type: z17.literal(FieldType.LOCATION),
1777
1852
  defaultValue: NonEmptyTextValue.optional(),
1778
- configuration: import_zod16.z.object({
1779
- searchableResource: import_zod16.z.array(import_zod16.z.enum(["locations", "facilities", "offices"]))
1853
+ configuration: z17.object({
1854
+ searchableResource: z17.array(z17.enum(["locations", "facilities", "offices"]))
1780
1855
  })
1781
1856
  }).describe("Input field for a location");
1782
1857
  var FileUploadWithOptions = BaseField.extend({
1783
- type: import_zod16.z.literal(FieldType.FILE_WITH_OPTIONS),
1784
- options: import_zod16.z.array(SelectOption).describe("A list of options"),
1858
+ type: z17.literal(FieldType.FILE_WITH_OPTIONS),
1859
+ options: z17.array(SelectOption).describe("A list of options"),
1785
1860
  defaultValue: FileFieldWithOptionValue.optional(),
1786
- configuration: import_zod16.z.object({
1787
- maxFileSize: import_zod16.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1788
- maxImageSize: import_zod16.z.object({
1789
- targetSize: import_zod16.z.object({ width: import_zod16.z.number(), height: import_zod16.z.number() })
1861
+ configuration: z17.object({
1862
+ maxFileSize: z17.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
1863
+ maxImageSize: z17.object({
1864
+ targetSize: z17.object({ width: z17.number(), height: z17.number() })
1790
1865
  }).optional(),
1791
1866
  acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
1792
1867
  }).default({
@@ -1794,93 +1869,93 @@ var FileUploadWithOptions = BaseField.extend({
1794
1869
  })
1795
1870
  });
1796
1871
  var Facility = BaseField.extend({
1797
- type: import_zod16.z.literal(FieldType.FACILITY),
1872
+ type: z17.literal(FieldType.FACILITY),
1798
1873
  defaultValue: NonEmptyTextValue.optional()
1799
1874
  }).describe("Input field for a facility");
1800
1875
  var Office = BaseField.extend({
1801
- type: import_zod16.z.literal(FieldType.OFFICE),
1876
+ type: z17.literal(FieldType.OFFICE),
1802
1877
  defaultValue: NonEmptyTextValue.optional()
1803
1878
  }).describe("Input field for an office");
1804
1879
  var DefaultAddressFieldValue = DomesticAddressFieldValue.extend({
1805
- administrativeArea: import_zod16.z.union([UUID, SerializedUserField]).optional()
1880
+ administrativeArea: z17.union([UUID, SerializedUserField]).optional()
1806
1881
  });
1807
1882
  var Address = BaseField.extend({
1808
- type: import_zod16.z.literal(FieldType.ADDRESS),
1809
- configuration: import_zod16.z.object({
1810
- lineSeparator: import_zod16.z.string().optional(),
1811
- fields: import_zod16.z.array(import_zod16.z.enum(["country", "administrativeArea"])).optional(),
1812
- administrativeLevels: import_zod16.z.array(import_zod16.z.string()).optional(),
1813
- streetAddressForm: import_zod16.z.array(
1814
- import_zod16.z.object({
1815
- id: import_zod16.z.string(),
1816
- required: RequiredSchema,
1883
+ type: z17.literal(FieldType.ADDRESS),
1884
+ configuration: z17.object({
1885
+ lineSeparator: z17.string().optional(),
1886
+ fields: z17.array(z17.enum(["country", "administrativeArea"])).optional(),
1887
+ administrativeLevels: z17.array(z17.string()).optional(),
1888
+ streetAddressForm: z17.array(
1889
+ z17.object({
1890
+ id: z17.string(),
1891
+ required: requiredSchema,
1817
1892
  label: TranslationConfig,
1818
- type: import_zod16.z.literal(FieldType.TEXT),
1819
- conditionals: import_zod16.z.array(FieldConditional).default([]).optional(),
1893
+ type: z17.literal(FieldType.TEXT),
1894
+ conditionals: z17.array(FieldConditional).default([]).optional(),
1820
1895
  parent: FieldReference.optional()
1821
1896
  })
1822
1897
  ).optional()
1823
1898
  }).optional(),
1824
1899
  defaultValue: DefaultAddressFieldValue.optional()
1825
1900
  }).describe("Address input field \u2013 a combination of location and text fields");
1826
- var StaticDataEntry = import_zod16.z.object({
1827
- id: import_zod16.z.string().describe("ID for the data entry."),
1901
+ var StaticDataEntry = z17.object({
1902
+ id: z17.string().describe("ID for the data entry."),
1828
1903
  label: TranslationConfig,
1829
- value: TranslationConfig.or(import_zod16.z.string()).or(FieldReference)
1904
+ value: TranslationConfig.or(z17.string()).or(FieldReference)
1830
1905
  }).describe("Static data entry");
1831
- var DataEntry = import_zod16.z.union([StaticDataEntry, import_zod16.z.object({ fieldId: import_zod16.z.string() })]).describe(
1906
+ var DataEntry = z17.union([StaticDataEntry, z17.object({ fieldId: z17.string() })]).describe(
1832
1907
  "Data entry can be either a static data entry, or a reference to another field in the current form or the declaration."
1833
1908
  );
1834
1909
  var DataField = BaseField.extend({
1835
- type: import_zod16.z.literal(FieldType.DATA),
1836
- configuration: import_zod16.z.object({
1910
+ type: z17.literal(FieldType.DATA),
1911
+ configuration: z17.object({
1837
1912
  subtitle: TranslationConfig.optional(),
1838
- data: import_zod16.z.array(DataEntry)
1913
+ data: z17.array(DataEntry)
1839
1914
  })
1840
1915
  }).describe("Data field for displaying read-only data");
1841
1916
  var ButtonField = BaseField.extend({
1842
- type: import_zod16.z.literal(FieldType.BUTTON),
1917
+ type: z17.literal(FieldType.BUTTON),
1843
1918
  defaultValue: ButtonFieldValue.optional(),
1844
- configuration: import_zod16.z.object({
1845
- icon: import_zod16.z.string().optional().describe(
1919
+ configuration: z17.object({
1920
+ icon: z17.string().optional().describe(
1846
1921
  "Icon for the button. You can find icons from OpenCRVS UI-Kit."
1847
1922
  ),
1848
- loading: import_zod16.z.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1923
+ loading: z17.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
1849
1924
  text: TranslationConfig.describe("Text to display on the button")
1850
1925
  })
1851
1926
  }).describe("Generic button without any built-in functionality");
1852
1927
  var AlphaPrintButton = BaseField.extend({
1853
- type: import_zod16.z.literal(FieldType.ALPHA_PRINT_BUTTON),
1854
- configuration: import_zod16.z.object({
1855
- template: import_zod16.z.string().describe("Template ID from countryconfig templates to use for printing"),
1928
+ type: z17.literal(FieldType.ALPHA_PRINT_BUTTON),
1929
+ configuration: z17.object({
1930
+ template: z17.string().describe("Template ID from countryconfig templates to use for printing"),
1856
1931
  buttonLabel: TranslationConfig.optional().describe(
1857
1932
  "Label for the print button"
1858
1933
  )
1859
1934
  })
1860
1935
  }).describe("Print button field for printing certificates");
1861
1936
  var HttpField = BaseField.extend({
1862
- type: import_zod16.z.literal(FieldType.HTTP),
1937
+ type: z17.literal(FieldType.HTTP),
1863
1938
  defaultValue: HttpFieldValue.optional(),
1864
- configuration: import_zod16.z.object({
1939
+ configuration: z17.object({
1865
1940
  trigger: FieldReference,
1866
- url: import_zod16.z.string().describe("URL to send the HTTP request to"),
1867
- method: import_zod16.z.enum(["GET", "POST", "PUT", "DELETE"]),
1868
- headers: import_zod16.z.record(import_zod16.z.string()).optional(),
1869
- body: import_zod16.z.record(import_zod16.z.any()).optional(),
1870
- errorValue: import_zod16.z.any().optional().describe("Value to set if the request fails"),
1871
- params: import_zod16.z.record(import_zod16.z.string(), import_zod16.z.union([import_zod16.z.string(), FieldReference])).optional(),
1872
- timeout: import_zod16.z.number().default(15e3).describe("Request timeout in milliseconds")
1941
+ url: z17.string().describe("URL to send the HTTP request to"),
1942
+ method: z17.enum(["GET", "POST", "PUT", "DELETE"]),
1943
+ headers: z17.record(z17.string(), z17.string()).optional(),
1944
+ body: z17.record(z17.string(), z17.any()).optional(),
1945
+ errorValue: z17.any().optional().describe("Value to set if the request fails"),
1946
+ params: z17.record(z17.string(), z17.union([z17.string(), FieldReference])).optional(),
1947
+ timeout: z17.number().default(15e3).describe("Request timeout in milliseconds")
1873
1948
  })
1874
1949
  }).describe("HTTP request function triggered by a button click or other event");
1875
1950
  var SearchField = HttpField.extend({
1876
- type: import_zod16.z.literal(FieldType.SEARCH),
1951
+ type: z17.literal(FieldType.SEARCH),
1877
1952
  configuration: SearchQuery.pick({
1878
1953
  query: true,
1879
1954
  limit: true,
1880
1955
  offset: true
1881
1956
  }).extend({
1882
1957
  validation: ValidationConfig,
1883
- indicators: import_zod16.z.object({
1958
+ indicators: z17.object({
1884
1959
  loading: TranslationConfig.optional().describe(
1885
1960
  "Text to display while the search is in progress"
1886
1961
  ),
@@ -1895,7 +1970,7 @@ var SearchField = HttpField.extend({
1895
1970
  ),
1896
1971
  confirmButton: TranslationConfig.optional(),
1897
1972
  clearButton: TranslationConfig.optional(),
1898
- clearModal: import_zod16.z.object({
1973
+ clearModal: z17.object({
1899
1974
  title: TranslationConfig.optional(),
1900
1975
  description: TranslationConfig.optional(),
1901
1976
  cancel: TranslationConfig.optional(),
@@ -1906,17 +1981,17 @@ var SearchField = HttpField.extend({
1906
1981
  })
1907
1982
  });
1908
1983
  var LinkButtonField = BaseField.extend({
1909
- type: import_zod16.z.literal(FieldType.LINK_BUTTON),
1910
- configuration: import_zod16.z.object({
1911
- url: import_zod16.z.string().describe("URL to open"),
1984
+ type: z17.literal(FieldType.LINK_BUTTON),
1985
+ configuration: z17.object({
1986
+ url: z17.string().describe("URL to open"),
1912
1987
  text: TranslationConfig.describe("Text to display on the button"),
1913
- icon: import_zod16.z.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1988
+ icon: z17.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit.")
1914
1989
  })
1915
1990
  }).describe("Button that opens a link");
1916
1991
  var VerificationStatus = BaseField.extend({
1917
- type: import_zod16.z.literal(FieldType.VERIFICATION_STATUS),
1992
+ type: z17.literal(FieldType.VERIFICATION_STATUS),
1918
1993
  defaultValue: VerificationStatusValue.optional(),
1919
- configuration: import_zod16.z.object({
1994
+ configuration: z17.object({
1920
1995
  status: TranslationConfig.describe("Text to display on the status pill."),
1921
1996
  description: TranslationConfig.describe(
1922
1997
  "Explaining text on the banner in form."
@@ -1924,38 +1999,55 @@ var VerificationStatus = BaseField.extend({
1924
1999
  })
1925
2000
  });
1926
2001
  var QueryParamReaderField = BaseField.extend({
1927
- type: import_zod16.z.literal(FieldType.QUERY_PARAM_READER),
1928
- configuration: import_zod16.z.object({
1929
- pickParams: import_zod16.z.array(import_zod16.z.string()).describe("List of query parameters to read from the URL")
2002
+ type: z17.literal(FieldType.QUERY_PARAM_READER),
2003
+ configuration: z17.object({
2004
+ pickParams: z17.array(z17.string()).describe("List of query parameters to read from the URL")
1930
2005
  })
1931
2006
  }).describe(
1932
2007
  "A field that maps URL query params into form values and clears them afterward"
1933
2008
  );
1934
2009
  var QrReaderField = BaseField.extend({
1935
- type: import_zod16.z.literal(FieldType.QR_READER),
2010
+ type: z17.literal(FieldType.QR_READER),
1936
2011
  defaultValue: QrReaderFieldValue.optional(),
1937
- configuration: import_zod16.z.object({
1938
- validator: import_zod16.z.custom(
1939
- (val) => typeof val === "object" && val !== null
1940
- )
2012
+ configuration: z17.object({
2013
+ validator: z17.any().meta({
2014
+ description: "JSON Schema to validate the scanned QR code data against before populating the form fields.",
2015
+ id: "QrReaderFieldValidator"
2016
+ })
1941
2017
  }).optional()
2018
+ }).meta({
2019
+ description: "Configuration for QR code reader field, including optional JSON Schema validator.",
2020
+ id: "QrReaderField"
1942
2021
  });
1943
2022
  var IdReaderField = BaseField.extend({
1944
- type: import_zod16.z.literal(FieldType.ID_READER),
2023
+ type: z17.literal(FieldType.ID_READER),
1945
2024
  defaultValue: IdReaderFieldValue.optional(),
1946
- methods: import_zod16.z.array(
1947
- import_zod16.z.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
2025
+ methods: z17.array(
2026
+ z17.union([QrReaderField, LinkButtonField]).describe("Methods for reading an ID")
1948
2027
  )
1949
2028
  });
2029
+ var CustomField = BaseField.extend({
2030
+ type: z17.literal(FieldType._EXPERIMENTAL_CUSTOM),
2031
+ defaultValue: CustomFieldValue.optional(),
2032
+ src: z17.string().describe("Module source path for the custom field component"),
2033
+ configuration: z17.unknown().optional()
2034
+ });
1950
2035
  var LoaderField = BaseField.extend({
1951
- type: import_zod16.z.literal(FieldType.LOADER),
1952
- configuration: import_zod16.z.object({
2036
+ type: z17.literal(FieldType.LOADER),
2037
+ configuration: z17.object({
1953
2038
  text: TranslationConfig.describe("Display text above the loading spinner")
1954
2039
  })
1955
2040
  }).describe(
1956
2041
  "A non-interactive field that indicates an in progress operation in form"
1957
2042
  );
1958
- var FieldConfig = import_zod16.z.discriminatedUnion("type", [
2043
+ var HiddenField = BaseField.extend({
2044
+ type: z17.literal(FieldType.ALPHA_HIDDEN),
2045
+ required: z17.boolean().default(false).optional(),
2046
+ defaultValue: TextValue.optional()
2047
+ }).describe(
2048
+ "A non-interactive, hidden field that only hold a value in the form"
2049
+ );
2050
+ var FieldConfig = z17.discriminatedUnion("type", [
1959
2051
  Address,
1960
2052
  TextField,
1961
2053
  NumberField,
@@ -1977,7 +2069,7 @@ var FieldConfig = import_zod16.z.discriminatedUnion("type", [
1977
2069
  Checkbox,
1978
2070
  File,
1979
2071
  Country,
1980
- AdministrativeArea,
2072
+ AdministrativeAreaField,
1981
2073
  Divider,
1982
2074
  LocationInput,
1983
2075
  Facility,
@@ -1995,83 +2087,81 @@ var FieldConfig = import_zod16.z.discriminatedUnion("type", [
1995
2087
  IdReaderField,
1996
2088
  QueryParamReaderField,
1997
2089
  LoaderField,
1998
- SearchField
1999
- ]).openapi({
2090
+ SearchField,
2091
+ CustomField,
2092
+ HiddenField
2093
+ ]).meta({
2000
2094
  description: "Form field configuration",
2001
- ref: "FieldConfig"
2095
+ id: "FieldConfig"
2002
2096
  });
2003
- var AnyFileField = import_zod16.z.discriminatedUnion("type", [
2097
+ var AnyFileField = z17.discriminatedUnion("type", [
2004
2098
  SignatureField,
2005
2099
  File,
2006
2100
  FileUploadWithOptions
2007
2101
  ]);
2008
2102
 
2009
2103
  // ../commons/src/events/FormConfig.ts
2010
- var import_zod18 = require("zod");
2104
+ var z19 = __toESM(require("zod/v4"));
2011
2105
 
2012
2106
  // ../commons/src/events/PageConfig.ts
2013
- var import_zod17 = require("zod");
2014
- var import_zod_openapi7 = require("zod-openapi");
2015
- (0, import_zod_openapi7.extendZodWithOpenApi)(import_zod17.z);
2016
- var PageTypes = import_zod17.z.enum(["FORM", "VERIFICATION"]);
2017
- var PageConfigBase = import_zod17.z.object({
2018
- id: import_zod17.z.string().describe("Unique identifier for the page"),
2107
+ var z18 = __toESM(require("zod/v4"));
2108
+ var PageTypes = z18.enum(["FORM", "VERIFICATION"]);
2109
+ var PageConfigBase = z18.object({
2110
+ id: z18.string().describe("Unique identifier for the page"),
2019
2111
  title: TranslationConfig.describe("Header title of the page"),
2020
- requireCompletionToContinue: import_zod17.z.boolean().default(false).describe(
2112
+ requireCompletionToContinue: z18.boolean().default(false).describe(
2021
2113
  "If true, all required fields must be filled before continuing to the next page"
2022
2114
  ),
2023
- fields: import_zod17.z.array(FieldConfig).describe("Fields to be rendered on the page"),
2115
+ fields: z18.array(FieldConfig).describe("Fields to be rendered on the page"),
2024
2116
  conditional: Conditional.optional().describe(
2025
2117
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2026
2118
  )
2027
- }).openapi({
2119
+ }).meta({
2028
2120
  description: "Form page configuration",
2029
- ref: "FormPageConfig"
2121
+ id: "FormPageConfig"
2030
2122
  });
2031
2123
  var FormPageConfig = PageConfigBase.extend({
2032
- type: import_zod17.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2124
+ type: z18.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2033
2125
  });
2034
- var VerificationActionConfig = import_zod17.z.object({
2035
- verify: import_zod17.z.object({ label: TranslationConfig }),
2036
- cancel: import_zod17.z.object({
2126
+ var VerificationActionConfig = z18.object({
2127
+ verify: z18.object({ label: TranslationConfig }),
2128
+ cancel: z18.object({
2037
2129
  label: TranslationConfig,
2038
- confirmation: import_zod17.z.object({
2130
+ confirmation: z18.object({
2039
2131
  title: TranslationConfig,
2040
2132
  body: TranslationConfig
2041
2133
  })
2042
2134
  })
2043
- }).describe("Actions available on the verification page").openapi({
2135
+ }).describe("Actions available on the verification page").meta({
2044
2136
  description: "Verification action configuration",
2045
- ref: "VerificationActionConfig"
2137
+ id: "VerificationActionConfig"
2046
2138
  });
2047
2139
  var VerificationPageConfig = FormPageConfig.extend({
2048
- type: import_zod17.z.literal(PageTypes.enum.VERIFICATION),
2140
+ type: z18.literal(PageTypes.enum.VERIFICATION),
2049
2141
  actions: VerificationActionConfig
2050
2142
  });
2051
- var PageConfig = import_zod17.z.discriminatedUnion("type", [
2143
+ var PageConfig = z18.discriminatedUnion("type", [
2052
2144
  FormPageConfig,
2053
2145
  VerificationPageConfig
2054
2146
  ]);
2055
2147
 
2056
2148
  // ../commons/src/events/FormConfig.ts
2057
- var DeclarationFormConfig = import_zod18.z.object({
2149
+ var DeclarationFormConfig = z19.object({
2058
2150
  label: TranslationConfig.describe("Human readable description of the form"),
2059
- pages: import_zod18.z.array(FormPageConfig)
2151
+ pages: z19.array(FormPageConfig)
2060
2152
  }).describe("Configuration of the declaration form.");
2061
- var ActionFormConfig = import_zod18.z.object({
2153
+ var ActionFormConfig = z19.object({
2062
2154
  label: TranslationConfig.describe("Human readable description of the form"),
2063
- pages: import_zod18.z.array(PageConfig)
2155
+ pages: z19.array(PageConfig)
2064
2156
  }).describe(
2065
2157
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2066
2158
  );
2067
- var FormConfig = import_zod18.z.union([DeclarationFormConfig, ActionFormConfig]);
2159
+ var FormConfig = z19.union([DeclarationFormConfig, ActionFormConfig]);
2068
2160
 
2069
2161
  // ../commons/src/events/DeduplicationConfig.ts
2070
- var import_zod19 = require("zod");
2071
- var import_zod_openapi8 = require("zod-openapi");
2072
- (0, import_zod_openapi8.extendZodWithOpenApi)(import_zod19.z);
2073
- var FieldReference2 = import_zod19.z.string();
2074
- var Matcher = import_zod19.z.object({
2162
+ var z20 = __toESM(require("zod/v4"));
2163
+ var FieldReference2 = z20.string();
2164
+ var Matcher = z20.object({
2075
2165
  /**
2076
2166
  * Reference to the field used in matching.
2077
2167
  *
@@ -2079,23 +2169,23 @@ var Matcher = import_zod19.z.object({
2079
2169
  * be used as the origin date to calculate the distance from.
2080
2170
  */
2081
2171
  fieldId: FieldReference2,
2082
- options: import_zod19.z.object({
2083
- boost: import_zod19.z.number().optional(),
2172
+ options: z20.object({
2173
+ boost: z20.number().optional(),
2084
2174
  matchAgainst: FieldReference2.optional()
2085
2175
  }).optional().default({
2086
2176
  boost: 1
2087
2177
  })
2088
2178
  });
2089
2179
  var FuzzyMatcher = Matcher.extend({
2090
- type: import_zod19.z.literal("fuzzy"),
2091
- options: import_zod19.z.object({
2180
+ type: z20.literal("fuzzy"),
2181
+ options: z20.object({
2092
2182
  /**
2093
2183
  * Names of length 3 or less characters = 0 edits allowed
2094
2184
  * Names of length 4 - 6 characters = 1 edit allowed
2095
2185
  * Names of length >7 characters = 2 edits allowed
2096
2186
  */
2097
- fuzziness: import_zod19.z.union([import_zod19.z.string(), import_zod19.z.number()]).optional().default("AUTO:4,7"),
2098
- boost: import_zod19.z.number().optional().default(1),
2187
+ fuzziness: z20.union([z20.string(), z20.number()]).optional().default("AUTO:4,7"),
2188
+ boost: z20.number().optional().default(1),
2099
2189
  matchAgainst: FieldReference2.optional()
2100
2190
  }).optional().default({
2101
2191
  fuzziness: "AUTO:4,7",
@@ -2103,48 +2193,48 @@ var FuzzyMatcher = Matcher.extend({
2103
2193
  })
2104
2194
  });
2105
2195
  var StrictMatcher = Matcher.extend({
2106
- type: import_zod19.z.literal("strict"),
2107
- options: import_zod19.z.object({
2108
- boost: import_zod19.z.number().optional().default(1),
2196
+ type: z20.literal("strict"),
2197
+ options: z20.object({
2198
+ boost: z20.number().optional().default(1),
2109
2199
  /**
2110
2200
  * The constant value to be present in the field for both records
2111
2201
  */
2112
- value: import_zod19.z.string().optional(),
2202
+ value: z20.string().optional(),
2113
2203
  matchAgainst: FieldReference2.optional()
2114
2204
  }).optional().default({
2115
2205
  boost: 1
2116
2206
  })
2117
2207
  });
2118
2208
  var DateRangeMatcher = Matcher.extend({
2119
- type: import_zod19.z.literal("dateRange"),
2120
- options: import_zod19.z.object({
2209
+ type: z20.literal("dateRange"),
2210
+ options: z20.object({
2121
2211
  /**
2122
2212
  * The distance pivot in days. Distance from the origin (the value of
2123
2213
  * fieldId) at which relevance scores receive half of the boost value
2124
2214
  */
2125
- pivot: import_zod19.z.number().optional(),
2126
- days: import_zod19.z.number(),
2127
- boost: import_zod19.z.number().optional().default(1),
2215
+ pivot: z20.number().optional(),
2216
+ days: z20.number(),
2217
+ boost: z20.number().optional().default(1),
2128
2218
  matchAgainst: FieldReference2.optional()
2129
2219
  })
2130
2220
  });
2131
- var Not = import_zod19.z.object({
2132
- type: import_zod19.z.literal("not"),
2221
+ var Not = z20.object({
2222
+ type: z20.literal("not"),
2133
2223
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2134
- clause: import_zod19.z.lazy(() => Clause)
2224
+ clause: z20.lazy(() => Clause)
2135
2225
  });
2136
- var And = import_zod19.z.object({
2137
- type: import_zod19.z.literal("and"),
2226
+ var And = z20.object({
2227
+ type: z20.literal("and"),
2138
2228
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2139
- clauses: import_zod19.z.lazy(() => Clause.array())
2229
+ clauses: z20.lazy(() => Clause.array())
2140
2230
  });
2141
- var Or = import_zod19.z.object({
2142
- type: import_zod19.z.literal("or"),
2231
+ var Or = z20.object({
2232
+ type: z20.literal("or"),
2143
2233
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2144
- clauses: import_zod19.z.lazy(() => Clause.array())
2234
+ clauses: z20.lazy(() => Clause.array())
2145
2235
  });
2146
- var Clause = import_zod19.z.lazy(
2147
- () => import_zod19.z.discriminatedUnion("type", [
2236
+ var Clause = z20.lazy(
2237
+ () => z20.discriminatedUnion("type", [
2148
2238
  Not,
2149
2239
  And,
2150
2240
  Or,
@@ -2152,193 +2242,328 @@ var Clause = import_zod19.z.lazy(
2152
2242
  StrictMatcher,
2153
2243
  DateRangeMatcher
2154
2244
  ])
2155
- ).openapi({
2156
- ref: "Clause"
2245
+ ).meta({
2246
+ id: "Clause"
2157
2247
  });
2158
- var DeduplicationConfig = import_zod19.z.object({
2159
- id: import_zod19.z.string(),
2248
+ var DeduplicationConfig = z20.object({
2249
+ id: z20.string(),
2160
2250
  label: TranslationConfig,
2161
2251
  query: Clause
2162
2252
  });
2163
2253
 
2254
+ // ../commons/src/icons.ts
2255
+ var z21 = __toESM(require("zod/v4"));
2256
+ var AvailableIcons = z21.enum([
2257
+ "Archived",
2258
+ "Assigned",
2259
+ "Briefcase",
2260
+ "Certified",
2261
+ "Close",
2262
+ "Collapse",
2263
+ "Draft",
2264
+ "DuplicateYellow",
2265
+ "Expand",
2266
+ "ExternalValidate",
2267
+ "FilledCheck",
2268
+ "InReview",
2269
+ "Offline",
2270
+ "Registered",
2271
+ "RequiresUpdates",
2272
+ "Sent",
2273
+ "Validated",
2274
+ "WaitingApproval",
2275
+ "ChartActivity",
2276
+ "Activity",
2277
+ "Archive",
2278
+ "ArchiveTray",
2279
+ "ArrowLeft",
2280
+ "ArrowRight",
2281
+ "Buildings",
2282
+ "Circle",
2283
+ "CaretDown",
2284
+ "CaretLeft",
2285
+ "CaretRight",
2286
+ "ChartBar",
2287
+ "ChartLine",
2288
+ "ChatCircle",
2289
+ "CheckSquare",
2290
+ "Compass",
2291
+ "Check",
2292
+ "Copy",
2293
+ "Database",
2294
+ "DotsThreeVertical",
2295
+ "ArrowCounterClockwise",
2296
+ "MagnifyingGlassMinus",
2297
+ "MagnifyingGlassPlus",
2298
+ "Export",
2299
+ "Eye",
2300
+ "EyeSlash",
2301
+ "Envelope",
2302
+ "File",
2303
+ "FileSearch",
2304
+ "FileMinus",
2305
+ "FilePlus",
2306
+ "FileText",
2307
+ "FileX",
2308
+ "Handshake",
2309
+ "Gear",
2310
+ "GitBranch",
2311
+ "IdentificationCard",
2312
+ "List",
2313
+ "ListBullets",
2314
+ "Lock",
2315
+ "MagnifyingGlass",
2316
+ "MapPin",
2317
+ "Medal",
2318
+ "NotePencil",
2319
+ "Paperclip",
2320
+ "PaperPlaneTilt",
2321
+ "Pen",
2322
+ "PenNib",
2323
+ "Pencil",
2324
+ "PencilSimpleLine",
2325
+ "Phone",
2326
+ "Plus",
2327
+ "Printer",
2328
+ "SignOut",
2329
+ "Stamp",
2330
+ "Star",
2331
+ "Target",
2332
+ "TextT",
2333
+ "Trash",
2334
+ "UploadSimple",
2335
+ "User",
2336
+ "UserPlus",
2337
+ "Users",
2338
+ "WarningCircle",
2339
+ "X",
2340
+ "ChatText",
2341
+ "CircleWavyCheck",
2342
+ "CircleWavyQuestion",
2343
+ "ArchiveBox",
2344
+ "ArrowCircleDown",
2345
+ "FileArrowUp",
2346
+ "FileDotted",
2347
+ "Files",
2348
+ "PencilLine",
2349
+ "PencilCircle",
2350
+ "UserCircle",
2351
+ "Clock",
2352
+ "QrCode",
2353
+ "Webcam",
2354
+ "Sun",
2355
+ "DeviceTabletCamera",
2356
+ "Globe",
2357
+ "Fingerprint",
2358
+ "PushPin",
2359
+ "Timer"
2360
+ ]);
2361
+
2164
2362
  // ../commons/src/events/ActionConfig.ts
2165
- var import_zod_openapi9 = require("zod-openapi");
2166
- (0, import_zod_openapi9.extendZodWithOpenApi)(import_zod20.z);
2167
- var DeclarationReviewConfig = import_zod20.z.object({
2363
+ var DeclarationReviewConfig = z22.object({
2168
2364
  title: TranslationConfig.describe("Title of the review page"),
2169
- fields: import_zod20.z.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2365
+ fields: z22.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2170
2366
  }).describe(
2171
2367
  "Configuration of the declaration review page for collecting event-related metadata."
2172
2368
  );
2173
- var ActionConfigBase = import_zod20.z.object({
2174
- label: TranslationConfig.describe("Human readable description of the action")
2369
+ var ActionConfigBase = z22.object({
2370
+ label: TranslationConfig.describe("Human readable description of the action"),
2371
+ flags: z22.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2372
+ supportingCopy: TranslationConfig.optional().describe(
2373
+ "Text displayed on the confirmation dialog"
2374
+ ),
2375
+ icon: AvailableIcons.describe("Icon representing the action").optional(),
2376
+ conditionals: z22.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2175
2377
  });
2176
2378
  var DeclarationActionBase = ActionConfigBase.extend({
2177
- review: DeclarationReviewConfig,
2178
2379
  deduplication: DeduplicationConfig.optional()
2179
2380
  });
2180
- var ReadActionConfig = ActionConfigBase.merge(
2181
- import_zod20.z.object({
2182
- type: import_zod20.z.literal(ActionType.READ),
2381
+ var ReadActionConfig = ActionConfigBase.extend(
2382
+ z22.object({
2383
+ type: z22.literal(ActionType.READ),
2183
2384
  review: DeclarationReviewConfig.describe(
2184
2385
  "Configuration of the review page for read-only view."
2185
- )
2186
- })
2187
- );
2188
- var DeclareConfig = DeclarationActionBase.merge(
2189
- import_zod20.z.object({
2190
- type: import_zod20.z.literal(ActionType.DECLARE)
2191
- })
2386
+ ),
2387
+ conditionals: z22.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2388
+ }).shape
2192
2389
  );
2193
- var ValidateConfig = DeclarationActionBase.merge(
2194
- import_zod20.z.object({
2195
- type: import_zod20.z.literal(ActionType.VALIDATE)
2196
- })
2390
+ var DeclareConfig = DeclarationActionBase.extend(
2391
+ z22.object({
2392
+ type: z22.literal(ActionType.DECLARE),
2393
+ review: DeclarationReviewConfig.describe(
2394
+ "Configuration of the review page fields."
2395
+ ),
2396
+ dialogCopy: z22.object({
2397
+ notify: TranslationConfig.describe(
2398
+ "Confirmation text for the notify action"
2399
+ ),
2400
+ declare: TranslationConfig.describe(
2401
+ "Confirmation text for the declare action"
2402
+ ),
2403
+ register: TranslationConfig.describe(
2404
+ "Confirmation text for the register action"
2405
+ )
2406
+ }).optional()
2407
+ }).shape
2197
2408
  );
2198
- var RegisterConfig = DeclarationActionBase.merge(
2199
- import_zod20.z.object({
2200
- type: import_zod20.z.literal(ActionType.REGISTER)
2201
- })
2409
+ var ArchiveConfig = ActionConfigBase.extend(
2410
+ z22.object({
2411
+ type: z22.literal(ActionType.ARCHIVE)
2412
+ }).shape
2202
2413
  );
2203
- var RejectDeclarationConfig = ActionConfigBase.merge(
2204
- import_zod20.z.object({
2205
- type: import_zod20.z.literal(ActionType.REJECT)
2206
- })
2414
+ var EditActionConfig = ActionConfigBase.extend(
2415
+ z22.object({
2416
+ type: z22.literal(ActionType.EDIT),
2417
+ dialogCopy: z22.object({
2418
+ notify: TranslationConfig.describe(
2419
+ "Confirmation text for the notify with edits action"
2420
+ ),
2421
+ declare: TranslationConfig.describe(
2422
+ "Confirmation text for the declare with edits action"
2423
+ ),
2424
+ register: TranslationConfig.describe(
2425
+ "Confirmation text for the register with edits action"
2426
+ )
2427
+ })
2428
+ }).shape
2207
2429
  );
2208
- var ArchiveConfig = ActionConfigBase.merge(
2209
- import_zod20.z.object({
2210
- type: import_zod20.z.literal(ActionType.ARCHIVE)
2211
- })
2430
+ var RejectConfig = ActionConfigBase.extend(
2431
+ z22.object({
2432
+ type: z22.literal(ActionType.REJECT)
2433
+ }).shape
2212
2434
  );
2213
- var DeleteConfig = ActionConfigBase.merge(
2214
- import_zod20.z.object({
2215
- type: import_zod20.z.literal(ActionType.DELETE)
2216
- })
2435
+ var RegisterConfig = DeclarationActionBase.extend(
2436
+ z22.object({
2437
+ type: z22.literal(ActionType.REGISTER)
2438
+ }).shape
2217
2439
  );
2218
- var PrintCertificateActionConfig = ActionConfigBase.merge(
2219
- import_zod20.z.object({
2220
- type: import_zod20.z.literal(ActionType.PRINT_CERTIFICATE),
2440
+ var PrintCertificateActionConfig = ActionConfigBase.extend(
2441
+ z22.object({
2442
+ type: z22.literal(ActionType.PRINT_CERTIFICATE),
2221
2443
  printForm: ActionFormConfig
2222
- })
2444
+ }).shape
2223
2445
  );
2224
- var RequestCorrectionConfig = ActionConfigBase.merge(
2225
- import_zod20.z.object({
2226
- type: import_zod20.z.literal(ActionType.REQUEST_CORRECTION),
2446
+ var RequestCorrectionConfig = ActionConfigBase.extend(
2447
+ z22.object({
2448
+ type: z22.literal(ActionType.REQUEST_CORRECTION),
2227
2449
  correctionForm: ActionFormConfig
2228
- })
2229
- );
2230
- var RejectCorrectionConfig = ActionConfigBase.merge(
2231
- import_zod20.z.object({
2232
- type: import_zod20.z.literal(ActionType.REJECT_CORRECTION)
2233
- })
2450
+ }).shape
2234
2451
  );
2235
- var ApproveCorrectionConfig = ActionConfigBase.merge(
2236
- import_zod20.z.object({
2237
- type: import_zod20.z.literal(ActionType.APPROVE_CORRECTION)
2452
+ var CustomActionConfig = ActionConfigBase.merge(
2453
+ z22.object({
2454
+ type: z22.literal(ActionType.CUSTOM),
2455
+ customActionType: z22.string().describe("Type identifier of the custom action."),
2456
+ /** 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. */
2457
+ form: z22.array(FieldConfig).describe(
2458
+ "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2459
+ ),
2460
+ auditHistoryLabel: TranslationConfig.describe(
2461
+ 'The label to show in audit history for this action. For example "Approved".'
2462
+ )
2238
2463
  })
2239
2464
  );
2240
- var ActionConfig = import_zod20.z.discriminatedUnion("type", [
2465
+ var ActionConfig = z22.discriminatedUnion("type", [
2241
2466
  /*
2242
2467
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2243
2468
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
2244
2469
  */
2245
- ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
2246
- DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
2247
- ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
2248
- RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
2249
- ArchiveConfig.openapi({ ref: "ArchiveActionConfig" }),
2250
- RegisterConfig.openapi({ ref: "RegisterActionConfig" }),
2251
- DeleteConfig.openapi({ ref: "DeleteActionConfig" }),
2252
- PrintCertificateActionConfig.openapi({
2253
- ref: "PrintCertificateActionConfig"
2470
+ ReadActionConfig.meta({ id: "ReadActionConfig" }),
2471
+ DeclareConfig.meta({ id: "DeclareActionConfig" }),
2472
+ RejectConfig.meta({ id: "RejectActionConfig" }),
2473
+ RegisterConfig.meta({ id: "RegisterActionConfig" }),
2474
+ PrintCertificateActionConfig.meta({
2475
+ id: "PrintCertificateActionConfig"
2254
2476
  }),
2255
- RequestCorrectionConfig.openapi({ ref: "RequestCorrectionActionConfig" }),
2256
- RejectCorrectionConfig.openapi({ ref: "RejectCorrectionActionConfig" }),
2257
- ApproveCorrectionConfig.openapi({ ref: "ApproveCorrectionActionConfig" })
2477
+ RequestCorrectionConfig.meta({ id: "RequestCorrectionActionConfig" }),
2478
+ EditActionConfig.meta({ id: "EditActionConfig" }),
2479
+ ArchiveConfig.meta({ id: "ArchiveActionConfig" }),
2480
+ CustomActionConfig.meta({ id: "CustomActionConfig" })
2258
2481
  ]).describe(
2259
2482
  "Configuration of an action available for an event. Data collected depends on the action type and is accessible through the annotation property in ActionDocument."
2260
- ).openapi({ ref: "ActionConfig" });
2261
- var DeclarationActionConfig = import_zod20.z.discriminatedUnion("type", [
2483
+ ).meta({ id: "ActionConfig" });
2484
+ var actionConfigTypes = new Set(
2485
+ ActionConfig.options.map((opt) => opt.shape.type.value)
2486
+ );
2487
+ var DeclarationActionConfig = z22.discriminatedUnion("type", [
2262
2488
  DeclareConfig,
2263
- ValidateConfig,
2264
2489
  RegisterConfig
2265
2490
  ]);
2266
2491
 
2267
2492
  // ../commons/src/events/offline/CertificateConfig.ts
2268
- var import_zod21 = require("zod");
2269
- var FontFamily = import_zod21.z.object({
2270
- normal: import_zod21.z.string(),
2271
- bold: import_zod21.z.string(),
2272
- italics: import_zod21.z.string(),
2273
- bolditalics: import_zod21.z.string()
2274
- });
2275
- var CertificateConfig = import_zod21.z.object({
2276
- id: import_zod21.z.string(),
2277
- event: import_zod21.z.string(),
2278
- isV2Template: import_zod21.z.boolean().optional(),
2493
+ var z23 = __toESM(require("zod/v4"));
2494
+ var FontFamily = z23.object({
2495
+ normal: z23.string(),
2496
+ bold: z23.string(),
2497
+ italics: z23.string(),
2498
+ bolditalics: z23.string()
2499
+ });
2500
+ var CertificateConfig = z23.object({
2501
+ id: z23.string(),
2502
+ event: z23.string(),
2503
+ isV2Template: z23.boolean().optional(),
2279
2504
  label: TranslationConfig,
2280
- isDefault: import_zod21.z.boolean(),
2281
- fee: import_zod21.z.object({
2282
- onTime: import_zod21.z.number(),
2283
- late: import_zod21.z.number(),
2284
- delayed: import_zod21.z.number()
2505
+ isDefault: z23.boolean(),
2506
+ fee: z23.object({
2507
+ onTime: z23.number(),
2508
+ late: z23.number(),
2509
+ delayed: z23.number()
2285
2510
  }),
2286
- svgUrl: import_zod21.z.string(),
2287
- fonts: import_zod21.z.record(FontFamily).optional(),
2288
- conditionals: import_zod21.z.array(ShowConditional).optional()
2511
+ svgUrl: z23.string(),
2512
+ fonts: z23.record(z23.string(), FontFamily).optional(),
2513
+ conditionals: z23.array(ShowConditional).optional()
2289
2514
  });
2290
2515
  var CertificateTemplateConfig = CertificateConfig.extend({
2291
- hash: import_zod21.z.string().optional(),
2292
- svg: import_zod21.z.string()
2516
+ hash: z23.string().optional(),
2517
+ svg: z23.string()
2293
2518
  });
2294
2519
 
2295
2520
  // ../commons/src/events/offline/LanguageConfig.ts
2296
- var import_zod22 = require("zod");
2297
- var LanguageConfig = import_zod22.z.object({
2298
- lang: import_zod22.z.string(),
2521
+ var z24 = __toESM(require("zod/v4"));
2522
+ var LanguageConfig = z24.object({
2523
+ lang: z24.string(),
2299
2524
  /**
2300
2525
  * client.csv contents
2301
2526
  */
2302
- messages: import_zod22.z.record(import_zod22.z.string())
2527
+ messages: z24.record(z24.string(), z24.string())
2303
2528
  });
2304
2529
 
2305
2530
  // ../commons/src/events/EventConfig.ts
2306
- var import_zod27 = require("zod");
2531
+ var z30 = __toESM(require("zod/v4"));
2307
2532
 
2308
2533
  // ../commons/src/events/SummaryConfig.ts
2309
- var import_zod23 = require("zod");
2310
- var BaseField2 = import_zod23.z.object({
2534
+ var z25 = __toESM(require("zod/v4"));
2535
+ var BaseField2 = z25.object({
2311
2536
  emptyValueMessage: TranslationConfig.optional().describe(
2312
2537
  "Default message displayed when the field value is empty."
2313
2538
  ),
2314
- conditionals: import_zod23.z.array(ShowConditional).default([]).optional()
2539
+ conditionals: z25.array(ShowConditional).default([]).optional()
2315
2540
  });
2316
2541
  var ReferenceField = BaseField2.extend({
2317
- fieldId: import_zod23.z.string(),
2542
+ fieldId: z25.string(),
2318
2543
  label: TranslationConfig.optional().describe(
2319
2544
  "Overrides the default label from the referenced field when provided."
2320
2545
  )
2321
2546
  }).describe("Field referencing existing event data by field ID.");
2322
2547
  var Field = BaseField2.extend({
2323
- id: import_zod23.z.string().describe("Identifier of the summary field."),
2548
+ id: z25.string().describe("Identifier of the summary field."),
2324
2549
  value: TranslationConfig.describe(
2325
2550
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
2326
2551
  ),
2327
2552
  label: TranslationConfig
2328
2553
  }).describe("Custom field defined for the summary view.");
2329
- var SummaryConfig = import_zod23.z.object({
2330
- fields: import_zod23.z.array(import_zod23.z.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2554
+ var SummaryConfig = z25.object({
2555
+ fields: z25.array(z25.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2331
2556
  }).describe("Configuration of the event summary section.");
2332
2557
 
2333
2558
  // ../commons/src/events/AdvancedSearchConfig.ts
2334
- var import_zod24 = require("zod");
2335
- var MatchType = import_zod24.z.enum(["fuzzy", "exact", "range", "within"]);
2336
- var BaseField3 = import_zod24.z.object({
2337
- config: import_zod24.z.object({
2559
+ var z26 = __toESM(require("zod/v4"));
2560
+ var MatchType = z26.enum(["fuzzy", "exact", "range", "within"]);
2561
+ var BaseField3 = z26.object({
2562
+ config: z26.object({
2338
2563
  type: MatchType.describe(
2339
2564
  "Determines the search type of field. How to match value."
2340
2565
  ),
2341
- searchFields: import_zod24.z.array(import_zod24.z.string()).optional().describe(
2566
+ searchFields: z26.array(z26.string()).optional().describe(
2342
2567
  `
2343
2568
  Defines multiple form fields that should be searched when this field has a value.
2344
2569
  All specified fields will be combined using OR logic.
@@ -2348,7 +2573,7 @@ var BaseField3 = import_zod24.z.object({
2348
2573
  `
2349
2574
  )
2350
2575
  }),
2351
- type: import_zod24.z.nativeEnum(FieldType).optional().describe(
2576
+ type: z26.nativeEnum(FieldType).optional().describe(
2352
2577
  `
2353
2578
  Explicitly specify the field type for searchFields.
2354
2579
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -2362,7 +2587,7 @@ var BaseField3 = import_zod24.z.object({
2362
2587
  This is required when searchFields is defined.
2363
2588
  `
2364
2589
  ),
2365
- options: import_zod24.z.array(SelectOption).optional(),
2590
+ options: z26.array(SelectOption).optional(),
2366
2591
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
2367
2592
  `
2368
2593
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -2383,7 +2608,7 @@ var BaseField3 = import_zod24.z.object({
2383
2608
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2384
2609
  `
2385
2610
  ),
2386
- conditionals: import_zod24.z.array(FieldConditional).default([]).optional().describe(
2611
+ conditionals: z26.array(FieldConditional).optional().describe(
2387
2612
  `
2388
2613
  In advanced search, we sometimes need to override the default field visibility conditionals.
2389
2614
 
@@ -2397,20 +2622,20 @@ var BaseField3 = import_zod24.z.object({
2397
2622
  are always rendered in the advanced search form.
2398
2623
  `
2399
2624
  ),
2400
- validations: import_zod24.z.array(ValidationConfig).default([]).optional().describe(
2625
+ validations: z26.array(ValidationConfig).optional().describe(
2401
2626
  `Option for overriding the field validations specifically for advanced search form.`
2402
2627
  )
2403
2628
  });
2404
- var SearchQueryParams = import_zod24.z.object({
2405
- eventType: import_zod24.z.string().optional().describe(
2629
+ var SearchQueryParams = z26.object({
2630
+ eventType: z26.string().optional().describe(
2406
2631
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
2407
2632
  )
2408
2633
  }).catchall(FieldValue);
2409
2634
  var FieldConfigSchema = BaseField3.extend({
2410
- fieldId: import_zod24.z.string(),
2411
- fieldType: import_zod24.z.literal("field")
2635
+ fieldId: z26.string(),
2636
+ fieldType: z26.literal("field")
2412
2637
  });
2413
- var EventFieldIdInput = import_zod24.z.enum([
2638
+ var EventFieldIdInput = z26.enum([
2414
2639
  "trackingId",
2415
2640
  "status",
2416
2641
  "legalStatuses.REGISTERED.acceptedAt",
@@ -2419,7 +2644,7 @@ var EventFieldIdInput = import_zod24.z.enum([
2419
2644
  "updatedAt"
2420
2645
  ]);
2421
2646
  var METADATA_FIELD_PREFIX = "event.";
2422
- var EventFieldId = import_zod24.z.enum([
2647
+ var EventFieldId = z26.enum([
2423
2648
  `${METADATA_FIELD_PREFIX}trackingId`,
2424
2649
  `${METADATA_FIELD_PREFIX}status`,
2425
2650
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -2429,29 +2654,29 @@ var EventFieldId = import_zod24.z.enum([
2429
2654
  ]);
2430
2655
  var EventFieldConfigSchema = BaseField3.extend({
2431
2656
  fieldId: EventFieldId,
2432
- fieldType: import_zod24.z.literal("event")
2657
+ fieldType: z26.literal("event")
2433
2658
  });
2434
- var AdvancedSearchField = import_zod24.z.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2659
+ var AdvancedSearchField = z26.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2435
2660
  if (data.config.searchFields && data.config.searchFields.length > 0) {
2436
2661
  if (!data.label) {
2437
2662
  ctx.addIssue({
2438
- code: import_zod24.z.ZodIssueCode.custom,
2663
+ code: z26.ZodIssueCode.custom,
2439
2664
  message: "label is required when config.searchFields is defined.",
2440
2665
  path: ["label"]
2441
2666
  });
2442
2667
  }
2443
2668
  if (!data.type) {
2444
2669
  ctx.addIssue({
2445
- code: import_zod24.z.ZodIssueCode.custom,
2670
+ code: z26.ZodIssueCode.custom,
2446
2671
  message: "type is required when config.searchFields is defined.",
2447
2672
  path: ["type"]
2448
2673
  });
2449
2674
  }
2450
2675
  }
2451
2676
  });
2452
- var AdvancedSearchConfig = import_zod24.z.object({
2677
+ var AdvancedSearchConfig = z26.object({
2453
2678
  title: TranslationConfig.describe("Advanced search tab title"),
2454
- fields: import_zod24.z.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2679
+ fields: z26.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2455
2680
  });
2456
2681
 
2457
2682
  // ../commons/src/events/utils.ts
@@ -2460,11 +2685,11 @@ var import_lodash = require("lodash");
2460
2685
  // ../commons/src/conditionals/validate.ts
2461
2686
  var import__ = __toESM(require("ajv/dist/2019"));
2462
2687
  var import_ajv_formats = __toESM(require("ajv-formats"));
2463
- var import_zod26 = require("zod");
2688
+ var z28 = __toESM(require("zod/v4"));
2464
2689
  var import_date_fns = require("date-fns");
2465
2690
 
2466
2691
  // ../commons/src/events/DynamicFieldValue.ts
2467
- var import_zod25 = require("zod");
2692
+ var z27 = __toESM(require("zod/v4"));
2468
2693
 
2469
2694
  // ../commons/src/conditionals/validate.ts
2470
2695
  var ajv = new import__.default({
@@ -2473,9 +2698,9 @@ var ajv = new import__.default({
2473
2698
  strict: false
2474
2699
  // Allow minContains and other newer features
2475
2700
  });
2476
- var DataContext = import_zod26.z.object({
2477
- rootData: import_zod26.z.object({
2478
- $leafAdminStructureLocationIds: import_zod26.z.array(import_zod26.z.object({ id: UUID }))
2701
+ var DataContext = z28.object({
2702
+ rootData: z28.object({
2703
+ $leafAdminStructureLocationIds: z28.array(z28.object({ id: UUID }))
2479
2704
  })
2480
2705
  });
2481
2706
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -2552,12 +2777,12 @@ ajv.addKeyword({
2552
2777
  });
2553
2778
 
2554
2779
  // ../commons/src/utils.ts
2555
- var z27 = __toESM(require("zod"));
2556
- var FullNameV1 = z27.array(
2557
- z27.object({
2558
- use: z27.string(),
2559
- family: z27.string(),
2560
- given: z27.array(z27.string())
2780
+ var z29 = __toESM(require("zod/v4"));
2781
+ var FullNameV1 = z29.array(
2782
+ z29.object({
2783
+ use: z29.string(),
2784
+ family: z29.string(),
2785
+ given: z29.array(z29.string())
2561
2786
  })
2562
2787
  );
2563
2788
  function omitKeyDeep(obj, keyToRemove) {
@@ -2578,9 +2803,6 @@ function omitKeyDeep(obj, keyToRemove) {
2578
2803
 
2579
2804
  // ../commons/src/events/utils.ts
2580
2805
  var import_date_fns2 = require("date-fns");
2581
- function isDeclarationActionConfig(action) {
2582
- return DeclarationActions.safeParse(action.type).success;
2583
- }
2584
2806
  function getDeclarationFields(configuration) {
2585
2807
  return configuration.declaration.pages.flatMap(({ fields }) => fields);
2586
2808
  }
@@ -2591,7 +2813,10 @@ var getActionAnnotationFields = (actionConfig) => {
2591
2813
  if (actionConfig.type === ActionType.PRINT_CERTIFICATE) {
2592
2814
  return actionConfig.printForm.pages.flatMap(({ fields }) => fields);
2593
2815
  }
2594
- if (isDeclarationActionConfig(actionConfig)) {
2816
+ if (actionConfig.type === ActionType.CUSTOM) {
2817
+ return actionConfig.form;
2818
+ }
2819
+ if ("review" in actionConfig) {
2595
2820
  return actionConfig.review.fields;
2596
2821
  }
2597
2822
  return [];
@@ -2611,38 +2836,8 @@ var EXCLUDED_ACTIONS = [
2611
2836
  ActionType.REJECT_CORRECTION
2612
2837
  ];
2613
2838
 
2614
- // ../commons/src/events/EventConfig.ts
2615
- var import_zod_openapi10 = require("zod-openapi");
2616
- (0, import_zod_openapi10.extendZodWithOpenApi)(import_zod27.z);
2617
- var EventConfig = import_zod27.z.object({
2618
- id: import_zod27.z.string().describe(
2619
- 'Machine-readable identifier of the event (e.g. "birth", "death").'
2620
- ),
2621
- dateOfEvent: FieldReference.optional().describe(
2622
- "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
2623
- ),
2624
- title: TranslationConfig.describe(
2625
- 'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
2626
- ),
2627
- fallbackTitle: TranslationConfig.optional().describe(
2628
- "Fallback title shown when the main title resolves to an empty value."
2629
- ),
2630
- summary: SummaryConfig.describe(
2631
- "Summary information displayed in the event overview."
2632
- ),
2633
- label: TranslationConfig.describe(
2634
- "Human-readable label for the event type."
2635
- ),
2636
- actions: import_zod27.z.array(ActionConfig).describe(
2637
- "Configuration of system-defined actions associated with the event."
2638
- ),
2639
- declaration: DeclarationFormConfig.describe(
2640
- "Configuration of the form used to gather event data."
2641
- ),
2642
- advancedSearch: import_zod27.z.array(AdvancedSearchConfig).optional().default([]).describe(
2643
- "Configuration of fields available in the advanced search feature."
2644
- )
2645
- }).superRefine((event2, ctx) => {
2839
+ // ../commons/src/events/eventConfigValidation.ts
2840
+ function validateAdvancedSearchConfig(event2, ctx) {
2646
2841
  const allFields = findAllFields(event2);
2647
2842
  const fieldIds = allFields.map((field3) => field3.id);
2648
2843
  const advancedSearchFields = event2.advancedSearch.flatMap(
@@ -2669,10 +2864,12 @@ var EventConfig = import_zod27.z.object({
2669
2864
  ctx.addIssue({
2670
2865
  code: "custom",
2671
2866
  message: `Advanced search id must match a field id of form fields or pre-defined metadata fields.
2672
- Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
2867
+ Invalid AdvancedSearch field IDs for event ${event2.id}: ${invalidFields.map((f) => f.fieldId).join(", ")}`,
2673
2868
  path: ["advancedSearch"]
2674
2869
  });
2675
2870
  }
2871
+ }
2872
+ function validateDateOfEvent(event2, ctx) {
2676
2873
  if (event2.dateOfEvent) {
2677
2874
  const eventDateFieldId = getDeclarationFields(event2).find(
2678
2875
  ({ id }) => id === event2.dateOfEvent?.$$field
@@ -2681,7 +2878,7 @@ var EventConfig = import_zod27.z.object({
2681
2878
  ctx.addIssue({
2682
2879
  code: "custom",
2683
2880
  message: `Date of event field id must match a field id in fields array.
2684
- Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
2881
+ Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
2685
2882
  path: ["dateOfEvent"]
2686
2883
  });
2687
2884
  } else if (eventDateFieldId.type !== FieldType.DATE) {
@@ -2692,8 +2889,105 @@ var EventConfig = import_zod27.z.object({
2692
2889
  });
2693
2890
  }
2694
2891
  }
2695
- }).openapi({
2696
- ref: "EventConfig"
2892
+ }
2893
+ function validatePlaceOfEvent(event2, ctx) {
2894
+ if (event2.placeOfEvent) {
2895
+ const eventPlaceFieldId = getDeclarationFields(event2).find(
2896
+ ({ id }) => id === event2.placeOfEvent?.$$field
2897
+ );
2898
+ if (!eventPlaceFieldId) {
2899
+ ctx.addIssue({
2900
+ code: "custom",
2901
+ message: `Place of event field id must match a field id in the event.declaration fields.
2902
+ Invalid place of event field ID for event ${event2.id}: ${event2.placeOfEvent.$$field}`,
2903
+ path: ["placeOfEvent"]
2904
+ });
2905
+ }
2906
+ }
2907
+ }
2908
+ function validateActionFlags(event2, ctx) {
2909
+ const isInherentFlag = (value) => Object.values(InherentFlags).includes(value);
2910
+ const configuredFlagIds = event2.flags.map((flag) => flag.id);
2911
+ const actionFlagIds = event2.actions.flatMap(
2912
+ (action) => action.flags.map((flag) => flag.id)
2913
+ );
2914
+ for (const actionFlagId of actionFlagIds) {
2915
+ const isConfigured = configuredFlagIds.includes(actionFlagId);
2916
+ const isInherent = isInherentFlag(actionFlagId);
2917
+ if (!isConfigured && !isInherent) {
2918
+ ctx.addIssue({
2919
+ code: "custom",
2920
+ 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}'`,
2921
+ path: ["actions"]
2922
+ });
2923
+ }
2924
+ }
2925
+ }
2926
+ function validateActionOrder(event2, ctx) {
2927
+ if (event2.actionOrder) {
2928
+ const customActionTypes = event2.actions.filter((action) => action.type === ActionType.CUSTOM).map((action) => action.customActionType);
2929
+ const validActionTypes = [
2930
+ ...workqueueActions.options,
2931
+ ...customActionTypes
2932
+ ];
2933
+ for (const actionType of event2.actionOrder) {
2934
+ if (!validActionTypes.includes(actionType)) {
2935
+ ctx.addIssue({
2936
+ code: "custom",
2937
+ message: `Invalid action type in action order: ${actionType}`,
2938
+ path: ["actionOrder"]
2939
+ });
2940
+ }
2941
+ }
2942
+ }
2943
+ }
2944
+
2945
+ // ../commons/src/events/EventConfig.ts
2946
+ var EventConfig = z30.object({
2947
+ id: z30.string().describe(
2948
+ 'Machine-readable identifier of the event (e.g. "birth", "death").'
2949
+ ),
2950
+ dateOfEvent: FieldReference.optional().describe(
2951
+ "Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified."
2952
+ ),
2953
+ placeOfEvent: FieldReference.optional().describe(
2954
+ "Reference to the field capturing the place of the event (e.g. place of birth). Defaults to the meta.createdAtLocation if unspecified."
2955
+ ),
2956
+ title: TranslationConfig.describe(
2957
+ 'Title template for the singular event, supporting variables (e.g. "{applicant.name.firstname} {applicant.name.surname}").'
2958
+ ),
2959
+ fallbackTitle: TranslationConfig.optional().describe(
2960
+ "Fallback title shown when the main title resolves to an empty value."
2961
+ ),
2962
+ summary: SummaryConfig.describe(
2963
+ "Summary information displayed in the event overview."
2964
+ ),
2965
+ label: TranslationConfig.describe(
2966
+ "Human-readable label for the event type."
2967
+ ),
2968
+ actions: z30.array(ActionConfig).describe(
2969
+ "Configuration of system-defined actions associated with the event."
2970
+ ),
2971
+ actionOrder: z30.array(z30.string()).optional().describe(
2972
+ "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
2973
+ ),
2974
+ declaration: DeclarationFormConfig.describe(
2975
+ "Configuration of the form used to gather event data."
2976
+ ),
2977
+ advancedSearch: z30.array(AdvancedSearchConfig).optional().default([]).describe(
2978
+ "Configuration of fields available in the advanced search feature."
2979
+ ),
2980
+ flags: z30.array(FlagConfig).optional().default([]).describe(
2981
+ "Configuration of flags associated with the actions of this event type."
2982
+ )
2983
+ }).superRefine((event2, ctx) => {
2984
+ validateAdvancedSearchConfig(event2, ctx);
2985
+ validateDateOfEvent(event2, ctx);
2986
+ validatePlaceOfEvent(event2, ctx);
2987
+ validateActionFlags(event2, ctx);
2988
+ validateActionOrder(event2, ctx);
2989
+ }).meta({
2990
+ id: "EventConfig"
2697
2991
  }).describe("Configuration defining an event type.");
2698
2992
 
2699
2993
  // ../commons/src/events/EventConfigInput.ts
@@ -2702,7 +2996,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
2702
2996
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
2703
2997
 
2704
2998
  // ../commons/src/events/WorkqueueConfig.ts
2705
- var import_zod31 = require("zod");
2999
+ var z33 = __toESM(require("zod/v4"));
2706
3000
 
2707
3001
  // ../commons/src/conditionals/conditionals.ts
2708
3002
  var objectHash = __toESM(require("object-hash"));
@@ -2740,7 +3034,7 @@ function not(condition) {
2740
3034
  required: []
2741
3035
  });
2742
3036
  }
2743
- function never() {
3037
+ function never2() {
2744
3038
  return not(alwaysTrue());
2745
3039
  }
2746
3040
  function jsonFieldPath(field3) {
@@ -3410,217 +3704,108 @@ var event = Object.assign(eventFn, {
3410
3704
  return {
3411
3705
  /**
3412
3706
  * Creates a conditional that checks if the event contains a specific action type
3413
- * with a minimum count of occurrences.
3414
- *
3415
- * @param minCount - The minimum number of actions required.
3416
- */
3417
- minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
3418
- /**
3419
- * Builds a conditional that sets a maximum count for the number of actions.
3420
- * This is useful for limiting the number of actions of a specific type in a single event.
3421
- */
3422
- maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
3423
- };
3424
- };
3425
- const chainableMethods = {
3426
- /**
3427
- * Adds additional field constraints to the action matching.
3428
- *
3429
- * @param fields - Object containing additional fields to match on the action.
3430
- */
3431
- withFields: (fields) => withMinMax(fields),
3432
- /**
3433
- * Adds template ID constraint to the action matching.
3434
- * This is a convenience method that adds content.templateId to the fields.
3435
- *
3436
- * @param id - The template ID to match against.
3437
- */
3438
- withTemplate: (id) => withMinMax({
3439
- content: { templateId: id }
3440
- }),
3441
- ...withMinMax()
3442
- };
3443
- return { ...basicConditional, ...chainableMethods };
3444
- },
3445
- field(field3) {
3446
- return {
3447
- $event: field3
3448
- };
3449
- }
3450
- });
3451
-
3452
- // ../commons/src/events/WorkqueueColumnConfig.ts
3453
- var import_zod28 = require("zod");
3454
- var WorkqueueColumnKeysArray = [
3455
- ...EventMetadataKeysArray,
3456
- "title",
3457
- "outbox"
3458
- ];
3459
- var WorkqueueColumnKeys = import_zod28.z.enum(WorkqueueColumnKeysArray);
3460
- var WorkqueueColumnValue = import_zod28.z.object({
3461
- $event: WorkqueueColumnKeys
3462
- });
3463
- var WorkqueueColumn = import_zod28.z.object({
3464
- label: TranslationConfig,
3465
- value: WorkqueueColumnValue
3466
- });
3467
- function defineWorkqueuesColumns(workqueueColumns) {
3468
- return workqueueColumns.map(
3469
- (workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
3470
- );
3471
- }
3472
-
3473
- // ../commons/src/events/CountryConfigQueryInput.ts
3474
- var import_zod29 = require("zod");
3475
- var SerializableExact = import_zod29.z.object({
3476
- type: import_zod29.z.literal("exact"),
3477
- term: import_zod29.z.union([import_zod29.z.string(), SerializedUserField])
3478
- });
3479
- var SerializableWithin = import_zod29.z.object({
3480
- type: import_zod29.z.literal("within"),
3481
- location: import_zod29.z.union([import_zod29.z.string(), SerializedUserField])
3482
- });
3483
- var SerializedQueryExpression = import_zod29.z.object({
3484
- eventType: import_zod29.z.string(),
3485
- status: import_zod29.z.optional(import_zod29.z.union([AnyOfStatus, ExactStatus])),
3486
- createdAt: import_zod29.z.optional(DateCondition),
3487
- updatedAt: import_zod29.z.optional(DateCondition),
3488
- "legalStatuses.REGISTERED.createdAt": import_zod29.z.optional(DateCondition),
3489
- "legalStatuses.REGISTERED.createdAtLocation": import_zod29.z.optional(
3490
- import_zod29.z.union([Within, Exact])
3491
- ),
3492
- "legalStatuses.REGISTERED.registrationNumber": import_zod29.z.optional(Exact),
3493
- createdAtLocation: import_zod29.z.optional(
3494
- import_zod29.z.union([SerializableWithin, SerializableExact])
3495
- ),
3496
- updatedAtLocation: import_zod29.z.optional(
3497
- import_zod29.z.union([SerializableWithin, SerializableExact])
3498
- ),
3499
- assignedTo: import_zod29.z.optional(SerializableExact),
3500
- createdBy: import_zod29.z.optional(SerializableExact),
3501
- createdByUserType: ExactUserType,
3502
- updatedBy: import_zod29.z.optional(SerializableExact),
3503
- trackingId: import_zod29.z.optional(Exact),
3504
- flags: import_zod29.z.optional(ContainsFlags),
3505
- data: QueryInput
3506
- }).partial();
3507
- var Or2 = import_zod29.z.object({
3508
- type: import_zod29.z.literal("or"),
3509
- clauses: import_zod29.z.array(SerializedQueryExpression)
3510
- });
3511
- var And2 = import_zod29.z.object({
3512
- type: import_zod29.z.literal("and"),
3513
- clauses: import_zod29.z.array(SerializedQueryExpression)
3514
- });
3515
- var CountryConfigQueryType = import_zod29.z.discriminatedUnion("type", [And2, Or2]);
3516
- var CountryConfigQueryInputType = import_zod29.z.union([
3517
- SerializedQueryExpression,
3518
- And2,
3519
- Or2
3520
- ]);
3521
-
3522
- // ../commons/src/icons.ts
3523
- var import_zod30 = require("zod");
3524
- var AvailableIcons = import_zod30.z.enum([
3525
- "Archived",
3526
- "Assigned",
3527
- "Certified",
3528
- "Close",
3529
- "Collapse",
3530
- "Draft",
3531
- "DuplicateYellow",
3532
- "Expand",
3533
- "ExternalValidate",
3534
- "FilledCheck",
3535
- "InReview",
3536
- "Offline",
3537
- "Registered",
3538
- "RequiresUpdates",
3539
- "Sent",
3540
- "Validated",
3541
- "WaitingApproval",
3542
- "ChartActivity",
3543
- "Activity",
3544
- "Archive",
3545
- "ArchiveTray",
3546
- "ArrowLeft",
3547
- "ArrowRight",
3548
- "Buildings",
3549
- "Circle",
3550
- "CaretDown",
3551
- "CaretLeft",
3552
- "CaretRight",
3553
- "ChartBar",
3554
- "ChartLine",
3555
- "ChatCircle",
3556
- "CheckSquare",
3557
- "Compass",
3558
- "Check",
3559
- "Copy",
3560
- "Database",
3561
- "DotsThreeVertical",
3562
- "ArrowCounterClockwise",
3563
- "MagnifyingGlassMinus",
3564
- "MagnifyingGlassPlus",
3565
- "Export",
3566
- "Eye",
3567
- "EyeSlash",
3568
- "Envelope",
3569
- "File",
3570
- "FileSearch",
3571
- "FileMinus",
3572
- "FilePlus",
3573
- "FileText",
3574
- "FileX",
3575
- "Handshake",
3576
- "Gear",
3577
- "GitBranch",
3578
- "IdentificationCard",
3579
- "List",
3580
- "ListBullets",
3581
- "Lock",
3582
- "MagnifyingGlass",
3583
- "MapPin",
3584
- "Medal",
3585
- "NotePencil",
3586
- "Paperclip",
3587
- "PaperPlaneTilt",
3588
- "Pen",
3589
- "Pencil",
3590
- "PencilSimpleLine",
3591
- "Phone",
3592
- "Plus",
3593
- "Printer",
3594
- "SignOut",
3595
- "Star",
3596
- "Target",
3597
- "TextT",
3598
- "Trash",
3599
- "UploadSimple",
3600
- "User",
3601
- "UserPlus",
3602
- "Users",
3603
- "WarningCircle",
3604
- "X",
3605
- "CircleWavyCheck",
3606
- "CircleWavyQuestion",
3607
- "ArchiveBox",
3608
- "ArrowCircleDown",
3609
- "FileArrowUp",
3610
- "FileDotted",
3611
- "Files",
3612
- "PencilLine",
3613
- "PencilCircle",
3614
- "UserCircle",
3615
- "Clock",
3616
- "QrCode",
3617
- "Webcam",
3618
- "Sun",
3619
- "DeviceTabletCamera",
3620
- "Globe",
3621
- "Fingerprint",
3622
- "PushPin",
3623
- "Timer"
3707
+ * with a minimum count of occurrences.
3708
+ *
3709
+ * @param minCount - The minimum number of actions required.
3710
+ */
3711
+ minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
3712
+ /**
3713
+ * Builds a conditional that sets a maximum count for the number of actions.
3714
+ * This is useful for limiting the number of actions of a specific type in a single event.
3715
+ */
3716
+ maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
3717
+ };
3718
+ };
3719
+ const chainableMethods = {
3720
+ /**
3721
+ * Adds additional field constraints to the action matching.
3722
+ *
3723
+ * @param fields - Object containing additional fields to match on the action.
3724
+ */
3725
+ withFields: (fields) => withMinMax(fields),
3726
+ /**
3727
+ * Adds template ID constraint to the action matching.
3728
+ * This is a convenience method that adds content.templateId to the fields.
3729
+ *
3730
+ * @param id - The template ID to match against.
3731
+ */
3732
+ withTemplate: (id) => withMinMax({
3733
+ content: { templateId: id }
3734
+ }),
3735
+ ...withMinMax()
3736
+ };
3737
+ return { ...basicConditional, ...chainableMethods };
3738
+ },
3739
+ field(field3) {
3740
+ return {
3741
+ $event: field3
3742
+ };
3743
+ }
3744
+ });
3745
+
3746
+ // ../commons/src/events/WorkqueueColumnConfig.ts
3747
+ var z31 = __toESM(require("zod/v4"));
3748
+ var WorkqueueColumnKeysArray = [
3749
+ ...EventMetadataKeysArray,
3750
+ "title",
3751
+ "outbox"
3752
+ ];
3753
+ var WorkqueueColumnKeys = z31.enum(WorkqueueColumnKeysArray);
3754
+ var WorkqueueColumnValue = z31.object({
3755
+ $event: WorkqueueColumnKeys
3756
+ });
3757
+ var WorkqueueColumn = z31.object({
3758
+ label: TranslationConfig,
3759
+ value: WorkqueueColumnValue
3760
+ });
3761
+ function defineWorkqueuesColumns(workqueueColumns) {
3762
+ return workqueueColumns.map(
3763
+ (workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
3764
+ );
3765
+ }
3766
+
3767
+ // ../commons/src/events/CountryConfigQueryInput.ts
3768
+ var z32 = __toESM(require("zod/v4"));
3769
+ var SerializableExact = z32.object({
3770
+ type: z32.literal("exact"),
3771
+ term: z32.union([z32.string(), SerializedUserField])
3772
+ });
3773
+ var SerializableWithin = z32.object({
3774
+ type: z32.literal("within"),
3775
+ location: z32.union([z32.string(), SerializedUserField])
3776
+ });
3777
+ var SerializedQueryExpression = z32.object({
3778
+ eventType: z32.string(),
3779
+ status: z32.optional(z32.union([AnyOfStatus, ExactStatus])),
3780
+ createdAt: z32.optional(DateCondition),
3781
+ updatedAt: z32.optional(DateCondition),
3782
+ "legalStatuses.REGISTERED.createdAt": z32.optional(DateCondition),
3783
+ "legalStatuses.DECLARED.createdAtLocation": z32.optional(SerializableWithin),
3784
+ "legalStatuses.REGISTERED.createdAtLocation": z32.optional(SerializableWithin),
3785
+ "legalStatuses.REGISTERED.registrationNumber": z32.optional(Exact),
3786
+ createdAtLocation: z32.optional(SerializableWithin),
3787
+ updatedAtLocation: z32.optional(SerializableWithin),
3788
+ assignedTo: z32.optional(SerializableExact),
3789
+ createdBy: z32.optional(SerializableExact),
3790
+ createdByUserType: ExactUserType,
3791
+ updatedBy: z32.optional(SerializableExact),
3792
+ trackingId: z32.optional(Exact),
3793
+ flags: z32.optional(ContainsFlags),
3794
+ data: QueryInput
3795
+ }).partial();
3796
+ var Or2 = z32.object({
3797
+ type: z32.literal("or"),
3798
+ clauses: z32.array(SerializedQueryExpression)
3799
+ });
3800
+ var And2 = z32.object({
3801
+ type: z32.literal("and"),
3802
+ clauses: z32.array(SerializedQueryExpression)
3803
+ });
3804
+ var CountryConfigQueryType = z32.discriminatedUnion("type", [And2, Or2]);
3805
+ var CountryConfigQueryInputType = z32.union([
3806
+ SerializedQueryExpression,
3807
+ And2,
3808
+ Or2
3624
3809
  ]);
3625
3810
 
3626
3811
  // ../commons/src/events/WorkqueueConfig.ts
@@ -3642,23 +3827,17 @@ var mandatoryColumns = defineWorkqueuesColumns([
3642
3827
  value: event.field("updatedAt")
3643
3828
  }
3644
3829
  ]);
3645
- var WorkqueueActionsWithDefault = import_zod31.z.enum([
3646
- ...workqueueActions.options,
3647
- "DEFAULT"
3648
- ]);
3649
- var WorkqueueConfig = import_zod31.z.object({
3650
- slug: import_zod31.z.string().describe("Determines the url of the workqueue."),
3830
+ var CtaActionType = z33.enum([...workqueueActions.options, ActionType.READ]);
3831
+ var WorkqueueConfig = z33.object({
3832
+ slug: z33.string().describe("Determines the url of the workqueue."),
3651
3833
  name: TranslationConfig.describe(
3652
3834
  "Title of the workflow (both in navigation and on the page)"
3653
3835
  ),
3654
3836
  query: CountryConfigQueryType,
3655
- actions: import_zod31.z.array(
3656
- import_zod31.z.object({
3657
- type: WorkqueueActionsWithDefault,
3658
- conditionals: import_zod31.z.array(Conditional).optional()
3659
- })
3660
- ),
3661
- columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
3837
+ /** This action object used to contain a conditionals option, but it was not used anywhere.
3838
+ * It's also debatable whether it should be an array, or just a single action. */
3839
+ actions: z33.array(z33.object({ type: CtaActionType })).describe("Workqueue call-to-action button configuration."),
3840
+ columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
3662
3841
  icon: AvailableIcons,
3663
3842
  emptyMessage: TranslationConfig.optional()
3664
3843
  }).describe("Configuration for workqueue.");
@@ -3666,26 +3845,21 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
3666
3845
  query: true,
3667
3846
  columns: true
3668
3847
  });
3669
- var WorkqueueConfigInput = import_zod31.z.object({
3670
- slug: import_zod31.z.string().describe("Determines the url of the workqueue."),
3848
+ var WorkqueueConfigInput = z33.object({
3849
+ slug: z33.string().describe("Determines the url of the workqueue."),
3671
3850
  name: TranslationConfig.describe(
3672
3851
  "Title of the workflow (both in navigation and on the page)"
3673
3852
  ),
3674
3853
  query: CountryConfigQueryInputType,
3675
- actions: import_zod31.z.array(
3676
- import_zod31.z.object({
3677
- type: WorkqueueActionsWithDefault,
3678
- conditionals: import_zod31.z.array(Conditional).optional()
3679
- })
3680
- ),
3681
- columns: import_zod31.z.array(WorkqueueColumn).default(mandatoryColumns),
3854
+ actions: z33.array(z33.object({ type: CtaActionType })).describe("Workqueue call-to-action button configuration."),
3855
+ columns: z33.array(WorkqueueColumn).default(mandatoryColumns),
3682
3856
  icon: AvailableIcons,
3683
3857
  emptyMessage: TranslationConfig.optional()
3684
3858
  });
3685
- var WorkqueueCountInput = import_zod31.z.array(
3686
- import_zod31.z.object({ slug: import_zod31.z.string(), query: QueryType })
3859
+ var WorkqueueCountInput = z33.array(
3860
+ z33.object({ slug: z33.string(), query: QueryType })
3687
3861
  );
3688
- var WorkqueueCountOutput = import_zod31.z.record(import_zod31.z.string(), import_zod31.z.number());
3862
+ var WorkqueueCountOutput = z33.record(z33.string(), z33.number());
3689
3863
 
3690
3864
  // ../commons/src/events/workqueueDefaultColumns.ts
3691
3865
  var defaultWorkqueueColumns = [
@@ -3708,47 +3882,48 @@ var defaultWorkqueueColumns = [
3708
3882
  ];
3709
3883
 
3710
3884
  // ../commons/src/events/Draft.ts
3711
- var import_zod33 = require("zod");
3885
+ var z35 = __toESM(require("zod/v4"));
3712
3886
 
3713
3887
  // ../commons/src/events/ActionInput.ts
3714
- var import_zod32 = require("zod");
3715
- var import_zod_openapi11 = require("zod-openapi");
3716
- (0, import_zod_openapi11.extendZodWithOpenApi)(import_zod32.z);
3717
- var BaseActionInput = import_zod32.z.object({
3888
+ var z34 = __toESM(require("zod/v4"));
3889
+ var BaseActionInput = z34.object({
3718
3890
  eventId: UUID,
3719
- transactionId: import_zod32.z.string(),
3891
+ transactionId: z34.string(),
3720
3892
  declaration: ActionUpdate.default({}),
3721
3893
  annotation: ActionUpdate.optional(),
3722
3894
  originalActionId: UUID.optional(),
3723
3895
  // should not be part of base action.
3724
- keepAssignment: import_zod32.z.boolean().optional(),
3896
+ keepAssignment: z34.boolean().optional(),
3725
3897
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3726
- createdAtLocation: CreatedAtLocation.describe(
3898
+ // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
3899
+ createdAtLocation: UUID.nullish().describe(
3727
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."
3728
3901
  )
3729
3902
  });
3730
- var CreateActionInput = BaseActionInput.merge(
3731
- import_zod32.z.object({
3732
- type: import_zod32.z.literal(ActionType.CREATE).default(ActionType.CREATE),
3733
- createdAtLocation: CreatedAtLocation
3734
- })
3903
+ var CreateActionInput = BaseActionInput.extend(
3904
+ z34.object({
3905
+ type: z34.literal(ActionType.CREATE).default(ActionType.CREATE),
3906
+ // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3907
+ createdAtLocation: UUID.nullish().describe(
3908
+ "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."
3909
+ )
3910
+ }).shape
3735
3911
  );
3736
- var RegisterActionInput = BaseActionInput.merge(
3737
- import_zod32.z.object({
3738
- type: import_zod32.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3739
- registrationNumber: import_zod32.z.string().optional()
3740
- })
3741
- ).strict();
3742
- var ValidateActionInput = BaseActionInput.merge(
3743
- import_zod32.z.object({
3744
- type: import_zod32.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE)
3745
- })
3912
+ var RegisterActionInput = BaseActionInput.extend(
3913
+ z34.strictObject({
3914
+ type: z34.literal(ActionType.REGISTER).default(ActionType.REGISTER),
3915
+ registrationNumber: z34.string().optional()
3916
+ }).shape
3746
3917
  );
3747
- var NotifyActionInput = BaseActionInput.merge(
3748
- import_zod32.z.object({
3749
- type: import_zod32.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
3750
- })
3751
- ).openapi({
3918
+ var NotifyActionInput = BaseActionInput.extend(
3919
+ z34.object({
3920
+ type: z34.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
3921
+ // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
3922
+ createdAtLocation: UUID.nullish().describe(
3923
+ "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."
3924
+ )
3925
+ }).shape
3926
+ ).meta({
3752
3927
  default: {
3753
3928
  eventId: "<event-id-here>",
3754
3929
  transactionId: getUUID(),
@@ -3757,135 +3932,150 @@ var NotifyActionInput = BaseActionInput.merge(
3757
3932
  type: ActionType.NOTIFY
3758
3933
  }
3759
3934
  });
3760
- var DeclareActionInput = BaseActionInput.merge(
3761
- import_zod32.z.object({
3762
- type: import_zod32.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3763
- })
3935
+ var DeclareActionInput = BaseActionInput.extend(
3936
+ z34.object({
3937
+ type: z34.literal(ActionType.DECLARE).default(ActionType.DECLARE)
3938
+ }).shape
3939
+ );
3940
+ var EditActionInput = BaseActionInput.extend(
3941
+ z34.object({
3942
+ type: z34.literal(ActionType.EDIT).default(ActionType.EDIT),
3943
+ content: z34.object({
3944
+ comment: z34.string().describe("Comment for the edit action.").optional()
3945
+ })
3946
+ }).shape
3764
3947
  );
3765
- var PrintCertificateActionInput = BaseActionInput.merge(
3766
- import_zod32.z.object({
3767
- type: import_zod32.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3948
+ var PrintCertificateActionInput = BaseActionInput.extend(
3949
+ z34.object({
3950
+ type: z34.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
3768
3951
  content: PrintContent.optional()
3769
- })
3952
+ }).shape
3770
3953
  );
3771
- var RejectDeclarationActionInput = BaseActionInput.merge(
3772
- import_zod32.z.object({
3773
- type: import_zod32.z.literal(ActionType.REJECT).default(ActionType.REJECT),
3954
+ var RejectDeclarationActionInput = BaseActionInput.extend(
3955
+ z34.object({
3956
+ type: z34.literal(ActionType.REJECT).default(ActionType.REJECT),
3774
3957
  content: ReasonContent
3775
- })
3958
+ }).shape
3776
3959
  );
3777
- var DuplicateDetectedActionInput = BaseActionInput.merge(
3778
- import_zod32.z.object({
3779
- type: import_zod32.z.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3780
- content: import_zod32.z.object({
3781
- duplicates: import_zod32.z.array(PotentialDuplicate)
3960
+ var DuplicateDetectedActionInput = BaseActionInput.extend(
3961
+ z34.object({
3962
+ type: z34.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
3963
+ content: z34.object({
3964
+ duplicates: z34.array(PotentialDuplicate)
3782
3965
  })
3783
- })
3966
+ }).shape
3784
3967
  );
3785
- var MarkAsDuplicateActionInput = BaseActionInput.merge(
3786
- import_zod32.z.object({
3787
- type: import_zod32.z.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3788
- content: import_zod32.z.object({
3968
+ var MarkAsDuplicateActionInput = BaseActionInput.extend(
3969
+ z34.object({
3970
+ type: z34.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
3971
+ content: z34.object({
3789
3972
  duplicateOf: UUID
3790
3973
  }).optional()
3791
- })
3974
+ }).shape
3792
3975
  );
3793
- var MarkNotDuplicateActionInput = BaseActionInput.merge(
3794
- import_zod32.z.object({
3795
- type: import_zod32.z.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3796
- })
3976
+ var MarkNotDuplicateActionInput = BaseActionInput.extend(
3977
+ z34.object({
3978
+ type: z34.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
3979
+ }).shape
3797
3980
  );
3798
- var ArchiveActionInput = BaseActionInput.merge(
3799
- import_zod32.z.object({
3800
- type: import_zod32.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3981
+ var ArchiveActionInput = BaseActionInput.extend(
3982
+ z34.object({
3983
+ type: z34.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
3801
3984
  content: ReasonContent
3802
- })
3985
+ }).shape
3803
3986
  );
3804
- var AssignActionInput = BaseActionInput.merge(
3805
- import_zod32.z.object({
3806
- type: import_zod32.z.literal(ActionType.ASSIGN),
3807
- assignedTo: import_zod32.z.string()
3808
- })
3987
+ var AssignActionInput = BaseActionInput.extend(
3988
+ z34.object({
3989
+ type: z34.literal(ActionType.ASSIGN),
3990
+ assignedTo: z34.string()
3991
+ }).shape
3809
3992
  );
3810
- var UnassignActionInput = BaseActionInput.merge(
3811
- import_zod32.z.object({
3812
- type: import_zod32.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3813
- assignedTo: import_zod32.z.literal(null).default(null)
3814
- })
3993
+ var UnassignActionInput = BaseActionInput.extend(
3994
+ z34.object({
3995
+ type: z34.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
3996
+ assignedTo: z34.literal(null).default(null)
3997
+ }).shape
3815
3998
  );
3816
- var RequestCorrectionActionInput = BaseActionInput.merge(
3817
- import_zod32.z.object({
3818
- type: import_zod32.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
3819
- })
3999
+ var RequestCorrectionActionInput = BaseActionInput.extend(
4000
+ z34.object({
4001
+ type: z34.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
4002
+ }).shape
3820
4003
  );
3821
- var RejectCorrectionActionInput = BaseActionInput.merge(
3822
- import_zod32.z.object({
3823
- requestId: import_zod32.z.string(),
3824
- type: import_zod32.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
4004
+ var RejectCorrectionActionInput = BaseActionInput.extend(
4005
+ z34.object({
4006
+ requestId: z34.string(),
4007
+ type: z34.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
3825
4008
  content: ReasonContent
3826
- })
4009
+ }).shape
3827
4010
  );
3828
- var ApproveCorrectionActionInput = BaseActionInput.merge(
3829
- import_zod32.z.object({
3830
- requestId: import_zod32.z.string(),
3831
- type: import_zod32.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
3832
- })
4011
+ var ApproveCorrectionActionInput = BaseActionInput.extend(
4012
+ z34.object({
4013
+ requestId: z34.string(),
4014
+ type: z34.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4015
+ }).shape
3833
4016
  );
3834
- var ReadActionInput = BaseActionInput.merge(
3835
- import_zod32.z.object({
3836
- type: import_zod32.z.literal(ActionType.READ).default(ActionType.READ)
3837
- })
4017
+ var ReadActionInput = BaseActionInput.extend(
4018
+ z34.object({
4019
+ type: z34.literal(ActionType.READ).default(ActionType.READ)
4020
+ }).shape
4021
+ );
4022
+ var DeleteActionInput = z34.object({ eventId: UUID });
4023
+ var CustomActionInput = BaseActionInput.extend(
4024
+ z34.object({
4025
+ type: z34.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
4026
+ customActionType: z34.string().describe("Name of the custom action.")
4027
+ }).shape
3838
4028
  );
3839
- var DeleteActionInput = import_zod32.z.object({ eventId: UUID });
3840
- var ActionInput = import_zod32.z.discriminatedUnion("type", [
3841
- CreateActionInput.openapi({ ref: "CreateActionInput" }),
3842
- ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
3843
- RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
3844
- NotifyActionInput.openapi({ ref: "NotifyActionInput" }),
3845
- DeclareActionInput.openapi({ ref: "DeclareActionInput" }),
3846
- RejectDeclarationActionInput.openapi({
3847
- ref: "RejectDeclarationActionInput"
4029
+ var ActionInput = z34.discriminatedUnion("type", [
4030
+ CreateActionInput.meta({ id: "CreateActionInput" }),
4031
+ RegisterActionInput.meta({ id: "RegisterActionInput" }),
4032
+ NotifyActionInput.meta({ id: "NotifyActionInput" }),
4033
+ DeclareActionInput.meta({ id: "DeclareActionInput" }),
4034
+ RejectDeclarationActionInput.meta({
4035
+ id: "RejectDeclarationActionInput"
3848
4036
  }),
3849
- DuplicateDetectedActionInput.openapi({
3850
- ref: "DuplicateDetectedActionInput"
4037
+ DuplicateDetectedActionInput.meta({
4038
+ id: "DuplicateDetectedActionInput"
3851
4039
  }),
3852
- MarkAsDuplicateActionInput.openapi({
3853
- ref: "MarkAsDuplicateActionInput"
4040
+ MarkAsDuplicateActionInput.meta({
4041
+ id: "MarkAsDuplicateActionInput"
3854
4042
  }),
3855
- MarkNotDuplicateActionInput.openapi({
3856
- ref: "MarkNotDuplicateActionInput"
4043
+ MarkNotDuplicateActionInput.meta({
4044
+ id: "MarkNotDuplicateActionInput"
3857
4045
  }),
3858
- ArchiveActionInput.openapi({ ref: "ArchiveActionInput" }),
3859
- AssignActionInput.openapi({ ref: "AssignActionInput" }),
3860
- UnassignActionInput.openapi({ ref: "UnassignActionInput" }),
3861
- PrintCertificateActionInput.openapi({ ref: "PrintCertificateActionInput" }),
3862
- RequestCorrectionActionInput.openapi({
3863
- ref: "RequestCorrectionActionInput"
4046
+ ArchiveActionInput.meta({ id: "ArchiveActionInput" }),
4047
+ AssignActionInput.meta({ id: "AssignActionInput" }),
4048
+ UnassignActionInput.meta({ id: "UnassignActionInput" }),
4049
+ PrintCertificateActionInput.meta({ id: "PrintCertificateActionInput" }),
4050
+ RequestCorrectionActionInput.meta({
4051
+ id: "RequestCorrectionActionInput"
3864
4052
  }),
3865
- RejectCorrectionActionInput.openapi({ ref: "RejectCorrectionActionInput" }),
3866
- ApproveCorrectionActionInput.openapi({
3867
- ref: "ApproveCorrectionActionInput"
4053
+ RejectCorrectionActionInput.meta({ id: "RejectCorrectionActionInput" }),
4054
+ ApproveCorrectionActionInput.meta({
4055
+ id: "ApproveCorrectionActionInput"
3868
4056
  }),
3869
- ReadActionInput.openapi({ ref: "ReadActionInput" })
3870
- ]).openapi({
3871
- ref: "ActionInput"
4057
+ ReadActionInput.meta({ id: "ReadActionInput" }),
4058
+ CustomActionInput.meta({ id: "CustomActionInput" }),
4059
+ EditActionInput.meta({ id: "EditActionInput" })
4060
+ ]).meta({
4061
+ id: "ActionInput"
3872
4062
  });
3873
4063
 
3874
4064
  // ../commons/src/events/Draft.ts
3875
- var Draft = import_zod33.z.object({
4065
+ var Draft = z35.object({
3876
4066
  id: UUID,
3877
4067
  eventId: UUID,
3878
- transactionId: import_zod33.z.string(),
3879
- createdAt: import_zod33.z.string().datetime(),
4068
+ transactionId: z35.string(),
4069
+ createdAt: z35.string().datetime(),
3880
4070
  action: ActionBase.extend({
3881
- type: ActionTypes.exclude([ActionTypes.Enum.DELETE])
4071
+ type: ActionTypes.exclude([ActionTypes.enum.DELETE])
3882
4072
  }).omit({ id: true, createdAtLocation: true })
3883
4073
  }).describe(
3884
4074
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
3885
4075
  );
3886
4076
  var DraftInput = BaseActionInput.extend({
3887
- type: ActionTypes.exclude([ActionTypes.Enum.DELETE]),
3888
- status: import_zod33.z.enum([
4077
+ type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4078
+ status: z35.enum([
3889
4079
  ActionStatus.Requested,
3890
4080
  ActionStatus.Accepted,
3891
4081
  ActionStatus.Rejected
@@ -3893,32 +4083,33 @@ var DraftInput = BaseActionInput.extend({
3893
4083
  });
3894
4084
 
3895
4085
  // ../commons/src/events/EventInput.ts
3896
- var import_zod34 = require("zod");
3897
- var import_uuid10 = require("uuid");
3898
- var EventInput = import_zod34.z.object({
3899
- transactionId: import_zod34.z.string(),
3900
- type: import_zod34.z.string()
3901
- }).openapi({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
4086
+ var z36 = __toESM(require("zod/v4"));
4087
+ var import_uuid9 = require("uuid");
4088
+ var EventInput = z36.object({
4089
+ transactionId: z36.string(),
4090
+ type: z36.string(),
4091
+ createdAtLocation: UUID.nullish().describe(
4092
+ "Location where the event occurred. Required for system users."
4093
+ )
4094
+ }).meta({ default: { transactionId: (0, import_uuid9.v4)(), type: "birth" } });
3902
4095
 
3903
4096
  // ../commons/src/events/EventDocument.ts
3904
- var import_zod35 = require("zod");
3905
- var import_zod_openapi12 = require("zod-openapi");
3906
- (0, import_zod_openapi12.extendZodWithOpenApi)(import_zod35.z);
3907
- var EventDocument = import_zod35.z.object({
4097
+ var z37 = __toESM(require("zod/v4"));
4098
+ var EventDocument = z37.object({
3908
4099
  id: UUID.describe("Unique identifier of the event."),
3909
- type: import_zod35.z.string().describe("Type of the event (e.g. birth, death, marriage)."),
3910
- createdAt: import_zod35.z.string().datetime().describe("Timestamp indicating when the event was created."),
3911
- updatedAt: import_zod35.z.string().datetime().describe(
4100
+ type: z37.string().describe("Type of the event (e.g. birth, death, marriage)."),
4101
+ createdAt: z37.string().datetime().describe("Timestamp indicating when the event was created."),
4102
+ updatedAt: z37.string().datetime().describe(
3912
4103
  "Timestamp of the last update, excluding changes from actions."
3913
4104
  ),
3914
- actions: import_zod35.z.array(Action).describe("Ordered list of actions associated with the event."),
3915
- trackingId: import_zod35.z.string().describe(
4105
+ actions: z37.array(Action).describe("Ordered list of actions associated with the event."),
4106
+ trackingId: z37.string().describe(
3916
4107
  "System-generated tracking identifier used to look up the event."
3917
4108
  )
3918
- }).openapi({ ref: "EventDocument" });
4109
+ }).meta({ id: "EventDocument" });
3919
4110
 
3920
4111
  // ../commons/src/events/state/index.ts
3921
- var import_lodash3 = require("lodash");
4112
+ var import_lodash4 = require("lodash");
3922
4113
 
3923
4114
  // ../commons/src/events/state/utils.ts
3924
4115
  var import_lodash2 = require("lodash");
@@ -3926,14 +4117,18 @@ var updateActions = ActionTypes.extract([
3926
4117
  ActionType.CREATE,
3927
4118
  ActionType.NOTIFY,
3928
4119
  ActionType.DECLARE,
3929
- ActionType.VALIDATE,
3930
4120
  ActionType.REGISTER,
3931
4121
  ActionType.REJECT,
3932
4122
  ActionType.ARCHIVE,
3933
4123
  ActionType.PRINT_CERTIFICATE,
3934
- ActionType.REQUEST_CORRECTION
4124
+ ActionType.REQUEST_CORRECTION,
4125
+ ActionType.CUSTOM
3935
4126
  ]);
3936
4127
 
4128
+ // ../commons/src/events/state/flags.ts
4129
+ var import_lodash3 = require("lodash");
4130
+ var import_date_fns3 = require("date-fns");
4131
+
3937
4132
  // ../commons/src/events/defineConfig.ts
3938
4133
  var defineConfig = (config) => {
3939
4134
  const input = EventConfig.parse(config);
@@ -3941,7 +4136,7 @@ var defineConfig = (config) => {
3941
4136
  };
3942
4137
 
3943
4138
  // ../commons/src/events/test.utils.ts
3944
- var import_lodash4 = require("lodash");
4139
+ var import_lodash5 = require("lodash");
3945
4140
  var import_date_fns4 = require("date-fns");
3946
4141
 
3947
4142
  // ../commons/src/field-config/field-configuration.ts
@@ -3963,7 +4158,6 @@ function field(fieldId, options = {}) {
3963
4158
  }
3964
4159
 
3965
4160
  // ../commons/src/fixtures/forms.ts
3966
- var import_date_fns3 = require("date-fns");
3967
4161
  var PRINT_CERTIFICATE_FORM = defineActionForm({
3968
4162
  label: {
3969
4163
  id: "event.tennis-club-membership.action.certificate.form.label",
@@ -4763,7 +4957,7 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
4763
4957
  conditionals: [
4764
4958
  {
4765
4959
  type: ConditionalType.DISPLAY_ON_REVIEW,
4766
- conditional: never()
4960
+ conditional: never2()
4767
4961
  }
4768
4962
  ]
4769
4963
  },
@@ -5146,119 +5340,16 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5146
5340
  }
5147
5341
  }
5148
5342
  ],
5149
- conditional: not(never())
5343
+ conditional: not(never2())
5150
5344
  // Intentional always-true page conditional to exercise interactions between page-level and field-level conditionals in tests
5151
5345
  }
5152
5346
  ]
5153
5347
  });
5154
- var statusOptions = [
5155
- {
5156
- value: "ALL",
5157
- label: {
5158
- defaultMessage: "Any status",
5159
- description: "Option for form field: status of record",
5160
- id: "advancedSearch.form.recordStatusAny"
5161
- }
5162
- },
5163
- {
5164
- value: EventStatus.enum.CREATED,
5165
- label: {
5166
- defaultMessage: "Draft",
5167
- description: "Option for form field: status of record",
5168
- id: "advancedSearch.form.recordStatusCreated"
5169
- }
5170
- },
5171
- {
5172
- value: EventStatus.enum.NOTIFIED,
5173
- label: {
5174
- defaultMessage: "Notified",
5175
- description: "Option for form field: status of record",
5176
- id: "advancedSearch.form.recordStatusNotified"
5177
- }
5178
- },
5179
- {
5180
- value: EventStatus.enum.DECLARED,
5181
- label: {
5182
- defaultMessage: "Declared",
5183
- description: "Option for form field: status of record",
5184
- id: "advancedSearch.form.recordStatusDeclared"
5185
- }
5186
- },
5187
- {
5188
- value: EventStatus.enum.VALIDATED,
5189
- label: {
5190
- defaultMessage: "Validated",
5191
- description: "Option for form field: status of record",
5192
- id: "advancedSearch.form.recordStatusValidated"
5193
- }
5194
- },
5195
- {
5196
- value: EventStatus.enum.REGISTERED,
5197
- label: {
5198
- defaultMessage: "Registered",
5199
- description: "Option for form field: status of record",
5200
- id: "advancedSearch.form.recordStatusRegistered"
5201
- }
5202
- },
5203
- {
5204
- value: EventStatus.enum.ARCHIVED,
5205
- label: {
5206
- defaultMessage: "Archived",
5207
- description: "Option for form field: status of record",
5208
- id: "advancedSearch.form.recordStatusArchived"
5209
- }
5210
- }
5211
- ];
5212
- var timePeriodOptions = [
5213
- {
5214
- label: {
5215
- defaultMessage: "Last 7 days",
5216
- description: "Label for option of time period select: last 7 days",
5217
- id: "form.section.label.timePeriodLast7Days"
5218
- },
5219
- value: `${(0, import_date_fns3.format)((0, import_date_fns3.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5220
- /* @__PURE__ */ new Date(),
5221
- "yyyy-MM-dd"
5222
- )}`
5223
- },
5224
- {
5225
- label: {
5226
- defaultMessage: "Last 30 days",
5227
- description: "Label for option of time period select: last 30 days",
5228
- id: "form.section.label.timePeriodLast30Days"
5229
- },
5230
- value: `${(0, import_date_fns3.format)((0, import_date_fns3.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5231
- /* @__PURE__ */ new Date(),
5232
- "yyyy-MM-dd"
5233
- )}`
5234
- },
5235
- {
5236
- label: {
5237
- defaultMessage: "Last 90 days",
5238
- description: "Label for option of time period select: last 90 days",
5239
- id: "form.section.label.timePeriodLast90Days"
5240
- },
5241
- value: `${(0, import_date_fns3.format)((0, import_date_fns3.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5242
- /* @__PURE__ */ new Date(),
5243
- "yyyy-MM-dd"
5244
- )}`
5245
- },
5246
- {
5247
- label: {
5248
- defaultMessage: "Last year",
5249
- description: "Label for option of time period select: last year",
5250
- id: "form.section.label.timePeriodLastYear"
5251
- },
5252
- value: `${(0, import_date_fns3.format)((0, import_date_fns3.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns3.format)(
5253
- /* @__PURE__ */ new Date(),
5254
- "yyyy-MM-dd"
5255
- )}`
5256
- }
5257
- ];
5258
5348
 
5259
5349
  // ../commons/src/fixtures/tennis-club-membership-event.ts
5260
5350
  var tennisClubMembershipEvent = defineConfig({
5261
5351
  id: TENNIS_CLUB_MEMBERSHIP,
5352
+ declaration: TENNIS_CLUB_DECLARATION_FORM,
5262
5353
  label: {
5263
5354
  defaultMessage: "Tennis club membership application",
5264
5355
  description: "This is what this event is referred as in the system",
@@ -5309,13 +5400,12 @@ var tennisClubMembershipEvent = defineConfig({
5309
5400
  review: TENNIS_CLUB_DECLARATION_REVIEW
5310
5401
  },
5311
5402
  {
5312
- type: ActionType.VALIDATE,
5403
+ type: ActionType.REJECT,
5313
5404
  label: {
5314
- defaultMessage: "Validate",
5405
+ defaultMessage: "Reject",
5315
5406
  description: "This is shown as the action name anywhere the user can trigger the action from",
5316
- id: "event.tennis-club-membership.action.validate.label"
5317
- },
5318
- review: TENNIS_CLUB_DECLARATION_REVIEW
5407
+ id: "event.tennis-club-membership.action.reject.label"
5408
+ }
5319
5409
  },
5320
5410
  {
5321
5411
  type: ActionType.REGISTER,
@@ -5323,8 +5413,7 @@ var tennisClubMembershipEvent = defineConfig({
5323
5413
  defaultMessage: "Register",
5324
5414
  description: "This is shown as the action name anywhere the user can trigger the action from",
5325
5415
  id: "event.tennis-club-membership.action.register.label"
5326
- },
5327
- review: TENNIS_CLUB_DECLARATION_REVIEW
5416
+ }
5328
5417
  },
5329
5418
  {
5330
5419
  type: ActionType.REQUEST_CORRECTION,
@@ -5527,14 +5616,6 @@ var tennisClubMembershipEvent = defineConfig({
5527
5616
  ]
5528
5617
  }
5529
5618
  },
5530
- {
5531
- type: ActionType.APPROVE_CORRECTION,
5532
- label: {
5533
- defaultMessage: "Approve correction",
5534
- description: "This is shown as the action name anywhere the user can trigger the action from",
5535
- id: "event.tennis-club-membership.action.correction.approve.label"
5536
- }
5537
- },
5538
5619
  {
5539
5620
  type: ActionType.PRINT_CERTIFICATE,
5540
5621
  label: {
@@ -5543,22 +5624,6 @@ var tennisClubMembershipEvent = defineConfig({
5543
5624
  description: "This is shown as the action name anywhere the user can trigger the action from"
5544
5625
  },
5545
5626
  printForm: PRINT_CERTIFICATE_FORM
5546
- },
5547
- {
5548
- type: ActionType.ARCHIVE,
5549
- label: {
5550
- id: "event.tennis-club-membership.action.archive.label",
5551
- defaultMessage: "Archive",
5552
- description: "This is shown as the action name anywhere the user can trigger the action from"
5553
- }
5554
- },
5555
- {
5556
- type: ActionType.REJECT,
5557
- label: {
5558
- id: "event.tennis-club-membership.action.reject.label",
5559
- defaultMessage: "Reject",
5560
- description: "This is shown as the action name anywhere the user can trigger the action from"
5561
- }
5562
5627
  }
5563
5628
  ],
5564
5629
  advancedSearch: [
@@ -5595,8 +5660,7 @@ var tennisClubMembershipEvent = defineConfig({
5595
5660
  },
5596
5661
  fields: [field("recommender.name").fuzzy()]
5597
5662
  }
5598
- ],
5599
- declaration: TENNIS_CLUB_DECLARATION_FORM
5663
+ ]
5600
5664
  });
5601
5665
 
5602
5666
  // ../commons/src/fixtures/football-club-membership-event.ts
@@ -5664,23 +5728,13 @@ var footballClubMembershipEvent = defineConfig({
5664
5728
  },
5665
5729
  review: TENNIS_CLUB_DECLARATION_REVIEW
5666
5730
  },
5667
- {
5668
- type: ActionType.VALIDATE,
5669
- label: {
5670
- defaultMessage: "Validate",
5671
- description: "This is shown as the action name anywhere the user can trigger the action from",
5672
- id: "event.football-club-membership.action.validate.label"
5673
- },
5674
- review: TENNIS_CLUB_DECLARATION_REVIEW
5675
- },
5676
5731
  {
5677
5732
  type: ActionType.REGISTER,
5678
5733
  label: {
5679
5734
  defaultMessage: "Register",
5680
5735
  description: "This is shown as the action name anywhere the user can trigger the action from",
5681
5736
  id: "event.football-club-membership.action.register.label"
5682
- },
5683
- review: TENNIS_CLUB_DECLARATION_REVIEW
5737
+ }
5684
5738
  },
5685
5739
  {
5686
5740
  type: ActionType.REQUEST_CORRECTION,
@@ -5886,14 +5940,6 @@ var footballClubMembershipEvent = defineConfig({
5886
5940
  ]
5887
5941
  }
5888
5942
  },
5889
- {
5890
- type: ActionType.APPROVE_CORRECTION,
5891
- label: {
5892
- defaultMessage: "Approve correction",
5893
- description: "This is shown as the action name anywhere the user can trigger the action from",
5894
- id: "event.football-club-membership.action.correction.approve.label"
5895
- }
5896
- },
5897
5943
  {
5898
5944
  type: ActionType.PRINT_CERTIFICATE,
5899
5945
  label: {
@@ -5902,22 +5948,6 @@ var footballClubMembershipEvent = defineConfig({
5902
5948
  description: "This is shown as the action name anywhere the user can trigger the action from"
5903
5949
  },
5904
5950
  printForm: PRINT_CERTIFICATE_FORM
5905
- },
5906
- {
5907
- type: ActionType.ARCHIVE,
5908
- label: {
5909
- id: "event.football-club-membership.action.archive.label",
5910
- defaultMessage: "Archive",
5911
- description: "This is shown as the action name anywhere the user can trigger the action from"
5912
- }
5913
- },
5914
- {
5915
- type: ActionType.REJECT,
5916
- label: {
5917
- id: "event.football-club-membership.action.reject.label",
5918
- defaultMessage: "Reject",
5919
- description: "This is shown as the action name anywhere the user can trigger the action from"
5920
- }
5921
5951
  }
5922
5952
  ],
5923
5953
  advancedSearch: [
@@ -6017,7 +6047,7 @@ var libraryMembershipEvent = defineConfig({
6017
6047
  declaration: libraryMembershipForm
6018
6048
  });
6019
6049
 
6020
- // ../commons/src/fixtures/v2-birth-event.ts
6050
+ // ../commons/src/fixtures/child-onboarding-event.ts
6021
6051
  function generateTranslationConfig(message) {
6022
6052
  return {
6023
6053
  defaultMessage: message,
@@ -6046,6 +6076,61 @@ var child = defineFormPage({
6046
6076
  secured: true,
6047
6077
  validation: [],
6048
6078
  label: generateTranslationConfig("Date of birth")
6079
+ },
6080
+ {
6081
+ id: "child.placeOfBirth",
6082
+ analytics: true,
6083
+ type: FieldType.SELECT,
6084
+ required: true,
6085
+ secured: true,
6086
+ label: {
6087
+ defaultMessage: "Place of delivery",
6088
+ description: "This is the label for the field",
6089
+ id: "event.birth.action.declare.form.section.child.field.placeOfBirth.label"
6090
+ },
6091
+ options: [
6092
+ {
6093
+ value: "child.placeOfBirth-SELECT-2",
6094
+ label: generateTranslationConfig("Health Institution")
6095
+ },
6096
+ {
6097
+ value: "PRIVATE_HOME",
6098
+ label: generateTranslationConfig("Residential address")
6099
+ }
6100
+ ]
6101
+ },
6102
+ {
6103
+ id: "child.birthLocation",
6104
+ analytics: true,
6105
+ type: "FACILITY",
6106
+ required: true,
6107
+ secured: true,
6108
+ label: generateTranslationConfig("Health Institution"),
6109
+ conditionals: [
6110
+ {
6111
+ type: "SHOW",
6112
+ conditional: field("child.placeOfBirth").isEqualTo(
6113
+ "child.placeOfBirth-SELECT-2"
6114
+ )
6115
+ }
6116
+ ]
6117
+ },
6118
+ {
6119
+ id: "child.birthLocation.privateHome",
6120
+ analytics: true,
6121
+ type: FieldType.ADDRESS,
6122
+ secured: true,
6123
+ hideLabel: true,
6124
+ label: generateTranslationConfig("Child's address"),
6125
+ conditionals: [
6126
+ {
6127
+ type: "SHOW",
6128
+ conditional: field("child.placeOfBirth").isEqualTo("PRIVATE_HOME")
6129
+ }
6130
+ ],
6131
+ configuration: {
6132
+ streetAddressForm: []
6133
+ }
6049
6134
  }
6050
6135
  ]
6051
6136
  });
@@ -6149,7 +6234,7 @@ var mother = defineFormPage({
6149
6234
  }
6150
6235
  ]
6151
6236
  });
6152
- var BIRTH_DECLARATION_REVIEW = {
6237
+ var CHILD_ONBOARDING_DECLARATION_REVIEW = {
6153
6238
  title: generateTranslationConfig(
6154
6239
  "{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}}}}}"
6155
6240
  ),
@@ -6169,12 +6254,12 @@ var BIRTH_DECLARATION_REVIEW = {
6169
6254
  }
6170
6255
  ]
6171
6256
  };
6172
- var BIRTH_DECLARATION_FORM = defineDeclarationForm({
6257
+ var CHILD_ONBOARDING_DECLARATION_FORM = defineDeclarationForm({
6173
6258
  label: generateTranslationConfig("Birth decalration form"),
6174
6259
  pages: [child, mother]
6175
6260
  });
6176
- var v2BirthEvent = defineConfig({
6177
- id: BIRTH_EVENT,
6261
+ var ChildOnboardingEvent = defineConfig({
6262
+ id: CHILD_ONBOARDING_EVENT,
6178
6263
  title: generateTranslationConfig(
6179
6264
  "{child.name.firstname} {child.name.surname}"
6180
6265
  ),
@@ -6182,27 +6267,21 @@ var v2BirthEvent = defineConfig({
6182
6267
  summary: {
6183
6268
  fields: []
6184
6269
  },
6185
- declaration: BIRTH_DECLARATION_FORM,
6270
+ declaration: CHILD_ONBOARDING_DECLARATION_FORM,
6186
6271
  actions: [
6187
6272
  {
6188
6273
  type: ActionType.READ,
6189
6274
  label: generateTranslationConfig("Read"),
6190
- review: BIRTH_DECLARATION_REVIEW
6275
+ review: CHILD_ONBOARDING_DECLARATION_REVIEW
6191
6276
  },
6192
6277
  {
6193
6278
  type: ActionType.DECLARE,
6194
6279
  label: generateTranslationConfig("Declare"),
6195
- review: BIRTH_DECLARATION_REVIEW
6196
- },
6197
- {
6198
- type: ActionType.VALIDATE,
6199
- label: generateTranslationConfig("Validate"),
6200
- review: BIRTH_DECLARATION_REVIEW
6280
+ review: CHILD_ONBOARDING_DECLARATION_REVIEW
6201
6281
  },
6202
6282
  {
6203
6283
  type: ActionType.REGISTER,
6204
- label: generateTranslationConfig("Register"),
6205
- review: BIRTH_DECLARATION_REVIEW
6284
+ label: generateTranslationConfig("Register")
6206
6285
  }
6207
6286
  ],
6208
6287
  advancedSearch: []
@@ -6290,7 +6369,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6290
6369
  conditionals: [
6291
6370
  {
6292
6371
  type: ConditionalType.ENABLE,
6293
- conditional: never()
6372
+ conditional: never2()
6294
6373
  },
6295
6374
  {
6296
6375
  type: ConditionalType.SHOW,
@@ -6317,7 +6396,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6317
6396
  conditionals: [
6318
6397
  {
6319
6398
  type: ConditionalType.ENABLE,
6320
- conditional: never()
6399
+ conditional: never2()
6321
6400
  },
6322
6401
  {
6323
6402
  type: ConditionalType.SHOW,
@@ -6345,7 +6424,7 @@ var PRINT_DIGITAL_ID_CERTIFICATE_FORM = defineActionForm({
6345
6424
  conditionals: [
6346
6425
  {
6347
6426
  type: ConditionalType.ENABLE,
6348
- conditional: never()
6427
+ conditional: never2()
6349
6428
  }
6350
6429
  ],
6351
6430
  value: field("identity.http-fetch").get("data.certificateId")
@@ -6423,8 +6502,8 @@ var digitalIdentityEvent = defineConfig({
6423
6502
  });
6424
6503
 
6425
6504
  // ../commons/src/events/test.utils.ts
6426
- var import_zod36 = require("zod");
6427
- var TestUserRole = import_zod36.z.enum([
6505
+ var z38 = __toESM(require("zod/v4"));
6506
+ var TestUserRole = z38.enum([
6428
6507
  "FIELD_AGENT",
6429
6508
  "LOCAL_REGISTRAR",
6430
6509
  "LOCAL_SYSTEM_ADMIN",
@@ -6435,18 +6514,14 @@ var TestUserRole = import_zod36.z.enum([
6435
6514
  ]);
6436
6515
 
6437
6516
  // ../commons/src/events/scopes.ts
6438
- var import_lodash5 = require("lodash");
6517
+ var import_lodash6 = require("lodash");
6439
6518
  var ACTION_SCOPE_MAP = {
6440
6519
  [ActionType.READ]: ["record.read"],
6441
6520
  [ActionType.CREATE]: ["record.create"],
6442
6521
  [ActionType.NOTIFY]: ["record.notify"],
6443
- [ActionType.DECLARE]: [
6444
- "record.declare",
6445
- "record.declared.validate",
6446
- "record.register"
6447
- ],
6522
+ [ActionType.DECLARE]: ["record.declare", "record.register"],
6523
+ [ActionType.EDIT]: ["record.declared.edit"],
6448
6524
  [ActionType.DELETE]: ["record.declare"],
6449
- [ActionType.VALIDATE]: ["record.declared.validate", "record.register"],
6450
6525
  [ActionType.REGISTER]: ["record.register"],
6451
6526
  [ActionType.PRINT_CERTIFICATE]: ["record.registered.print-certified-copies"],
6452
6527
  [ActionType.REQUEST_CORRECTION]: [
@@ -6464,7 +6539,8 @@ var ACTION_SCOPE_MAP = {
6464
6539
  [ActionType.REJECT]: ["record.declared.reject"],
6465
6540
  [ActionType.ASSIGN]: null,
6466
6541
  [ActionType.UNASSIGN]: null,
6467
- [ActionType.DUPLICATE_DETECTED]: []
6542
+ [ActionType.DUPLICATE_DETECTED]: [],
6543
+ [ActionType.CUSTOM]: []
6468
6544
  };
6469
6545
 
6470
6546
  // ../commons/src/events/state/availableActions.ts
@@ -6473,28 +6549,25 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6473
6549
  ActionType.READ,
6474
6550
  ActionType.DECLARE,
6475
6551
  ActionType.NOTIFY,
6476
- ActionType.DELETE
6552
+ ActionType.DELETE,
6553
+ ActionType.CUSTOM
6477
6554
  ],
6478
6555
  [EventStatus.enum.NOTIFIED]: [
6479
6556
  ActionType.READ,
6480
- ActionType.DECLARE,
6557
+ ActionType.EDIT,
6481
6558
  ActionType.MARK_AS_DUPLICATE,
6482
6559
  ActionType.ARCHIVE,
6483
- ActionType.REJECT
6560
+ ActionType.REJECT,
6561
+ ActionType.CUSTOM
6484
6562
  ],
6485
6563
  [EventStatus.enum.DECLARED]: [
6486
- ActionType.READ,
6487
- ActionType.VALIDATE,
6488
- ActionType.MARK_AS_DUPLICATE,
6489
- ActionType.ARCHIVE,
6490
- ActionType.REJECT
6491
- ],
6492
- [EventStatus.enum.VALIDATED]: [
6493
6564
  ActionType.READ,
6494
6565
  ActionType.REGISTER,
6495
6566
  ActionType.MARK_AS_DUPLICATE,
6496
6567
  ActionType.ARCHIVE,
6497
- ActionType.REJECT
6568
+ ActionType.REJECT,
6569
+ ActionType.CUSTOM,
6570
+ ActionType.EDIT
6498
6571
  ],
6499
6572
  [EventStatus.enum.REGISTERED]: [
6500
6573
  ActionType.READ,
@@ -6502,12 +6575,14 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
6502
6575
  ActionType.REQUEST_CORRECTION,
6503
6576
  ActionType.APPROVE_CORRECTION,
6504
6577
  ActionType.REJECT_CORRECTION,
6578
+ ActionType.CUSTOM,
6505
6579
  ClientSpecificAction.REVIEW_CORRECTION_REQUEST
6506
6580
  ],
6507
6581
  [EventStatus.enum.ARCHIVED]: [
6508
6582
  ActionType.READ,
6509
6583
  ActionType.ASSIGN,
6510
- ActionType.UNASSIGN
6584
+ ActionType.UNASSIGN,
6585
+ ActionType.CUSTOM
6511
6586
  ]
6512
6587
  };
6513
6588
  var ACTION_FILTERS = {
@@ -6517,32 +6592,41 @@ var ACTION_FILTERS = {
6517
6592
  [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6518
6593
  [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag) => flag.endsWith(":requested")),
6519
6594
  [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6520
- [ActionType.VALIDATE]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6595
+ [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6521
6596
  [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag) => flag.endsWith(":requested")),
6522
6597
  [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag) => flag.endsWith(":requested")),
6523
6598
  [ActionType.ARCHIVE]: (flags) => !flags.some((flag) => flag.endsWith(":requested"))
6524
6599
  };
6525
6600
 
6526
6601
  // ../commons/src/events/FileUtils.ts
6527
- var import_lodash6 = require("lodash");
6602
+ var import_lodash7 = require("lodash");
6528
6603
 
6529
6604
  // ../commons/src/events/locations.ts
6530
- var import_zod37 = require("zod");
6531
- var LocationType = import_zod37.z.enum([
6605
+ var z39 = __toESM(require("zod/v4"));
6606
+ var LocationTypeV1 = z39.enum([
6532
6607
  "ADMIN_STRUCTURE",
6533
6608
  "CRVS_OFFICE",
6534
6609
  "HEALTH_FACILITY"
6535
6610
  ]);
6536
- var Location = import_zod37.z.object({
6611
+ var LocationType = z39.enum(["CRVS_OFFICE", "HEALTH_FACILITY"]);
6612
+ var AdministrativeArea = z39.object({
6537
6613
  id: UUID,
6538
- name: import_zod37.z.string(),
6614
+ name: z39.string(),
6615
+ externalId: z39.string().nullish(),
6539
6616
  parentId: UUID.nullable(),
6540
- validUntil: import_zod37.z.string().datetime().nullable(),
6541
- locationType: LocationType.nullable()
6617
+ validUntil: z39.iso.datetime().nullable()
6618
+ });
6619
+ var Location = z39.object({
6620
+ id: UUID,
6621
+ name: z39.string(),
6622
+ externalId: z39.string().nullish(),
6623
+ administrativeAreaId: UUID.nullable(),
6624
+ validUntil: z39.iso.datetime().nullable(),
6625
+ locationType: z39.string().nullable()
6542
6626
  });
6543
6627
 
6544
6628
  // ../commons/src/notification/UserNotifications.ts
6545
- var import_zod38 = require("zod");
6629
+ var z40 = __toESM(require("zod/v4"));
6546
6630
  var TriggerEvent = {
6547
6631
  USER_CREATED: "user-created",
6548
6632
  USER_UPDATED: "user-updated",
@@ -6554,50 +6638,50 @@ var TriggerEvent = {
6554
6638
  CHANGE_PHONE_NUMBER: "change-phone-number",
6555
6639
  CHANGE_EMAIL_ADDRESS: "change-email-address"
6556
6640
  };
6557
- var Recipient = import_zod38.z.object({
6641
+ var Recipient = z40.object({
6558
6642
  name: NameFieldValue.optional(),
6559
- mobile: import_zod38.z.string().optional(),
6560
- email: import_zod38.z.string().optional(),
6561
- bcc: import_zod38.z.array(import_zod38.z.string()).optional()
6643
+ mobile: z40.string().optional(),
6644
+ email: z40.string().optional(),
6645
+ bcc: z40.array(z40.string()).optional()
6562
6646
  });
6563
- var BasePayload = import_zod38.z.object({
6647
+ var BasePayload = z40.object({
6564
6648
  recipient: Recipient
6565
6649
  });
6566
6650
  var TriggerPayload = {
6567
6651
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
6568
- username: import_zod38.z.string(),
6569
- temporaryPassword: import_zod38.z.string()
6652
+ username: z40.string(),
6653
+ temporaryPassword: z40.string()
6570
6654
  }),
6571
6655
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
6572
- oldUsername: import_zod38.z.string(),
6573
- newUsername: import_zod38.z.string()
6656
+ oldUsername: z40.string(),
6657
+ newUsername: z40.string()
6574
6658
  }),
6575
6659
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
6576
- username: import_zod38.z.string()
6660
+ username: z40.string()
6577
6661
  }),
6578
6662
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
6579
- code: import_zod38.z.string()
6663
+ code: z40.string()
6580
6664
  }),
6581
6665
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
6582
- temporaryPassword: import_zod38.z.string(),
6583
- admin: import_zod38.z.object({
6584
- id: import_zod38.z.string(),
6666
+ temporaryPassword: z40.string(),
6667
+ admin: z40.object({
6668
+ id: z40.string(),
6585
6669
  name: NameFieldValue,
6586
- role: import_zod38.z.string()
6670
+ role: z40.string()
6587
6671
  })
6588
6672
  }),
6589
6673
  [TriggerEvent.TWO_FA]: BasePayload.extend({
6590
- code: import_zod38.z.string()
6674
+ code: z40.string()
6591
6675
  }),
6592
6676
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
6593
- subject: import_zod38.z.string(),
6594
- body: import_zod38.z.string()
6677
+ subject: z40.string(),
6678
+ body: z40.string()
6595
6679
  }),
6596
6680
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
6597
- code: import_zod38.z.string()
6681
+ code: z40.string()
6598
6682
  }),
6599
6683
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
6600
- code: import_zod38.z.string()
6684
+ code: z40.string()
6601
6685
  })
6602
6686
  };
6603
6687
  async function triggerUserEventNotification({
@@ -6619,3 +6703,6 @@ function parseUserEventTrigger(event2, body) {
6619
6703
  const schema = TriggerPayload[event2];
6620
6704
  return schema.parse(body);
6621
6705
  }
6706
+
6707
+ // src/notification/index.ts
6708
+ z41.globalRegistry.clear();