@opencrvs/toolkit 2.2.0-rc.1a111f2 → 2.2.0-rc.25c3c81

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 (118) hide show
  1. package/build.sh +15 -2
  2. package/dist/application-config/index.js +16 -5
  3. package/dist/authentication/index.d.ts +1 -1
  4. package/dist/authentication/index.js +4 -8
  5. package/dist/cli.js +1109 -25
  6. package/dist/commons/api/router.d.ts +13 -0
  7. package/dist/commons/application-config/index.d.ts +1 -1
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/validate.d.ts +1 -1
  10. package/dist/commons/events/ActionStatus.d.ts +2 -2
  11. package/dist/commons/events/EventConfig.d.ts +66 -5
  12. package/dist/commons/events/EventDocument.d.ts +2 -0
  13. package/dist/commons/events/EventIndex.d.ts +1 -0
  14. package/dist/commons/events/EventInput.d.ts +1 -0
  15. package/dist/commons/events/EventMetadata.d.ts +1 -0
  16. package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
  17. package/dist/commons/events/PlainDate.d.ts +5 -0
  18. package/dist/commons/events/defineConfig.d.ts +1 -1
  19. package/dist/commons/events/locations.d.ts +1 -1
  20. package/dist/commons/events/scopes.d.ts +1 -1
  21. package/dist/commons/events/state/index.d.ts +1 -0
  22. package/dist/commons/events/test.utils.d.ts +2 -1
  23. package/dist/commons/events/utils.d.ts +15 -2
  24. package/dist/commons/users/Role.d.ts +23 -0
  25. package/dist/commons/users/User.d.ts +263 -0
  26. package/dist/commons/users/authentication.d.ts +67 -0
  27. package/dist/commons/users/index.d.ts +5 -0
  28. package/dist/commons/users/roleValidations.d.ts +15 -0
  29. package/dist/commons/users/scopes.d.ts +1402 -0
  30. package/dist/commons/users/userReferences.d.ts +176 -0
  31. package/dist/conditionals/index.js +3 -3
  32. package/dist/configurator/index.d.ts +24 -0
  33. package/dist/configurator/index.d.ts.map +1 -0
  34. package/dist/configurator/index.js +161 -0
  35. package/dist/configurator/layout.d.ts +28 -0
  36. package/dist/configurator/layout.d.ts.map +1 -0
  37. package/dist/configurator/layout.js +78 -0
  38. package/dist/configurator/paths.d.ts +13 -0
  39. package/dist/configurator/paths.d.ts.map +1 -0
  40. package/dist/configurator/paths.js +48 -0
  41. package/dist/configurator/server/environments.d.ts +20 -0
  42. package/dist/configurator/server/environments.d.ts.map +1 -0
  43. package/dist/configurator/server/environments.js +143 -0
  44. package/dist/configurator/server/files.d.ts +11 -0
  45. package/dist/configurator/server/files.d.ts.map +1 -0
  46. package/dist/configurator/server/files.js +67 -0
  47. package/dist/configurator/server/github.d.ts +56 -0
  48. package/dist/configurator/server/github.d.ts.map +1 -0
  49. package/dist/configurator/server/github.js +239 -0
  50. package/dist/configurator/server/plugin.d.ts +39 -0
  51. package/dist/configurator/server/plugin.d.ts.map +1 -0
  52. package/dist/configurator/server/plugin.js +298 -0
  53. package/dist/configurator/server/seal.d.ts +2 -0
  54. package/dist/configurator/server/seal.d.ts.map +1 -0
  55. package/dist/configurator/server/seal.js +36 -0
  56. package/dist/configurator/server/sshKeys.d.ts +5 -0
  57. package/dist/configurator/server/sshKeys.d.ts.map +1 -0
  58. package/dist/configurator/server/sshKeys.js +28 -0
  59. package/dist/configurator/server/start.d.ts +12 -0
  60. package/dist/configurator/server/start.d.ts.map +1 -0
  61. package/dist/configurator/server/start.js +91 -0
  62. package/dist/configurator/testing.d.ts +11 -0
  63. package/dist/configurator/testing.d.ts.map +1 -0
  64. package/dist/configurator/testing.js +74 -0
  65. package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
  66. package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
  67. package/dist/configurator/ui/bindings/bindings.js +5 -0
  68. package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
  69. package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
  70. package/dist/configurator/ui/bindings/parsers.js +85 -0
  71. package/dist/configurator/ui/form/users.d.ts +11 -0
  72. package/dist/configurator/ui/form/users.d.ts.map +1 -0
  73. package/dist/configurator/ui/form/users.js +33 -0
  74. package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
  75. package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
  76. package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
  77. package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
  78. package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
  79. package/dist/configurator/ui/plan/templateValues.js +70 -0
  80. package/dist/configurator/workflows.d.ts +53 -0
  81. package/dist/configurator/workflows.d.ts.map +1 -0
  82. package/dist/configurator/workflows.js +161 -0
  83. package/dist/configurator-assets/forms/bindings.yml +263 -0
  84. package/dist/configurator-assets/templates/README.md +18 -0
  85. package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
  86. package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +99 -0
  87. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  88. package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
  89. package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
  90. package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
  91. package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
  92. package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
  93. package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
  94. package/dist/configurator-assets/ui/assets/index-Bf3eC7uO.js +169 -0
  95. package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
  96. package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
  97. package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
  98. package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
  99. package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
  100. package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
  101. package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
  102. package/dist/configurator-assets/ui/index.html +25 -0
  103. package/dist/environment/setup-environment.d.ts.map +1 -1
  104. package/dist/environment/setup-environment.js +6 -0
  105. package/dist/events/index.js +188 -65
  106. package/dist/notification/index.js +124 -48
  107. package/dist/roles/index.d.ts +2 -0
  108. package/dist/roles/index.d.ts.map +1 -0
  109. package/dist/roles/index.js +730 -0
  110. package/dist/scopes/index.d.ts +0 -10
  111. package/dist/scopes/index.js +3 -7
  112. package/dist/templates/charts-values/dependencies/values.yaml +2 -0
  113. package/opencrvs-toolkit-2.2.0-rc.25c3c81.tgz +0 -0
  114. package/package.json +15 -3
  115. package/tsconfig.build.json +11 -1
  116. package/tsconfig.build.tsbuildinfo +1 -1
  117. package/tsconfig.json +15 -6
  118. package/opencrvs-toolkit-2.2.0-rc.1a111f2.tgz +0 -0
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 798.9456787 150" role="img" aria-label="OpenCRVS"> <g> <g> <path fill="#373050" d="M227.8518677,28.4674606c25.7293701,0,46.6018677,19.9539185,46.6018677,46.60186 c0,26.6464233-20.8724976,46.6018677-46.6018677,46.6018677S181.25,101.715744,181.25,75.0693207 C181.25,48.4213791,202.1224976,28.4674606,227.8518677,28.4674606z M227.8518677,105.130661 c15.3579712,0,28.0914307-10.369873,28.0914307-30.0613403S243.2098389,45.007988,227.8518677,45.007988 c-15.3594971,0-28.0929565,10.369873-28.0929565,30.0613327S212.4923706,105.130661,227.8518677,105.130661z"></path> <path fill="#373050" d="M298.4848022,63.1232224c3.0197144-4.2007446,9.9777222-8.4014893,19.4290161-8.4014893 c17.7215576,0,31.6360474,14.1784592,31.6360474,33.4747238s-13.9144897,33.4747314-31.6360474,33.4747314 c-9.4512939,0-16.4093018-4.2022705-19.4290161-8.4014893v30.7159424c0,3.1524658-0.1312256,3.2836914-3.2806396,3.2836914 h-10.3713989c-3.1509399,0-3.2821655-0.1312256-3.2821655-3.2836914V58.6600266 c0-3.1509399,0.1312256-3.2821655,3.2821655-3.2821655h10.3713989c3.1494141,0,3.2806396,0.1312256,3.2806396,3.2821655 V63.1232224z M332.6156616,88.1964569c0-10.5010986-7.2189331-18.1152344-17.0654297-18.1152344 c-9.8449707,0-17.0654297,7.6141357-17.0654297,18.1152344s7.220459,18.1152344,17.0654297,18.1152344 C325.3967285,106.3116913,332.6156616,98.6975555,332.6156616,88.1964569z"></path> <path fill="#373050" d="M408.0169678,100.0098114c0.7873535,0,1.3122559,0.3936768,2.3620605,1.4434814l6.0394287,6.0394287 c2.3620605,2.3620605,2.3620605,2.4932861,0,4.5959473c-7.4829102,6.6925049-16.8029785,9.5825195-25.8605957,9.5825195 c-18.3792114,0-35.8383179-11.9476318-35.8383179-33.0810547c0-19.6899414,15.2282715-33.8684006,33.9996338-33.8684006 c18.7728882,0,33.9996338,14.1784592,33.9996338,33.4747238v3.9367676c0,3.1524658-0.1312256,3.2836914-3.2806396,3.2836914 h-46.6018677c2.7557373,7.220459,9.9761963,10.8947754,17.7215576,10.8947754 c5.1193237,0,10.5010986-1.574707,14.9642944-4.989624C406.7047119,100.4034882,407.3608398,100.0098114,408.0169678,100.0098114z M404.4723511,80.9759979c-2.494812-6.5628052-8.4014893-10.8947754-15.7531738-10.8947754 c-7.3501587,0-13.2583618,4.2007446-15.7516479,10.8947754H404.4723511z"></path> <path fill="#373050" d="M432.5790405,121.0150604c-3.1509399,0-3.2821655-0.1312256-3.2821655-3.2836914V58.6600266 c0-3.1509399,0.1312256-3.2821655,3.2821655-3.2821655h10.3713989c3.1494141,0,3.2806396,0.1312256,3.2806396,3.2821655v4.4631958 c3.5461731-5.6442261,9.58255-8.4014893,17.5903625-8.4014893c12.6052856,0,26.2557983,7.220459,26.2557983,30.8502121v32.1594238 c0,3.1524658-0.1312256,3.2836914-3.2806396,3.2836914h-10.369873c-3.1524658,0-3.2836914-0.1312256-3.2836914-3.2836914 V85.5719452c0-10.3713989-6.2988281-15.4907227-13.7832642-15.4907227c-6.9580078,0-13.1286926,4.4631958-13.1286926,16.1468506 v31.5032959c0,3.1524658-0.1312256,3.2836914-3.2806396,3.2836914H432.5790405z"></path> <path fill="#373050" d="M570.5765381,56.297966c-1.0528564,0.6561279-1.7089844,0.9185791-2.2338867,0.9185791 c-0.7873535,0-1.4434814-0.6561279-2.4932861-1.9699097c-5.1208496-6.6940308-13.2598877-10.2386475-22.0550537-10.2386475 c-15.3594971,0-28.0914307,10.369873-28.0914307,30.0613327s12.7319336,30.0613403,28.0914307,30.0613403 c8.795166,0,16.9342041-3.5461426,22.0550537-10.2386475c1.0498047-1.3153076,1.7059326-1.9714355,2.4932861-1.9714355 c0.5249023,0,1.1810303,0.2624512,2.2338867,0.9216309l9.4512939,5.380249 c2.7557373,1.574707,3.0181885,1.8371582,1.0498047,4.3334961c-8.5327148,11.1572266-22.0550537,18.1152344-37.2833252,18.1152344 c-25.7293701,0-46.6003723-19.9554443-46.6003723-46.6018677c0-26.6479416,20.8710022-46.60186,46.6003723-46.60186 c15.0970459,0,28.6193848,6.9580078,37.1520996,18.1152344c1.9683838,2.494812,1.8371582,2.7572632-0.9185791,4.3319702 L570.5765381,56.297966z"></path> <path fill="#373050" d="M628.4500732,29.1235886c18.1152344,0,30.19104,12.9959106,30.19104,30.4550171 c0,11.9460983-5.7739258,21.7925949-15.0939941,26.9119186c1.9683838,1.3122559,3.6743164,3.2806396,4.7241211,5.5114746 l12.210083,25.9918213c1.3122559,2.8900146,1.3122559,3.0212402-1.84021,3.0212402h-12.8631592 c-3.1494141,0-3.4118652-0.1312256-4.7271729-3.0212402l-9.8449707-21.0021973 c-3.1494141-6.6955566-8.795166-6.8267822-16.2780762-6.8267822h-6.6955566v27.5665283 c0,3.1524658-0.1312256,3.2836914-3.2806396,3.2836914H593.006958c-3.1524658,0-3.2836914-0.1312256-3.2836914-3.2836914 V32.4057541c0-3.1509399,0.1312256-3.2821655,3.2836914-3.2821655H628.4500732z M608.2321777,45.6641159v27.9617233h17.5933838 c9.7137451,0,14.3066406-6.1706543,14.3066406-14.0472336c0-7.6126099-4.5928955-13.9144897-14.3066406-13.9144897H608.2321777z"></path> <path fill="#373050" d="M658.3634033,32.2745285c-1.0498047-3.0197144-1.0498047-3.1509399,2.0996094-3.1509399h13.1286621 c3.1494141,0,3.2806396,0.1312256,4.3334961,3.1509399l21.7895508,60.7772751l21.7926025-60.7772751 c1.0498047-3.0197144,1.1810303-3.1509399,4.3304443-3.1509399h13.1286621c3.1494141,0,3.1494141,0.1312256,2.0996094,3.1509399 l-30.9814453,85.5880661c-1.0498047,3.0212402-1.3122559,3.1524658-4.4616699,3.1524658h-11.8164062 c-3.1494141,0-3.4118652-0.1312256-4.4616699-3.1524658L658.3634033,32.2745285z"></path> <path fill="#373050" d="M744.0720215,101.0596161c0.7873535-1.7059326,1.1810303-2.3620605,1.8371582-2.3620605 c0.5249023,0,1.1810303,0.3936768,2.3620605,1.0498047c6.0394287,3.414917,12.3413086,5.3833008,18.1182861,5.3833008 c8.4014893,0,14.0441895-4.0710449,14.0441895-10.2386475c0-6.9580078-6.8237305-9.5825195-14.831543-12.7334595 c-10.8978271-4.3319702-23.7609863-9.4528198-23.7609863-26.7806931c0-16.6717529,12.2070312-26.9104004,31.2408447-26.9104004 c9.8480225,0,16.6717529,2.8884888,21.3989258,5.3817749c2.7557373,1.4450073,2.7557373,1.7074585,1.4434814,4.5944214 l-4.3304443,9.3215942c-0.7873535,1.7059326-1.1810303,2.3620605-1.84021,2.3620605 c-0.5249023,0-1.3122559-0.2624512-2.4932861-0.9185791c-3.9367676-2.1011353-9.3200684-4.2007446-15.0970459-4.2007446 c-8.2702637,0-11.8133545,4.069519-11.8133545,8.795166c0,6.8267822,6.9580078,9.5825195,14.8345947,12.7334518 c10.8947754,4.3319702,23.7609863,9.5825195,23.7609863,27.0401001c0,15.8843994-10.8978271,28.0944824-33.4747314,28.0944824 c-9.3231201,0-17.855835-2.8900146-24.2858887-6.4331055c-2.7587891-1.4434814-2.7587891-1.8371582-1.4465332-4.7241211 L744.0720215,101.0596161z"></path> </g> <g> <path fill="#1470FF" d="M109.375,0h-0.1489563c-1.5796814,0-2.9581299,1.1752625-3.0952911,2.74897 C104.7388,18.7205124,91.3327332,31.25,75,31.25c-16.3325577,0-29.7387848-12.5294876-31.1307526-28.50103 C43.7320938,1.1752586,42.3536377,0,40.7739639,0H40.625C18.1884308,0,0,18.1884308,0,40.625v68.75 C0,131.8115692,18.1884308,150,40.625,150h0.1489639c1.5796738,0,2.9581223-1.1752625,3.0952835-2.7489624 C45.2612152,131.2795105,58.6674423,118.7501831,75,118.7501831c16.3327332,0,29.7388,12.5293274,31.1307526,28.5008392 C106.2679138,148.8247375,107.6463623,150,109.2260437,150H109.375C131.8115692,150,150,131.8115692,150,109.375v-68.75 C150,18.1884308,131.8115692,0,109.375,0z M75,106.25c-17.2588348,0-31.25-13.9909668-31.25-31.25 c0-17.2588348,13.9911652-31.25,31.25-31.25c17.2590179,0,31.25,13.9911652,31.25,31.25 C106.25,92.2590332,92.2590179,106.25,75,106.25z"></path> </g> </g> </svg>
@@ -0,0 +1,25 @@
1
+ <!--
2
+ This Source Code Form is subject to the terms of the Mozilla Public
3
+ License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+
6
+ OpenCRVS is also distributed under the terms of the Civil Registration
7
+ & Healthcare Disclaimer located at http://opencrvs.org/license.
8
+
9
+ Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
10
+ -->
11
+ <!doctype html>
12
+ <html lang="en">
13
+ <head>
14
+ <meta charset="UTF-8" />
15
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
16
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
17
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
18
+ <title>OpenCRVS Setup</title>
19
+ <script type="module" crossorigin src="/assets/index-Bf3eC7uO.js"></script>
20
+ <link rel="stylesheet" crossorigin href="/assets/index-CaqYFJUk.css">
21
+ </head>
22
+ <body>
23
+ <div id="root"></div>
24
+ </body>
25
+ </html>
@@ -1 +1 @@
1
- {"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AA8aA,wBAAsB,mBAAmB,kBAosCxC"}
1
+ {"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AA8aA,wBAAsB,mBAAmB,kBA0sCxC"}
@@ -428,6 +428,11 @@ function runSetupEnvironment() {
428
428
  const existingRustfsHostDataPath = (0, utils_1.findExistingValue)('RUSTFS_HOST_DATA_PATH', 'VARIABLE', 'ENVIRONMENT', existingValues);
429
429
  const rustfs_host_data_path = (existingRustfsHostDataPath === null || existingRustfsHostDataPath === void 0 ? void 0 : existingRustfsHostDataPath.value) ||
430
430
  (environment_exists ? '/data/minio' : '/data/rustfs');
431
+ // The PVC that RustFS uses follows the same decision. The name `minio` makes RustFS
432
+ // take over the PVC of MinIO, so it does not depend on the storage type.
433
+ const rustfs_pvc_name = rustfs_host_data_path.endsWith('/minio')
434
+ ? 'minio'
435
+ : 'rustfs';
431
436
  // Backup and restore configuration
432
437
  let backupHost = ((_a = (0, utils_1.findExistingValue)('BACKUP_HOST', 'VARIABLE', 'ENVIRONMENT', existingValues)) === null || _a === void 0 ? void 0 : _a.value) || '';
433
438
  let backupType = '';
@@ -886,6 +891,7 @@ function runSetupEnvironment() {
886
891
  two_fa_enabled,
887
892
  monitoring_enabled,
888
893
  rustfs_host_data_path,
894
+ rustfs_pvc_name,
889
895
  traefik_mode: traefikConfOption,
890
896
  restore_enabled: restoreEnvironmentName ? true : false,
891
897
  restore_environment_name: restoreEnvironmentName || '',
@@ -89,7 +89,6 @@ __export(events_exports, {
89
89
  CustomFlag: () => CustomFlag,
90
90
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
91
91
  DEFAULT_EFFECTIVE_FROM: () => DEFAULT_EFFECTIVE_FROM,
92
- DEFAULT_EVENT_CONFIG_VERSION_ID: () => DEFAULT_EVENT_CONFIG_VERSION_ID,
93
92
  DEFAULT_PLACE_OF_EVENT_PROPERTY: () => DEFAULT_PLACE_OF_EVENT_PROPERTY,
94
93
  DOCUMENT_DELETE_SCOPES: () => DOCUMENT_DELETE_SCOPES,
95
94
  DataEntry: () => DataEntry,
@@ -119,7 +118,7 @@ __export(events_exports, {
119
118
  EmailField: () => EmailField,
120
119
  EmailValue: () => EmailValue,
121
120
  EnableConditional: () => EnableConditional,
122
- EventConfig: () => EventConfig,
121
+ EventConfig: () => EventConfig2,
123
122
  EventDocument: () => EventDocument,
124
123
  EventDocumentOnlyLastAction: () => EventDocumentOnlyLastAction,
125
124
  EventFieldConfigSchema: () => EventFieldConfigSchema,
@@ -163,6 +162,7 @@ __export(events_exports, {
163
162
  HiddenFieldValue: () => HiddenFieldValue,
164
163
  HttpFieldUpdateValue: () => HttpFieldUpdateValue,
165
164
  HttpFieldValue: () => HttpFieldValue,
165
+ INITIAL_EVENT_CONFIG_VERSION_ID: () => INITIAL_EVENT_CONFIG_VERSION_ID,
166
166
  IdReaderFieldValue: () => IdReaderFieldValue,
167
167
  ImageMimeType: () => ImageMimeType,
168
168
  InactiveOfficeError: () => InactiveOfficeError,
@@ -250,7 +250,7 @@ __export(events_exports, {
250
250
  VerificationActionConfig: () => VerificationActionConfig,
251
251
  VerificationPageConfig: () => VerificationPageConfig,
252
252
  VerificationStatusValue: () => VerificationStatusValue,
253
- VersionedEventConfig: () => VersionedEventConfig,
253
+ VersionedEventConfig: () => VersionedEventConfig2,
254
254
  WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
255
255
  WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
256
256
  Within: () => Within,
@@ -280,6 +280,7 @@ __export(events_exports, {
280
280
  areConditionsMet: () => areConditionsMet,
281
281
  buildClientFunctionContext: () => buildClientFunctionContext,
282
282
  buildFormState: () => buildFormState,
283
+ byEffectiveFrom: () => byEffectiveFrom,
283
284
  canAccessEventWithScope: () => canAccessEventWithScope,
284
285
  canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
285
286
  canAccessUserWithScope: () => canAccessUserWithScope,
@@ -317,6 +318,8 @@ __export(events_exports, {
317
318
  filterActionsByFlags: () => filterActionsByFlags,
318
319
  findActiveDraftForEvent: () => findActiveDraftForEvent,
319
320
  findAllFields: () => findAllFields,
321
+ findConfigVersion: () => findConfigVersion,
322
+ findEventConfigForRecord: () => findEventConfigForRecord,
320
323
  findLastAssignmentAction: () => findLastAssignmentAction,
321
324
  findPendingCorrectionAction: () => findPendingCorrectionAction,
322
325
  findRecordActionPages: () => findRecordActionPages,
@@ -358,15 +361,18 @@ __export(events_exports, {
358
361
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
359
362
  getCompleteActionContent: () => getCompleteActionContent,
360
363
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
364
+ getConfigVersion: () => getConfigVersion,
361
365
  getCurrentEventState: () => getCurrentEventState,
362
366
  getCustomActionFields: () => getCustomActionFields,
363
367
  getDeclaration: () => getDeclaration,
364
368
  getDeclarationAfterEachAction: () => getDeclarationAfterEachAction,
365
369
  getDeclarationFieldById: () => getDeclarationFieldById,
366
370
  getDeclarationFields: () => getDeclarationFields,
371
+ getDeclarationFieldsOfAllVersions: () => getDeclarationFieldsOfAllVersions,
367
372
  getDeclarationPages: () => getDeclarationPages,
368
373
  getDeclarationWithPendingAction: () => getDeclarationWithPendingAction,
369
374
  getEventConfigById: () => getEventConfigById,
375
+ getEventConfigForRecord: () => getEventConfigForRecord,
370
376
  getEventConfigOfVersion: () => getEventConfigOfVersion,
371
377
  getEventFlags: () => getEventFlags,
372
378
  getEventValidatorContext: () => getEventValidatorContext,
@@ -382,6 +388,7 @@ __export(events_exports, {
382
388
  getRandomDate: () => getRandomDate,
383
389
  getStatusFromActions: () => getStatusFromActions,
384
390
  getValidatorsForField: () => getValidatorsForField,
391
+ getVersionsInEffect: () => getVersionsInEffect,
385
392
  getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
386
393
  hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
387
394
  hasAnyOfScopes: () => hasAnyOfScopes,
@@ -481,7 +488,10 @@ __export(events_exports, {
481
488
  plainDateToLocalDate: () => plainDateToLocalDate,
482
489
  precompileActionSchemas: () => precompileActionSchemas,
483
490
  resolveDateOfEvent: () => resolveDateOfEvent,
491
+ resolveEffectiveVersion: () => resolveEffectiveVersion,
484
492
  resolveEventConfig: () => resolveEventConfig,
493
+ resolveEventConfigInTimeZone: () => resolveEventConfigInTimeZone,
494
+ resolveEventConfigOnDate: () => resolveEventConfigOnDate,
485
495
  resolveEventCustomFlags: () => resolveEventCustomFlags,
486
496
  resolvePath: () => resolvePath,
487
497
  resolvePlaceOfEvent: () => resolvePlaceOfEvent,
@@ -494,9 +504,11 @@ __export(events_exports, {
494
504
  timePeriodToDateRange: () => timePeriodToDateRange,
495
505
  toClientAdministrativeArea: () => toClientAdministrativeArea,
496
506
  toClientLocation: () => toClientLocation,
507
+ toEventConfig: () => toEventConfig,
497
508
  toNotificationForm: () => toNotificationForm,
498
509
  toNotificationReview: () => toNotificationReview,
499
510
  toPlainDate: () => toPlainDate,
511
+ toPlainDateInTimeZone: () => toPlainDateInTimeZone,
500
512
  toVersionedEventConfig: () => toVersionedEventConfig,
501
513
  todayISO: () => todayISO,
502
514
  user: () => user,
@@ -518,11 +530,11 @@ var import_compile = require("zod/compile");
518
530
  // ../commons/src/events/AuditLog.ts
519
531
  var z9 = __toESM(require("zod/v4"));
520
532
 
521
- // ../commons/src/authentication.ts
533
+ // ../commons/src/users/authentication.ts
522
534
  var import_jwt_decode = __toESM(require("jwt-decode"));
523
535
  var z8 = __toESM(require("zod/v4"));
524
536
 
525
- // ../commons/src/scopes.ts
537
+ // ../commons/src/users/scopes.ts
526
538
  var z7 = __toESM(require("zod/v4"));
527
539
  var qs = __toESM(require("qs"));
528
540
 
@@ -811,7 +823,7 @@ var EventStatus = z6.enum([
811
823
  "ARCHIVED"
812
824
  ]);
813
825
 
814
- // ../commons/src/scopes.ts
826
+ // ../commons/src/users/scopes.ts
815
827
  var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
816
828
  "Filters based on user jurisdiction relative to their office location in hierarchy."
817
829
  );
@@ -1143,7 +1155,7 @@ function getAcceptedScopesByType({
1143
1155
  }).filter((scope) => scope !== null);
1144
1156
  }
1145
1157
 
1146
- // ../commons/src/authentication.ts
1158
+ // ../commons/src/users/authentication.ts
1147
1159
  var TokenUserType = z8.enum(["user", "system"]);
1148
1160
  var TokenWithBearer = z8.string().regex(/^Bearer\s/);
1149
1161
 
@@ -1668,6 +1680,26 @@ var isPlainDate = (date) => PlainDate.validate(date);
1668
1680
  function toPlainDate(dateTime) {
1669
1681
  return dateTime.split("T")[0];
1670
1682
  }
1683
+ var dateFormats = /* @__PURE__ */ new Map();
1684
+ function getDateFormat(timeZone) {
1685
+ let format2 = dateFormats.get(timeZone);
1686
+ if (!format2) {
1687
+ format2 = new Intl.DateTimeFormat("en-US", {
1688
+ timeZone,
1689
+ year: "numeric",
1690
+ month: "2-digit",
1691
+ day: "2-digit"
1692
+ });
1693
+ dateFormats.set(timeZone, format2);
1694
+ }
1695
+ return format2;
1696
+ }
1697
+ function toPlainDateInTimeZone(date, timeZone) {
1698
+ const parts = Object.fromEntries(
1699
+ getDateFormat(timeZone).formatToParts(date).map(({ type, value }) => [type, value])
1700
+ );
1701
+ return `${parts.year}-${parts.month}-${parts.day}`;
1702
+ }
1671
1703
  function plainDateToLocalDate(date) {
1672
1704
  const [year, month, day] = date.split("-").map(Number);
1673
1705
  return new Date(year, month - 1, day);
@@ -2109,6 +2141,9 @@ var LegalStatuses = z17.object({
2109
2141
  var EventMetadata = z17.object({
2110
2142
  id: UUID,
2111
2143
  type: z17.string().describe("The type of event, such as birth, death, or marriage."),
2144
+ configVersionId: z17.string().describe(
2145
+ "Id of the event configuration version the record was created under. Records created before versioning have 'initial'."
2146
+ ),
2112
2147
  status: EventStatus,
2113
2148
  legalStatuses: LegalStatuses.describe(
2114
2149
  "Metadata related to the legal registration of the event, such as who registered it and when."
@@ -3749,7 +3784,7 @@ var ActionConfig = z25.discriminatedUnion("type", [
3749
3784
  }),
3750
3785
  NotifyConfig.meta({
3751
3786
  id: "NotifyActionConfig",
3752
- description: "Configuration for the notify action, including the notification form and its review page. When undefined, it is generated using the DeclareActionConfig."
3787
+ description: "Configuration for the notify action: the notification form and its review page. An event without a NOTIFY action cannot be notified."
3753
3788
  }),
3754
3789
  DeclareConfig.meta({
3755
3790
  id: "DeclareActionConfig",
@@ -4017,7 +4052,7 @@ var ReferenceField = BaseField2.extend({
4017
4052
  var Field = BaseField2.extend({
4018
4053
  id: z29.string().describe("Identifier of the summary field."),
4019
4054
  value: TranslationConfig.describe(
4020
- '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}").'
4055
+ '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}"). "{event.configVersionLabel}" gives the label of the configuration version that the record was created under.'
4021
4056
  ),
4022
4057
  label: TranslationConfig
4023
4058
  }).describe("Custom field defined for the summary view.");
@@ -4164,6 +4199,41 @@ var AdvancedSearchConfig = z30.object({
4164
4199
  description: "Configuration of one advanced search tab. Each tab has a title and a list of searchable fields \u2014 either declaration fields (via `field()`) or event metadata (via `event()`)."
4165
4200
  });
4166
4201
 
4202
+ // ../commons/src/utils.ts
4203
+ var z31 = __toESM(require("zod/v4"));
4204
+ var _ = __toESM(require("lodash"));
4205
+ function getOrThrow(x, message) {
4206
+ if (x === void 0 || x === null) {
4207
+ throw new Error(message);
4208
+ }
4209
+ return x;
4210
+ }
4211
+ function joinValues(values, separator = " ") {
4212
+ return values.filter((value) => !!value).join(separator).trim();
4213
+ }
4214
+ var FullNameV1 = z31.array(
4215
+ z31.object({
4216
+ use: z31.string(),
4217
+ family: z31.string(),
4218
+ given: z31.array(z31.string())
4219
+ })
4220
+ );
4221
+ function omitKeyDeep(obj, keyToRemove) {
4222
+ if (Array.isArray(obj)) {
4223
+ return obj.map((item) => omitKeyDeep(item, keyToRemove));
4224
+ }
4225
+ if (obj === null || typeof obj !== "object") {
4226
+ return obj;
4227
+ }
4228
+ const newObj = {};
4229
+ for (const key of Object.keys(obj)) {
4230
+ if (key !== keyToRemove) {
4231
+ newObj[key] = omitKeyDeep(obj[key], keyToRemove);
4232
+ }
4233
+ }
4234
+ return newObj;
4235
+ }
4236
+
4167
4237
  // ../commons/src/events/utils.ts
4168
4238
  var import_lodash4 = require("lodash");
4169
4239
 
@@ -4174,15 +4244,15 @@ var z34 = __toESM(require("zod/v4"));
4174
4244
  var import_date_fns2 = require("date-fns");
4175
4245
 
4176
4246
  // ../commons/src/events/FieldTypeMapping.ts
4177
- var z32 = __toESM(require("zod/v4"));
4247
+ var z33 = __toESM(require("zod/v4"));
4178
4248
 
4179
4249
  // ../commons/src/events/DynamicFieldValue.ts
4180
- var z31 = __toESM(require("zod/v4"));
4250
+ var z32 = __toESM(require("zod/v4"));
4181
4251
  function getDynamicNameValue(field3) {
4182
4252
  const nameConfiguration = field3.configuration?.name;
4183
4253
  const firstnameRequired = nameConfiguration?.firstname?.required ?? field3.required;
4184
4254
  const surnameRequired = nameConfiguration?.surname?.required ?? field3.required;
4185
- return z31.object({
4255
+ return z32.object({
4186
4256
  firstname: firstnameRequired ? NonEmptyTextValue : TextValue,
4187
4257
  surname: surnameRequired ? NonEmptyTextValue : TextValue,
4188
4258
  middlename: nameConfiguration?.middlename?.required ? NonEmptyTextValue : TextValue.optional()
@@ -4213,7 +4283,7 @@ function mapFieldTypeToZod(field3, actionType) {
4213
4283
  let schema;
4214
4284
  switch (field3.type) {
4215
4285
  case FieldType.FIELD_GROUP: {
4216
- schema = z32.object(
4286
+ schema = z33.object(
4217
4287
  field3.fields.reduce((acc, subfield) => {
4218
4288
  acc[subfield.id] = mapFieldTypeToZod(subfield, actionType);
4219
4289
  return acc;
@@ -4537,41 +4607,6 @@ var isNonInteractiveFieldType = (field3) => {
4537
4607
  // ../commons/src/events/state/index.ts
4538
4608
  var import_lodash3 = require("lodash");
4539
4609
 
4540
- // ../commons/src/utils.ts
4541
- var z33 = __toESM(require("zod/v4"));
4542
- var _ = __toESM(require("lodash"));
4543
- function getOrThrow(x, message) {
4544
- if (x === void 0 || x === null) {
4545
- throw new Error(message);
4546
- }
4547
- return x;
4548
- }
4549
- function joinValues(values, separator = " ") {
4550
- return values.filter((value) => !!value).join(separator).trim();
4551
- }
4552
- var FullNameV1 = z33.array(
4553
- z33.object({
4554
- use: z33.string(),
4555
- family: z33.string(),
4556
- given: z33.array(z33.string())
4557
- })
4558
- );
4559
- function omitKeyDeep(obj, keyToRemove) {
4560
- if (Array.isArray(obj)) {
4561
- return obj.map((item) => omitKeyDeep(item, keyToRemove));
4562
- }
4563
- if (obj === null || typeof obj !== "object") {
4564
- return obj;
4565
- }
4566
- const newObj = {};
4567
- for (const key of Object.keys(obj)) {
4568
- if (key !== keyToRemove) {
4569
- newObj[key] = omitKeyDeep(obj[key], keyToRemove);
4570
- }
4571
- }
4572
- return newObj;
4573
- }
4574
-
4575
4610
  // ../commons/src/events/state/utils.ts
4576
4611
  var import_lodash = require("lodash");
4577
4612
  function getActionRequests(actionType, actions) {
@@ -5658,6 +5693,7 @@ function getCurrentEventState(event2, config) {
5658
5693
  updatedAtLocation: requestActionMetadata.createdAtLocation,
5659
5694
  declaration,
5660
5695
  trackingId: event2.trackingId,
5696
+ configVersionId: event2.configVersionId,
5661
5697
  updatedByUserRole: requestActionMetadata.createdByRole,
5662
5698
  placeOfEvent: resolvePlaceOfEvent(
5663
5699
  { createdAtLocation: creationAction.createdAtLocation },
@@ -6339,6 +6375,17 @@ function getDeclarationPages(configuration) {
6339
6375
  function getDeclarationFields(configuration) {
6340
6376
  return getDeclarationPages(configuration).flatMap(({ fields }) => fields);
6341
6377
  }
6378
+ function getDeclarationFieldsOfAllVersions(config) {
6379
+ const oldestFirst = [...config.versions].sort(byEffectiveFrom);
6380
+ const fieldsById = new Map(
6381
+ oldestFirst.flatMap(
6382
+ (version) => getDeclarationFields(toEventConfig(config, version)).map(
6383
+ (field3) => [field3.id, field3]
6384
+ )
6385
+ )
6386
+ );
6387
+ return [...fieldsById.values()];
6388
+ }
6342
6389
  function findNotificationForm(configuration) {
6343
6390
  const notifyAction = configuration.actions.find(
6344
6391
  (action) => action.type === ActionType.NOTIFY
@@ -6645,10 +6692,10 @@ function getMixedPath(obj, path, defaultValue) {
6645
6692
  return (0, import_lodash4.isNil)(result) ? defaultValue : result;
6646
6693
  }
6647
6694
  function getEventConfigById(eventConfigs, id) {
6648
- const eventConfig = eventConfigs.find(
6649
- (eventConfiguration) => eventConfiguration.id === id
6695
+ return getOrThrow(
6696
+ eventConfigs.find((eventConfiguration) => eventConfiguration.id === id),
6697
+ `No configuration found for event type: ${id}`
6650
6698
  );
6651
- return getOrThrow(eventConfig, `Event config for ${id} not found`);
6652
6699
  }
6653
6700
  function timePeriodToDateRange(value) {
6654
6701
  let startDate;
@@ -7211,23 +7258,26 @@ function validateEventConfig(event2, ctx) {
7211
7258
  validateActionFlags(event2, ctx);
7212
7259
  validateActionOrder(event2, ctx);
7213
7260
  }
7214
- var EventConfig = _EventConfigBase.superRefine(validateEventConfig).meta({
7261
+ var EventConfig2 = _EventConfigBase.superRefine(validateEventConfig).meta({
7215
7262
  id: "EventConfig",
7216
7263
  description: "Configuration defining an event type registered in OpenCRVS (for example birth or death)."
7217
7264
  });
7218
- var DEFAULT_EVENT_CONFIG_VERSION_ID = "default";
7265
+ var INITIAL_EVENT_CONFIG_VERSION_ID = "initial";
7219
7266
  var DEFAULT_EFFECTIVE_FROM = "0001-01-01";
7220
7267
  var _EventConfigVersion = z35.object({
7221
7268
  id: z35.string().describe(
7222
7269
  'Identifier of the version, unique within the event (e.g. "birth-v2").'
7223
7270
  ),
7271
+ label: TranslationConfig.describe(
7272
+ 'Name of the version, which the UI shows wherever it names the version. For example, "{event.configVersionLabel}" in the event summary.'
7273
+ ),
7224
7274
  effectiveFrom: z35.iso.date().default(DEFAULT_EFFECTIVE_FROM).describe(
7225
7275
  `Date (YYYY-MM-DD) from which this version is effective. A version without one is effective from the beginning of time ('${DEFAULT_EFFECTIVE_FROM}').`
7226
7276
  ),
7227
7277
  ...versionFields
7228
7278
  });
7229
7279
  var resolvedConfigs = /* @__PURE__ */ new WeakMap();
7230
- function getEventConfigOfVersion(config, version) {
7280
+ function toEventConfig(config, version) {
7231
7281
  let resolvedVersions = resolvedConfigs.get(config);
7232
7282
  if (!resolvedVersions) {
7233
7283
  resolvedVersions = /* @__PURE__ */ new WeakMap();
@@ -7237,7 +7287,12 @@ function getEventConfigOfVersion(config, version) {
7237
7287
  if (cached) {
7238
7288
  return cached;
7239
7289
  }
7240
- const { id: _id, effectiveFrom: _effectiveFrom, ...fields } = version;
7290
+ const {
7291
+ id: _id,
7292
+ label: _label,
7293
+ effectiveFrom: _effectiveFrom,
7294
+ ...fields
7295
+ } = version;
7241
7296
  const resolved = {
7242
7297
  ...fields,
7243
7298
  id: config.id,
@@ -7247,8 +7302,54 @@ function getEventConfigOfVersion(config, version) {
7247
7302
  resolvedVersions.set(version, resolved);
7248
7303
  return resolved;
7249
7304
  }
7305
+ function findConfigVersion(config, versionId) {
7306
+ return config.versions.find(({ id }) => id === versionId);
7307
+ }
7308
+ function getConfigVersion(config, versionId) {
7309
+ return getOrThrow(
7310
+ findConfigVersion(config, versionId),
7311
+ `Event '${config.id}' has no version '${versionId}'`
7312
+ );
7313
+ }
7314
+ function getEventConfigOfVersion(config, versionId) {
7315
+ return toEventConfig(config, getConfigVersion(config, versionId));
7316
+ }
7317
+ function byEffectiveFrom(a, b) {
7318
+ return a.effectiveFrom.localeCompare(b.effectiveFrom);
7319
+ }
7320
+ function getVersionsInEffectOn(config, date) {
7321
+ return config.versions.filter(({ effectiveFrom }) => effectiveFrom <= date).sort(byEffectiveFrom);
7322
+ }
7323
+ function findVersionInEffectOn(config, date) {
7324
+ return getVersionsInEffectOn(config, date).at(-1);
7325
+ }
7326
+ function getVersionsInEffect(config, now2, timeZone) {
7327
+ return getVersionsInEffectOn(config, toPlainDateInTimeZone(now2, timeZone));
7328
+ }
7329
+ function resolveEffectiveVersion(config, now2, timeZone) {
7330
+ return findVersionInEffectOn(config, toPlainDateInTimeZone(now2, timeZone));
7331
+ }
7332
+ function findEventConfigForRecord(config, record8) {
7333
+ const version = findConfigVersion(config, record8.configVersionId);
7334
+ return version && toEventConfig(config, version);
7335
+ }
7336
+ function getEventConfigForRecord(config, record8) {
7337
+ return getEventConfigOfVersion(config, record8.configVersionId);
7338
+ }
7339
+ function resolveEventConfigOnDate(config, date) {
7340
+ return toEventConfig(
7341
+ config,
7342
+ getOrThrow(
7343
+ findVersionInEffectOn(config, date),
7344
+ `Event '${config.id}' has no version in effect on ${date}`
7345
+ )
7346
+ );
7347
+ }
7348
+ function resolveEventConfigInTimeZone(config, timeZone, now2 = /* @__PURE__ */ new Date()) {
7349
+ return resolveEventConfigOnDate(config, toPlainDateInTimeZone(now2, timeZone));
7350
+ }
7250
7351
  function resolveEventConfig(config) {
7251
- return getEventConfigOfVersion(config, config.versions[0]);
7352
+ return resolveEventConfigInTimeZone(config, "UTC");
7252
7353
  }
7253
7354
  function validateVersionList(config, ctx) {
7254
7355
  const ids = /* @__PURE__ */ new Set();
@@ -7302,18 +7403,16 @@ function validateEachVersion(ctx, events, validate2) {
7302
7403
  validate2(event2, { value: event2, addIssue });
7303
7404
  });
7304
7405
  }
7305
- var VersionedEventConfig = z35.object({
7406
+ var VersionedEventConfig2 = z35.object({
7306
7407
  ...eventLevelFields,
7307
7408
  versions: z35.array(_EventConfigVersion).min(1).describe(
7308
- `Versions of the event configuration, each effective from its \`effectiveFrom\`. An event configured without versions has a single version, with id '${DEFAULT_EVENT_CONFIG_VERSION_ID}' and \`effectiveFrom\` '${DEFAULT_EFFECTIVE_FROM}'.`
7409
+ `Versions of the event configuration, each effective from its \`effectiveFrom\`. An event configured without versions has a single version, with id '${INITIAL_EVENT_CONFIG_VERSION_ID}' and \`effectiveFrom\` '${DEFAULT_EFFECTIVE_FROM}'.`
7309
7410
  )
7310
7411
  }).superRefine((config, ctx) => {
7311
7412
  validateVersionList(config, ctx);
7312
7413
  validateEachVersion(
7313
7414
  ctx,
7314
- config.versions.map(
7315
- (version) => getEventConfigOfVersion(config, version)
7316
- ),
7415
+ config.versions.map((version) => toEventConfig(config, version)),
7317
7416
  validateEventConfig
7318
7417
  );
7319
7418
  }).meta({
@@ -7962,6 +8061,9 @@ var EventInput = z41.object({
7962
8061
  type: z41.string(),
7963
8062
  createdAtLocation: UUID.nullish().describe(
7964
8063
  "Location where the event occurred. Required for system users."
8064
+ ),
8065
+ configVersionId: z41.string().optional().describe(
8066
+ "Id of the event configuration version the client created the record under, e.g. while offline. Must be configured and not take effect in the future. Defaults to the version in effect when the server receives the record."
7965
8067
  )
7966
8068
  }).meta({ default: { transactionId: (0, import_uuid11.v4)(), type: "birth" } });
7967
8069
 
@@ -7977,6 +8079,9 @@ var EventDocument = z42.object({
7977
8079
  actions: z42.array(Action).describe("Ordered list of actions associated with the event."),
7978
8080
  trackingId: z42.string().describe(
7979
8081
  "System-generated tracking identifier used to look up the event."
8082
+ ),
8083
+ configVersionId: z42.string().describe(
8084
+ "Id of the event configuration version the record was created under. Every action on the record uses that version. Records created before versioning have 'initial'."
7980
8085
  )
7981
8086
  }).meta({ id: "EventDocument" });
7982
8087
  var EventDocumentOnlyLastAction = EventDocument.extend({
@@ -8032,9 +8137,23 @@ function toVersionedInput(config) {
8032
8137
  id,
8033
8138
  label,
8034
8139
  advancedSearch,
8035
- versions: [{ ...version, id: DEFAULT_EVENT_CONFIG_VERSION_ID }]
8140
+ versions: [{ ...version, id: INITIAL_EVENT_CONFIG_VERSION_ID, label }]
8036
8141
  };
8037
8142
  }
8143
+ var WESTERNMOST_TIME_ZONE = "Etc/GMT+12";
8144
+ function validateVersionInEffectToday(config, ctx) {
8145
+ const today = toPlainDateInTimeZone(/* @__PURE__ */ new Date(), WESTERNMOST_TIME_ZONE);
8146
+ const isAnyVersionInEffect = config.versions.some(
8147
+ ({ effectiveFrom }) => effectiveFrom <= today
8148
+ );
8149
+ if (!isAnyVersionInEffect) {
8150
+ ctx.addIssue({
8151
+ code: "custom",
8152
+ message: `Event '${config.id}' has no version in effect today (${today}, UTC\u221212, the last time zone to begin the day). At least one version must omit \`effectiveFrom\` or take effect on or before that date.`,
8153
+ path: ["versions"]
8154
+ });
8155
+ }
8156
+ }
8038
8157
  var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
8039
8158
  if ("versions" in config) {
8040
8159
  validateNoVersionFieldsAtTopLevel(config, ctx);
@@ -8044,7 +8163,7 @@ var EventConfigDefinition = z43.custom().superRefine((config, ctx) => {
8044
8163
  if (validateExactlyOneDeclareAction(config, eventCtx)) {
8045
8164
  validateDeclarationGivenExactlyOnce(config, eventCtx);
8046
8165
  }
8047
- }).transform(toVersionedInput).pipe(VersionedEventConfig);
8166
+ }).transform(toVersionedInput).pipe(VersionedEventConfig2).superRefine(validateVersionInEffectToday);
8048
8167
  var defineConfig = (config) => EventConfigDefinition.parse(config);
8049
8168
 
8050
8169
  // ../commons/src/events/toNotificationForm.ts
@@ -11607,7 +11726,8 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
11607
11726
  ...input
11608
11727
  }),
11609
11728
  /**
11610
- * Notify allows sending incomplete data. Think it as 'partial declare' for now.
11729
+ * NOTIFY submits the values of the notification form, and the record can stay incomplete.
11730
+ * When `declaration` is not given, string values are left out of the generated declaration to make it incomplete.
11611
11731
  */
11612
11732
  notify: (eventId, input = {}) => {
11613
11733
  let declaration = input.declaration;
@@ -11995,6 +12115,7 @@ function generateEventDocument({
11995
12115
  }) {
11996
12116
  return {
11997
12117
  trackingId: generateTrackingId(rng),
12118
+ configVersionId: INITIAL_EVENT_CONFIG_VERSION_ID,
11998
12119
  type: configuration.id,
11999
12120
  actions: actions.flatMap((action, i) => {
12000
12121
  const createdAt = (0, import_date_fns4.addDays)(
@@ -12089,6 +12210,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
12089
12210
  return {
12090
12211
  id: overrides.id ?? generateUuid(rng),
12091
12212
  type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
12213
+ configVersionId: overrides.configVersionId ?? INITIAL_EVENT_CONFIG_VERSION_ID,
12092
12214
  status: overrides.status ?? pickRandom(rng, EventStatus.options),
12093
12215
  createdAt: overrides.createdAt ?? createdAt,
12094
12216
  createdByUserType: overrides.createdByUserType ?? "user",
@@ -12251,7 +12373,8 @@ function toVersionedEventConfig({
12251
12373
  versions: [
12252
12374
  {
12253
12375
  ...version,
12254
- id: DEFAULT_EVENT_CONFIG_VERSION_ID,
12376
+ id: INITIAL_EVENT_CONFIG_VERSION_ID,
12377
+ label,
12255
12378
  effectiveFrom: DEFAULT_EFFECTIVE_FROM
12256
12379
  }
12257
12380
  ]