@opencrvs/toolkit 2.1.0-rc.1f688f9 → 2.1.0-rc.268cfbe

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 (209) hide show
  1. package/README.md +2 -12
  2. package/build.sh +20 -5
  3. package/create-countryconfig/index.js +164 -4
  4. package/dist/application-config/index.js +36 -25
  5. package/dist/authentication/index.d.ts +66 -0
  6. package/dist/authentication/index.d.ts.map +1 -0
  7. package/dist/authentication/index.js +765 -0
  8. package/dist/cli.js +2829 -1294
  9. package/dist/commons/api/router.d.ts +252 -290
  10. package/dist/commons/application-config/index.d.ts +0 -2
  11. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  12. package/dist/commons/conditionals/validate.d.ts +19 -4
  13. package/dist/commons/events/ActionConfig.d.ts +5 -14
  14. package/dist/commons/events/ActionDocument.d.ts +30 -4
  15. package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -12
  16. package/dist/commons/events/AuditLog.d.ts +1 -0
  17. package/dist/commons/events/Draft.d.ts +1 -21
  18. package/dist/commons/events/EventDocument.d.ts +4 -4
  19. package/dist/commons/events/FieldConfig.d.ts +26 -15
  20. package/dist/commons/events/FieldTypeMapping.d.ts +10 -10
  21. package/dist/commons/events/FieldValue.d.ts +1 -0
  22. package/dist/commons/events/FormConfig.d.ts +6 -0
  23. package/dist/commons/events/PageConfig.d.ts +4 -0
  24. package/dist/commons/events/locations.d.ts +4 -0
  25. package/dist/commons/events/scopes.d.ts +21 -1
  26. package/dist/commons/events/test.utils.d.ts +71 -22
  27. package/dist/commons/events/utils.d.ts +37 -2
  28. package/dist/commons/notification/dispatch.d.ts +1 -6
  29. package/dist/conditionals/index.js +21 -7
  30. package/dist/csv.d.ts +25 -0
  31. package/dist/csv.d.ts.map +1 -0
  32. package/dist/csv.js +120 -0
  33. package/dist/environment/index.d.ts.map +1 -1
  34. package/dist/environment/index.js +2 -1
  35. package/dist/environment/logger.d.ts +3 -0
  36. package/dist/environment/logger.d.ts.map +1 -1
  37. package/dist/environment/manage-users.js +1 -1
  38. package/dist/environment/setup-environment.d.ts +1 -1
  39. package/dist/environment/setup-environment.d.ts.map +1 -1
  40. package/dist/environment/setup-environment.js +593 -562
  41. package/dist/environment/swarm-to-k8s.js +3 -4
  42. package/dist/environment/templates.d.ts +0 -1
  43. package/dist/environment/templates.d.ts.map +1 -1
  44. package/dist/environment/templates.js +3 -8
  45. package/dist/environment/update-workflows.d.ts.map +1 -1
  46. package/dist/environment/update-workflows.js +4 -0
  47. package/dist/environment/utils.d.ts +0 -12
  48. package/dist/environment/utils.d.ts.map +1 -1
  49. package/dist/environment/utils.js +1 -28
  50. package/dist/events/index.js +2115 -1884
  51. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -1
  52. package/dist/migrations/v2.1/add-recovery-link-notifications.js +13 -32
  53. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  54. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  55. package/dist/migrations/v2.1/add-translations.js +149 -0
  56. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
  57. package/dist/migrations/v2.1/enable-telemetry.js +32 -15
  58. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  59. package/dist/migrations/v2.1/index.js +1160 -70
  60. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
  61. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  62. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +345 -0
  63. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  64. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  65. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  66. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  67. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  68. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  69. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  70. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  71. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  72. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  73. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  74. package/dist/migrations/v2.1/template-files.js +49 -0
  75. package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
  76. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  77. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  78. package/dist/notification/index.js +249 -207
  79. package/dist/scopes/index.d.ts +288 -5
  80. package/dist/scopes/index.js +22 -7
  81. package/dist/telemetry/index.js +5 -1
  82. package/dist/templates/charts-values/dependencies/values.yaml +8 -0
  83. package/dist/templates/charts-values/opencrvs-services/values.yaml +6 -0
  84. package/dist/templates/charts-values/opentelemetry/values.yaml +7 -0
  85. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  86. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  87. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  88. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  89. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  90. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  91. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  92. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  93. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  94. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  95. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  96. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  97. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  98. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  99. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  100. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  101. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  102. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  103. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  104. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  105. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  106. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  107. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  108. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  109. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  110. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  111. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  112. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  113. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  114. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  115. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  116. package/dist/translations/template.d.ts +11 -0
  117. package/dist/translations/template.d.ts.map +1 -0
  118. package/dist/translations/template.js +100 -0
  119. package/dist/verify/endpoints.d.ts +2 -0
  120. package/dist/verify/endpoints.d.ts.map +1 -0
  121. package/dist/verify/endpoints.js +510 -0
  122. package/opencrvs-toolkit-2.1.0-rc.268cfbe.tgz +0 -0
  123. package/package.json +9 -4
  124. package/tsconfig.build.json +11 -0
  125. package/tsconfig.build.tsbuildinfo +1 -0
  126. package/tsconfig.json +3 -0
  127. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  128. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  129. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  130. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  131. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  132. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  133. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  134. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  135. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  136. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  137. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  138. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  139. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  140. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  141. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  142. package/dist/migrations/v2.0/create-events-index.d.ts +0 -3
  143. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  144. package/dist/migrations/v2.0/create-events-index.js +0 -325
  145. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  146. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  147. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  148. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  149. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  150. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  151. package/dist/migrations/v2.0/index.d.ts +0 -13
  152. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  153. package/dist/migrations/v2.0/index.js +0 -103
  154. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  155. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  156. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  157. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  158. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  159. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  160. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  161. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  162. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  163. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  164. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  165. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  166. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  167. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  168. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  169. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  170. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  171. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  172. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  173. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  174. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  175. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  176. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  177. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  178. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  179. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  180. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  181. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  182. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  183. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  184. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  185. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  186. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  187. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  188. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  189. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  190. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  191. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  192. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  193. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  194. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  195. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  196. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  197. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  198. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  199. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  200. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  201. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  202. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  203. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  204. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  205. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  206. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  207. package/dist/migrations/v2.0/update-package-json.js +0 -105
  208. package/opencrvs-toolkit-2.1.0-rc.1f688f9.tgz +0 -0
  209. package/tsconfig.tsbuildinfo +0 -1
