@opencrvs/toolkit 1.9.2 → 1.9.3-rc.0263d03

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