@opencrvs/toolkit 1.9.12-rc.f5ca5e6 → 1.9.12-rc.f5d99e1

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 (104) hide show
  1. package/build.sh +8 -0
  2. package/dist/application-config/index.js +2037 -41
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +3633 -0
  6. package/dist/commons/api/router.d.ts +482 -244
  7. package/dist/commons/application-config/index.d.ts +13 -16
  8. package/dist/commons/conditionals/conditionals.d.ts +8 -8
  9. package/dist/commons/events/ActionDocument.d.ts +196 -196
  10. package/dist/commons/events/ActionInput.d.ts +149 -113
  11. package/dist/commons/events/ActionType.d.ts +3 -3
  12. package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
  13. package/dist/commons/events/AuditLog.d.ts +345 -163
  14. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +461 -190
  16. package/dist/commons/events/Draft.d.ts +10 -9
  17. package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
  18. package/dist/commons/events/EventConfig.d.ts +3 -1
  19. package/dist/commons/events/EventDocument.d.ts +80 -80
  20. package/dist/commons/events/EventIndex.d.ts +35 -27
  21. package/dist/commons/events/EventInput.d.ts +1 -1
  22. package/dist/commons/events/EventMetadata.d.ts +19 -19
  23. package/dist/commons/events/FieldConfig.d.ts +287 -71
  24. package/dist/commons/events/FieldType.d.ts +2 -1
  25. package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
  26. package/dist/commons/events/FieldValue.d.ts +54 -26
  27. package/dist/commons/events/PlainDate.d.ts +1 -1
  28. package/dist/commons/events/WorkqueueColumnConfig.d.ts +7 -7
  29. package/dist/commons/events/WorkqueueConfig.d.ts +443 -199
  30. package/dist/commons/events/defineConfig.d.ts +0 -4
  31. package/dist/commons/events/locations.d.ts +4 -4
  32. package/dist/commons/events/scopes.d.ts +4 -3
  33. package/dist/commons/events/state/index.d.ts +2 -2
  34. package/dist/commons/events/state/utils.d.ts +1 -1
  35. package/dist/commons/events/test.utils.d.ts +2 -2
  36. package/dist/commons/events/utils.d.ts +3 -175
  37. package/dist/commons/notification/UserNotifications.d.ts +6 -1
  38. package/dist/conditionals/index.js +74 -359
  39. package/dist/events/index.js +1190 -1251
  40. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  41. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  42. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  43. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
  44. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
  45. package/dist/migrations/v2.0/checkout-upstream-files.js +143 -0
  46. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  47. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  48. package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
  49. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  50. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  51. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  52. package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
  53. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
  54. package/dist/migrations/v2.0/create-events-index.js +326 -0
  55. package/dist/migrations/v2.0/index.d.ts +7 -0
  56. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  57. package/dist/migrations/v2.0/index.js +3572 -0
  58. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  59. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  60. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  61. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  62. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  63. package/dist/migrations/v2.0/migrate-scopes.js +282 -0
  64. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  65. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  66. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  67. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
  68. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
  69. package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -0
  70. package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
  71. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
  72. package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
  73. package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
  74. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
  75. package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
  76. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  77. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  78. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  79. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
  80. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
  81. package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
  82. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  83. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  84. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  85. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  86. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  87. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  88. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  89. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  90. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  91. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  92. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  93. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  94. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
  95. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
  96. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +196 -0
  97. package/dist/notification/index.js +1020 -1155
  98. package/dist/scopes/index.d.ts +389 -152
  99. package/dist/scopes/index.js +128 -322
  100. package/opencrvs-toolkit-1.9.12-rc.f5d99e1.tgz +0 -0
  101. package/package.json +11 -7
  102. package/tsconfig.json +3 -0
  103. package/tsconfig.tsbuildinfo +1 -1
  104. package/opencrvs-toolkit-1.9.12-rc.f5ca5e6.tgz +0 -0
@@ -38,7 +38,7 @@ __export(notification_exports, {
38
38
  triggerUserEventNotification: () => triggerUserEventNotification
39
39
  });
40
40
  module.exports = __toCommonJS(notification_exports);
41
- var z46 = __toESM(require("zod/v4"));
41
+ var z45 = __toESM(require("zod/v4"));
42
42
 
43
43
  // ../commons/src/url.ts
