@opencrvs/toolkit 1.9.4-rc.793f834 → 1.9.4-rc.f09603b

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