@opencrvs/toolkit 1.9.7-rc.36fa667 → 1.9.7-rc.3f06c45

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