@@ -338,7 +338,9 @@ var RecordScopeTypeV2 = z7.enum([
338
338
  "record.request-correction",
339
339
  "record.correct",
340
340
  "record.unassign-others",
341
- "record.custom-action"
341
+ "record.custom-action",
342
+ "record.action.accept",
343
+ "record.action.reject"
342
344
  ]);
343
345
  var PlainScopeType = z7.enum([
344
346
  // Misc. system scopes
@@ -360,10 +362,7 @@ var PlainScopeType = z7.enum([
360
362
  // Performance dashboard
361
363
  "performance.read",
362
364
  "performance.read-dashboards",
363
- "performance.vital-statistics-export",
364
- // Scopes used exclusively by countryconfig integration token
365
- "record.confirm-registration",
366
- "record.reject-registration"
365
+ "performance.vital-statistics-export"
367
366
  ]);
368
367
  var scopeByEvent = z7.preprocess(
369
368
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -381,7 +380,9 @@ var userRole = z7.preprocess(
381
380
  ).describe("User role, e.g. admin, field agent");
382
381
  var scopeOptionsPlaceEvent = z7.object({
383
382
  event: scopeByEvent,
384
- placeOfEvent: JurisdictionFilter.optional()
383
+ placeOfEvent: JurisdictionFilter.optional(),
384
+ createdBy: UserFilter.optional(),
385
+ createdIn: JurisdictionFilter.optional()
385
386
  }).describe("Options applicable to all record scopes.");
386
387
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
387
388
  notifiedIn: JurisdictionFilter.optional(),
@@ -424,7 +425,9 @@ var AllScopeOptions = z7.object({
424
425
  var ScopeOptionKey = AllScopeOptions.keyof();
425
426
  var ResolvedScopeOptionsPlaceEvent = z7.object({
426
427
  event: scopeByEvent,
427
- placeOfEvent: UUID.nullish()
428
+ placeOfEvent: UUID.nullish(),
429
+ createdBy: z7.string().optional(),
430
+ createdIn: UUID.nullish()
428
431
  }).describe(
429
432
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
430
433
  );
@@ -471,6 +474,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
471
474
  "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."
472
475
  )
473
476
  });
477
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
478
+ "record.action.accept",
479
+ "record.action.reject"
480
+ ]);
481
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
482
+ "Options for confirming (accepting or rejecting) an action."
483
+ );
474
484
  var RecordScopeV2 = z7.discriminatedUnion("type", [
475
485
  z7.object({
476
486
  type: ScopesWithPlaceEventOptions,
@@ -491,6 +501,10 @@ var RecordScopeV2 = z7.discriminatedUnion("type", [
491
501
  z7.object({
492
502
  type: z7.literal("record.print-certified-copies"),
493
503
  options: ScopeOptionsPrintCertifiedCopies.optional()
504
+ }),
505
+ z7.object({
506
+ type: ActionConfirmationScopeType,
507
+ options: ActionConfirmationScopeOptions.optional()
494
508
  })
495
509
  ]).describe(
496
510
  "Scopes used to check user's permission to perform actions on a record."
@@ -766,6 +780,7 @@ var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
766
780
  operation: z9.literal("attachments.upload"),
767
781
  requestData: z9.object({
768
782
  transactionId: z9.string(),
783
+ eventId: z9.string().optional(),
769
784
  path: z9.string().nullable()
770
785
  }),
771
786
  responseSummary: z9.object({ fileUrl: z9.string() })
@@ -1080,8 +1095,9 @@ var TextValue = z14.string();
1080
1095
  var HiddenFieldValue = z14.string();
1081
1096
  var NonEmptyTextValue = z14.string().trim().min(1);
1082
1097
  var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
1098
+ var AGE_MAX_VALUE = 999;
1083
1099
  var AgeValue = z14.object({
1084
- age: z14.number(),
1100
+ age: z14.number().int().min(0).max(AGE_MAX_VALUE),
1085
1101
  asOfDateRef: z14.string()
1086
1102
  });
1087
1103
  var AgeUpdateValue = AgeValue.optional().nullable();
@@ -1411,7 +1427,7 @@ var RequestedCorrectionAction = ActionBase.extend(
1411
1427
  var ApprovedCorrectionAction = ActionBase.extend(
1412
1428
  z16.object({
1413
1429
  type: z16.literal(ActionType.APPROVE_CORRECTION),
1414
- requestId: z16.string(),
1430
+ requestId: UUID,
1415
1431
  // TODO move into 'content' property
1416
1432
  content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
1417
1433
  }).shape
@@ -1419,7 +1435,7 @@ var ApprovedCorrectionAction = ActionBase.extend(
1419
1435
  var RejectedCorrectionAction = ActionBase.extend(
1420
1436
  z16.object({
1421
1437
  type: z16.literal(ActionType.REJECT_CORRECTION),
1422
- requestId: z16.string(),
1438
+ requestId: UUID,
1423
1439
  // TODO move into 'content' property
1424
1440
  content: ReasonContent
1425
1441
  }).shape
@@ -2244,9 +2260,6 @@ var AdministrativeAreaField = BaseField.extend({
2244
2260
  partOf: FieldReference.optional().describe("Parent location"),
2245
2261
  type: AdministrativeAreas,
2246
2262
  allowedLocations: AllowedLocations,
2247
- listHistoricalNames: import_v43.default.boolean().optional().describe(
2248
- "List every historical name a location has had as a separate, selectable option."
2249
- ),
2250
2263
  activeOnly: import_v43.default.boolean().optional().describe(
2251
2264
  "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
2252
2265
  ),
@@ -2264,9 +2277,6 @@ var LocationInput = BaseField.extend({
2264
2277
  configuration: import_v43.default.object({
2265
2278
  locationTypes: import_v43.default.array(import_v43.default.string()).optional().describe("Types of the locations that are available for selection."),
2266
2279
  allowedLocations: AllowedLocations,
2267
- listHistoricalNames: import_v43.default.boolean().optional().describe(
2268
- "List every historical name a location has had as a separate, selectable option."
2269
- ),
2270
2280
  activeOnly: import_v43.default.boolean().optional().describe(
2271
2281
  "Offer only locations that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded."
2272
2282
  ),
@@ -2300,7 +2310,6 @@ var Facility = BaseField.extend({
2300
2310
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2301
2311
  configuration: import_v43.default.object({
2302
2312
  allowedLocations: AllowedLocations,
2303
- listHistoricalNames: import_v43.default.boolean().optional(),
2304
2313
  activeOnly: import_v43.default.boolean().optional(),
2305
2314
  anchorToDateOfEvent: import_v43.default.boolean().optional()
2306
2315
  }).optional()
@@ -2310,7 +2319,6 @@ var Office = BaseField.extend({
2310
2319
  defaultValue: NonEmptyTextValue.or(ComputedDefaultValue).optional(),
2311
2320
  configuration: import_v43.default.object({
2312
2321
  allowedLocations: AllowedLocations,
2313
- listHistoricalNames: import_v43.default.boolean().optional(),
2314
2322
  activeOnly: import_v43.default.boolean().optional(),
2315
2323
  anchorToDateOfEvent: import_v43.default.boolean().optional()
2316
2324
  }).optional()
@@ -2347,9 +2355,6 @@ var Address = BaseField.extend({
2347
2355
  })
2348
2356
  ).optional(),
2349
2357
  allowedLocations: AllowedLocations,
2350
- listHistoricalNames: import_v43.default.boolean().optional().describe(
2351
- "List every historical name a location has had as a separate, selectable option. Propagated to the embedded admin-area selectors."
2352
- ),
2353
2358
  activeOnly: import_v43.default.boolean().optional().describe(
2354
2359
  "Offer only admin areas that are active at the resolved anchor date (today, or the date of event when anchorToDateOfEvent is set); inactive or not-yet-effective versions are excluded. Propagated to the embedded admin-area selectors."
2355
2360
  ),
@@ -2410,10 +2415,19 @@ var ButtonField = BaseField.extend({
2410
2415
  description: "A generic button that can be used to trigger an action",
2411
2416
  id: "ButtonField"
2412
2417
  });
2418
+ var FieldGroupConfiguration = import_v43.default.object({
2419
+ separator: import_v43.default.string().optional().describe(
2420
+ 'Joins the subfield values when the group is rendered as output, e.g. ", ". Defaults to one subfield per line.'
2421
+ ),
2422
+ hideEmptyFields: import_v43.default.boolean().default(false).optional().describe(
2423
+ "Leaves subfields without a value out of the output. Pair it with a separator so the separator does not double up around the gaps."
2424
+ )
2425
+ });
2413
2426
  var FieldGroup = BaseField.extend({
2414
2427
  type: import_v43.default.literal(FieldType.FIELD_GROUP),
2415
2428
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
2416
- fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig))
2429
+ fields: import_v43.default.lazy(() => import_v43.default.array(FieldConfig)),
2430
+ configuration: FieldGroupConfiguration.optional()
2417
2431
  }).meta({
2418
2432
  description: "A group of fields that are displayed together",
2419
2433
  id: "FieldGroup"
@@ -2667,6 +2681,9 @@ var PageConfigBase = z22.object({
2667
2681
  requireCompletionToContinue: z22.boolean().default(false).describe(
2668
2682
  "If true, all required fields must be filled before continuing to the next page"
2669
2683
  ),
2684
+ showClearButton: z22.boolean().optional().describe(
2685
+ 'If true, a "Clear" button is shown at the top of the page allowing the user to reset all fields on the page to their default state'
2686
+ ),
2670
2687
  fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
2671
2688
  conditional: Conditional.optional().describe(
2672
2689
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
@@ -2847,7 +2864,10 @@ var ReadActionConfig = ActionConfigBase.extend(
2847
2864
  review: DeclarationReviewConfig.describe(
2848
2865
  "Configuration of the review page for read-only view."
2849
2866
  ),
2850
- conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
2867
+ conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals."),
2868
+ flags: z25.never().optional().describe(
2869
+ "READ is a meta action excluded from flag resolution, so flags configured here would never apply."
2870
+ )
2851
2871
  }).shape
2852
2872
  );
2853
2873
  var NotifyConfig = ActionConfigBase.extend(
@@ -3279,7 +3299,7 @@ var ReferenceField = BaseField2.extend({
3279
3299
  var Field = BaseField2.extend({
3280
3300
  id: z29.string().describe("Identifier of the summary field."),
3281
3301
  value: TranslationConfig.describe(
3282
- 'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3302
+ 'Field value template supports variables from configuration (e.g. "{informant.phoneNo} {informant.email}") and EventMetadata (e.g. "{event.legalStatuses.REGISTERED.acceptedAt, date, ::dd MMMM yyyy}").'
3283
3303
  ),
3284
3304
  label: TranslationConfig
3285
3305
  }).describe("Custom field defined for the summary view.");
@@ -3469,21 +3489,23 @@ function omitKeyDeep(obj, keyToRemove) {
3469
3489
 
3470
3490
  // ../commons/src/events/state/utils.ts
3471
3491
  var import_lodash = require("lodash");
3472
- var updateActions = ActionTypes.extract([
3473
- ActionType.CREATE,
3474
- ActionType.NOTIFY,
3475
- ActionType.EDIT,
3476
- ActionType.DECLARE,
3477
- ActionType.REGISTER,
3478
- ActionType.REJECT,
3479
- ActionType.ARCHIVE,
3480
- ActionType.UNARCHIVE,
3481
- ActionType.PRINT_CERTIFICATE,
3482
- ActionType.REQUEST_CORRECTION,
3483
- ActionType.APPROVE_CORRECTION,
3484
- ActionType.REJECT_CORRECTION,
3485
- ActionType.CUSTOM
3486
- ]);
3492
+ var updateActions = new Set(
3493
+ ActionTypes.extract([
3494
+ ActionType.CREATE,
3495
+ ActionType.NOTIFY,
3496
+ ActionType.EDIT,
3497
+ ActionType.DECLARE,
3498
+ ActionType.REGISTER,
3499
+ ActionType.REJECT,
3500
+ ActionType.ARCHIVE,
3501
+ ActionType.UNARCHIVE,
3502
+ ActionType.PRINT_CERTIFICATE,
3503
+ ActionType.REQUEST_CORRECTION,
3504
+ ActionType.APPROVE_CORRECTION,
3505
+ ActionType.REJECT_CORRECTION,
3506
+ ActionType.CUSTOM
3507
+ ]).options
3508
+ );
3487
3509
 
3488
3510
  // ../commons/src/events/state/flags.ts
3489
3511
  var import_lodash2 = require("lodash");
@@ -5069,7 +5091,14 @@ var Draft = z40.object({
5069
5091
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
5070
5092
  );
5071
5093
  var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
5072
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
5094
+ /*
5095
+ * A draft can name a file that no action references. Such a file stays until
5096
+ * the record is deleted or the record's next action sweeps its prefix.
5097
+ * DECLARE is available only where one of those is still coming: a created
5098
+ * record, which can still be deleted, and a record part way through an edit,
5099
+ * which is about to be declared or registered.
5100
+ */
5101
+ type: z40.literal(ActionTypes.enum.DECLARE),
5073
5102
  status: z40.enum([
5074
5103
  ActionStatus.Requested,
5075
5104
  ActionStatus.Accepted,
@@ -5107,38 +5136,8 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
5107
5136
  }).brand("EventDocumentOnlyLastAction");
5108
5137
 
5109
5138
  // ../commons/src/events/defineConfig.ts
5110
- var IGNORED_EVENT_TYPES = [
5111
- "FOOTBALL_CLUB_MEMBERSHIP",
5112
- "tennis-club-membership",
5113
- "library-membership",
5114
- "child-onboarding",
5115
- "digital-identity",
5116
- "event-with-optional-address"
5117
- ];
5118
- function warnOnConfigurationIssues(config) {
5119
- const eventId = config.id;
5120
- if (IGNORED_EVENT_TYPES.includes(eventId)) {
5121
- return;
5122
- }
5123
- const validateDeclarationAction = config.actions.find(
5124
- (action) => action.type === ActionType.CUSTOM && action.customActionType === "VALIDATE_DECLARATION"
5125
- );
5126
- if (!validateDeclarationAction) {
5127
- console.warn(
5128
- `
5129
- ************** WARNING **************
5130
- A custom action with customActionType 'VALIDATE_DECLARATION' is not defined for event '${eventId}'!
5131
- For v2.0, we expect this to be defined for all events.
5132
-
5133
- The deprecated v1.9 'ActionType.VALIDATE' actions are migrated to customActionType 'VALIDATE_DECLARATION' in v2.0.
5134
- ************** WARNING **************
5135
- `
5136
- );
5137
- }
5138
- }
5139
5139
  var defineConfig = (config) => {
5140
5140
  const input = EventConfig.parse(config);
5141
- warnOnConfigurationIssues(input);
5142
5141
  return input;
5143
5142
  };
5144
5143
 
@@ -5829,6 +5828,21 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
5829
5828
  description: "Title of the review page"
5830
5829
  },
5831
5830
  fields: [
5831
+ {
5832
+ id: "annotation.hidden",
5833
+ type: FieldType.TEXT,
5834
+ label: {
5835
+ id: "annotation.hidden.label",
5836
+ defaultMessage: "Show not be visible",
5837
+ description: "Catch for rendering"
5838
+ },
5839
+ conditionals: [
5840
+ {
5841
+ type: ConditionalType.SHOW,
5842
+ conditional: never2()
5843
+ }
5844
+ ]
5845
+ },
5832
5846
  {
5833
5847
  id: "review.comment",
5834
5848
  type: FieldType.TEXTAREA,
@@ -5885,7 +5899,23 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
5885
5899
  defaultMessage: "Who is applying for the membership?",
5886
5900
  description: "This is the title of the section"
5887
5901
  },
5902
+ showClearButton: true,
5888
5903
  fields: [
5904
+ {
5905
+ id: "declaration.hidden",
5906
+ type: FieldType.TEXT,
5907
+ label: {
5908
+ id: "declaration.hidden.label",
5909
+ defaultMessage: "Show not be visible",
5910
+ description: "Catch for rendering"
5911
+ },
5912
+ conditionals: [
5913
+ {
5914
+ type: ConditionalType.SHOW,
5915
+ conditional: never2()
5916
+ }
5917
+ ]
5918
+ },
5889
5919
  {
5890
5920
  id: "applicant.name",
5891
5921
  type: FieldType.NAME,
@@ -7555,53 +7585,39 @@ var digitalIdentityEvent = defineConfig({
7555
7585
  });
7556
7586
 
7557
7587
  // ../commons/src/events/test.utils.ts
7558
- var z43 = __toESM(require("zod/v4"));
7559
- var TestUserRole = z43.enum([
7560
- "FIELD_AGENT",
7561
- "LOCAL_REGISTRAR",
7562
- "LOCAL_SYSTEM_ADMIN",
7563
- "NATIONAL_REGISTRAR",
7564
- "REGISTRATION_AGENT",
7565
- "NATIONAL_SYSTEM_ADMIN",
7566
- "SOCIAL_WORKER",
7567
- "COMMUNITY_LEADER",
7568
- "PROVINCIAL_REGISTRAR"
7569
- ]);
7570
-
7571
- // ../commons/src/events/scopes.ts
7572
- var import_lodash6 = require("lodash");
7588
+ var z44 = __toESM(require("zod/v4"));
7573
7589
 
7574
7590
  // ../commons/src/events/locations.ts
7575
- var z44 = __toESM(require("zod/v4"));
7576
- var LocationTypeV1 = z44.enum([
7591
+ var z43 = __toESM(require("zod/v4"));
7592
+ var LocationTypeV1 = z43.enum([
7577
7593
  "ADMIN_STRUCTURE",
7578
7594
  "CRVS_OFFICE",
7579
7595
  "HEALTH_FACILITY"
7580
7596
  ]);
7581
- var LocationStatus = z44.enum(["active", "inactive"]);
7582
- var LocationVersion = z44.object({
7597
+ var LocationStatus = z43.enum(["active", "inactive"]);
7598
+ var LocationVersion = z43.object({
7583
7599
  versionId: UUID,
7584
- effectiveFrom: z44.iso.date(),
7585
- name: z44.string(),
7586
- externalId: z44.string().nullish(),
7600
+ effectiveFrom: z43.iso.date(),
7601
+ name: z43.string(),
7602
+ externalId: z43.string().nullish(),
7587
7603
  status: LocationStatus
7588
7604
  });
7589
- var AdministrativeArea = z44.object({
7605
+ var AdministrativeArea = z43.object({
7590
7606
  id: UUID,
7591
- name: z44.string(),
7592
- externalId: z44.string().nullish(),
7607
+ name: z43.string(),
7608
+ externalId: z43.string().nullish(),
7593
7609
  parentId: UUID.nullable(),
7594
7610
  status: LocationStatus,
7595
- versions: z44.array(LocationVersion)
7611
+ versions: z43.array(LocationVersion)
7596
7612
  });
7597
- var Location = z44.object({
7613
+ var Location = z43.object({
7598
7614
  id: UUID,
7599
- name: z44.string(),
7600
- externalId: z44.string().nullish(),
7615
+ name: z43.string(),
7616
+ externalId: z43.string().nullish(),
7601
7617
  administrativeAreaId: UUID.nullable(),
7602
- locationType: z44.string().nullable(),
7618
+ locationType: z43.string().nullable(),
7603
7619
  status: LocationStatus,
7604
- versions: z44.array(LocationVersion)
7620
+ versions: z43.array(LocationVersion)
7605
7621
  });
7606
7622
  var ClientAdministrativeArea = AdministrativeArea.omit({
7607
7623
  name: true,
@@ -7642,121 +7658,26 @@ function validateUniqueIds(versions, ctx) {
7642
7658
  ctx.addIssue("versions must not repeat a versionId");
7643
7659
  }
7644
7660
  }
7645
- var SeededLocationVersions = z44.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7661
+ var SeededLocationVersions = z43.array(LocationVersion).min(1).superRefine((versions, ctx) => {
7646
7662
  validateAscendingDates(versions, ctx);
7647
7663
  validateUniqueIds(versions, ctx);
7648
7664
  });
7649
- var SetLocationPayload = z44.object({
7665
+ var SetLocationPayload = z43.object({
7650
7666
  id: UUID,
7651
- name: z44.string(),
7652
- externalId: z44.string().nullish(),
7667
+ name: z43.string(),
7668
+ externalId: z43.string().nullish(),
7653
7669
  administrativeAreaId: UUID.nullable(),
7654
- locationType: z44.string().nullable(),
7670
+ locationType: z43.string().nullable(),
7655
7671
  versions: SeededLocationVersions.optional()
7656
7672
  });
7657
- var SetAdministrativeAreaPayload = z44.object({
7673
+ var SetAdministrativeAreaPayload = z43.object({
7658
7674
  id: UUID,
7659
- name: z44.string(),
7660
- externalId: z44.string().nullish(),
7675
+ name: z43.string(),
7676
+ externalId: z43.string().nullish(),
7661
7677
  parentId: UUID.nullable(),
7662
7678
  versions: SeededLocationVersions.optional()
7663
7679
  });
7664
7680
 
7665
- // ../commons/src/events/scopes.ts
7666
- var ACTION_SCOPE_MAP = {
7667
- [ActionType.READ]: ["record.read"],
7668
- [ActionType.CREATE]: ["record.create"],
7669
- [ActionType.NOTIFY]: ["record.notify"],
7670
- [ActionType.DECLARE]: ["record.declare", "record.register"],
7671
- [ActionType.EDIT]: ["record.edit"],
7672
- [ActionType.DELETE]: ["record.declare", "record.notify"],
7673
- [ActionType.REGISTER]: ["record.register"],
7674
- [ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
7675
- [ActionType.REQUEST_CORRECTION]: [
7676
- "record.request-correction",
7677
- "record.correct"
7678
- ],
7679
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
7680
- [ActionType.REJECT_CORRECTION]: ["record.correct"],
7681
- [ActionType.APPROVE_CORRECTION]: ["record.correct"],
7682
- [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
7683
- [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
7684
- [ActionType.ARCHIVE]: ["record.archive"],
7685
- [ActionType.UNARCHIVE]: ["record.unarchive"],
7686
- [ActionType.REJECT]: ["record.reject"],
7687
- [ActionType.ASSIGN]: null,
7688
- [ActionType.UNASSIGN]: null,
7689
- [ActionType.DUPLICATE_DETECTED]: [],
7690
- [ActionType.CUSTOM]: []
7691
- };
7692
-
7693
- // ../commons/src/events/state/availableActions.ts
7694
- var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
7695
- [EventStatus.enum.CREATED]: [
7696
- ActionType.READ,
7697
- ActionType.DECLARE,
7698
- ActionType.NOTIFY,
7699
- ActionType.DELETE
7700
- ],
7701
- [EventStatus.enum.NOTIFIED]: [
7702
- ActionType.READ,
7703
- ActionType.EDIT,
7704
- ActionType.MARK_AS_DUPLICATE,
7705
- ActionType.ARCHIVE,
7706
- ActionType.REJECT,
7707
- ActionType.CUSTOM
7708
- ],
7709
- [EventStatus.enum.DECLARED]: [
7710
- ActionType.READ,
7711
- ActionType.REGISTER,
7712
- ActionType.MARK_AS_DUPLICATE,
7713
- ActionType.ARCHIVE,
7714
- ActionType.REJECT,
7715
- ActionType.CUSTOM,
7716
- ActionType.EDIT
7717
- ],
7718
- [EventStatus.enum.REGISTERED]: [
7719
- ActionType.READ,
7720
- ActionType.PRINT_CERTIFICATE,
7721
- ActionType.REQUEST_CORRECTION,
7722
- ActionType.APPROVE_CORRECTION,
7723
- ActionType.REJECT_CORRECTION,
7724
- ActionType.CUSTOM,
7725
- ClientSpecificAction.REVIEW_CORRECTION_REQUEST
7726
- ],
7727
- [EventStatus.enum.ARCHIVED]: [
7728
- ActionType.READ,
7729
- ActionType.CUSTOM,
7730
- ActionType.UNARCHIVE
7731
- ]
7732
- };
7733
- var ACTION_FILTERS = {
7734
- [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7735
- [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7736
- [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7737
- [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7738
- [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7739
- [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
7740
- [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
7741
- [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
7742
- [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
7743
- [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
7744
- [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
7745
- [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
7746
- [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
7747
- [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
7748
- };
7749
- var REJECTED_ACTIONS = [
7750
- ActionType.READ,
7751
- ActionType.NOTIFY,
7752
- ActionType.CUSTOM,
7753
- ActionType.EDIT,
7754
- ActionType.ARCHIVE
7755
- ];
7756
-
7757
- // ../commons/src/events/FileUtils.ts
7758
- var import_lodash7 = require("lodash");
7759
-
7760
7681
  // ../commons/src/events/mocks.test.utils.ts
7761
7682
  function withVersionFields(entity) {
7762
7683
  return {
@@ -8099,6 +8020,118 @@ var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
8099
8020
  ])
8100
8021
  );
8101
8022
 
8023
+ // ../commons/src/events/test.utils.ts
8024
+ var TestUserRole = z44.enum([
8025
+ "FIELD_AGENT",
8026
+ "LOCAL_REGISTRAR",
8027
+ "LOCAL_SYSTEM_ADMIN",
8028
+ "NATIONAL_REGISTRAR",
8029
+ "REGISTRATION_AGENT",
8030
+ "NATIONAL_SYSTEM_ADMIN",
8031
+ "SOCIAL_WORKER",
8032
+ "COMMUNITY_LEADER",
8033
+ "PROVINCIAL_REGISTRAR"
8034
+ ]);
8035
+
8036
+ // ../commons/src/events/scopes.ts
8037
+ var import_lodash6 = require("lodash");
8038
+ var ACTION_SCOPE_MAP = {
8039
+ [ActionType.READ]: ["record.read"],
8040
+ [ActionType.CREATE]: ["record.create"],
8041
+ [ActionType.NOTIFY]: ["record.notify"],
8042
+ [ActionType.DECLARE]: ["record.declare", "record.register"],
8043
+ [ActionType.EDIT]: ["record.edit"],
8044
+ [ActionType.DELETE]: ["record.declare", "record.notify"],
8045
+ [ActionType.REGISTER]: ["record.register"],
8046
+ [ActionType.PRINT_CERTIFICATE]: ["record.print-certified-copies"],
8047
+ [ActionType.REQUEST_CORRECTION]: [
8048
+ "record.request-correction",
8049
+ "record.correct"
8050
+ ],
8051
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: ["record.correct"],
8052
+ [ActionType.REJECT_CORRECTION]: ["record.correct"],
8053
+ [ActionType.APPROVE_CORRECTION]: ["record.correct"],
8054
+ [ActionType.MARK_AS_DUPLICATE]: ["record.review-duplicates"],
8055
+ [ActionType.MARK_AS_NOT_DUPLICATE]: ["record.review-duplicates"],
8056
+ [ActionType.ARCHIVE]: ["record.archive"],
8057
+ [ActionType.UNARCHIVE]: ["record.unarchive"],
8058
+ [ActionType.REJECT]: ["record.reject"],
8059
+ [ActionType.ASSIGN]: null,
8060
+ [ActionType.UNASSIGN]: null,
8061
+ [ActionType.DUPLICATE_DETECTED]: [],
8062
+ [ActionType.CUSTOM]: []
8063
+ };
8064
+ var RECORD_WRITE_SCOPES = (0, import_lodash6.uniq)(
8065
+ Object.entries(ACTION_SCOPE_MAP).filter(([action]) => action !== ActionType.READ).flatMap(([, scopes]) => scopes ?? [])
8066
+ );
8067
+
8068
+ // ../commons/src/events/state/availableActions.ts
8069
+ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
8070
+ [EventStatus.enum.CREATED]: [
8071
+ ActionType.READ,
8072
+ ActionType.DECLARE,
8073
+ ActionType.NOTIFY,
8074
+ ActionType.DELETE
8075
+ ],
8076
+ [EventStatus.enum.NOTIFIED]: [
8077
+ ActionType.READ,
8078
+ ActionType.EDIT,
8079
+ ActionType.MARK_AS_DUPLICATE,
8080
+ ActionType.ARCHIVE,
8081
+ ActionType.REJECT,
8082
+ ActionType.CUSTOM
8083
+ ],
8084
+ [EventStatus.enum.DECLARED]: [
8085
+ ActionType.READ,
8086
+ ActionType.REGISTER,
8087
+ ActionType.MARK_AS_DUPLICATE,
8088
+ ActionType.ARCHIVE,
8089
+ ActionType.REJECT,
8090
+ ActionType.CUSTOM,
8091
+ ActionType.EDIT
8092
+ ],
8093
+ [EventStatus.enum.REGISTERED]: [
8094
+ ActionType.READ,
8095
+ ActionType.PRINT_CERTIFICATE,
8096
+ ActionType.REQUEST_CORRECTION,
8097
+ ActionType.APPROVE_CORRECTION,
8098
+ ActionType.REJECT_CORRECTION,
8099
+ ActionType.CUSTOM,
8100
+ ClientSpecificAction.REVIEW_CORRECTION_REQUEST
8101
+ ],
8102
+ [EventStatus.enum.ARCHIVED]: [
8103
+ ActionType.READ,
8104
+ ActionType.CUSTOM,
8105
+ ActionType.UNARCHIVE
8106
+ ]
8107
+ };
8108
+ var ACTION_FILTERS = {
8109
+ [ActionType.PRINT_CERTIFICATE]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8110
+ [ActionType.REQUEST_CORRECTION]: (flags) => !flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8111
+ [ClientSpecificAction.REVIEW_CORRECTION_REQUEST]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8112
+ [ActionType.APPROVE_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8113
+ [ActionType.REJECT_CORRECTION]: (flags) => flags.includes(InherentFlags.CORRECTION_REQUESTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8114
+ [ActionType.MARK_AS_DUPLICATE]: (flags) => flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8115
+ [ActionType.EDIT]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8116
+ [ActionType.REGISTER]: (flags) => !flags.includes(InherentFlags.POTENTIAL_DUPLICATE) && !flags.some((flag2) => flag2.endsWith(":requested")),
8117
+ [ActionType.REJECT]: (flags) => !flags.includes(InherentFlags.REJECTED) && !flags.some((flag2) => flag2.endsWith(":requested")),
8118
+ [ActionType.ARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8119
+ [ActionType.UNARCHIVE]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8120
+ [ActionType.ASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8121
+ [ActionType.UNASSIGN]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested")),
8122
+ [ActionType.CUSTOM]: (flags) => !flags.some((flag2) => flag2.endsWith(":requested"))
8123
+ };
8124
+ var REJECTED_ACTIONS = [
8125
+ ActionType.READ,
8126
+ ActionType.NOTIFY,
8127
+ ActionType.CUSTOM,
8128
+ ActionType.EDIT,
8129
+ ActionType.ARCHIVE
8130
+ ];
8131
+
8132
+ // ../commons/src/events/FileUtils.ts
8133
+ var import_lodash7 = require("lodash");
8134
+
8102
8135
  // ../commons/src/events/locationPayloads.ts
8103
8136
  var z45 = __toESM(require("zod/v4"));
8104
8137
  var CreateLocationPayload = z45.object({
@@ -8268,7 +8301,7 @@ function buildLoggerOptions() {
8268
8301
  hooks: { logMethod: filterHealthCheckLogs }
8269
8302
  };
8270
8303
  }
8271
- var logger = false ? (0, import_pino.default)({
8304
+ var logger = process.env.NODE_ENV === "production" ? (0, import_pino.default)({
8272
8305
  level: "info",
8273
8306
  redact: [
8274
8307
  "req.headers.authorization",
@@ -8287,7 +8320,7 @@ var logger = false ? (0, import_pino.default)({
8287
8320
  },
8288
8321
  ...buildLoggerOptions()
8289
8322
  });
8290
- var level = false ? "silent" : process.env.LOG_LEVEL;
8323
+ var level = process.env.NODE_ENV === "test" ? "silent" : process.env.LOG_LEVEL;
8291
8324
  if (level) {
8292
8325
  logger.level = level;
8293
8326
  }
@@ -8300,7 +8333,7 @@ async function triggerUserEventNotification({
8300
8333
  authHeader
8301
8334
  }) {
8302
8335
  const response = await fetch(
8303
- joinUrl(countryConfigUrl, `triggers/user/${event2}`),
8336
+ joinUrl(countryConfigUrl, `trigger/user/${event2}`),
8304
8337
  {
8305
8338
  method: "POST",
8306
8339
  body: JSON.stringify(payload),
@@ -8320,3 +8353,12 @@ async function triggerUserEventNotification({
8320
8353
 
8321
8354
  // src/notification/index.ts
8322
8355
  z47.globalRegistry.clear();
8356
+ // Annotate the CommonJS export names for ESM import in node:
8357
+ 0 && (module.exports = {
8358
+ BasePayload,
8359
+ Recipient,
8360
+ TriggerEvent,
8361
+ TriggerPayload,
8362
+ parseUserEventTrigger,
8363
+ triggerUserEventNotification
8364
+ });