44
44
  function joinUrl(base, path) {
@@ -47,111 +47,231 @@ function joinUrl(base, path) {
47
47
  }
48
48
 
49
49
  // ../commons/src/events/AuditLog.ts
50
+ var z5 = __toESM(require("zod/v4"));
51
+
52
+ // ../commons/src/authentication.ts
53
+ var import_jwt_decode = __toESM(require("jwt-decode"));
54
+ var z3 = __toESM(require("zod/v4"));
55
+
56
+ // ../commons/src/scopes.ts
57
+ var z2 = __toESM(require("zod/v4"));
58
+ var qs = __toESM(require("qs"));
59
+
60
+ // ../commons/src/uuid.ts
61
+ var import_uuid = require("uuid");
50
62
  var z = __toESM(require("zod/v4"));
51
- var UserAuditRecordInput = z.discriminatedUnion("operation", [
52
- z.object({
53
- operation: z.literal("user.create_user"),
54
- requestData: z.object({
55
- subjectId: z.string(),
56
- role: z.string(),
57
- primaryOfficeId: z.string()
58
- }),
59
- responseSummary: z.object({})
60
- }),
61
- z.object({
62
- operation: z.literal("user.deactivate"),
63
- requestData: z.object({
64
- subjectId: z.string(),
65
- reason: z.string(),
66
- comment: z.string().optional()
67
- }),
68
- responseSummary: z.object({})
69
- }),
70
- z.object({
71
- operation: z.literal("user.reactivate"),
72
- requestData: z.object({
73
- subjectId: z.string(),
74
- reason: z.string(),
75
- comment: z.string().optional()
76
- }),
77
- responseSummary: z.object({})
78
- }),
79
- z.object({
80
- operation: z.literal("user.edit_user"),
81
- requestData: z.object({ subjectId: z.string() }),
82
- responseSummary: z.object({})
83
- }),
84
- z.object({
85
- operation: z.literal("user.email_address_changed"),
86
- requestData: z.object({ subjectId: z.string() }),
87
- responseSummary: z.object({ email: z.string() })
63
+ var UUID = z.uuid().brand("UUID");
64
+ function getUUID() {
65
+ return (0, import_uuid.v4)();
66
+ }
67
+
68
+ // ../commons/src/scopes.ts
69
+ var JurisdictionFilter = z2.enum(["administrativeArea", "location", "all"]).describe(
70
+ "Filters based on user jurisdiction relative to their office location in hierarchy."
71
+ );
72
+ var UserFilter = z2.enum(["user"]).describe("Filters based on the user. Limits to self.");
73
+ var RecordScopeTypeV2 = z2.enum([
74
+ "record.search",
75
+ "record.create",
76
+ "record.read",
77
+ "record.declare",
78
+ "record.notify",
79
+ "record.edit",
80
+ "record.reject",
81
+ "record.archive",
82
+ "record.review-duplicates",
83
+ "record.register",
84
+ "record.print-certified-copies",
85
+ "record.request-correction",
86
+ "record.correct",
87
+ "record.unassign-others",
88
+ "record.custom-action"
89
+ ]);
90
+ var PlainScopeType = z2.enum([
91
+ // Misc. system scopes
92
+ "bypassratelimit",
93
+ "record.reindex",
94
+ "user.data-seeding",
95
+ "integration.create",
96
+ "record.import",
97
+ "config.update-all",
98
+ "attachment.upload",
99
+ "profile.electronic-signature",
100
+ "user.read-only-my-audit",
101
+ // Performance dashboard
102
+ "performance.read",
103
+ "performance.read-dashboards",
104
+ "performance.vital-statistics-export",
105
+ // Scopes used exclusively by countryconfig integration token
106
+ "record.confirm-registration",
107
+ "record.reject-registration"
108
+ ]);
109
+ var scopeByEvent = z2.preprocess(
110
+ (val) => val === void 0 ? void 0 : [val].flat(),
111
+ z2.array(z2.string()).optional()
112
+ ).describe("Event type, e.g. birth, death");
113
+ var scopeOptionsPlaceEvent = z2.object({
114
+ event: scopeByEvent,
115
+ placeOfEvent: JurisdictionFilter.optional()
116
+ }).describe("Options applicable to all record scopes.");
117
+ var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
118
+ declaredIn: JurisdictionFilter.optional(),
119
+ declaredBy: UserFilter.optional()
120
+ }).describe("Options applicable to actions that may take place after DECLARE");
121
+ var AllRecordScopeOptions = scopeOptionsDeclared.extend({
122
+ registeredIn: JurisdictionFilter.optional(),
123
+ registeredBy: UserFilter.optional()
124
+ }).describe(
125
+ "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
126
+ );
127
+ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
128
+ customActionTypes: z2.preprocess(
129
+ (val) => val === void 0 ? void 0 : [val].flat(),
130
+ z2.array(z2.string()).optional()
131
+ ).describe("Allowed custom action types")
132
+ });
133
+ var AccessLevelOptions = z2.object({
134
+ accessLevel: JurisdictionFilter.optional()
135
+ });
136
+ var WorkqueueOrDashboardOptions = z2.object({
137
+ ids: z2.preprocess(
138
+ (val) => val === void 0 ? void 0 : [val].flat(),
139
+ z2.array(z2.string())
140
+ ).describe("Must contain a list of workqueue or dashboard ids.")
141
+ });
142
+ var AllScopeOptions = z2.object({
143
+ ...AllRecordScopeOptions.shape,
144
+ ...AccessLevelOptions.shape,
145
+ ...WorkqueueOrDashboardOptions.shape
146
+ });
147
+ var ScopeOptionKey = AllScopeOptions.keyof();
148
+ var ResolvedScopeOptionsPlaceEvent = z2.object({
149
+ event: scopeByEvent,
150
+ placeOfEvent: UUID.nullish()
151
+ }).describe(
152
+ "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
153
+ );
154
+ var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
155
+ declaredIn: UUID.nullish(),
156
+ declaredBy: z2.string().optional()
157
+ }).describe(
158
+ "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
159
+ );
160
+ var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
161
+ registeredIn: UUID.nullish(),
162
+ registeredBy: z2.string().optional()
163
+ }).describe(
164
+ "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
165
+ );
166
+ var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
167
+ "record.create",
168
+ "record.declare",
169
+ "record.notify"
170
+ ]);
171
+ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
172
+ "record.edit",
173
+ "record.reject",
174
+ "record.archive",
175
+ "record.review-duplicates",
176
+ "record.register"
177
+ ]);
178
+ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
179
+ "record.search",
180
+ "record.read",
181
+ "record.request-correction",
182
+ "record.correct",
183
+ "record.unassign-others"
184
+ ]);
185
+ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
186
+ templates: z2.preprocess(
187
+ (val) => val === void 0 ? void 0 : [val].flat(),
188
+ z2.array(z2.string()).optional()
189
+ ).describe(
190
+ "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
191
+ )
192
+ });
193
+ var RecordScopeV2 = z2.discriminatedUnion("type", [
194
+ z2.object({
195
+ type: ScopesWithPlaceEventOptions,
196
+ options: scopeOptionsPlaceEvent.optional()
88
197
  }),
89
- z.object({
90
- operation: z.literal("user.logged_in"),
91
- requestData: z.object({ subjectId: z.string() }),
92
- responseSummary: z.object({})
198
+ z2.object({
199
+ type: ScopesWithDeclaredOptions,
200
+ options: scopeOptionsDeclared.optional()
93
201
  }),
94
- z.object({
95
- operation: z.literal("user.logged_out"),
96
- requestData: z.object({ subjectId: z.string() }),
97
- responseSummary: z.object({})
202
+ z2.object({
203
+ type: ScopesWithFullOptions,
204
+ options: AllRecordScopeOptions.optional()
98
205
  }),
99
- z.object({
100
- operation: z.literal("user.password_changed"),
101
- requestData: z.object({ subjectId: z.string() }),
102
- responseSummary: z.object({})
206
+ z2.object({
207
+ type: z2.literal("record.custom-action"),
208
+ options: CustomActionScopeOptions.optional()
103
209
  }),
104
- z.object({
105
- operation: z.literal("user.password_reset"),
106
- requestData: z.object({ subjectId: z.string() }),
107
- responseSummary: z.object({})
210
+ z2.object({
211
+ type: z2.literal("record.print-certified-copies"),
212
+ options: ScopeOptionsPrintCertifiedCopies.optional()
213
+ })
214
+ ]).describe(
215
+ "Scopes used to check user's permission to perform actions on a record."
216
+ );
217
+ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
218
+ z2.object({
219
+ type: ScopesWithPlaceEventOptions,
220
+ options: ResolvedScopeOptionsPlaceEvent.optional()
108
221
  }),
109
- z.object({
110
- operation: z.literal("user.password_reset_by_admin"),
111
- requestData: z.object({ subjectId: z.string() }),
112
- responseSummary: z.object({})
222
+ z2.object({
223
+ type: ScopesWithDeclaredOptions,
224
+ options: ResolvedScopeOptionsDeclared.optional()
113
225
  }),
114
- z.object({
115
- operation: z.literal("user.phone_number_changed"),
116
- requestData: z.object({ subjectId: z.string() }),
117
- responseSummary: z.object({ phoneNumber: z.string() })
226
+ z2.object({
227
+ type: ScopesWithFullOptions,
228
+ options: ResolvedScopeOptionsFull.optional()
118
229
  }),
119
- z.object({
120
- operation: z.literal("user.username_reminder"),
121
- requestData: z.object({ subjectId: z.string() }),
122
- responseSummary: z.object({})
230
+ z2.object({
231
+ type: z2.literal("record.print-certified-copies"),
232
+ options: ResolvedScopeOptionsFull.extend({
233
+ templates: z2.array(z2.string()).optional()
234
+ }).optional()
235
+ })
236
+ ]).describe("Resolved scope with location/user IDs instead of filters.");
237
+ var SystemScopeType = z2.enum([
238
+ "organisation.read-locations",
239
+ "user.read",
240
+ "user.create",
241
+ "user.edit"
242
+ ]);
243
+ var Scope = z2.discriminatedUnion("type", [
244
+ z2.object({ type: PlainScopeType }),
245
+ ...RecordScopeV2.options,
246
+ z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
247
+ z2.object({
248
+ type: z2.literal("workqueue"),
249
+ options: WorkqueueOrDashboardOptions
123
250
  }),
124
- z.object({
125
- operation: z.literal("user.username_reminder_by_admin"),
126
- requestData: z.object({ subjectId: z.string() }),
127
- responseSummary: z.object({})
251
+ z2.object({
252
+ type: z2.literal("dashboard.view"),
253
+ options: WorkqueueOrDashboardOptions
128
254
  })
129
255
  ]);
256
+ var ScopeType = z2.enum([
257
+ ...SystemScopeType.options,
258
+ ...RecordScopeTypeV2.options,
259
+ ...PlainScopeType.options,
260
+ "workqueue",
261
+ "dashboard.view"
262
+ ]);
263
+ var EncodedScope = z2.string().brand("EncodedScope");
264
+ var DEFAULT_SCOPE_OPTIONS = {
265
+ placeOfEvent: JurisdictionFilter.enum.all,
266
+ accessLevel: JurisdictionFilter.enum.all
267
+ };
130
268
 
131
- // ../commons/src/events/Constants.ts
132
- var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
133
- var CHILD_ONBOARDING_EVENT = "child-onboarding";
134
-
135
- // ../commons/src/events/ActionConfig.ts
136
- var z25 = __toESM(require("zod/v4"));
137
-
138
- // ../commons/src/events/TranslationConfig.ts
139
- var z2 = __toESM(require("zod/v4"));
140
- var TranslationConfig = z2.object({
141
- id: z2.string().describe(
142
- "The identifier of the translation referred in translation CSV files"
143
- ),
144
- defaultMessage: z2.string().describe("Default translation message"),
145
- description: z2.string().describe(
146
- "Describe the translation for a translator to be able to identify it."
147
- )
148
- }).meta({
149
- description: "Translation configuration",
150
- id: "TranslationConfig"
151
- });
269
+ // ../commons/src/authentication.ts
270
+ var TokenUserType = z3.enum(["user", "system"]);
271
+ var TokenWithBearer = z3.string().regex(/^Bearer\s/);
152
272
 
153
273
  // ../commons/src/events/ActionType.ts
154
- var z3 = __toESM(require("zod/v4"));
274
+ var z4 = __toESM(require("zod/v4"));
155
275
  var ActionType = {
156
276
  // Pre-declaration actions
157
277
  DELETE: "DELETE",
@@ -193,7 +313,7 @@ var ConfirmableActions = [
193
313
  ActionType.REJECT_CORRECTION,
194
314
  ActionType.CUSTOM
195
315
  ];
196
- var ActionTypes = z3.enum([
316
+ var ActionTypes = z4.enum([
197
317
  "DELETE",
198
318
  "CREATE",
199
319
  "NOTIFY",
@@ -257,12 +377,225 @@ var META_ACTIONS = [
257
377
  ActionType.READ
258
378
  ];
259
379
 
380
+ // ../commons/src/events/AuditLog.ts
381
+ var AuditLogEntryBase = z5.object({
382
+ id: z5.string(),
383
+ clientId: z5.string(),
384
+ clientType: TokenUserType,
385
+ createdAt: z5.string()
386
+ });
387
+ var EventCreateEntrySchema = AuditLogEntryBase.extend({
388
+ operation: z5.literal("event.create"),
389
+ requestData: z5.object({
390
+ transactionId: z5.string(),
391
+ type: z5.string(),
392
+ createdAtLocation: z5.string().nullable()
393
+ }),
394
+ responseSummary: z5.object({
395
+ eventId: z5.string(),
396
+ trackingId: z5.string()
397
+ })
398
+ });
399
+ var EventGetEntrySchema = AuditLogEntryBase.extend({
400
+ operation: z5.literal("event.get"),
401
+ requestData: z5.object({ eventId: z5.string() }),
402
+ responseSummary: z5.object({
403
+ eventType: z5.string(),
404
+ trackingId: z5.string()
405
+ })
406
+ });
407
+ var EventSearchEntrySchema = AuditLogEntryBase.extend({
408
+ operation: z5.literal("event.search"),
409
+ clientType: z5.literal("system"),
410
+ requestData: z5.object({
411
+ query: z5.record(z5.string(), z5.unknown()).nullable(),
412
+ limit: z5.number().nullable(),
413
+ offset: z5.number().nullable()
414
+ }),
415
+ responseSummary: z5.object({
416
+ total: z5.number(),
417
+ eventIds: z5.array(z5.string())
418
+ })
419
+ });
420
+ var EventActionEntrySchema = AuditLogEntryBase.extend({
421
+ operation: z5.enum([
422
+ "event.actions.notify.request",
423
+ "event.actions.declare.request",
424
+ "event.actions.register.request",
425
+ "event.actions.reject.request",
426
+ "event.actions.validate.request",
427
+ "event.actions.edit.request",
428
+ "event.actions.assign.request",
429
+ "event.actions.unassign.request",
430
+ "event.actions.read.request",
431
+ "event.actions.archive.request",
432
+ "event.actions.reinstate.request",
433
+ "event.actions.print_certificate.request",
434
+ "event.actions.correction.request.request",
435
+ "event.actions.correction.approve.request",
436
+ "event.actions.correction.reject.request",
437
+ "event.actions.mark_as_duplicate.request",
438
+ "event.actions.mark_as_not_duplicate.request"
439
+ ]),
440
+ requestData: z5.object({
441
+ eventId: z5.string(),
442
+ actionType: z5.string(),
443
+ eventType: z5.string(),
444
+ trackingId: z5.string(),
445
+ transactionId: z5.string()
446
+ })
447
+ });
448
+ var EventCustomActionEntrySchema = AuditLogEntryBase.extend({
449
+ operation: z5.literal("event.actions.custom.request"),
450
+ requestData: z5.object({
451
+ eventId: z5.string(),
452
+ actionType: z5.literal(ActionType.CUSTOM),
453
+ customAction: z5.string(),
454
+ eventType: z5.string(),
455
+ trackingId: z5.string(),
456
+ transactionId: z5.string()
457
+ })
458
+ });
459
+ var IntegrationCreateEntrySchema = AuditLogEntryBase.extend({
460
+ operation: z5.literal("integrations.create"),
461
+ requestData: z5.object({ name: z5.string(), scopes: z5.array(z5.string()) }),
462
+ responseSummary: z5.object({ clientId: z5.string() })
463
+ });
464
+ var IntegrationRefreshTokenEntrySchema = AuditLogEntryBase.extend({
465
+ operation: z5.literal("integrations.refreshToken"),
466
+ requestData: z5.object({ clientId: z5.string() }),
467
+ responseSummary: z5.object({ clientId: z5.string() })
468
+ });
469
+ var IntegrationDeactivateEntrySchema = AuditLogEntryBase.extend({
470
+ operation: z5.literal("integrations.deactivate"),
471
+ requestData: z5.object({ id: z5.string() }),
472
+ responseSummary: z5.object({ id: z5.string(), status: z5.string() })
473
+ });
474
+ var IntegrationActivateEntrySchema = AuditLogEntryBase.extend({
475
+ operation: z5.literal("integrations.activate"),
476
+ requestData: z5.object({ id: z5.string() }),
477
+ responseSummary: z5.object({ id: z5.string(), status: z5.string() })
478
+ });
479
+ var IntegrationDeleteEntrySchema = AuditLogEntryBase.extend({
480
+ operation: z5.literal("integrations.delete"),
481
+ requestData: z5.object({ id: z5.string() }),
482
+ responseSummary: z5.object({ id: z5.string(), name: z5.string() })
483
+ });
484
+ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
485
+ operation: z5.literal("integrations.refreshSecret"),
486
+ requestData: z5.object({ id: z5.string() }),
487
+ responseSummary: z5.object({ clientId: z5.string() })
488
+ });
489
+ var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
490
+ operation: z5.literal("attachments.upload"),
491
+ requestData: z5.object({
492
+ transactionId: z5.string(),
493
+ path: z5.string().nullable()
494
+ }),
495
+ responseSummary: z5.object({ fileUrl: z5.string() })
496
+ });
497
+ var subjectOnly = z5.object({ subjectId: z5.string() });
498
+ var subjectWithReason = z5.object({
499
+ subjectId: z5.string(),
500
+ reason: z5.string(),
501
+ comment: z5.string().optional()
502
+ });
503
+ var UserCreateEntrySchema = AuditLogEntryBase.extend({
504
+ operation: z5.literal("user.create_user"),
505
+ requestData: z5.object({
506
+ subjectId: z5.string(),
507
+ role: z5.string(),
508
+ primaryOfficeId: z5.string()
509
+ })
510
+ });
511
+ var UserReasonEntrySchema = AuditLogEntryBase.extend({
512
+ operation: z5.enum(["user.deactivate", "user.reactivate"]),
513
+ requestData: subjectWithReason
514
+ });
515
+ var UserSubjectOnlyEntrySchema = AuditLogEntryBase.extend({
516
+ operation: z5.enum([
517
+ "user.edit_user",
518
+ "user.logged_in",
519
+ "user.logged_out",
520
+ "user.password_changed",
521
+ "user.password_reset",
522
+ "user.password_reset_by_admin",
523
+ "user.username_reminder",
524
+ "user.username_reminder_by_admin"
525
+ ]),
526
+ requestData: subjectOnly
527
+ });
528
+ var UserEmailChangedEntrySchema = AuditLogEntryBase.extend({
529
+ operation: z5.literal("user.email_address_changed"),
530
+ requestData: subjectOnly,
531
+ responseSummary: z5.object({ email: z5.string() })
532
+ });
533
+ var UserPhoneChangedEntrySchema = AuditLogEntryBase.extend({
534
+ operation: z5.literal("user.phone_number_changed"),
535
+ requestData: subjectOnly,
536
+ responseSummary: z5.object({ phoneNumber: z5.string() })
537
+ });
538
+ var userBaseOmit = {
539
+ id: true,
540
+ clientId: true,
541
+ clientType: true,
542
+ createdAt: true
543
+ };
544
+ var UserAuditRecordInput = z5.discriminatedUnion("operation", [
545
+ UserCreateEntrySchema.omit(userBaseOmit),
546
+ UserReasonEntrySchema.omit(userBaseOmit),
547
+ UserSubjectOnlyEntrySchema.omit(userBaseOmit),
548
+ UserEmailChangedEntrySchema.omit(userBaseOmit),
549
+ UserPhoneChangedEntrySchema.omit(userBaseOmit)
550
+ ]);
551
+ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
552
+ EventCreateEntrySchema,
553
+ EventGetEntrySchema,
554
+ EventSearchEntrySchema,
555
+ EventActionEntrySchema,
556
+ EventCustomActionEntrySchema,
557
+ IntegrationCreateEntrySchema,
558
+ IntegrationRefreshTokenEntrySchema,
559
+ IntegrationDeactivateEntrySchema,
560
+ IntegrationActivateEntrySchema,
561
+ IntegrationDeleteEntrySchema,
562
+ IntegrationRefreshSecretEntrySchema,
563
+ AttachmentUploadEntrySchema,
564
+ UserCreateEntrySchema,
565
+ UserReasonEntrySchema,
566
+ UserSubjectOnlyEntrySchema,
567
+ UserEmailChangedEntrySchema,
568
+ UserPhoneChangedEntrySchema
569
+ ]);
570
+
571
+ // ../commons/src/events/Constants.ts
572
+ var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
573
+ var CHILD_ONBOARDING_EVENT = "child-onboarding";
574
+
575
+ // ../commons/src/events/ActionConfig.ts
576
+ var z24 = __toESM(require("zod/v4"));
577
+
578
+ // ../commons/src/events/TranslationConfig.ts
579
+ var z6 = __toESM(require("zod/v4"));
580
+ var TranslationConfig = z6.object({
581
+ id: z6.string().describe(
582
+ "The identifier of the translation referred in translation CSV files"
583
+ ),
584
+ defaultMessage: z6.string().describe("Default translation message"),
585
+ description: z6.string().describe(
586
+ "Describe the translation for a translator to be able to identify it."
587
+ )
588
+ }).meta({
589
+ description: "Translation configuration",
590
+ id: "TranslationConfig"
591
+ });
592
+
260
593
  // ../commons/src/events/FieldConfig.ts
261
594
  var import_v43 = __toESM(require("zod/v4"));
262
595
 
263
596
  // ../commons/src/events/Conditional.ts
264
- var z4 = __toESM(require("zod/v4"));
265
- var Conditional = z4.any().describe("JSONSchema").meta({
597
+ var z7 = __toESM(require("zod/v4"));
598
+ var Conditional = z7.any().describe("JSONSchema").meta({
266
599
  description: "JSON schema conditional configuration",
267
600
  id: "Conditional"
268
601
  });
@@ -271,31 +604,31 @@ var ConditionalType = {
271
604
  ENABLE: "ENABLE",
272
605
  DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
273
606
  };
274
- var ShowConditional = z4.object({
275
- type: z4.literal(ConditionalType.SHOW),
607
+ var ShowConditional = z7.object({
608
+ type: z7.literal(ConditionalType.SHOW),
276
609
  conditional: Conditional
277
610
  }).describe(
278
611
  "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
279
612
  );
280
- var EnableConditional = z4.object({
281
- type: z4.literal(ConditionalType.ENABLE),
613
+ var EnableConditional = z7.object({
614
+ type: z7.literal(ConditionalType.ENABLE),
282
615
  conditional: Conditional
283
616
  }).describe(
284
617
  "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
285
618
  );
286
- var ActionConditional = z4.discriminatedUnion("type", [
619
+ var ActionConditional = z7.discriminatedUnion("type", [
287
620
  // Action can be shown / hidden
288
621
  ShowConditional,
289
622
  // Action can be shown to the user in the list but as disabled
290
623
  EnableConditional
291
624
  ]);
292
- var DisplayOnReviewConditional = z4.object({
293
- type: z4.literal(ConditionalType.DISPLAY_ON_REVIEW),
625
+ var DisplayOnReviewConditional = z7.object({
626
+ type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
294
627
  conditional: Conditional
295
628
  }).describe(
296
629
  "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."
297
630
  );
298
- var FieldConditional = z4.discriminatedUnion("type", [
631
+ var FieldConditional = z7.discriminatedUnion("type", [
299
632
  // Field input can be shown / hidden
300
633
  ShowConditional,
301
634
  // Field input can be shown to the user but as disabled
@@ -308,7 +641,7 @@ var FieldConditional = z4.discriminatedUnion("type", [
308
641
  });
309
642
 
310
643
  // ../commons/src/events/FieldType.ts
311
- var z5 = __toESM(require("zod/v4"));
644
+ var z8 = __toESM(require("zod/v4"));
312
645
  var FieldType = {
313
646
  NAME: "NAME",
314
647
  PHONE: "PHONE",
@@ -348,6 +681,7 @@ var FieldType = {
348
681
  SIGNATURE: "SIGNATURE",
349
682
  DATA: "DATA",
350
683
  BUTTON: "BUTTON",
684
+ AUTOCOMPLETE: "AUTOCOMPLETE",
351
685
  SEARCH: "SEARCH",
352
686
  ALPHA_PRINT_BUTTON: "ALPHA_PRINT_BUTTON",
353
687
  HTTP: "HTTP",
@@ -371,7 +705,7 @@ var FieldType = {
371
705
  */
372
706
  _EXPERIMENTAL_CUSTOM: "CUSTOM"
373
707
  };
374
- var FileFieldType = z5.enum([
708
+ var FileFieldType = z8.enum([
375
709
  FieldType.FILE,
376
710
  FieldType.FILE_WITH_OPTIONS,
377
711
  FieldType.SIGNATURE
@@ -402,154 +736,159 @@ var FieldTypesToHideInReview = [
402
736
  ];
403
737
 
404
738
  // ../commons/src/events/FieldValue.ts
405
- var z9 = __toESM(require("zod/v4"));
739
+ var z12 = __toESM(require("zod/v4"));
406
740
 
407
741
  // ../commons/src/documents.ts
408
- var z6 = __toESM(require("zod/v4"));
409
- var FullDocumentUrl = z6.string().brand("FullDocumentUrl").describe(
742
+ var z9 = __toESM(require("zod/v4"));
743
+ var FullDocumentUrl = z9.string().brand("FullDocumentUrl").describe(
410
744
  "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"
411
745
  );
412
- var FullDocumentPath = z6.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
746
+ var FullDocumentPath = z9.string().overwrite((val) => val.startsWith("/") ? val : `/${val}`).meta({ effectType: "input", type: "string" }).describe(
413
747
  "A full absolute path with bucket name, starting from the root of the S3 server, /bucket-name/document-id.jpg"
414
748
  );
415
- var DocumentPath = z6.string().brand("DocumentPath").describe(
749
+ var DocumentPath = z9.string().brand("DocumentPath").describe(
416
750
  "A relative path within the S3 bucket, never starting with /. e.g. document-id.jpg or directory/document-id.jpg. The document service constructs the full /bucket/path internally."
417
751
  );
418
752
 
419
753
  // ../commons/src/events/CompositeFieldValue.ts
420
- var z7 = __toESM(require("zod/v4"));
754
+ var z10 = __toESM(require("zod/v4"));
421
755
  var AddressType = {
422
756
  DOMESTIC: "DOMESTIC",
423
757
  INTERNATIONAL: "INTERNATIONAL"
424
758
  };
425
- var FileFieldValue = z7.object({
759
+ var FileFieldValue = z10.object({
426
760
  path: DocumentPath,
427
- originalFilename: z7.string(),
428
- type: z7.string()
429
- });
430
- var NameFieldValue = z7.object({
431
- firstname: z7.string(),
432
- surname: z7.string(),
433
- middlename: z7.string().optional()
434
- });
435
- var NameFieldUpdateValue = z7.object({
436
- firstname: z7.string().nullish(),
437
- surname: z7.string().nullish(),
438
- middlename: z7.string().nullish()
439
- }).or(z7.null()).or(z7.undefined());
440
- var StreetLevelDetailsValue = z7.record(z7.string(), z7.string()).optional();
441
- var StreetLevelDetailsUpdateValue = z7.record(z7.string(), z7.string().nullable()).nullish();
442
- var BaseAddressFieldValue = z7.object({
443
- country: z7.string(),
761
+ originalFilename: z10.string(),
762
+ type: z10.string()
763
+ });
764
+ var NameFieldValue = z10.object({
765
+ firstname: z10.string(),
766
+ surname: z10.string(),
767
+ middlename: z10.string().optional()
768
+ });
769
+ var NameFieldUpdateValue = z10.object({
770
+ firstname: z10.string().nullish(),
771
+ surname: z10.string().nullish(),
772
+ middlename: z10.string().nullish()
773
+ }).or(z10.null()).or(z10.undefined());
774
+ var StreetLevelDetailsValue = z10.record(z10.string(), z10.string()).optional();
775
+ var StreetLevelDetailsUpdateValue = z10.record(z10.string(), z10.string().nullable()).nullish();
776
+ var BaseAddressFieldValue = z10.object({
777
+ country: z10.string(),
444
778
  streetLevelDetails: StreetLevelDetailsValue
445
779
  });
446
- var BaseAddressFieldUpdateValue = z7.object({
447
- country: z7.string().nullish(),
780
+ var BaseAddressFieldUpdateValue = z10.object({
781
+ country: z10.string().nullish(),
448
782
  streetLevelDetails: StreetLevelDetailsUpdateValue
449
783
  });
450
784
  var DomesticAddressFieldValue = BaseAddressFieldValue.extend({
451
- addressType: z7.literal(AddressType.DOMESTIC),
452
- administrativeArea: z7.string().uuid()
785
+ addressType: z10.literal(AddressType.DOMESTIC),
786
+ administrativeArea: z10.string().uuid()
453
787
  });
454
788
  var InternationalAddressFieldValue = BaseAddressFieldValue.extend({
455
- addressType: z7.literal(AddressType.INTERNATIONAL)
789
+ addressType: z10.literal(AddressType.INTERNATIONAL)
456
790
  });
457
- var AddressFieldValue = z7.discriminatedUnion("addressType", [
791
+ var AddressFieldValue = z10.discriminatedUnion("addressType", [
458
792
  DomesticAddressFieldValue,
459
793
  InternationalAddressFieldValue
460
794
  ]);
461
795
  var DomesticAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend({
462
- addressType: z7.literal(AddressType.DOMESTIC),
463
- administrativeArea: z7.string().uuid().nullish()
796
+ addressType: z10.literal(AddressType.DOMESTIC),
797
+ administrativeArea: z10.string().uuid().nullish()
464
798
  /* Leaf level admin structure */
465
799
  });
466
800
  var InternationalAddressUpdateFieldValue = BaseAddressFieldUpdateValue.extend(
467
801
  {
468
- addressType: z7.literal(AddressType.INTERNATIONAL)
802
+ addressType: z10.literal(AddressType.INTERNATIONAL)
469
803
  }
470
804
  );
471
- var AddressFieldUpdateValue = z7.discriminatedUnion("addressType", [
805
+ var AddressFieldUpdateValue = z10.discriminatedUnion("addressType", [
472
806
  DomesticAddressUpdateFieldValue,
473
807
  InternationalAddressUpdateFieldValue
474
808
  ]).nullish();
475
- var FileFieldValueWithOption = z7.object({
809
+ var FileFieldValueWithOption = z10.object({
476
810
  path: DocumentPath,
477
- originalFilename: z7.string(),
478
- type: z7.string(),
479
- option: z7.string()
480
- });
481
- var FileFieldWithOptionValue = z7.array(FileFieldValueWithOption);
482
- var HttpFieldValue = z7.object({
483
- loading: z7.boolean(),
484
- error: z7.object({ statusCode: z7.number(), message: z7.string() }).nullish(),
485
- data: z7.any()
486
- });
487
- var HttpFieldUpdateValue = z7.object({
488
- loading: z7.boolean().nullish(),
489
- error: z7.object({ statusCode: z7.number(), message: z7.string() }).nullish(),
490
- data: z7.any().nullish()
491
- }).or(z7.null()).or(z7.undefined());
492
- var QueryParamReaderFieldValue = z7.object({
493
- data: z7.record(z7.string(), z7.string()),
494
- updatedAt: z7.iso.datetime()
811
+ originalFilename: z10.string(),
812
+ type: z10.string(),
813
+ option: z10.string()
814
+ });
815
+ var FileFieldWithOptionValue = z10.array(FileFieldValueWithOption);
816
+ var HttpFieldValue = z10.object({
817
+ loading: z10.boolean(),
818
+ error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
819
+ data: z10.any()
820
+ });
821
+ var HttpFieldUpdateValue = z10.object({
822
+ loading: z10.boolean().nullish(),
823
+ error: z10.object({ statusCode: z10.number(), message: z10.string() }).nullish(),
824
+ data: z10.any().nullish()
825
+ }).or(z10.null()).or(z10.undefined());
826
+ var QueryParamReaderFieldValue = z10.object({
827
+ data: z10.record(z10.string(), z10.string()),
828
+ updatedAt: z10.iso.datetime()
495
829
  }).nullish();
496
- var QueryParamReaderFieldUpdateValue = z7.object({
497
- data: z7.record(z7.string(), z7.string())
830
+ var QueryParamReaderFieldUpdateValue = z10.object({
831
+ data: z10.record(z10.string(), z10.string())
498
832
  });
499
- var ReadDataValue = z7.object({
500
- data: z7.any()
833
+ var ReadDataValue = z10.object({
834
+ data: z10.any()
501
835
  });
502
836
  var QrReaderFieldValue = ReadDataValue;
503
837
  var IdReaderFieldValue = ReadDataValue;
504
- var NumberWithUnitFieldValue = z7.object({
505
- numericValue: z7.number(),
506
- unit: z7.string()
838
+ var NumberWithUnitFieldValue = z10.object({
839
+ numericValue: z10.number(),
840
+ unit: z10.string()
507
841
  });
508
- var NumberWithUnitFieldUpdateValue = z7.object({
509
- numericValue: z7.number().optional(),
510
- unit: z7.string().optional()
842
+ var NumberWithUnitFieldUpdateValue = z10.object({
843
+ numericValue: z10.number().optional(),
844
+ unit: z10.string().optional()
511
845
  });
512
- var CustomFieldValue = z7.unknown().brand("CustomFieldValue");
846
+ var CustomFieldValue = z10.unknown().brand("CustomFieldValue");
513
847
 
514
848
  // ../commons/src/events/PlainDate.ts
515
849
  var import_zod = require("zod");
516
850
  var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
517
851
 
518
852
  // ../commons/src/events/FieldValue.ts
519
- var TextValue = z9.string();
520
- var HiddenFieldValue = z9.string();
853
+ var TextValue = z12.string();
854
+ var HiddenFieldValue = z12.string();
521
855
  var NonEmptyTextValue = TextValue.min(1);
522
- var DateValue = z9.iso.date().describe("Date in the format YYYY-MM-DD");
523
- var AgeValue = z9.object({
524
- age: z9.number(),
525
- asOfDateRef: z9.string()
856
+ var DateValue = z12.iso.date().describe("Date in the format YYYY-MM-DD");
857
+ var AgeValue = z12.object({
858
+ age: z12.number(),
859
+ asOfDateRef: z12.string()
526
860
  });
527
861
  var AgeUpdateValue = AgeValue.optional().nullable();
528
- var TimeValue = z9.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
529
- var DatetimeValue = z9.iso.datetime();
530
- var SelectDateRangeValue = z9.enum([
862
+ var AutocompleteValue = z12.object({
863
+ label: z12.string(),
864
+ value: z12.string()
865
+ });
866
+ var AutocompleteUpdateValue = AutocompleteValue.optional().nullable();
867
+ var TimeValue = z12.string().regex(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
868
+ var DatetimeValue = z12.iso.datetime();
869
+ var SelectDateRangeValue = z12.enum([
531
870
  "last7Days",
532
871
  "last30Days",
533
872
  "last90Days",
534
873
  "last365Days"
535
874
  ]);
536
- var DateRangeFieldValue = z9.object({
875
+ var DateRangeFieldValue = z12.object({
537
876
  start: PlainDate,
538
877
  end: PlainDate
539
878
  }).or(PlainDate).describe(
540
879
  "Date range with start and end dates in the format YYYY-MM-DD. Inclusive start, exclusive end."
541
880
  );
542
- var EmailValue = z9.email();
543
- var CheckboxFieldValue = z9.boolean();
544
- var NumberFieldValue = z9.number();
545
- var ButtonFieldValue = z9.number();
546
- var VerificationStatusValue = z9.enum([
881
+ var EmailValue = z12.email();
882
+ var CheckboxFieldValue = z12.boolean();
883
+ var NumberFieldValue = z12.number();
884
+ var ButtonFieldValue = z12.number();
885
+ var VerificationStatusValue = z12.enum([
547
886
  "verified",
548
887
  "authenticated",
549
888
  "failed",
550
889
  "pending"
551
890
  ]);
552
- var LeafFieldValues = z9.union([
891
+ var LeafFieldValues = z12.union([
553
892
  AddressFieldValue,
554
893
  TextValue,
555
894
  PlainDate,
@@ -571,13 +910,15 @@ var LeafFieldValues = z9.union([
571
910
  IdReaderFieldValue,
572
911
  NumberWithUnitFieldValue,
573
912
  NumberWithUnitFieldUpdateValue,
574
- CustomFieldValue
913
+ CustomFieldValue,
914
+ AutocompleteValue,
915
+ AutocompleteUpdateValue
575
916
  ]);
576
- var FieldGroupValue = z9.record(z9.string(), LeafFieldValues);
577
- var DataFieldValue = z9.object({
578
- data: z9.record(z9.string(), LeafFieldValues)
917
+ var FieldGroupValue = z12.record(z12.string(), LeafFieldValues);
918
+ var DataFieldValue = z12.object({
919
+ data: z12.record(z12.string(), LeafFieldValues)
579
920
  }).nullish();
580
- var FieldValue = z9.union([
921
+ var FieldValue = z12.union([
581
922
  LeafFieldValues,
582
923
  DataFieldValue,
583
924
  FieldGroupValue
@@ -608,28 +949,20 @@ function schemaPriority(schema) {
608
949
  return idx === -1 ? 9999 : idx;
609
950
  }
610
951
  function safeUnion(schemas) {
611
- return z9.any().superRefine((val, ctx) => {
612
- const successful = schemas.filter((s) => s.safeParse(val).success);
613
- if (successful.length === 1) {
614
- return;
615
- }
616
- if (successful.length === 0) {
617
- ctx.addIssue({
618
- code: "invalid_type",
619
- expected: "custom",
620
- message: "Value does not match any schema"
621
- });
622
- return;
623
- }
624
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
625
- const best = successful[0];
626
- if (!best.safeParse(val).success) {
627
- ctx.addIssue({
628
- expected: "custom",
629
- code: "invalid_type",
630
- message: "Value did not match the best schema"
631
- });
952
+ const sortedSchemas = [...schemas].sort(
953
+ (a, b) => schemaPriority(a) - schemaPriority(b)
954
+ );
955
+ return z12.any().superRefine((val, ctx) => {
956
+ for (const schema of sortedSchemas) {
957
+ if (schema.safeParse(val).success) {
958
+ return;
959
+ }
632
960
  }
961
+ ctx.addIssue({
962
+ code: "invalid_type",
963
+ expected: "custom",
964
+ message: "Value does not match any schema"
965
+ });
633
966
  }).meta({
634
967
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
635
968
  });
@@ -653,21 +986,14 @@ var FieldUpdateValue = safeUnion([
653
986
  HttpFieldUpdateValue.describe("HttpFieldUpdateValue"),
654
987
  QueryParamReaderFieldUpdateValue.describe("QueryParamReaderFieldUpdateValue"),
655
988
  CustomFieldValue.describe("CustomFieldValue"),
656
- HiddenFieldValue.describe("HiddenFieldValue")
989
+ HiddenFieldValue.describe("HiddenFieldValue"),
990
+ AutocompleteUpdateValue.describe("AutocompleteUpdateValue")
657
991
  ]);
658
992
 
659
- // ../commons/src/uuid.ts
660
- var import_uuid = require("uuid");
661
- var z10 = __toESM(require("zod/v4"));
662
- var UUID = z10.uuid().brand("UUID");
663
- function getUUID() {
664
- return (0, import_uuid.v4)();
665
- }
666
-
667
993
  // ../commons/src/events/serializers/user/serializer.ts
668
- var z11 = __toESM(require("zod/v4"));
669
- var SerializedUserField = z11.object({
670
- $userField: z11.enum([
994
+ var z13 = __toESM(require("zod/v4"));
995
+ var SerializedUserField = z13.object({
996
+ $userField: z13.enum([
671
997
  "id",
672
998
  "name",
673
999
  "role",
@@ -681,7 +1007,7 @@ var SerializedUserField = z11.object({
681
1007
  "primaryOfficeId",
682
1008
  "administrativeAreaId"
683
1009
  ]),
684
- $location: z11.string().optional()
1010
+ $location: z13.string().optional()
685
1011
  });
686
1012
  function userSerializer(userField) {
687
1013
  return {
@@ -704,514 +1030,14 @@ function userSerializer(userField) {
704
1030
  var import_v4 = require("zod/v4");
705
1031
 
706
1032
  // ../commons/src/events/EventMetadata.ts
707
- var z17 = __toESM(require("zod/v4"));
1033
+ var z16 = __toESM(require("zod/v4"));
708
1034
 
709
1035
  // ../commons/src/events/ActionDocument.ts
710
- var z15 = __toESM(require("zod/v4"));
711
-
712
- // ../commons/src/authentication.ts
713
- var import_jwt_decode = __toESM(require("jwt-decode"));
714
1036
  var z14 = __toESM(require("zod/v4"));
715
-
716
- // ../commons/src/scopes.ts
717
- var z13 = __toESM(require("zod/v4"));
718
- var qs = __toESM(require("qs"));
719
-
720
- // ../commons/src/scopes.deprecated.do-not-use.ts
721
- var z12 = __toESM(require("zod/v4"));
722
- var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
723
- var rawConfigurableScope = z12.string().regex(rawConfigurableScopeRegex);
724
- var SearchScope = z12.object({
725
- type: z12.literal("search"),
726
- options: z12.object({
727
- event: z12.array(z12.string()).length(1),
728
- access: z12.array(z12.enum(["my-jurisdiction", "all"])).length(1)
729
- })
730
- });
731
- var CreateUserScope = z12.object({
732
- type: z12.literal("user.create"),
733
- options: z12.object({
734
- role: z12.array(z12.string())
735
- })
736
- });
737
- var EditUserScope = z12.object({
738
- type: z12.literal("user.edit"),
739
- options: z12.object({
740
- role: z12.array(z12.string())
741
- })
742
- });
743
- var WorkqueueScope = z12.object({
744
- type: z12.literal("workqueue"),
745
- options: z12.object({
746
- id: z12.array(z12.string())
747
- })
748
- });
749
- var PrintCertifiedCopiesScope = z12.object({
750
- type: z12.literal("record.registered.print-certified-copies"),
751
- options: z12.object({
752
- event: z12.array(z12.string()).describe("Event type, e.g. birth, death"),
753
- templates: z12.array(z12.string()).optional().describe(
754
- "Template IDs for certified copies. If not provided, all templates will be used."
755
- )
756
- })
757
- });
758
- var LegacyRecordScope = z12.object({
759
- type: z12.enum([
760
- "record.create",
761
- "record.read",
762
- "record.declare",
763
- "record.notify",
764
- "record.declared.edit",
765
- "record.declared.validate",
766
- "record.declared.reject",
767
- "record.declared.archive",
768
- "record.declared.review-duplicates",
769
- "record.register",
770
- "record.registered.request-correction",
771
- "record.registered.correct",
772
- "record.unassign-others"
773
- ]),
774
- options: z12.object({
775
- event: z12.array(z12.string()).describe("Event type, e.g. birth, death")
776
- })
777
- }).describe(
778
- "Scopes used to check user's permission to perform actions on a record."
779
- );
780
- var ConfigurableRawScopes = z12.discriminatedUnion("type", [
781
- SearchScope,
782
- LegacyRecordScope,
783
- PrintCertifiedCopiesScope,
784
- CreateUserScope,
785
- EditUserScope,
786
- WorkqueueScope
787
- ]);
788
-
789
- // ../commons/src/scopes.ts
790
- var SCOPES = {
791
- // TODO v1.8 legacy scopes
792
- BYPASSRATELIMIT: "bypassratelimit",
793
- REGISTER: "register",
794
- DEMO: "demo",
795
- CONFIG: "config",
796
- // systems / integrations
797
- WEBHOOK: "webhook",
798
- NATIONALID: "nationalId",
799
- NOTIFICATION_API: "notification-api",
800
- RECORDSEARCH: "recordsearch",
801
- RECORD_IMPORT: "record.import",
802
- RECORD_EXPORT: "record.export",
803
- RECORD_REINDEX: "record.reindex",
804
- INTEGRATION_CREATE: "integration.create",
805
- // declare
806
- RECORD_DECLARE_BIRTH: "record.declare-birth",
807
- RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
808
- RECORD_DECLARE_DEATH: "record.declare-death",
809
- RECORD_DECLARE_DEATH_MY_JURISDICTION: "record.declare-death:my-jurisdiction",
810
- RECORD_DECLARE_MARRIAGE: "record.declare-marriage",
811
- RECORD_DECLARE_MARRIAGE_MY_JURISDICTION: "record.declare-marriage:my-jurisdiction",
812
- RECORD_SUBMIT_INCOMPLETE: "record.declaration-submit-incomplete",
813
- // @todo: should this record be removed from events v2?
814
- RECORD_SUBMIT_FOR_REVIEW: "record.declaration-submit-for-review",
815
- RECORD_UNASSIGN_OTHERS: "record.unassign-others",
816
- // validate
817
- RECORD_SUBMIT_FOR_APPROVAL: "record.declaration-submit-for-approval",
818
- RECORD_SUBMIT_FOR_UPDATES: "record.declaration-submit-for-updates",
819
- RECORD_DECLARATION_EDIT: "record.declaration-edit",
820
- RECORD_REVIEW_DUPLICATES: "record.review-duplicates",
821
- RECORD_DECLARATION_ARCHIVE: "record.declaration-archive",
822
- RECORD_DECLARATION_REINSTATE: "record.declaration-reinstate",
823
- // register
824
- RECORD_REGISTER: "record.register",
825
- /**
826
- * This scope is used to **print and **issue certified copies of a record
827
- * after it has been registered. Previously Registrars had this permission.
828
- */
829
- RECORD_PRINT_ISSUE_CERTIFIED_COPIES: "record.registration-print&issue-certified-copies",
830
- // correct
831
- RECORD_REGISTRATION_REQUEST_CORRECTION: "record.registration-request-correction",
832
- RECORD_REGISTRATION_CORRECT: "record.registration-correct",
833
- RECORD_CONFIRM_REGISTRATION: "record.confirm-registration",
834
- RECORD_REJECT_REGISTRATION: "record.reject-registration",
835
- // search
836
- SEARCH_BIRTH_MY_JURISDICTION: "search.birth:my-jurisdiction",
837
- SEARCH_BIRTH: "search.birth",
838
- SEARCH_DEATH_MY_JURISDICTION: "search.death:my-jurisdiction",
839
- SEARCH_DEATH: "search.death",
840
- SEARCH_MARRIAGE_MY_JURISDICTION: "search.marriage:my-jurisdiction",
841
- SEARCH_MARRIAGE: "search.marriage",
842
- // audit v1.8
843
- RECORD_READ: "record.read",
844
- // profile
845
- PROFILE_ELECTRONIC_SIGNATURE: "profile.electronic-signature",
846
- // performance
847
- PERFORMANCE_READ: "performance.read",
848
- PERFORMANCE_READ_DASHBOARDS: "performance.read-dashboards",
849
- PERFORMANCE_EXPORT_VITAL_STATISTICS: "performance.vital-statistics-export",
850
- // organisation
851
- ORGANISATION_READ_LOCATIONS: "organisation.read-locations:all",
852
- ORGANISATION_READ_LOCATIONS_MY_OFFICE: "organisation.read-locations:my-office",
853
- ORGANISATION_READ_LOCATIONS_MY_JURISDICTION: "organisation.read-locations:my-jurisdiction",
854
- // user
855
- USER_READ: "user.read:all",
856
- USER_READ_MY_OFFICE: "user.read:my-office",
857
- USER_READ_MY_JURISDICTION: "user.read:my-jurisdiction",
858
- USER_READ_ONLY_MY_AUDIT: "user.read:only-my-audit",
859
- //v1.8
860
- USER_CREATE: "user.create:all",
861
- USER_CREATE_MY_JURISDICTION: "user.create:my-jurisdiction",
862
- USER_UPDATE: "user.update:all",
863
- USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction",
864
- // config
865
- CONFIG_UPDATE_ALL: "config.update:all",
866
- // data seeding
867
- USER_DATA_SEEDING: "user.data-seeding",
868
- // attachment
869
- ATTACHMENT_UPLOAD: "attachment.upload"
870
- };
871
- var LegacyScopes = z13.union([
872
- z13.literal(SCOPES.BYPASSRATELIMIT),
873
- z13.literal(SCOPES.REGISTER),
874
- z13.literal(SCOPES.DEMO),
875
- z13.literal(SCOPES.CONFIG)
876
- ]);
877
- var IntegrationScopes = z13.union([
878
- z13.literal(SCOPES.WEBHOOK),
879
- z13.literal(SCOPES.NATIONALID),
880
- z13.literal(SCOPES.NOTIFICATION_API),
881
- z13.literal(SCOPES.RECORDSEARCH),
882
- z13.literal(SCOPES.INTEGRATION_CREATE)
883
- ]);
884
- var InternalOperationsScopes = z13.union([
885
- z13.literal(SCOPES.RECORD_REINDEX),
886
- z13.literal(SCOPES.RECORD_IMPORT)
887
- ]);
888
- var PerformanceScopes = z13.union([
889
- z13.literal(SCOPES.PERFORMANCE_READ),
890
- z13.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
891
- z13.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
892
- ]);
893
- var OrganisationScopes = z13.union([
894
- z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
895
- z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
896
- z13.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
897
- ]);
898
- var UserScopes = z13.union([
899
- z13.literal(SCOPES.USER_READ),
900
- z13.literal(SCOPES.USER_READ_MY_OFFICE),
901
- z13.literal(SCOPES.USER_READ_MY_JURISDICTION),
902
- z13.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
903
- z13.literal(SCOPES.USER_CREATE),
904
- z13.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
905
- z13.literal(SCOPES.USER_UPDATE),
906
- z13.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
907
- ]);
908
- var ConfigScope = z13.literal(SCOPES.CONFIG_UPDATE_ALL);
909
- var DataSeedingScope = z13.literal(SCOPES.USER_DATA_SEEDING);
910
- var AttachmentScope = z13.literal(SCOPES.ATTACHMENT_UPLOAD);
911
- var LiteralScopes = z13.union([
912
- LegacyScopes,
913
- IntegrationScopes,
914
- z13.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
915
- z13.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
916
- PerformanceScopes,
917
- OrganisationScopes,
918
- UserScopes,
919
- ConfigScope,
920
- DataSeedingScope,
921
- InternalOperationsScopes,
922
- AttachmentScope
923
- ]);
924
- var JurisdictionFilter = z13.enum(["administrativeArea", "location", "all"]).describe(
925
- "Filters based on user jurisdiction relative to their office location in hierarchy."
926
- );
927
- var UserFilter = z13.enum(["user"]).describe("Filters based on the user. Limits to self.");
928
- var RecordScopeTypeV2 = z13.enum([
929
- "record.search",
930
- "record.create",
931
- "record.read",
932
- "record.declare",
933
- "record.notify",
934
- "record.edit",
935
- "record.reject",
936
- "record.archive",
937
- "record.review-duplicates",
938
- "record.register",
939
- "record.print-certified-copies",
940
- "record.request-correction",
941
- "record.correct",
942
- "record.unassign-others",
943
- "record.custom-action"
944
- ]);
945
- var scopeByEvent = z13.preprocess(
946
- (val) => val === void 0 ? void 0 : [val].flat(),
947
- z13.array(z13.string()).optional()
948
- ).describe("Event type, e.g. birth, death");
949
- var scopeOptionsPlaceEvent = z13.object({
950
- event: scopeByEvent,
951
- placeOfEvent: JurisdictionFilter.optional()
952
- }).describe("Options applicable to all record scopes.");
953
- var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
954
- declaredIn: JurisdictionFilter.optional(),
955
- declaredBy: UserFilter.optional()
956
- }).describe("Options applicable to actions that may take place after DECLARE");
957
- var ScopeOptionsFull = scopeOptionsDeclared.extend({
958
- registeredIn: JurisdictionFilter.optional(),
959
- registeredBy: UserFilter.optional()
960
- }).describe(
961
- "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
962
- );
963
- var CustomActionScopeOptions = ScopeOptionsFull.extend({
964
- customActionTypes: z13.preprocess(
965
- (val) => val === void 0 ? void 0 : [val].flat(),
966
- z13.array(z13.string()).optional()
967
- ).describe("Allowed custom action types")
968
- });
969
- var ScopeOptionKey = ScopeOptionsFull.keyof();
970
- var ResolvedScopeOptionsPlaceEvent = z13.object({
971
- event: scopeByEvent,
972
- placeOfEvent: UUID.nullish()
973
- }).describe(
974
- "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
975
- );
976
- var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
977
- declaredIn: UUID.nullish(),
978
- declaredBy: z13.string().optional()
979
- }).describe(
980
- "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
981
- );
982
- var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
983
- registeredIn: UUID.nullish(),
984
- registeredBy: z13.string().optional()
985
- }).describe(
986
- "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
987
- );
988
- var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
989
- "record.create",
990
- "record.declare",
991
- "record.notify"
992
- ]);
993
- var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
994
- "record.edit",
995
- "record.reject",
996
- "record.archive",
997
- "record.review-duplicates",
998
- "record.register"
999
- ]);
1000
- var ScopesWithFullOptions = RecordScopeTypeV2.extract([
1001
- "record.search",
1002
- "record.read",
1003
- "record.request-correction",
1004
- "record.correct",
1005
- "record.unassign-others"
1006
- ]);
1007
- var ScopeOptionsPrintCertifiedCopies = ScopeOptionsFull.extend({
1008
- templates: z13.preprocess(
1009
- (val) => val === void 0 ? void 0 : [val].flat(),
1010
- z13.array(z13.string()).optional()
1011
- ).describe(
1012
- "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
1013
- )
1014
- });
1015
- var RecordScopeV2 = z13.discriminatedUnion("type", [
1016
- z13.object({
1017
- type: ScopesWithPlaceEventOptions,
1018
- options: scopeOptionsPlaceEvent.optional()
1019
- }),
1020
- z13.object({
1021
- type: ScopesWithDeclaredOptions,
1022
- options: scopeOptionsDeclared.optional()
1023
- }),
1024
- z13.object({
1025
- type: ScopesWithFullOptions,
1026
- options: ScopeOptionsFull.optional()
1027
- }),
1028
- z13.object({
1029
- type: z13.literal("record.custom-action"),
1030
- options: CustomActionScopeOptions.optional()
1031
- }),
1032
- z13.object({
1033
- type: z13.literal("record.print-certified-copies"),
1034
- options: ScopeOptionsPrintCertifiedCopies.optional()
1035
- })
1036
- ]).describe(
1037
- "Scopes used to check user's permission to perform actions on a record."
1038
- );
1039
- var ResolvedRecordScopeV2 = z13.discriminatedUnion("type", [
1040
- z13.object({
1041
- type: ScopesWithPlaceEventOptions,
1042
- options: ResolvedScopeOptionsPlaceEvent.optional()
1043
- }),
1044
- z13.object({
1045
- type: ScopesWithDeclaredOptions,
1046
- options: ResolvedScopeOptionsDeclared.optional()
1047
- }),
1048
- z13.object({
1049
- type: ScopesWithFullOptions,
1050
- options: ResolvedScopeOptionsFull.optional()
1051
- }),
1052
- z13.object({
1053
- type: z13.literal("record.print-certified-copies"),
1054
- options: ResolvedScopeOptionsFull.extend({
1055
- templates: z13.array(z13.string()).optional()
1056
- }).optional()
1057
- })
1058
- ]).describe("Resolved scope with location/user IDs instead of filters.");
1059
- var flattenScope = (scope) => ({
1060
- type: scope.type,
1061
- ...scope.options
1062
- });
1063
- var encodeScope = (scope) => {
1064
- const flattened = flattenScope(scope);
1065
- return qs.stringify(flattened, {
1066
- arrayFormat: "comma",
1067
- allowDots: true,
1068
- addQueryPrefix: false,
1069
- encode: false
1070
- });
1071
- };
1072
- var DEFAULT_SCOPE_OPTIONS = {
1073
- placeOfEvent: JurisdictionFilter.enum.all
1074
- };
1075
-
1076
- // ../commons/src/authentication.ts
1077
- var DEFAULT_ROLES_DEFINITION = [
1078
- {
1079
- id: "FIELD_AGENT",
1080
- label: {
1081
- defaultMessage: "Field Agent",
1082
- description: "Name for user role Field Agent",
1083
- id: "userRole.fieldAgent"
1084
- },
1085
- scopes: [
1086
- encodeScope({
1087
- type: "record.create",
1088
- options: {
1089
- event: ["birth", "death", "tennis-club-membership"]
1090
- }
1091
- }),
1092
- encodeScope({
1093
- type: "record.declare",
1094
- options: {
1095
- event: ["birth", "death", "tennis-club-membership"]
1096
- }
1097
- })
1098
- ]
1099
- },
1100
- {
1101
- id: "REGISTRATION_AGENT",
1102
- label: {
1103
- defaultMessage: "Registration Agent",
1104
- description: "Name for user role Registration Agent",
1105
- id: "userRole.registrationAgent"
1106
- },
1107
- scopes: [
1108
- encodeScope({
1109
- type: "record.create",
1110
- options: {
1111
- event: ["birth", "death", "tennis-club-membership"]
1112
- }
1113
- }),
1114
- encodeScope({
1115
- type: "record.declare",
1116
- options: {
1117
- event: ["birth", "death", "tennis-club-membership"]
1118
- }
1119
- }),
1120
- SCOPES.PERFORMANCE_READ,
1121
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1122
- SCOPES.ORGANISATION_READ_LOCATIONS,
1123
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE
1124
- ]
1125
- },
1126
- {
1127
- id: "LOCAL_REGISTRAR",
1128
- label: {
1129
- defaultMessage: "Local Registrar",
1130
- description: "Name for user role Local Registrar",
1131
- id: "userRole.localRegistrar"
1132
- },
1133
- scopes: [
1134
- encodeScope({
1135
- type: "record.create",
1136
- options: {
1137
- event: ["birth", "death", "tennis-club-membership"]
1138
- }
1139
- }),
1140
- encodeScope({
1141
- type: "record.declare",
1142
- options: {
1143
- event: ["birth", "death", "tennis-club-membership"]
1144
- }
1145
- }),
1146
- encodeScope({
1147
- type: "record.review-duplicates",
1148
- options: {
1149
- event: ["birth", "death", "tennis-club-membership"]
1150
- }
1151
- }),
1152
- SCOPES.PERFORMANCE_READ,
1153
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1154
- SCOPES.ORGANISATION_READ_LOCATIONS,
1155
- SCOPES.PROFILE_ELECTRONIC_SIGNATURE,
1156
- SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE
1157
- ]
1158
- },
1159
- {
1160
- id: "LOCAL_SYSTEM_ADMIN",
1161
- label: {
1162
- defaultMessage: "Local System Admin",
1163
- description: "Name for user role Local System Admin",
1164
- id: "userRole.localSystemAdmin"
1165
- },
1166
- scopes: [
1167
- SCOPES.USER_READ_MY_OFFICE,
1168
- SCOPES.USER_CREATE_MY_JURISDICTION,
1169
- SCOPES.USER_UPDATE_MY_JURISDICTION,
1170
- SCOPES.ORGANISATION_READ_LOCATIONS,
1171
- SCOPES.PERFORMANCE_READ,
1172
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1173
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1174
- ]
1175
- },
1176
- {
1177
- id: "NATIONAL_SYSTEM_ADMIN",
1178
- label: {
1179
- defaultMessage: "National System Admin",
1180
- description: "Name for user role National System Admin",
1181
- id: "userRole.nationalSystemAdmin"
1182
- },
1183
- scopes: [
1184
- SCOPES.USER_CREATE,
1185
- SCOPES.USER_READ,
1186
- SCOPES.USER_UPDATE,
1187
- SCOPES.ORGANISATION_READ_LOCATIONS,
1188
- SCOPES.PERFORMANCE_READ,
1189
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1190
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1191
- ]
1192
- },
1193
- {
1194
- id: "PERFORMANCE_MANAGER",
1195
- label: {
1196
- defaultMessage: "Performance Manager",
1197
- description: "Name for user role Performance Manager",
1198
- id: "userRole.performanceManager"
1199
- },
1200
- scopes: [
1201
- SCOPES.PERFORMANCE_READ,
1202
- SCOPES.PERFORMANCE_READ_DASHBOARDS,
1203
- SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS
1204
- ]
1205
- }
1206
- ];
1207
- var TokenUserType = z14.enum(["user", "system"]);
1208
- var TokenWithBearer = z14.string().regex(/^Bearer\s/);
1209
-
1210
- // ../commons/src/events/ActionDocument.ts
1211
- var ActionUpdate = z15.record(z15.string(), FieldUpdateValue).describe(
1037
+ var ActionUpdate = z14.record(z14.string(), FieldUpdateValue).describe(
1212
1038
  "Record of field-level changes made by an action. Supports partial updates and nullable values."
1213
1039
  );
1214
- var EventState = z15.record(z15.string(), FieldValue).describe(
1040
+ var EventState = z14.record(z14.string(), FieldValue).describe(
1215
1041
  "Aggregate representation of event data after all actions have been applied, with all updates consolidated and null values removed."
1216
1042
  );
1217
1043
  var ActionStatus = {
@@ -1219,15 +1045,15 @@ var ActionStatus = {
1219
1045
  Accepted: "Accepted",
1220
1046
  Rejected: "Rejected"
1221
1047
  };
1222
- var ActionBase = z15.object({
1048
+ var ActionBase = z14.object({
1223
1049
  id: UUID.describe("Unique identifier of the action."),
1224
- transactionId: z15.string().describe("Unique identifier of the transaction."),
1050
+ transactionId: z14.string().describe("Unique identifier of the transaction."),
1225
1051
  createdByUserType: TokenUserType.describe(
1226
1052
  "Indicates whether the action was created by a human-user or by a system-user."
1227
1053
  ),
1228
- createdAt: z15.string().datetime().describe("Timestamp indicating when the action was created."),
1229
- createdBy: z15.string().describe("Identifier of the user who created the action."),
1230
- createdByRole: z15.string().optional().describe("Role of the user who created the action."),
1054
+ createdAt: z14.string().datetime().describe("Timestamp indicating when the action was created."),
1055
+ createdBy: z14.string().describe("Identifier of the user who created the action."),
1056
+ createdByRole: z14.string().optional().describe("Role of the user who created the action."),
1231
1057
  createdBySignature: DocumentPath.nullish().describe(
1232
1058
  "Reference to the signature of the user who created the action."
1233
1059
  ),
@@ -1239,7 +1065,7 @@ var ActionBase = z15.object({
1239
1065
  "Declaration data defined by the ActionConfig. Supports partial updates."
1240
1066
  ),
1241
1067
  annotation: ActionUpdate.optional().nullable().describe("Action-specific metadata used to annotate the event."),
1242
- status: z15.enum([
1068
+ status: z14.enum([
1243
1069
  ActionStatus.Requested,
1244
1070
  ActionStatus.Accepted,
1245
1071
  ActionStatus.Rejected
@@ -1251,132 +1077,132 @@ var ActionBase = z15.object({
1251
1077
  )
1252
1078
  });
1253
1079
  var AssignedAction = ActionBase.extend(
1254
- z15.object({
1255
- type: z15.literal(ActionType.ASSIGN),
1256
- assignedTo: z15.string().describe("Identifier of the user to whom the action is assigned.")
1080
+ z14.object({
1081
+ type: z14.literal(ActionType.ASSIGN),
1082
+ assignedTo: z14.string().describe("Identifier of the user to whom the action is assigned.")
1257
1083
  // TODO move into 'content' property
1258
1084
  }).shape
1259
1085
  );
1260
1086
  var UnassignedAction = ActionBase.extend(
1261
- z15.object({
1262
- type: z15.literal(ActionType.UNASSIGN)
1087
+ z14.object({
1088
+ type: z14.literal(ActionType.UNASSIGN)
1263
1089
  }).shape
1264
1090
  );
1265
1091
  var RegisterAction = ActionBase.extend(
1266
- z15.object({
1267
- type: z15.literal(ActionType.REGISTER),
1268
- registrationNumber: z15.string().optional().describe(
1092
+ z14.object({
1093
+ type: z14.literal(ActionType.REGISTER),
1094
+ registrationNumber: z14.string().optional().describe(
1269
1095
  "Registration number of the event. Always present for accepted registrations."
1270
1096
  )
1271
1097
  // TODO move into 'content' property
1272
1098
  }).shape
1273
1099
  );
1274
1100
  var DeclareAction = ActionBase.extend(
1275
- z15.object({
1276
- type: z15.literal(ActionType.DECLARE)
1101
+ z14.object({
1102
+ type: z14.literal(ActionType.DECLARE)
1277
1103
  }).shape
1278
1104
  );
1279
- var ReasonContent = z15.object({
1280
- reason: z15.string().min(1, { error: "Message cannot be empty" }).describe(
1105
+ var ReasonContent = z14.object({
1106
+ reason: z14.string().min(1, { error: "Message cannot be empty" }).describe(
1281
1107
  "Message describing the reason for rejecting or archiving the event."
1282
1108
  )
1283
1109
  });
1284
1110
  var RejectAction = ActionBase.extend(
1285
- z15.object({
1286
- type: z15.literal(ActionType.REJECT),
1111
+ z14.object({
1112
+ type: z14.literal(ActionType.REJECT),
1287
1113
  content: ReasonContent
1288
1114
  }).shape
1289
1115
  );
1290
- var PotentialDuplicate = z15.object({
1116
+ var PotentialDuplicate = z14.object({
1291
1117
  id: UUID,
1292
- trackingId: z15.string()
1118
+ trackingId: z14.string()
1293
1119
  });
1294
1120
  var DuplicateDetectedAction = ActionBase.extend(
1295
- z15.object({
1296
- type: z15.literal(ActionType.DUPLICATE_DETECTED),
1297
- content: z15.object({
1298
- duplicates: z15.array(PotentialDuplicate)
1121
+ z14.object({
1122
+ type: z14.literal(ActionType.DUPLICATE_DETECTED),
1123
+ content: z14.object({
1124
+ duplicates: z14.array(PotentialDuplicate)
1299
1125
  })
1300
1126
  }).shape
1301
1127
  );
1302
1128
  var MarkNotDuplicateAction = ActionBase.extend(
1303
- z15.object({
1304
- type: z15.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1129
+ z14.object({
1130
+ type: z14.literal(ActionType.MARK_AS_NOT_DUPLICATE)
1305
1131
  }).shape
1306
1132
  );
1307
1133
  var MarkAsDuplicateAction = ActionBase.extend(
1308
- z15.object({
1309
- type: z15.literal(ActionType.MARK_AS_DUPLICATE),
1310
- content: z15.object({
1134
+ z14.object({
1135
+ type: z14.literal(ActionType.MARK_AS_DUPLICATE),
1136
+ content: z14.object({
1311
1137
  duplicateOf: UUID
1312
1138
  }).optional()
1313
1139
  }).shape
1314
1140
  );
1315
1141
  var ArchiveAction = ActionBase.extend(
1316
- z15.object({
1317
- type: z15.literal(ActionType.ARCHIVE),
1142
+ z14.object({
1143
+ type: z14.literal(ActionType.ARCHIVE),
1318
1144
  content: ReasonContent
1319
1145
  }).shape
1320
1146
  );
1321
1147
  var CreatedAction = ActionBase.extend(
1322
- z15.object({
1323
- type: z15.literal(ActionType.CREATE)
1148
+ z14.object({
1149
+ type: z14.literal(ActionType.CREATE)
1324
1150
  }).shape
1325
1151
  );
1326
1152
  var NotifiedAction = ActionBase.extend(
1327
- z15.object({
1328
- type: z15.literal(ActionType.NOTIFY)
1153
+ z14.object({
1154
+ type: z14.literal(ActionType.NOTIFY)
1329
1155
  }).shape
1330
1156
  );
1331
1157
  var EditAction = ActionBase.extend(
1332
- z15.object({
1333
- type: z15.literal(ActionType.EDIT),
1334
- content: z15.object({
1335
- comment: z15.string().describe("Comment for the edit action.").optional()
1158
+ z14.object({
1159
+ type: z14.literal(ActionType.EDIT),
1160
+ content: z14.object({
1161
+ comment: z14.string().describe("Comment for the edit action.").optional()
1336
1162
  })
1337
1163
  }).shape
1338
1164
  );
1339
- var PrintContent = z15.object({
1340
- templateId: z15.string().optional()
1165
+ var PrintContent = z14.object({
1166
+ templateId: z14.string().optional()
1341
1167
  });
1342
1168
  var PrintCertificateAction = ActionBase.extend(
1343
- z15.object({
1344
- type: z15.literal(ActionType.PRINT_CERTIFICATE),
1169
+ z14.object({
1170
+ type: z14.literal(ActionType.PRINT_CERTIFICATE),
1345
1171
  content: PrintContent.optional().nullable()
1346
1172
  }).shape
1347
1173
  );
1348
1174
  var RequestedCorrectionAction = ActionBase.extend(
1349
- z15.object({
1350
- type: z15.literal(ActionType.REQUEST_CORRECTION)
1175
+ z14.object({
1176
+ type: z14.literal(ActionType.REQUEST_CORRECTION)
1351
1177
  }).shape
1352
1178
  );
1353
1179
  var ApprovedCorrectionAction = ActionBase.extend(
1354
- z15.object({
1355
- type: z15.literal(ActionType.APPROVE_CORRECTION),
1356
- requestId: z15.string()
1180
+ z14.object({
1181
+ type: z14.literal(ActionType.APPROVE_CORRECTION),
1182
+ requestId: z14.string()
1357
1183
  // TODO move into 'content' property
1358
1184
  }).shape
1359
1185
  );
1360
1186
  var RejectedCorrectionAction = ActionBase.extend(
1361
- z15.object({
1362
- type: z15.literal(ActionType.REJECT_CORRECTION),
1363
- requestId: z15.string(),
1187
+ z14.object({
1188
+ type: z14.literal(ActionType.REJECT_CORRECTION),
1189
+ requestId: z14.string(),
1364
1190
  // TODO move into 'content' property
1365
1191
  content: ReasonContent
1366
1192
  }).shape
1367
1193
  );
1368
1194
  var ReadAction = ActionBase.extend(
1369
- z15.object({
1370
- type: z15.literal(ActionType.READ)
1195
+ z14.object({
1196
+ type: z14.literal(ActionType.READ)
1371
1197
  }).shape
1372
1198
  );
1373
1199
  var CustomAction = ActionBase.merge(
1374
- z15.object({
1375
- type: z15.literal(ActionType.CUSTOM),
1376
- customActionType: z15.string()
1200
+ z14.object({
1201
+ type: z14.literal(ActionType.CUSTOM),
1202
+ customActionType: z14.string()
1377
1203
  })
1378
1204
  );
1379
- var ActionDocument = z15.discriminatedUnion("type", [
1205
+ var ActionDocument = z14.discriminatedUnion("type", [
1380
1206
  CreatedAction.meta({ id: "CreatedAction" }),
1381
1207
  RejectAction.meta({ id: "RejectAction" }),
1382
1208
  DuplicateDetectedAction.meta({ id: "DuplicateDetectedAction" }),
@@ -1402,15 +1228,15 @@ var AsyncRejectActionDocument = ActionBase.omit({
1402
1228
  declaration: true,
1403
1229
  annotation: true
1404
1230
  }).extend(
1405
- z15.object({
1406
- type: z15.enum(ConfirmableActions),
1407
- status: z15.literal(ActionStatus.Rejected)
1231
+ z14.object({
1232
+ type: z14.enum(ConfirmableActions),
1233
+ status: z14.literal(ActionStatus.Rejected)
1408
1234
  }).shape
1409
1235
  );
1410
- var Action = z15.union([ActionDocument, AsyncRejectActionDocument]);
1236
+ var Action = z14.union([ActionDocument, AsyncRejectActionDocument]);
1411
1237
 
1412
1238
  // ../commons/src/events/Flag.ts
1413
- var z16 = __toESM(require("zod/v4"));
1239
+ var z15 = __toESM(require("zod/v4"));
1414
1240
  var InherentFlags = {
1415
1241
  INCOMPLETE: "incomplete",
1416
1242
  REJECTED: "rejected",
@@ -1424,7 +1250,7 @@ var InherentFlags = {
1424
1250
  */
1425
1251
  EDIT_IN_PROGRESS: "edit-in-progress"
1426
1252
  };
1427
- var ActionFlag = z16.string().regex(
1253
+ var ActionFlag = z15.string().regex(
1428
1254
  new RegExp(
1429
1255
  `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
1430
1256
  ActionStatus
@@ -1432,73 +1258,73 @@ var ActionFlag = z16.string().regex(
1432
1258
  ),
1433
1259
  "Flag must be in the format ActionType:ActionStatus (lowerCase)"
1434
1260
  );
1435
- var CustomFlag = z16.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1261
+ var CustomFlag = z15.string().refine((val) => !Object.values(InherentFlags).includes(val), {
1436
1262
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
1437
1263
  InherentFlags
1438
1264
  ).join(", ")}`
1439
1265
  }).refine((val) => !ActionFlag.safeParse(val).success, {
1440
1266
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
1441
1267
  }).describe("Custom flag identifier defined by the country config.");
1442
- var Flag = ActionFlag.or(z16.enum(InherentFlags)).or(CustomFlag);
1443
- var FlagConfig = z16.object({
1268
+ var Flag = ActionFlag.or(z15.enum(InherentFlags)).or(CustomFlag);
1269
+ var FlagConfig = z15.object({
1444
1270
  id: CustomFlag,
1445
- requiresAction: z16.boolean().describe(
1271
+ requiresAction: z15.boolean().describe(
1446
1272
  "Indicates if this flag expects an action to be performed to be cleared."
1447
1273
  ),
1448
1274
  label: TranslationConfig.describe("Human readable label of the flag.")
1449
1275
  });
1450
- var ActionFlagConfig = z16.object({
1276
+ var ActionFlagConfig = z15.object({
1451
1277
  id: Flag,
1452
- operation: z16.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1278
+ operation: z15.enum(["add", "remove"]).describe("Operation to perform on the flag."),
1453
1279
  conditional: Conditional.optional().describe(
1454
1280
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1455
1281
  )
1456
1282
  });
1457
1283
 
1458
1284
  // ../commons/src/events/EventMetadata.ts
1459
- var EventStatus = z17.enum([
1285
+ var EventStatus = z16.enum([
1460
1286
  "CREATED",
1461
1287
  "NOTIFIED",
1462
1288
  "DECLARED",
1463
1289
  "REGISTERED",
1464
1290
  "ARCHIVED"
1465
1291
  ]);
1466
- var ZodDate = z17.iso.date();
1467
- var ZodDateTime = z17.string().datetime();
1468
- var ActionCreationMetadata = z17.object({
1469
- createdAt: z17.iso.datetime().describe("The timestamp when the action request was created."),
1470
- createdBy: z17.string().describe("ID of the user who created the action request."),
1292
+ var ZodDate = z16.iso.date();
1293
+ var ZodDateTime = z16.string().datetime();
1294
+ var ActionCreationMetadata = z16.object({
1295
+ createdAt: z16.iso.datetime().describe("The timestamp when the action request was created."),
1296
+ createdBy: z16.string().describe("ID of the user who created the action request."),
1471
1297
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1472
1298
  createdAtLocation: UUID.nullish().describe(
1473
1299
  "Location of the user who created the action request."
1474
1300
  ),
1475
- createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1476
- acceptedAt: z17.iso.datetime().describe("Timestamp when the action request was accepted."),
1477
- createdByRole: z17.string().optional().describe("Role of the user at the time of action request creation."),
1478
- createdBySignature: z17.string().nullish().describe("Signature of the user who created the action request.")
1301
+ createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1302
+ acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1303
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1304
+ createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1479
1305
  });
1480
1306
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1481
- registrationNumber: z17.string().describe(
1307
+ registrationNumber: z16.string().describe(
1482
1308
  "Registration number of the event. Always present for accepted registrations."
1483
1309
  )
1484
1310
  });
1485
- var LegalStatuses = z17.object({
1311
+ var LegalStatuses = z16.object({
1486
1312
  [EventStatus.enum.DECLARED]: ActionCreationMetadata.nullish(),
1487
1313
  [EventStatus.enum.REGISTERED]: RegistrationCreationMetadata.nullish()
1488
1314
  });
1489
- var EventMetadata = z17.object({
1315
+ var EventMetadata = z16.object({
1490
1316
  id: UUID,
1491
- type: z17.string().describe("The type of event, such as birth, death, or marriage."),
1317
+ type: z16.string().describe("The type of event, such as birth, death, or marriage."),
1492
1318
  status: EventStatus,
1493
1319
  legalStatuses: LegalStatuses.describe(
1494
1320
  "Metadata related to the legal registration of the event, such as who registered it and when."
1495
1321
  ),
1496
- createdAt: z17.iso.datetime().describe("The timestamp when the event was first created and saved."),
1322
+ createdAt: z16.iso.datetime().describe("The timestamp when the event was first created and saved."),
1497
1323
  dateOfEvent: ZodDate.nullish(),
1498
1324
  placeOfEvent: UUID.nullish(),
1499
- createdBy: z17.string().describe("ID of the user who created the event."),
1500
- createdByUserType: z17.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1501
- updatedByUserRole: z17.string().nullish().describe("Role of the user who last changed the status."),
1325
+ createdBy: z16.string().describe("ID of the user who created the event."),
1326
+ createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1327
+ updatedByUserRole: z16.string().nullish().describe("Role of the user who last changed the status."),
1502
1328
  // @TODO: createdAtLocation should be non-nullable in the future once all action requests have this field populated.
1503
1329
  createdAtLocation: UUID.nullish().describe(
1504
1330
  "Location of the user who created the event."
@@ -1509,18 +1335,18 @@ var EventMetadata = z17.object({
1509
1335
  updatedAtLocation: UUID.nullish().describe(
1510
1336
  "Location of the user who last changed the status."
1511
1337
  ),
1512
- updatedAt: z17.iso.datetime().describe(
1338
+ updatedAt: z16.iso.datetime().describe(
1513
1339
  "Timestamp of the most recent *accepted* status change. Possibly 3rd party update, if action is validation asynchronously."
1514
1340
  ),
1515
- assignedTo: z17.string().nullish().describe("ID of the user currently assigned to the event."),
1516
- updatedBy: z17.string().nullish().describe("ID of the user who last changed the status."),
1517
- trackingId: z17.string().describe(
1341
+ assignedTo: z16.string().nullish().describe("ID of the user currently assigned to the event."),
1342
+ updatedBy: z16.string().nullish().describe("ID of the user who last changed the status."),
1343
+ trackingId: z16.string().describe(
1518
1344
  "System-generated tracking ID used by informants or registrars to look up the event."
1519
1345
  ),
1520
- potentialDuplicates: z17.array(PotentialDuplicate).describe(
1346
+ potentialDuplicates: z16.array(PotentialDuplicate).describe(
1521
1347
  "List of event IDs and their tracking IDs that this event could be a duplicate of."
1522
1348
  ),
1523
- flags: z17.array(Flag)
1349
+ flags: z16.array(Flag)
1524
1350
  });
1525
1351
  var EventMetadataKeysArray = [
1526
1352
  "id",
@@ -1541,8 +1367,8 @@ var EventMetadataKeysArray = [
1541
1367
  "legalStatuses",
1542
1368
  "flags"
1543
1369
  ];
1544
- var EventMetadataKeys = z17.enum(EventMetadataKeysArray);
1545
- var EventMetadataDateFieldIdInput = z17.enum([
1370
+ var EventMetadataKeys = z16.enum(EventMetadataKeysArray);
1371
+ var EventMetadataDateFieldIdInput = z16.enum([
1546
1372
  "createdAt",
1547
1373
  "updatedAt",
1548
1374
  "legalStatuses.DECLARED.createdAt",
@@ -1550,7 +1376,7 @@ var EventMetadataDateFieldIdInput = z17.enum([
1550
1376
  "legalStatuses.REGISTERED.createdAt",
1551
1377
  "legalStatuses.REGISTERED.acceptedAt"
1552
1378
  ]);
1553
- var EventMetadataDateFieldId = z17.enum([
1379
+ var EventMetadataDateFieldId = z16.enum([
1554
1380
  "event.createdAt",
1555
1381
  "event.updatedAt",
1556
1382
  "event.legalStatuses.DECLARED.createdAt",
@@ -1658,8 +1484,8 @@ var QueryExpression = import_v4.z.object({
1658
1484
  "legalStatuses.REGISTERED.createdAtLocation": import_v4.z.optional(Within).nullable(),
1659
1485
  "legalStatuses.REGISTERED.createdByRole": import_v4.z.optional(AnyOf),
1660
1486
  "legalStatuses.REGISTERED.registrationNumber": import_v4.z.optional(Exact),
1661
- createdAtLocation: import_v4.z.optional(Within),
1662
- updatedAtLocation: import_v4.z.optional(Within),
1487
+ createdAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1488
+ updatedAtLocation: import_v4.z.optional(import_v4.z.union([Within, Exact])),
1663
1489
  assignedTo: import_v4.z.optional(Exact),
1664
1490
  createdByUserType: import_v4.z.optional(ExactUserType),
1665
1491
  updatedByUserRole: import_v4.z.optional(Exact),
@@ -1752,7 +1578,7 @@ function todayDateTimeValueSerializer() {
1752
1578
  // ../commons/src/users/userReferences.ts
1753
1579
  var import_v42 = __toESM(require("zod/v4"));
1754
1580
  var ScopeOptionReference = import_v42.default.object({
1755
- $scope: RecordScopeTypeV2,
1581
+ $scope: ScopeType,
1756
1582
  $option: ScopeOptionKey
1757
1583
  });
1758
1584
  var JurisdictionReference = import_v42.default.object({
@@ -1996,17 +1822,14 @@ var ImageViewField = BaseField.extend({
1996
1822
  }).describe("A read-only image component for form pages");
1997
1823
  var Paragraph = BaseField.extend({
1998
1824
  type: import_v43.default.literal(FieldType.PARAGRAPH),
1999
- defaultValue: NonEmptyTextValue.optional(),
2000
1825
  configuration: ParagraphConfiguration
2001
1826
  }).describe("A read-only HTML <p> paragraph");
2002
1827
  var Heading = BaseField.extend({
2003
1828
  type: import_v43.default.literal(FieldType.HEADING),
2004
- defaultValue: NonEmptyTextValue.optional(),
2005
1829
  configuration: HeadingConfiguration
2006
1830
  }).describe("A read-only heading component for form pages");
2007
1831
  var PageHeader = BaseField.extend({
2008
- type: import_v43.default.literal(FieldType.PAGE_HEADER),
2009
- defaultValue: NonEmptyTextValue.optional()
1832
+ type: import_v43.default.literal(FieldType.PAGE_HEADER)
2010
1833
  }).describe("A read-only header component for form pages");
2011
1834
  var File = BaseField.extend({
2012
1835
  type: import_v43.default.literal(FieldType.FILE),
@@ -2056,7 +1879,6 @@ var RadioGroup = BaseField.extend({
2056
1879
  }).describe("Grouped radio options");
2057
1880
  var BulletList = BaseField.extend({
2058
1881
  type: import_v43.default.literal(FieldType.BULLET_LIST),
2059
- defaultValue: TextValue.optional(),
2060
1882
  items: import_v43.default.array(TranslationConfig).describe("A list of items"),
2061
1883
  configuration: import_v43.default.object({
2062
1884
  styles: import_v43.default.object({
@@ -2162,7 +1984,7 @@ var LocationInput = BaseField.extend({
2162
1984
  configuration: import_v43.default.object({
2163
1985
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2164
1986
  allowedLocations: AllowedLocations
2165
- })
1987
+ }).optional()
2166
1988
  }).describe("Input field for a location");
2167
1989
  var FileUploadWithOptions = BaseField.extend({
2168
1990
  type: import_v43.default.literal(FieldType.FILE_WITH_OPTIONS),
@@ -2238,16 +2060,32 @@ var DataField = BaseField.extend({
2238
2060
  data: import_v43.default.array(DataEntry)
2239
2061
  })
2240
2062
  }).describe("Data field for displaying read-only data");
2063
+ var ButtonSize = import_v43.default.enum(["small", "medium", "large"]);
2064
+ var ButtonType = import_v43.default.enum([
2065
+ "primary",
2066
+ "secondary",
2067
+ "tertiary",
2068
+ "positive",
2069
+ "negative",
2070
+ "secondaryNegative",
2071
+ "icon",
2072
+ "iconPrimary"
2073
+ ]);
2074
+ var TextColor = import_v43.default.enum(["primary", "copy"]);
2075
+ var TextVariant = import_v43.default.enum(["bold14", "reg14"]);
2076
+ var ButtonConfiguration = import_v43.default.object({
2077
+ icon: import_v43.default.string().optional().describe("Icon for the button. You can find icons from OpenCRVS UI-Kit."),
2078
+ loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2079
+ buttonSize: ButtonSize.optional().describe("Size of the button."),
2080
+ buttonType: ButtonType.optional().describe("Type of the button."),
2081
+ textColor: TextColor.optional().describe("Color of the text."),
2082
+ textVariant: TextVariant.optional().describe("Variant of the text."),
2083
+ text: TranslationConfig.describe("Text to display on the button")
2084
+ });
2241
2085
  var ButtonField = BaseField.extend({
2242
2086
  type: import_v43.default.literal(FieldType.BUTTON),
2243
2087
  defaultValue: ButtonFieldValue.optional(),
2244
- configuration: import_v43.default.object({
2245
- icon: import_v43.default.string().optional().describe(
2246
- "Icon for the button. You can find icons from OpenCRVS UI-Kit."
2247
- ),
2248
- loading: import_v43.default.boolean().optional().describe("Whether the button is in a loading state and shows a spinner"),
2249
- text: TranslationConfig.describe("Text to display on the button")
2250
- })
2088
+ configuration: ButtonConfiguration
2251
2089
  }).describe("Generic button without any built-in functionality");
2252
2090
  var FieldGroup = BaseField.extend({
2253
2091
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
@@ -2279,6 +2117,19 @@ var HttpField = BaseField.extend({
2279
2117
  timeout: import_v43.default.number().default(15e3).describe("Request timeout in milliseconds")
2280
2118
  })
2281
2119
  }).describe("HTTP request function triggered by a button click or other event");
2120
+ var AutocompleteField = BaseField.extend({
2121
+ type: import_v43.default.literal(FieldType.AUTOCOMPLETE),
2122
+ configuration: import_v43.default.object({
2123
+ url: import_v43.default.string().describe("URL to fetch autocomplete suggestions from").optional(),
2124
+ method: import_v43.default.enum(["GET", "POST"]).default("GET").optional(),
2125
+ defaultOptions: import_v43.default.array(
2126
+ import_v43.default.object({
2127
+ label: import_v43.default.string(),
2128
+ value: import_v43.default.string()
2129
+ })
2130
+ ).optional()
2131
+ })
2132
+ }).describe("Autocomplete input field");
2282
2133
  var SearchField = HttpField.extend({
2283
2134
  type: import_v43.default.literal(FieldType.SEARCH),
2284
2135
  configuration: SearchQuery.pick({
@@ -2364,8 +2215,11 @@ var CustomField = BaseField.extend({
2364
2215
  src: import_v43.default.string().describe("Module source path for the custom field component"),
2365
2216
  configuration: import_v43.default.unknown().optional()
2366
2217
  });
2218
+ var FieldStyleVariant = import_v43.default.enum(["default", "highlighted"]);
2367
2219
  var LoaderField = BaseField.extend({
2368
2220
  type: import_v43.default.literal(FieldType.LOADER),
2221
+ variant: FieldStyleVariant.default("default").optional(),
2222
+ hideLabel: import_v43.default.boolean().default(true).optional().describe("Loader field does not show a label by default"),
2369
2223
  configuration: import_v43.default.object({
2370
2224
  text: TranslationConfig.describe("Display text above the loading spinner")
2371
2225
  })
@@ -2422,6 +2276,7 @@ var FieldConfig = import_v43.default.discriminatedUnion("type", [
2422
2276
  ButtonField,
2423
2277
  AlphaPrintButton,
2424
2278
  HttpField,
2279
+ AutocompleteField,
2425
2280
  LinkButtonField,
2426
2281
  VerificationStatus,
2427
2282
  QrReaderField,
@@ -2443,18 +2298,18 @@ var AnyFileField = import_v43.default.discriminatedUnion("type", [
2443
2298
  ]);
2444
2299
 
2445
2300
  // ../commons/src/events/FormConfig.ts
2446
- var z23 = __toESM(require("zod/v4"));
2301
+ var z22 = __toESM(require("zod/v4"));
2447
2302
 
2448
2303
  // ../commons/src/events/PageConfig.ts
2449
- var z22 = __toESM(require("zod/v4"));
2450
- var PageTypes = z22.enum(["FORM", "VERIFICATION"]);
2451
- var PageConfigBase = z22.object({
2452
- id: z22.string().describe("Unique identifier for the page"),
2304
+ var z21 = __toESM(require("zod/v4"));
2305
+ var PageTypes = z21.enum(["FORM", "VERIFICATION"]);
2306
+ var PageConfigBase = z21.object({
2307
+ id: z21.string().describe("Unique identifier for the page"),
2453
2308
  title: TranslationConfig.describe("Header title of the page"),
2454
- requireCompletionToContinue: z22.boolean().default(false).describe(
2309
+ requireCompletionToContinue: z21.boolean().default(false).describe(
2455
2310
  "If true, all required fields must be filled before continuing to the next page"
2456
2311
  ),
2457
- fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
2312
+ fields: z21.array(FieldConfig).describe("Fields to be rendered on the page"),
2458
2313
  conditional: Conditional.optional().describe(
2459
2314
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
2460
2315
  )
@@ -2463,13 +2318,13 @@ var PageConfigBase = z22.object({
2463
2318
  id: "FormPageConfig"
2464
2319
  });
2465
2320
  var FormPageConfig = PageConfigBase.extend({
2466
- type: z22.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2321
+ type: z21.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
2467
2322
  });
2468
- var VerificationActionConfig = z22.object({
2469
- verify: z22.object({ label: TranslationConfig }),
2470
- cancel: z22.object({
2323
+ var VerificationActionConfig = z21.object({
2324
+ verify: z21.object({ label: TranslationConfig }),
2325
+ cancel: z21.object({
2471
2326
  label: TranslationConfig,
2472
- confirmation: z22.object({
2327
+ confirmation: z21.object({
2473
2328
  title: TranslationConfig,
2474
2329
  body: TranslationConfig
2475
2330
  })
@@ -2479,31 +2334,31 @@ var VerificationActionConfig = z22.object({
2479
2334
  id: "VerificationActionConfig"
2480
2335
  });
2481
2336
  var VerificationPageConfig = FormPageConfig.extend({
2482
- type: z22.literal(PageTypes.enum.VERIFICATION),
2337
+ type: z21.literal(PageTypes.enum.VERIFICATION),
2483
2338
  actions: VerificationActionConfig
2484
2339
  });
2485
- var PageConfig = z22.discriminatedUnion("type", [
2340
+ var PageConfig = z21.discriminatedUnion("type", [
2486
2341
  FormPageConfig,
2487
2342
  VerificationPageConfig
2488
2343
  ]);
2489
2344
 
2490
2345
  // ../commons/src/events/FormConfig.ts
2491
- var DeclarationFormConfig = z23.object({
2346
+ var DeclarationFormConfig = z22.object({
2492
2347
  label: TranslationConfig.describe("Human readable description of the form"),
2493
- pages: z23.array(FormPageConfig)
2348
+ pages: z22.array(FormPageConfig)
2494
2349
  }).describe("Configuration of the declaration form.");
2495
- var ActionFormConfig = z23.object({
2350
+ var ActionFormConfig = z22.object({
2496
2351
  label: TranslationConfig.describe("Human readable description of the form"),
2497
- pages: z23.array(PageConfig)
2352
+ pages: z22.array(PageConfig)
2498
2353
  }).describe(
2499
2354
  "Configuration of the form used for system actions beyond declaration, supporting a wider range of page types."
2500
2355
  );
2501
- var FormConfig = z23.union([DeclarationFormConfig, ActionFormConfig]);
2356
+ var FormConfig = z22.union([DeclarationFormConfig, ActionFormConfig]);
2502
2357
 
2503
2358
  // ../commons/src/events/DeduplicationConfig.ts
2504
- var z24 = __toESM(require("zod/v4"));
2505
- var FieldReference2 = z24.string();
2506
- var Matcher = z24.object({
2359
+ var z23 = __toESM(require("zod/v4"));
2360
+ var FieldReference2 = z23.string();
2361
+ var Matcher = z23.object({
2507
2362
  /**
2508
2363
  * Reference to the field used in matching.
2509
2364
  *
@@ -2511,23 +2366,23 @@ var Matcher = z24.object({
2511
2366
  * be used as the origin date to calculate the distance from.
2512
2367
  */
2513
2368
  fieldId: FieldReference2,
2514
- options: z24.object({
2515
- boost: z24.number().optional(),
2369
+ options: z23.object({
2370
+ boost: z23.number().optional(),
2516
2371
  matchAgainst: FieldReference2.optional()
2517
2372
  }).optional().default({
2518
2373
  boost: 1
2519
2374
  })
2520
2375
  });
2521
2376
  var FuzzyMatcher = Matcher.extend({
2522
- type: z24.literal("fuzzy"),
2523
- options: z24.object({
2377
+ type: z23.literal("fuzzy"),
2378
+ options: z23.object({
2524
2379
  /**
2525
2380
  * Names of length 3 or less characters = 0 edits allowed
2526
2381
  * Names of length 4 - 6 characters = 1 edit allowed
2527
2382
  * Names of length >7 characters = 2 edits allowed
2528
2383
  */
2529
- fuzziness: z24.union([z24.string(), z24.number()]).optional().default("AUTO:4,7"),
2530
- boost: z24.number().optional().default(1),
2384
+ fuzziness: z23.union([z23.string(), z23.number()]).optional().default("AUTO:4,7"),
2385
+ boost: z23.number().optional().default(1),
2531
2386
  matchAgainst: FieldReference2.optional()
2532
2387
  }).optional().default({
2533
2388
  fuzziness: "AUTO:4,7",
@@ -2535,48 +2390,48 @@ var FuzzyMatcher = Matcher.extend({
2535
2390
  })
2536
2391
  });
2537
2392
  var StrictMatcher = Matcher.extend({
2538
- type: z24.literal("strict"),
2539
- options: z24.object({
2540
- boost: z24.number().optional().default(1),
2393
+ type: z23.literal("strict"),
2394
+ options: z23.object({
2395
+ boost: z23.number().optional().default(1),
2541
2396
  /**
2542
2397
  * The constant value to be present in the field for both records
2543
2398
  */
2544
- value: z24.string().optional(),
2399
+ value: z23.string().optional(),
2545
2400
  matchAgainst: FieldReference2.optional()
2546
2401
  }).optional().default({
2547
2402
  boost: 1
2548
2403
  })
2549
2404
  });
2550
2405
  var DateRangeMatcher = Matcher.extend({
2551
- type: z24.literal("dateRange"),
2552
- options: z24.object({
2406
+ type: z23.literal("dateRange"),
2407
+ options: z23.object({
2553
2408
  /**
2554
2409
  * The distance pivot in days. Distance from the origin (the value of
2555
2410
  * fieldId) at which relevance scores receive half of the boost value
2556
2411
  */
2557
- pivot: z24.number().optional(),
2558
- days: z24.number(),
2559
- boost: z24.number().optional().default(1),
2412
+ pivot: z23.number().optional(),
2413
+ days: z23.number(),
2414
+ boost: z23.number().optional().default(1),
2560
2415
  matchAgainst: FieldReference2.optional()
2561
2416
  })
2562
2417
  });
2563
- var Not = z24.object({
2564
- type: z24.literal("not"),
2418
+ var Not = z23.object({
2419
+ type: z23.literal("not"),
2565
2420
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2566
- clause: z24.lazy(() => Clause)
2421
+ clause: z23.lazy(() => Clause)
2567
2422
  });
2568
- var And = z24.object({
2569
- type: z24.literal("and"),
2423
+ var And = z23.object({
2424
+ type: z23.literal("and"),
2570
2425
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2571
- clauses: z24.lazy(() => Clause.array())
2426
+ clauses: z23.lazy(() => Clause.array())
2572
2427
  });
2573
- var Or = z24.object({
2574
- type: z24.literal("or"),
2428
+ var Or = z23.object({
2429
+ type: z23.literal("or"),
2575
2430
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2576
- clauses: z24.lazy(() => Clause.array())
2431
+ clauses: z23.lazy(() => Clause.array())
2577
2432
  });
2578
- var Clause = z24.lazy(
2579
- () => z24.discriminatedUnion("type", [
2433
+ var Clause = z23.lazy(
2434
+ () => z23.discriminatedUnion("type", [
2580
2435
  Not,
2581
2436
  And,
2582
2437
  Or,
@@ -2587,22 +2442,22 @@ var Clause = z24.lazy(
2587
2442
  ).meta({
2588
2443
  id: "Clause"
2589
2444
  });
2590
- var DeduplicationConfig = z24.object({
2591
- id: z24.string(),
2445
+ var DeduplicationConfig = z23.object({
2446
+ id: z23.string(),
2592
2447
  label: TranslationConfig,
2593
2448
  query: Clause
2594
2449
  });
2595
2450
 
2596
2451
  // ../commons/src/events/ActionConfig.ts
2597
- var DeclarationReviewConfig = z25.object({
2452
+ var DeclarationReviewConfig = z24.object({
2598
2453
  title: TranslationConfig.describe("Title of the review page"),
2599
- fields: z25.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2454
+ fields: z24.array(FieldConfig).describe("Fields displayed on the review page for annotations.")
2600
2455
  }).describe(
2601
2456
  "Configuration of the declaration review page for collecting event-related metadata."
2602
2457
  );
2603
- var ActionConfigBase = z25.object({
2458
+ var ActionConfigBase = z24.object({
2604
2459
  label: TranslationConfig.describe("Human readable description of the action"),
2605
- flags: z25.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2460
+ flags: z24.array(ActionFlagConfig).optional().default([]).describe("Flag actions which are executed when the action is performed."),
2606
2461
  supportingCopy: TranslationConfig.optional().describe(
2607
2462
  "Text displayed on the confirmation dialog"
2608
2463
  ),
@@ -2613,28 +2468,28 @@ var ActionConfigBase = z25.object({
2613
2468
  * "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."
2614
2469
  * for EventConfig.d.ts.
2615
2470
  */
2616
- icon: z25.string().describe("Icon representing the action").optional(),
2617
- conditionals: z25.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2471
+ icon: z24.string().describe("Icon representing the action").optional(),
2472
+ conditionals: z24.array(ActionConditional).optional().describe("Conditionals which can disable or hide actions.")
2618
2473
  });
2619
2474
  var DeclarationActionBase = ActionConfigBase.extend({
2620
2475
  deduplication: DeduplicationConfig.optional()
2621
2476
  });
2622
2477
  var ReadActionConfig = ActionConfigBase.extend(
2623
- z25.object({
2624
- type: z25.literal(ActionType.READ),
2478
+ z24.object({
2479
+ type: z24.literal(ActionType.READ),
2625
2480
  review: DeclarationReviewConfig.describe(
2626
2481
  "Configuration of the review page for read-only view."
2627
2482
  ),
2628
- conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2483
+ conditionals: z24.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2629
2484
  }).shape
2630
2485
  );
2631
2486
  var DeclareConfig = DeclarationActionBase.extend(
2632
- z25.object({
2633
- type: z25.literal(ActionType.DECLARE),
2487
+ z24.object({
2488
+ type: z24.literal(ActionType.DECLARE),
2634
2489
  review: DeclarationReviewConfig.describe(
2635
2490
  "Configuration of the review page fields."
2636
2491
  ),
2637
- dialogCopy: z25.object({
2492
+ dialogCopy: z24.object({
2638
2493
  notify: TranslationConfig.describe(
2639
2494
  "Confirmation text for the notify action"
2640
2495
  ),
@@ -2648,14 +2503,14 @@ var DeclareConfig = DeclarationActionBase.extend(
2648
2503
  }).shape
2649
2504
  );
2650
2505
  var ArchiveConfig = ActionConfigBase.extend(
2651
- z25.object({
2652
- type: z25.literal(ActionType.ARCHIVE)
2506
+ z24.object({
2507
+ type: z24.literal(ActionType.ARCHIVE)
2653
2508
  }).shape
2654
2509
  );
2655
2510
  var EditActionConfig = ActionConfigBase.extend(
2656
- z25.object({
2657
- type: z25.literal(ActionType.EDIT),
2658
- dialogCopy: z25.object({
2511
+ z24.object({
2512
+ type: z24.literal(ActionType.EDIT),
2513
+ dialogCopy: z24.object({
2659
2514
  notify: TranslationConfig.describe(
2660
2515
  "Confirmation text for the notify with edits action"
2661
2516
  ),
@@ -2669,33 +2524,33 @@ var EditActionConfig = ActionConfigBase.extend(
2669
2524
  }).shape
2670
2525
  );
2671
2526
  var RejectConfig = ActionConfigBase.extend(
2672
- z25.object({
2673
- type: z25.literal(ActionType.REJECT)
2527
+ z24.object({
2528
+ type: z24.literal(ActionType.REJECT)
2674
2529
  }).shape
2675
2530
  );
2676
2531
  var RegisterConfig = DeclarationActionBase.extend(
2677
- z25.object({
2678
- type: z25.literal(ActionType.REGISTER)
2532
+ z24.object({
2533
+ type: z24.literal(ActionType.REGISTER)
2679
2534
  }).shape
2680
2535
  );
2681
2536
  var PrintCertificateActionConfig = ActionConfigBase.extend(
2682
- z25.object({
2683
- type: z25.literal(ActionType.PRINT_CERTIFICATE),
2537
+ z24.object({
2538
+ type: z24.literal(ActionType.PRINT_CERTIFICATE),
2684
2539
  printForm: ActionFormConfig
2685
2540
  }).shape
2686
2541
  );
2687
2542
  var RequestCorrectionConfig = ActionConfigBase.extend(
2688
- z25.object({
2689
- type: z25.literal(ActionType.REQUEST_CORRECTION),
2543
+ z24.object({
2544
+ type: z24.literal(ActionType.REQUEST_CORRECTION),
2690
2545
  correctionForm: ActionFormConfig
2691
2546
  }).shape
2692
2547
  );
2693
2548
  var CustomActionConfig = ActionConfigBase.merge(
2694
- z25.object({
2695
- type: z25.literal(ActionType.CUSTOM),
2696
- customActionType: z25.string().describe("Type identifier of the custom action."),
2549
+ z24.object({
2550
+ type: z24.literal(ActionType.CUSTOM),
2551
+ customActionType: z24.string().describe("Type identifier of the custom action."),
2697
2552
  /** 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. */
2698
- form: z25.array(FieldConfig).describe(
2553
+ form: z24.array(FieldConfig).describe(
2699
2554
  "Form configuration for the custom action. The form configured here will be used on the custom action confirmation modal."
2700
2555
  ),
2701
2556
  auditHistoryLabel: TranslationConfig.describe(
@@ -2703,7 +2558,7 @@ var CustomActionConfig = ActionConfigBase.merge(
2703
2558
  )
2704
2559
  })
2705
2560
  );
2706
- var ActionConfig = z25.discriminatedUnion("type", [
2561
+ var ActionConfig = z24.discriminatedUnion("type", [
2707
2562
  /*
2708
2563
  * OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
2709
2564
  * and treat them as "models" instead of duplicating the data structure in each endpoint.
@@ -2725,86 +2580,86 @@ var ActionConfig = z25.discriminatedUnion("type", [
2725
2580
  var actionConfigTypes = new Set(
2726
2581
  ActionConfig.options.map((opt) => opt.shape.type.value)
2727
2582
  );
2728
- var DeclarationActionConfig = z25.discriminatedUnion("type", [
2583
+ var DeclarationActionConfig = z24.discriminatedUnion("type", [
2729
2584
  DeclareConfig,
2730
2585
  RegisterConfig
2731
2586
  ]);
2732
2587
 
2733
2588
  // ../commons/src/events/offline/CertificateConfig.ts
2734
- var z26 = __toESM(require("zod/v4"));
2735
- var FontFamily = z26.object({
2736
- normal: z26.string(),
2737
- bold: z26.string(),
2738
- italics: z26.string(),
2739
- bolditalics: z26.string()
2740
- });
2741
- var CertificateConfig = z26.object({
2742
- id: z26.string(),
2743
- event: z26.string(),
2744
- isV2Template: z26.boolean().optional(),
2589
+ var z25 = __toESM(require("zod/v4"));
2590
+ var FontFamily = z25.object({
2591
+ normal: z25.string(),
2592
+ bold: z25.string(),
2593
+ italics: z25.string(),
2594
+ bolditalics: z25.string()
2595
+ });
2596
+ var CertificateConfig = z25.object({
2597
+ id: z25.string(),
2598
+ event: z25.string(),
2599
+ isV2Template: z25.boolean().optional(),
2745
2600
  label: TranslationConfig,
2746
- isDefault: z26.boolean(),
2747
- fee: z26.object({
2748
- onTime: z26.number(),
2749
- late: z26.number(),
2750
- delayed: z26.number()
2601
+ isDefault: z25.boolean(),
2602
+ fee: z25.object({
2603
+ onTime: z25.number(),
2604
+ late: z25.number(),
2605
+ delayed: z25.number()
2751
2606
  }),
2752
- svgUrl: z26.string(),
2753
- fonts: z26.record(z26.string(), FontFamily).optional(),
2754
- conditionals: z26.array(ShowConditional).optional()
2607
+ svgUrl: z25.string(),
2608
+ fonts: z25.record(z25.string(), FontFamily).optional(),
2609
+ conditionals: z25.array(ShowConditional).optional()
2755
2610
  });
2756
2611
  var CertificateTemplateConfig = CertificateConfig.extend({
2757
- hash: z26.string().optional(),
2758
- svg: z26.string()
2612
+ hash: z25.string().optional(),
2613
+ svg: z25.string()
2759
2614
  });
2760
2615
 
2761
2616
  // ../commons/src/events/offline/LanguageConfig.ts
2762
- var z27 = __toESM(require("zod/v4"));
2763
- var LanguageConfig = z27.object({
2764
- lang: z27.string(),
2617
+ var z26 = __toESM(require("zod/v4"));
2618
+ var LanguageConfig = z26.object({
2619
+ lang: z26.string(),
2765
2620
  /**
2766
2621
  * client.csv contents
2767
2622
  */
2768
- messages: z27.record(z27.string(), z27.string())
2623
+ messages: z26.record(z26.string(), z26.string())
2769
2624
  });
2770
2625
 
2771
2626
  // ../commons/src/events/EventConfig.ts
2772
- var z34 = __toESM(require("zod/v4"));
2627
+ var z33 = __toESM(require("zod/v4"));
2773
2628
 
2774
2629
  // ../commons/src/events/SummaryConfig.ts
2775
- var z28 = __toESM(require("zod/v4"));
2776
- var BaseField2 = z28.object({
2630
+ var z27 = __toESM(require("zod/v4"));
2631
+ var BaseField2 = z27.object({
2777
2632
  emptyValueMessage: TranslationConfig.optional().describe(
2778
2633
  "Default message displayed when the field value is empty."
2779
2634
  ),
2780
- conditionals: z28.array(ShowConditional).default([]).optional()
2635
+ conditionals: z27.array(ShowConditional).default([]).optional()
2781
2636
  });
2782
2637
  var ReferenceField = BaseField2.extend({
2783
- fieldId: z28.string(),
2638
+ fieldId: z27.string(),
2784
2639
  label: TranslationConfig.optional().describe(
2785
2640
  "Overrides the default label from the referenced field when provided."
2786
2641
  )
2787
2642
  }).describe("Field referencing existing event data by field ID.");
2788
2643
  var Field = BaseField2.extend({
2789
- id: z28.string().describe("Identifier of the summary field."),
2644
+ id: z27.string().describe("Identifier of the summary field."),
2790
2645
  value: TranslationConfig.describe(
2791
2646
  'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
2792
2647
  ),
2793
2648
  label: TranslationConfig
2794
2649
  }).describe("Custom field defined for the summary view.");
2795
- var SummaryConfig = z28.object({
2796
- fields: z28.array(z28.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2650
+ var SummaryConfig = z27.object({
2651
+ fields: z27.array(z27.union([Field, ReferenceField])).describe("Fields displayed in the event summary view.")
2797
2652
  }).describe("Configuration of the event summary section.");
2798
2653
 
2799
2654
  // ../commons/src/events/AdvancedSearchConfig.ts
2800
- var z29 = __toESM(require("zod/v4"));
2801
- var MatchType = z29.enum(["fuzzy", "exact", "range", "within"]);
2802
- var BaseField3 = z29.object({
2803
- config: z29.object({
2655
+ var z28 = __toESM(require("zod/v4"));
2656
+ var MatchType = z28.enum(["fuzzy", "exact", "range", "within"]);
2657
+ var BaseField3 = z28.object({
2658
+ config: z28.object({
2804
2659
  type: MatchType.describe(
2805
2660
  "Determines the search type of field. How to match value."
2806
2661
  ),
2807
- searchFields: z29.array(z29.string()).optional().describe(
2662
+ searchFields: z28.array(z28.string()).optional().describe(
2808
2663
  `
2809
2664
  Defines multiple form fields that should be searched when this field has a value.
2810
2665
  All specified fields will be combined using OR logic.
@@ -2814,7 +2669,7 @@ var BaseField3 = z29.object({
2814
2669
  `
2815
2670
  )
2816
2671
  }),
2817
- type: z29.nativeEnum(FieldType).optional().describe(
2672
+ type: z28.nativeEnum(FieldType).optional().describe(
2818
2673
  `
2819
2674
  Explicitly specify the field type for searchFields.
2820
2675
  This is required when searchFields is defined, to show the correct control in the UI.
@@ -2828,7 +2683,7 @@ var BaseField3 = z29.object({
2828
2683
  This is required when searchFields is defined.
2829
2684
  `
2830
2685
  ),
2831
- options: z29.array(SelectOption).optional(),
2686
+ options: z28.array(SelectOption).optional(),
2832
2687
  searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
2833
2688
  `
2834
2689
  This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
@@ -2849,7 +2704,7 @@ var BaseField3 = z29.object({
2849
2704
  in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
2850
2705
  `
2851
2706
  ),
2852
- conditionals: z29.array(FieldConditional).optional().describe(
2707
+ conditionals: z28.array(FieldConditional).optional().describe(
2853
2708
  `
2854
2709
  In advanced search, we sometimes need to override the default field visibility conditionals.
2855
2710
 
@@ -2863,20 +2718,20 @@ var BaseField3 = z29.object({
2863
2718
  are always rendered in the advanced search form.
2864
2719
  `
2865
2720
  ),
2866
- validations: z29.array(ValidationConfig).optional().describe(
2721
+ validations: z28.array(ValidationConfig).optional().describe(
2867
2722
  `Option for overriding the field validations specifically for advanced search form.`
2868
2723
  )
2869
2724
  });
2870
- var SearchQueryParams = z29.object({
2871
- eventType: z29.string().optional().describe(
2725
+ var SearchQueryParams = z28.object({
2726
+ eventType: z28.string().optional().describe(
2872
2727
  "Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
2873
2728
  )
2874
2729
  }).catchall(FieldValue);
2875
2730
  var FieldConfigSchema = BaseField3.extend({
2876
- fieldId: z29.string(),
2877
- fieldType: z29.literal("field")
2731
+ fieldId: z28.string(),
2732
+ fieldType: z28.literal("field")
2878
2733
  });
2879
- var EventFieldIdInput = z29.enum([
2734
+ var EventFieldIdInput = z28.enum([
2880
2735
  "trackingId",
2881
2736
  "status",
2882
2737
  "legalStatuses.REGISTERED.acceptedAt",
@@ -2885,7 +2740,7 @@ var EventFieldIdInput = z29.enum([
2885
2740
  "updatedAt"
2886
2741
  ]);
2887
2742
  var METADATA_FIELD_PREFIX = "event.";
2888
- var EventFieldId = z29.enum([
2743
+ var EventFieldId = z28.enum([
2889
2744
  `${METADATA_FIELD_PREFIX}trackingId`,
2890
2745
  `${METADATA_FIELD_PREFIX}status`,
2891
2746
  `${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
@@ -2895,29 +2750,29 @@ var EventFieldId = z29.enum([
2895
2750
  ]);
2896
2751
  var EventFieldConfigSchema = BaseField3.extend({
2897
2752
  fieldId: EventFieldId,
2898
- fieldType: z29.literal("event")
2753
+ fieldType: z28.literal("event")
2899
2754
  });
2900
- var AdvancedSearchField = z29.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2755
+ var AdvancedSearchField = z28.discriminatedUnion("fieldType", [FieldConfigSchema, EventFieldConfigSchema]).superRefine((data, ctx) => {
2901
2756
  if (data.config.searchFields && data.config.searchFields.length > 0) {
2902
2757
  if (!data.label) {
2903
2758
  ctx.addIssue({
2904
- code: z29.ZodIssueCode.custom,
2759
+ code: z28.ZodIssueCode.custom,
2905
2760
  message: "label is required when config.searchFields is defined.",
2906
2761
  path: ["label"]
2907
2762
  });
2908
2763
  }
2909
2764
  if (!data.type) {
2910
2765
  ctx.addIssue({
2911
- code: z29.ZodIssueCode.custom,
2766
+ code: z28.ZodIssueCode.custom,
2912
2767
  message: "type is required when config.searchFields is defined.",
2913
2768
  path: ["type"]
2914
2769
  });
2915
2770
  }
2916
2771
  }
2917
2772
  });
2918
- var AdvancedSearchConfig = z29.object({
2773
+ var AdvancedSearchConfig = z28.object({
2919
2774
  title: TranslationConfig.describe("Advanced search tab title"),
2920
- fields: z29.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2775
+ fields: z28.array(AdvancedSearchField).describe("Advanced search fields within the tab.")
2921
2776
  });
2922
2777
 
2923
2778
  // ../commons/src/events/utils.ts
@@ -2926,14 +2781,14 @@ var import_lodash = require("lodash");
2926
2781
  // ../commons/src/conditionals/validate.ts
2927
2782
  var import__ = __toESM(require("ajv/dist/2019"));
2928
2783
  var import_ajv_formats = __toESM(require("ajv-formats"));
2929
- var z32 = __toESM(require("zod/v4"));
2784
+ var z31 = __toESM(require("zod/v4"));
2930
2785
  var import_date_fns = require("date-fns");
2931
2786
 
2932
2787
  // ../commons/src/events/FieldTypeMapping.ts
2933
- var z31 = __toESM(require("zod/v4"));
2788
+ var z30 = __toESM(require("zod/v4"));
2934
2789
 
2935
2790
  // ../commons/src/events/DynamicFieldValue.ts
2936
- var z30 = __toESM(require("zod/v4"));
2791
+ var z29 = __toESM(require("zod/v4"));
2937
2792
 
2938
2793
  // ../commons/src/conditionals/validate.ts
2939
2794
  var ajv = new import__.default({
@@ -2942,9 +2797,9 @@ var ajv = new import__.default({
2942
2797
  strict: false
2943
2798
  // Allow minContains and other newer features
2944
2799
  });
2945
- var DataContext = z32.object({
2946
- rootData: z32.object({
2947
- $leafAdminStructureLocationIds: z32.array(z32.object({ id: UUID }))
2800
+ var DataContext = z31.object({
2801
+ rootData: z31.object({
2802
+ $leafAdminStructureLocationIds: z31.array(z31.object({ id: UUID }))
2948
2803
  })
2949
2804
  });
2950
2805
  function resolveDataPath(rootData, dataPath, instancePath) {
@@ -3021,13 +2876,13 @@ ajv.addKeyword({
3021
2876
  });
3022
2877
 
3023
2878
  // ../commons/src/utils.ts
3024
- var z33 = __toESM(require("zod/v4"));
2879
+ var z32 = __toESM(require("zod/v4"));
3025
2880
  var _ = __toESM(require("lodash"));
3026
- var FullNameV1 = z33.array(
3027
- z33.object({
3028
- use: z33.string(),
3029
- family: z33.string(),
3030
- given: z33.array(z33.string())
2881
+ var FullNameV1 = z32.array(
2882
+ z32.object({
2883
+ use: z32.string(),
2884
+ family: z32.string(),
2885
+ given: z32.array(z32.string())
3031
2886
  })
3032
2887
  );
3033
2888
  function omitKeyDeep(obj, keyToRemove) {
@@ -3761,11 +3616,11 @@ function validateActionOrder(event2, ctx) {
3761
3616
  }
3762
3617
 
3763
3618
  // ../commons/src/events/EventConfig.ts
3764
- var EventFieldReference = z34.object({ $$event: EventMetadataDateFieldIdInput }).describe(
3619
+ var EventFieldReference = z33.object({ $$event: EventMetadataDateFieldIdInput }).describe(
3765
3620
  "Reference to a field defined in the event metadata, using the field id."
3766
3621
  );
3767
- var _EventConfigBase = z34.object({
3768
- id: z34.string().describe(
3622
+ var _EventConfigBase = z33.object({
3623
+ id: z33.string().describe(
3769
3624
  'Machine-readable identifier of the event (e.g. "birth", "death").'
3770
3625
  ),
3771
3626
  dateOfEvent: FieldReference.or(EventFieldReference).optional().describe(
@@ -3784,20 +3639,23 @@ var _EventConfigBase = z34.object({
3784
3639
  "Summary information displayed in the event overview."
3785
3640
  ),
3786
3641
  label: TranslationConfig.describe("Human-readable label for the event type."),
3787
- actions: z34.array(ActionConfig).describe(
3642
+ actions: z33.array(ActionConfig).describe(
3788
3643
  "Configuration of system-defined actions associated with the event."
3789
3644
  ),
3790
- actionOrder: z34.array(z34.string()).optional().describe(
3645
+ actionOrder: z33.array(z33.string()).optional().describe(
3791
3646
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
3792
3647
  ),
3793
3648
  declaration: DeclarationFormConfig.describe(
3794
3649
  "Configuration of the form used to gather event data."
3795
3650
  ),
3796
- advancedSearch: z34.array(AdvancedSearchConfig).optional().default([]).describe(
3651
+ advancedSearch: z33.array(AdvancedSearchConfig).optional().default([]).describe(
3797
3652
  "Configuration of fields available in the advanced search feature."
3798
3653
  ),
3799
- flags: z34.array(FlagConfig).optional().default([]).describe(
3654
+ flags: z33.array(FlagConfig).optional().default([]).describe(
3800
3655
  "Configuration of flags associated with the actions of this event type."
3656
+ ),
3657
+ analytics: z33.boolean().optional().default(true).describe(
3658
+ "Indicates whether the records of this event type are included in analytics"
3801
3659
  )
3802
3660
  });
3803
3661
  var EventConfig = _EventConfigBase.superRefine((event2, ctx) => {
@@ -3816,7 +3674,7 @@ var defineActionForm = (actionForm) => ActionFormConfig.parse(actionForm);
3816
3674
  var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
3817
3675
 
3818
3676
  // ../commons/src/events/WorkqueueConfig.ts
3819
- var z38 = __toESM(require("zod/v4"));
3677
+ var z37 = __toESM(require("zod/v4"));
3820
3678
 
3821
3679
  // ../commons/src/searchConfigs.ts
3822
3680
  function createSearchConfig(baseField) {
@@ -4017,17 +3875,17 @@ var event = Object.assign(eventFn, {
4017
3875
  });
4018
3876
 
4019
3877
  // ../commons/src/events/WorkqueueColumnConfig.ts
4020
- var z35 = __toESM(require("zod/v4"));
3878
+ var z34 = __toESM(require("zod/v4"));
4021
3879
  var WorkqueueColumnKeysArray = [
4022
3880
  ...EventMetadataKeysArray,
4023
3881
  "title",
4024
3882
  "outbox"
4025
3883
  ];
4026
- var WorkqueueColumnKeys = z35.enum(WorkqueueColumnKeysArray);
4027
- var WorkqueueColumnValue = z35.object({
3884
+ var WorkqueueColumnKeys = z34.enum(WorkqueueColumnKeysArray);
3885
+ var WorkqueueColumnValue = z34.object({
4028
3886
  $event: WorkqueueColumnKeys
4029
3887
  });
4030
- var WorkqueueColumn = z35.object({
3888
+ var WorkqueueColumn = z34.object({
4031
3889
  label: TranslationConfig,
4032
3890
  value: WorkqueueColumnValue
4033
3891
  });
@@ -4038,55 +3896,59 @@ function defineWorkqueuesColumns(workqueueColumns) {
4038
3896
  }
4039
3897
 
4040
3898
  // ../commons/src/events/CountryConfigQueryInput.ts
4041
- var z36 = __toESM(require("zod/v4"));
4042
- var SerializableExact = z36.object({
4043
- type: z36.literal("exact"),
4044
- term: z36.union([z36.string(), SerializedUserField])
4045
- });
4046
- var SerializableWithin = z36.object({
4047
- type: z36.literal("within"),
4048
- location: z36.union([z36.string(), SerializedUserField])
4049
- });
4050
- var SerializedQueryExpression = z36.object({
4051
- eventType: z36.string(),
4052
- status: z36.optional(z36.union([AnyOfStatus, ExactStatus])),
4053
- createdAt: z36.optional(DateCondition),
4054
- updatedAt: z36.optional(DateCondition),
4055
- "legalStatuses.DECLARED.createdAtLocation": z36.optional(SerializableWithin),
4056
- "legalStatuses.DECLARED.createdByRole": z36.optional(AnyOf),
4057
- "legalStatuses.REGISTERED.createdAt": z36.optional(DateCondition),
4058
- "legalStatuses.REGISTERED.createdAtLocation": z36.optional(SerializableWithin),
4059
- "legalStatuses.REGISTERED.createdByRole": z36.optional(AnyOf),
4060
- "legalStatuses.REGISTERED.registrationNumber": z36.optional(Exact),
4061
- createdAtLocation: z36.optional(SerializableWithin),
4062
- updatedAtLocation: z36.optional(SerializableWithin),
4063
- updatedByUserRole: z36.optional(SerializableExact),
4064
- assignedTo: z36.optional(SerializableExact),
4065
- createdBy: z36.optional(SerializableExact),
3899
+ var z35 = __toESM(require("zod/v4"));
3900
+ var SerializableExact = z35.object({
3901
+ type: z35.literal("exact"),
3902
+ term: z35.union([z35.string(), SerializedUserField])
3903
+ });
3904
+ var SerializableWithin = z35.object({
3905
+ type: z35.literal("within"),
3906
+ location: z35.union([z35.string(), SerializedUserField])
3907
+ });
3908
+ var SerializedQueryExpression = z35.object({
3909
+ eventType: z35.string(),
3910
+ status: z35.optional(z35.union([AnyOfStatus, ExactStatus])),
3911
+ createdAt: z35.optional(DateCondition),
3912
+ updatedAt: z35.optional(DateCondition),
3913
+ "legalStatuses.DECLARED.createdAtLocation": z35.optional(SerializableWithin),
3914
+ "legalStatuses.DECLARED.createdByRole": z35.optional(AnyOf),
3915
+ "legalStatuses.REGISTERED.createdAt": z35.optional(DateCondition),
3916
+ "legalStatuses.REGISTERED.createdAtLocation": z35.optional(SerializableWithin),
3917
+ "legalStatuses.REGISTERED.createdByRole": z35.optional(AnyOf),
3918
+ "legalStatuses.REGISTERED.registrationNumber": z35.optional(Exact),
3919
+ createdAtLocation: z35.optional(
3920
+ z35.union([SerializableWithin, SerializableExact])
3921
+ ),
3922
+ updatedAtLocation: z35.optional(
3923
+ z35.union([SerializableWithin, SerializableExact])
3924
+ ),
3925
+ updatedByUserRole: z35.optional(SerializableExact),
3926
+ assignedTo: z35.optional(SerializableExact),
3927
+ createdBy: z35.optional(SerializableExact),
4066
3928
  createdByUserType: ExactUserType,
4067
- updatedBy: z36.optional(SerializableExact),
4068
- trackingId: z36.optional(Exact),
4069
- flags: z36.optional(ContainsFlags),
3929
+ updatedBy: z35.optional(SerializableExact),
3930
+ trackingId: z35.optional(Exact),
3931
+ flags: z35.optional(ContainsFlags),
4070
3932
  data: QueryInput
4071
3933
  }).partial();
4072
- var Or2 = z36.object({
4073
- type: z36.literal("or"),
4074
- clauses: z36.array(SerializedQueryExpression)
3934
+ var Or2 = z35.object({
3935
+ type: z35.literal("or"),
3936
+ clauses: z35.array(SerializedQueryExpression)
4075
3937
  });
4076
- var And2 = z36.object({
4077
- type: z36.literal("and"),
4078
- clauses: z36.array(SerializedQueryExpression)
3938
+ var And2 = z35.object({
3939
+ type: z35.literal("and"),
3940
+ clauses: z35.array(SerializedQueryExpression)
4079
3941
  });
4080
- var CountryConfigQueryType = z36.discriminatedUnion("type", [And2, Or2]);
4081
- var CountryConfigQueryInputType = z36.union([
3942
+ var CountryConfigQueryType = z35.discriminatedUnion("type", [And2, Or2]);
3943
+ var CountryConfigQueryInputType = z35.union([
4082
3944
  SerializedQueryExpression,
4083
3945
  And2,
4084
3946
  Or2
4085
3947
  ]);
4086
3948
 
4087
3949
  // ../commons/src/icons.ts
4088
- var z37 = __toESM(require("zod/v4"));
4089
- var AvailableIcons = z37.enum([
3950
+ var z36 = __toESM(require("zod/v4"));
3951
+ var AvailableIcons = z36.enum([
4090
3952
  "Archived",
4091
3953
  "Assigned",
4092
3954
  "Briefcase",
@@ -4211,16 +4073,16 @@ var mandatoryColumns = defineWorkqueuesColumns([
4211
4073
  value: event.field("updatedAt")
4212
4074
  }
4213
4075
  ]);
4214
- var WorkqueueConfig = z38.object({
4215
- slug: z38.string().describe("Determines the url of the workqueue."),
4076
+ var WorkqueueConfig = z37.object({
4077
+ slug: z37.string().describe("Determines the url of the workqueue."),
4216
4078
  name: TranslationConfig.describe(
4217
4079
  "Title of the workflow (both in navigation and on the page)"
4218
4080
  ),
4219
4081
  query: CountryConfigQueryType,
4220
- action: z38.object({ type: WorkqueueActionType }).optional().describe(
4082
+ action: z37.object({ type: WorkqueueActionType }).optional().describe(
4221
4083
  "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4222
4084
  ),
4223
- columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
4085
+ columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4224
4086
  icon: AvailableIcons,
4225
4087
  emptyMessage: TranslationConfig.optional()
4226
4088
  }).describe("Configuration for workqueue.");
@@ -4228,23 +4090,23 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4228
4090
  query: true,
4229
4091
  columns: true
4230
4092
  });
4231
- var WorkqueueConfigInput = z38.object({
4232
- slug: z38.string().describe("Determines the url of the workqueue."),
4093
+ var WorkqueueConfigInput = z37.object({
4094
+ slug: z37.string().describe("Determines the url of the workqueue."),
4233
4095
  name: TranslationConfig.describe(
4234
4096
  "Title of the workflow (both in navigation and on the page)"
4235
4097
  ),
4236
4098
  query: CountryConfigQueryInputType,
4237
- action: z38.object({ type: WorkqueueActionType }).optional().describe(
4099
+ action: z37.object({ type: WorkqueueActionType }).optional().describe(
4238
4100
  "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4239
4101
  ),
4240
- columns: z38.array(WorkqueueColumn).default(mandatoryColumns),
4102
+ columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4241
4103
  icon: AvailableIcons,
4242
4104
  emptyMessage: TranslationConfig.optional()
4243
4105
  });
4244
- var WorkqueueCountInput = z38.array(
4245
- z38.object({ slug: z38.string(), query: QueryType })
4106
+ var WorkqueueCountInput = z37.array(
4107
+ z37.object({ slug: z37.string(), query: QueryType })
4246
4108
  );
4247
- var WorkqueueCountOutput = z38.record(z38.string(), z38.number());
4109
+ var WorkqueueCountOutput = z37.record(z37.string(), z37.number());
4248
4110
 
4249
4111
  // ../commons/src/events/workqueueDefaultColumns.ts
4250
4112
  var defaultWorkqueueColumns = [
@@ -4267,18 +4129,19 @@ var defaultWorkqueueColumns = [
4267
4129
  ];
4268
4130
 
4269
4131
  // ../commons/src/events/Draft.ts
4270
- var z40 = __toESM(require("zod/v4"));
4132
+ var z39 = __toESM(require("zod/v4"));
4271
4133
 
4272
4134
  // ../commons/src/events/ActionInput.ts
4273
- var z39 = __toESM(require("zod/v4"));
4274
- var BaseActionInput = z39.object({
4135
+ var z38 = __toESM(require("zod/v4"));
4136
+ var BaseActionInput = z38.object({
4275
4137
  eventId: UUID,
4276
- transactionId: z39.string(),
4138
+ transactionId: z38.string(),
4277
4139
  declaration: ActionUpdate.default({}),
4278
4140
  annotation: ActionUpdate.optional(),
4279
4141
  originalActionId: UUID.optional(),
4280
4142
  // should not be part of base action.
4281
- keepAssignment: z39.boolean().optional(),
4143
+ keepAssignment: z38.boolean().optional(),
4144
+ waitFor: z38.boolean().optional(),
4282
4145
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4283
4146
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4284
4147
  createdAtLocation: UUID.nullish().describe(
@@ -4286,8 +4149,8 @@ var BaseActionInput = z39.object({
4286
4149
  )
4287
4150
  });
4288
4151
  var CreateActionInput = BaseActionInput.extend(
4289
- z39.object({
4290
- type: z39.literal(ActionType.CREATE).default(ActionType.CREATE),
4152
+ z38.object({
4153
+ type: z38.literal(ActionType.CREATE).default(ActionType.CREATE),
4291
4154
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4292
4155
  createdAtLocation: UUID.nullish().describe(
4293
4156
  "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."
@@ -4295,14 +4158,14 @@ var CreateActionInput = BaseActionInput.extend(
4295
4158
  }).shape
4296
4159
  );
4297
4160
  var RegisterActionInput = BaseActionInput.extend(
4298
- z39.strictObject({
4299
- type: z39.literal(ActionType.REGISTER).default(ActionType.REGISTER),
4300
- registrationNumber: z39.string().optional()
4161
+ z38.strictObject({
4162
+ type: z38.literal(ActionType.REGISTER).default(ActionType.REGISTER),
4163
+ registrationNumber: z38.string().optional()
4301
4164
  }).shape
4302
4165
  );
4303
4166
  var NotifyActionInput = BaseActionInput.extend(
4304
- z39.object({
4305
- type: z39.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
4167
+ z38.object({
4168
+ type: z38.literal(ActionType.NOTIFY).default(ActionType.NOTIFY),
4306
4169
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4307
4170
  createdAtLocation: UUID.nullish().describe(
4308
4171
  "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."
@@ -4318,100 +4181,100 @@ var NotifyActionInput = BaseActionInput.extend(
4318
4181
  }
4319
4182
  });
4320
4183
  var DeclareActionInput = BaseActionInput.extend(
4321
- z39.object({
4322
- type: z39.literal(ActionType.DECLARE).default(ActionType.DECLARE)
4184
+ z38.object({
4185
+ type: z38.literal(ActionType.DECLARE).default(ActionType.DECLARE)
4323
4186
  }).shape
4324
4187
  );
4325
4188
  var EditActionInput = BaseActionInput.extend(
4326
- z39.object({
4327
- type: z39.literal(ActionType.EDIT).default(ActionType.EDIT),
4328
- content: z39.object({
4329
- comment: z39.string().describe("Comment for the edit action.").optional()
4189
+ z38.object({
4190
+ type: z38.literal(ActionType.EDIT).default(ActionType.EDIT),
4191
+ content: z38.object({
4192
+ comment: z38.string().describe("Comment for the edit action.").optional()
4330
4193
  })
4331
4194
  }).shape
4332
4195
  );
4333
4196
  var PrintCertificateActionInput = BaseActionInput.extend(
4334
- z39.object({
4335
- type: z39.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
4197
+ z38.object({
4198
+ type: z38.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
4336
4199
  content: PrintContent.optional()
4337
4200
  }).shape
4338
4201
  );
4339
4202
  var RejectDeclarationActionInput = BaseActionInput.extend(
4340
- z39.object({
4341
- type: z39.literal(ActionType.REJECT).default(ActionType.REJECT),
4203
+ z38.object({
4204
+ type: z38.literal(ActionType.REJECT).default(ActionType.REJECT),
4342
4205
  content: ReasonContent
4343
4206
  }).shape
4344
4207
  );
4345
4208
  var DuplicateDetectedActionInput = BaseActionInput.extend(
4346
- z39.object({
4347
- type: z39.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
4348
- content: z39.object({
4349
- duplicates: z39.array(PotentialDuplicate)
4209
+ z38.object({
4210
+ type: z38.literal(ActionType.DUPLICATE_DETECTED).default(ActionType.DUPLICATE_DETECTED),
4211
+ content: z38.object({
4212
+ duplicates: z38.array(PotentialDuplicate)
4350
4213
  })
4351
4214
  }).shape
4352
4215
  );
4353
4216
  var MarkAsDuplicateActionInput = BaseActionInput.extend(
4354
- z39.object({
4355
- type: z39.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
4356
- content: z39.object({
4217
+ z38.object({
4218
+ type: z38.literal(ActionType.MARK_AS_DUPLICATE).default(ActionType.MARK_AS_DUPLICATE),
4219
+ content: z38.object({
4357
4220
  duplicateOf: UUID
4358
4221
  }).optional()
4359
4222
  }).shape
4360
4223
  );
4361
4224
  var MarkNotDuplicateActionInput = BaseActionInput.extend(
4362
- z39.object({
4363
- type: z39.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
4225
+ z38.object({
4226
+ type: z38.literal(ActionType.MARK_AS_NOT_DUPLICATE).default(ActionType.MARK_AS_NOT_DUPLICATE)
4364
4227
  }).shape
4365
4228
  );
4366
4229
  var ArchiveActionInput = BaseActionInput.extend(
4367
- z39.object({
4368
- type: z39.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
4230
+ z38.object({
4231
+ type: z38.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
4369
4232
  content: ReasonContent
4370
4233
  }).shape
4371
4234
  );
4372
4235
  var AssignActionInput = BaseActionInput.extend(
4373
- z39.object({
4374
- type: z39.literal(ActionType.ASSIGN),
4375
- assignedTo: z39.string()
4236
+ z38.object({
4237
+ type: z38.literal(ActionType.ASSIGN),
4238
+ assignedTo: z38.string()
4376
4239
  }).shape
4377
4240
  );
4378
4241
  var UnassignActionInput = BaseActionInput.extend(
4379
- z39.object({
4380
- type: z39.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
4381
- assignedTo: z39.literal(null).default(null)
4242
+ z38.object({
4243
+ type: z38.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
4244
+ assignedTo: z38.literal(null).default(null)
4382
4245
  }).shape
4383
4246
  );
4384
4247
  var RequestCorrectionActionInput = BaseActionInput.extend(
4385
- z39.object({
4386
- type: z39.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
4248
+ z38.object({
4249
+ type: z38.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
4387
4250
  }).shape
4388
4251
  );
4389
4252
  var RejectCorrectionActionInput = BaseActionInput.extend(
4390
- z39.object({
4391
- requestId: z39.string(),
4392
- type: z39.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
4253
+ z38.object({
4254
+ requestId: z38.string(),
4255
+ type: z38.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
4393
4256
  content: ReasonContent
4394
4257
  }).shape
4395
4258
  );
4396
4259
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4397
- z39.object({
4398
- requestId: z39.string(),
4399
- type: z39.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4260
+ z38.object({
4261
+ requestId: z38.string(),
4262
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4400
4263
  }).shape
4401
4264
  );
4402
4265
  var ReadActionInput = BaseActionInput.extend(
4403
- z39.object({
4404
- type: z39.literal(ActionType.READ).default(ActionType.READ)
4266
+ z38.object({
4267
+ type: z38.literal(ActionType.READ).default(ActionType.READ)
4405
4268
  }).shape
4406
4269
  );
4407
- var DeleteActionInput = z39.object({ eventId: UUID });
4270
+ var DeleteActionInput = z38.object({ eventId: UUID });
4408
4271
  var CustomActionInput = BaseActionInput.extend(
4409
- z39.object({
4410
- type: z39.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
4411
- customActionType: z39.string().describe("Name of the custom action.")
4272
+ z38.object({
4273
+ type: z38.literal(ActionType.CUSTOM).default(ActionType.CUSTOM),
4274
+ customActionType: z38.string().describe("Name of the custom action.")
4412
4275
  }).shape
4413
4276
  );
4414
- var ActionInput = z39.discriminatedUnion("type", [
4277
+ var ActionInput = z38.discriminatedUnion("type", [
4415
4278
  CreateActionInput.meta({ id: "CreateActionInput" }),
4416
4279
  RegisterActionInput.meta({ id: "RegisterActionInput" }),
4417
4280
  NotifyActionInput.meta({ id: "NotifyActionInput" }),
@@ -4447,11 +4310,11 @@ var ActionInput = z39.discriminatedUnion("type", [
4447
4310
  });
4448
4311
 
4449
4312
  // ../commons/src/events/Draft.ts
4450
- var Draft = z40.object({
4313
+ var Draft = z39.object({
4451
4314
  id: UUID,
4452
4315
  eventId: UUID,
4453
- transactionId: z40.string(),
4454
- createdAt: z40.string().datetime(),
4316
+ transactionId: z39.string(),
4317
+ createdAt: z39.string().datetime(),
4455
4318
  action: ActionBase.extend({
4456
4319
  type: ActionTypes.exclude([ActionTypes.enum.DELETE])
4457
4320
  }).omit({ id: true, createdAtLocation: true })
@@ -4460,7 +4323,7 @@ var Draft = z40.object({
4460
4323
  );
4461
4324
  var DraftInput = BaseActionInput.extend({
4462
4325
  type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
4463
- status: z40.enum([
4326
+ status: z39.enum([
4464
4327
  ActionStatus.Requested,
4465
4328
  ActionStatus.Accepted,
4466
4329
  ActionStatus.Rejected
@@ -4468,27 +4331,27 @@ var DraftInput = BaseActionInput.extend({
4468
4331
  });
4469
4332
 
4470
4333
  // ../commons/src/events/EventInput.ts
4471
- var z41 = __toESM(require("zod/v4"));
4334
+ var z40 = __toESM(require("zod/v4"));
4472
4335
  var import_uuid10 = require("uuid");
4473
- var EventInput = z41.object({
4474
- transactionId: z41.string(),
4475
- type: z41.string(),
4336
+ var EventInput = z40.object({
4337
+ transactionId: z40.string(),
4338
+ type: z40.string(),
4476
4339
  createdAtLocation: UUID.nullish().describe(
4477
4340
  "Location where the event occurred. Required for system users."
4478
4341
  )
4479
4342
  }).meta({ default: { transactionId: (0, import_uuid10.v4)(), type: "birth" } });
4480
4343
 
4481
4344
  // ../commons/src/events/EventDocument.ts
4482
- var z42 = __toESM(require("zod/v4"));
4483
- var EventDocument = z42.object({
4345
+ var z41 = __toESM(require("zod/v4"));
4346
+ var EventDocument = z41.object({
4484
4347
  id: UUID.describe("Unique identifier of the event."),
4485
- type: z42.string().describe("Type of the event (e.g. birth, death, marriage)."),
4486
- createdAt: z42.string().datetime().describe("Timestamp indicating when the event was created."),
4487
- updatedAt: z42.string().datetime().describe(
4348
+ type: z41.string().describe("Type of the event (e.g. birth, death, marriage)."),
4349
+ createdAt: z41.string().datetime().describe("Timestamp indicating when the event was created."),
4350
+ updatedAt: z41.string().datetime().describe(
4488
4351
  "Timestamp of the last update, excluding changes from actions."
4489
4352
  ),
4490
- actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
4491
- trackingId: z42.string().describe(
4353
+ actions: z41.array(Action).describe("Ordered list of actions associated with the event."),
4354
+ trackingId: z41.string().describe(
4492
4355
  "System-generated tracking identifier used to look up the event."
4493
4356
  )
4494
4357
  }).meta({ id: "EventDocument" });
@@ -4501,6 +4364,7 @@ var import_lodash2 = require("lodash");
4501
4364
  var updateActions = ActionTypes.extract([
4502
4365
  ActionType.CREATE,
4503
4366
  ActionType.NOTIFY,
4367
+ ActionType.EDIT,
4504
4368
  ActionType.DECLARE,
4505
4369
  ActionType.REGISTER,
4506
4370
  ActionType.REJECT,
@@ -4520,7 +4384,8 @@ var IGNORED_EVENT_TYPES = [
4520
4384
  "tennis-club-membership",
4521
4385
  "library-membership",
4522
4386
  "child-onboarding",
4523
- "digital-identity"
4387
+ "digital-identity",
4388
+ "event-with-optional-address"
4524
4389
  ];
4525
4390
  function warnOnConfigurationIssues(config) {
4526
4391
  const eventId = config.id;
@@ -6932,8 +6797,8 @@ var digitalIdentityEvent = defineConfig({
6932
6797
  });
6933
6798
 
6934
6799
  // ../commons/src/events/test.utils.ts
6935
- var z43 = __toESM(require("zod/v4"));
6936
- var TestUserRole = z43.enum([
6800
+ var z42 = __toESM(require("zod/v4"));
6801
+ var TestUserRole = z42.enum([
6937
6802
  "FIELD_AGENT",
6938
6803
  "LOCAL_REGISTRAR",
6939
6804
  "LOCAL_SYSTEM_ADMIN",
@@ -6949,26 +6814,26 @@ var TestUserRole = z43.enum([
6949
6814
  var import_lodash6 = require("lodash");
6950
6815
 
6951
6816
  // ../commons/src/events/locations.ts
6952
- var z44 = __toESM(require("zod/v4"));
6953
- var LocationTypeV1 = z44.enum([
6817
+ var z43 = __toESM(require("zod/v4"));
6818
+ var LocationTypeV1 = z43.enum([
6954
6819
  "ADMIN_STRUCTURE",
6955
6820
  "CRVS_OFFICE",
6956
6821
  "HEALTH_FACILITY"
6957
6822
  ]);
6958
- var AdministrativeArea = z44.object({
6823
+ var AdministrativeArea = z43.object({
6959
6824
  id: UUID,
6960
- name: z44.string(),
6961
- externalId: z44.string().nullish(),
6825
+ name: z43.string(),
6826
+ externalId: z43.string().nullish(),
6962
6827
  parentId: UUID.nullable(),
6963
- validUntil: z44.iso.datetime().nullable()
6828
+ validUntil: z43.iso.datetime().nullable()
6964
6829
  });
6965
- var Location = z44.object({
6830
+ var Location = z43.object({
6966
6831
  id: UUID,
6967
- name: z44.string(),
6968
- externalId: z44.string().nullish(),
6832
+ name: z43.string(),
6833
+ externalId: z43.string().nullish(),
6969
6834
  administrativeAreaId: UUID.nullable(),
6970
- validUntil: z44.iso.datetime().nullable(),
6971
- locationType: z44.string().nullable()
6835
+ validUntil: z43.iso.datetime().nullable(),
6836
+ locationType: z43.string().nullable()
6972
6837
  });
6973
6838
 
6974
6839
  // ../commons/src/events/scopes.ts
@@ -6978,7 +6843,7 @@ var ACTION_SCOPE_MAP = {
6978
6843
  [ActionType.NOTIFY]: ["record.notify"],
6979
6844
  [ActionType.DECLARE]: ["record.declare", "record.register"],
6980
6845
  [ActionType.EDIT]: ["record.edit"],
6981
- [ActionType.DELETE]: ["record.declare"],
6846
+ [ActionType.DELETE]: ["record.declare", "record.notify"],
6982
6847
  [ActionType.REGISTER]: ["record.register"],
6983
6848
  [ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
6984
6849
  [ActionType.REQUEST_CORRECTION]: [
@@ -7055,7 +6920,7 @@ var ACTION_FILTERS = {
7055
6920
  var import_lodash7 = require("lodash");
7056
6921
 
7057
6922
  // ../commons/src/notification/UserNotifications.ts
7058
- var z45 = __toESM(require("zod/v4"));
6923
+ var z44 = __toESM(require("zod/v4"));
7059
6924
  var TriggerEvent = {
7060
6925
  USER_CREATED: "user-created",
7061
6926
  USER_UPDATED: "user-updated",
@@ -7067,50 +6932,50 @@ var TriggerEvent = {
7067
6932
  CHANGE_PHONE_NUMBER: "change-phone-number",
7068
6933
  CHANGE_EMAIL_ADDRESS: "change-email-address"
7069
6934
  };
7070
- var Recipient = z45.object({
6935
+ var Recipient = z44.object({
7071
6936
  name: NameFieldValue.optional(),
7072
- mobile: z45.string().optional(),
7073
- email: z45.string().optional(),
7074
- bcc: z45.array(z45.string()).optional()
6937
+ mobile: z44.string().optional(),
6938
+ email: z44.string().optional(),
6939
+ bcc: z44.array(z44.string()).optional()
7075
6940
  });
7076
- var BasePayload = z45.object({
6941
+ var BasePayload = z44.object({
7077
6942
  recipient: Recipient
7078
6943
  });
7079
6944
  var TriggerPayload = {
7080
6945
  [TriggerEvent.USER_CREATED]: BasePayload.extend({
7081
- username: z45.string(),
7082
- temporaryPassword: z45.string()
6946
+ username: z44.string(),
6947
+ temporaryPassword: z44.string()
7083
6948
  }),
7084
6949
  [TriggerEvent.USER_UPDATED]: BasePayload.extend({
7085
- oldUsername: z45.string(),
7086
- newUsername: z45.string()
6950
+ oldUsername: z44.string(),
6951
+ newUsername: z44.string()
7087
6952
  }),
7088
6953
  [TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
7089
- username: z45.string()
6954
+ username: z44.string()
7090
6955
  }),
7091
6956
  [TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
7092
- code: z45.string()
6957
+ code: z44.string()
7093
6958
  }),
7094
6959
  [TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
7095
- temporaryPassword: z45.string(),
7096
- admin: z45.object({
7097
- id: z45.string(),
6960
+ temporaryPassword: z44.string(),
6961
+ admin: z44.object({
6962
+ id: z44.string(),
7098
6963
  name: NameFieldValue,
7099
- role: z45.string()
6964
+ role: z44.string()
7100
6965
  })
7101
6966
  }),
7102
6967
  [TriggerEvent.TWO_FA]: BasePayload.extend({
7103
- code: z45.string()
6968
+ code: z44.string()
7104
6969
  }),
7105
6970
  [TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
7106
- subject: z45.string(),
7107
- body: z45.string()
6971
+ subject: z44.string(),
6972
+ body: z44.string()
7108
6973
  }),
7109
6974
  [TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
7110
- code: z45.string()
6975
+ code: z44.string()
7111
6976
  }),
7112
6977
  [TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
7113
- code: z45.string()
6978
+ code: z44.string()
7114
6979
  })
7115
6980
  };
7116
6981
  async function triggerUserEventNotification({
@@ -7134,4 +6999,4 @@ function parseUserEventTrigger(event2, body) {
7134
6999
  }
7135
7000
 
7136
7001
  // src/notification/index.ts
7137
- z46.globalRegistry.clear();
7002
+ z45.globalRegistry.clear();