@opencrvs/toolkit 2.1.0-rc.12673aa → 2.1.0-rc.14fb6a5

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 (188) hide show
  1. package/build.sh +14 -4
  2. package/create-countryconfig/index.js +59 -30
  3. package/dist/application-config/index.js +26 -13
  4. package/dist/authentication/index.d.ts +8 -9
  5. package/dist/authentication/index.js +23 -8
  6. package/dist/cli.js +2268 -1385
  7. package/dist/commons/api/router.d.ts +252 -290
  8. package/dist/commons/application-config/index.d.ts +0 -2
  9. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  10. package/dist/commons/conditionals/validate.d.ts +18 -3
  11. package/dist/commons/events/ActionConfig.d.ts +5 -14
  12. package/dist/commons/events/ActionDocument.d.ts +30 -4
  13. package/dist/commons/events/AdvancedSearchConfig.d.ts +24 -12
  14. package/dist/commons/events/AuditLog.d.ts +1 -0
  15. package/dist/commons/events/Draft.d.ts +1 -21
  16. package/dist/commons/events/EventDocument.d.ts +4 -4
  17. package/dist/commons/events/FieldConfig.d.ts +20 -10
  18. package/dist/commons/events/FieldTypeMapping.d.ts +10 -10
  19. package/dist/commons/events/FieldValue.d.ts +1 -0
  20. package/dist/commons/events/FormConfig.d.ts +6 -0
  21. package/dist/commons/events/PageConfig.d.ts +4 -0
  22. package/dist/commons/events/scopes.d.ts +21 -1
  23. package/dist/commons/events/test.utils.d.ts +53 -21
  24. package/dist/commons/events/utils.d.ts +26 -2
  25. package/dist/conditionals/index.js +21 -7
  26. package/dist/environment/index.d.ts.map +1 -1
  27. package/dist/environment/index.js +2 -1
  28. package/dist/environment/setup-environment.d.ts +1 -1
  29. package/dist/environment/setup-environment.d.ts.map +1 -1
  30. package/dist/environment/setup-environment.js +586 -569
  31. package/dist/environment/swarm-to-k8s.js +3 -4
  32. package/dist/events/index.js +282 -138
  33. package/dist/migrations/v2.1/add-recovery-link-notifications.js +4 -4
  34. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
  35. package/dist/migrations/v2.1/add-translations.js +4 -68
  36. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -1
  37. package/dist/migrations/v2.1/enable-telemetry.js +30 -13
  38. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  39. package/dist/migrations/v2.1/index.js +927 -33
  40. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +14 -0
  41. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +1 -0
  42. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +348 -0
  43. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +2 -0
  44. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +1 -0
  45. package/dist/migrations/v2.1/remove-metabase-package-installs.js +161 -0
  46. package/dist/migrations/{v2.0/migrate-scopes.d.ts → v2.1/remove-sentry.d.ts} +1 -1
  47. package/dist/migrations/v2.1/remove-sentry.d.ts.map +1 -0
  48. package/dist/migrations/v2.1/remove-sentry.js +354 -0
  49. package/dist/migrations/{v2.0/rename-api-paths.d.ts → v2.1/rename-trigger-paths.d.ts} +1 -1
  50. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  51. package/dist/migrations/{v2.0/rename-api-paths.js → v2.1/rename-trigger-paths.js} +69 -40
  52. package/dist/migrations/v2.1/template-files.d.ts +8 -0
  53. package/dist/migrations/v2.1/template-files.d.ts.map +1 -0
  54. package/dist/migrations/v2.1/template-files.js +49 -0
  55. package/dist/migrations/v2.1/upgrade-tilt.d.ts +8 -0
  56. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +1 -0
  57. package/dist/migrations/v2.1/upgrade-tilt.js +139 -0
  58. package/dist/notification/index.js +105 -61
  59. package/dist/scopes/index.d.ts +288 -5
  60. package/dist/scopes/index.js +22 -7
  61. package/dist/telemetry/index.js +4 -0
  62. package/dist/templates/charts-values/dependencies/values.yaml +6 -0
  63. package/dist/templates/charts-values/opencrvs-services/values.yaml +6 -0
  64. package/dist/templates/charts-values/opentelemetry/values.yaml +7 -0
  65. package/dist/templates/countryconfig-template/.tiltignore +1 -0
  66. package/dist/templates/countryconfig-template/Dockerfile.assets +7 -0
  67. package/dist/templates/countryconfig-template/Tiltfile +112 -0
  68. package/dist/templates/countryconfig-template/assets/README.md +1 -0
  69. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +61 -0
  70. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +455 -0
  71. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +168 -0
  72. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +67 -0
  73. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +168 -0
  74. package/dist/templates/countryconfig-template/assets/metabase/README.md +34 -0
  75. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +36 -0
  76. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +46 -0
  77. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +27737 -0
  78. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +21 -0
  79. package/dist/templates/countryconfig-template/assets/metabase/package.json +13 -0
  80. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +108 -0
  81. package/dist/templates/countryconfig-template/assets/metabase/run.sh +120 -0
  82. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +40 -0
  83. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +135 -0
  84. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +108 -0
  85. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +50 -0
  86. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +35 -0
  87. package/dist/templates/countryconfig-template/tilt/common.tilt +145 -0
  88. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +15 -0
  89. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +56 -0
  90. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +21 -0
  91. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +38 -0
  92. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +17 -0
  93. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +16 -0
  94. package/dist/templates/countryconfig-template/tilt/lib.tilt +95 -0
  95. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +136 -0
  96. package/dist/translations/template.d.ts +11 -0
  97. package/dist/translations/template.d.ts.map +1 -0
  98. package/dist/translations/template.js +100 -0
  99. package/dist/verify/endpoints.d.ts.map +1 -1
  100. package/dist/verify/endpoints.js +179 -14
  101. package/opencrvs-toolkit-2.1.0-rc.14fb6a5.tgz +0 -0
  102. package/package.json +2 -1
  103. package/tsconfig.build.tsbuildinfo +1 -1
  104. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  105. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  106. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -429
  107. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +0 -3
  108. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +0 -1
  109. package/dist/migrations/v2.0/add-resend-invite-notification.js +0 -373
  110. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +0 -22
  111. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +0 -1
  112. package/dist/migrations/v2.0/checkout-upstream-files.js +0 -146
  113. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  114. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  115. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -838
  116. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  117. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  118. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -158
  119. package/dist/migrations/v2.0/create-events-index.d.ts +0 -3
  120. package/dist/migrations/v2.0/create-events-index.d.ts.map +0 -1
  121. package/dist/migrations/v2.0/create-events-index.js +0 -325
  122. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +0 -11
  123. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +0 -1
  124. package/dist/migrations/v2.0/delete-infrastructure-directory.js +0 -123
  125. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +0 -3
  126. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +0 -1
  127. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +0 -110
  128. package/dist/migrations/v2.0/index.d.ts +0 -13
  129. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  130. package/dist/migrations/v2.0/index.js +0 -103
  131. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  132. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  133. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -432
  134. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +0 -13
  135. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +0 -1
  136. package/dist/migrations/v2.0/merge-infrastructure-directory.js +0 -222
  137. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +0 -3
  138. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +0 -1
  139. package/dist/migrations/v2.0/migrate-application-config-url.js +0 -343
  140. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  141. package/dist/migrations/v2.0/migrate-scopes.js +0 -305
  142. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  143. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  144. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -267
  145. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  146. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  147. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -317
  148. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  149. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  150. package/dist/migrations/v2.0/remove-delete-actions.js +0 -156
  151. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  152. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  153. package/dist/migrations/v2.0/remove-demo-scope.js +0 -74
  154. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  155. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  156. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -96
  157. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +0 -3
  158. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +0 -1
  159. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +0 -163
  160. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  161. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  162. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -87
  163. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +0 -3
  164. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +0 -1
  165. package/dist/migrations/v2.0/remove-old-statistics-service.js +0 -356
  166. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  167. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  168. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -109
  169. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  170. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  171. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -163
  172. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +0 -3
  173. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +0 -1
  174. package/dist/migrations/v2.0/remove-unused-environment-variables.js +0 -186
  175. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  176. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  177. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  178. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -180
  179. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +0 -3
  180. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +0 -1
  181. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +0 -195
  182. package/dist/migrations/v2.0/update-package-json.d.ts +0 -3
  183. package/dist/migrations/v2.0/update-package-json.d.ts.map +0 -1
  184. package/dist/migrations/v2.0/update-package-json.js +0 -105
  185. package/dist/translations/check.d.ts +0 -21
  186. package/dist/translations/check.d.ts.map +0 -1
  187. package/dist/translations/check.js +0 -132
  188. package/opencrvs-toolkit-2.1.0-rc.12673aa.tgz +0 -0
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var events_exports = {};
32
32
  __export(events_exports, {
33
33
  ACTION_SCOPE_MAP: () => ACTION_SCOPE_MAP,
34
+ AGE_MAX_VALUE: () => AGE_MAX_VALUE,
34
35
  Action: () => Action,
35
36
  ActionBase: () => ActionBase,
36
37
  ActionConditional: () => ActionConditional,
@@ -67,7 +68,6 @@ __export(events_exports, {
67
68
  AutocompleteUpdateValue: () => AutocompleteUpdateValue,
68
69
  AutocompleteValue: () => AutocompleteValue,
69
70
  BaseActionInput: () => BaseActionInput,
70
- BearerTokenByUserType: () => BearerTokenByUserType,
71
71
  ButtonFieldValue: () => ButtonFieldValue,
72
72
  CHILD_ONBOARDING_EVENT: () => CHILD_ONBOARDING_EVENT,
73
73
  CertificateConfig: () => CertificateConfig,
@@ -89,6 +89,7 @@ __export(events_exports, {
89
89
  CustomFlag: () => CustomFlag,
90
90
  DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
91
91
  DEFAULT_PLACE_OF_EVENT_PROPERTY: () => DEFAULT_PLACE_OF_EVENT_PROPERTY,
92
+ DOCUMENT_DELETE_SCOPES: () => DOCUMENT_DELETE_SCOPES,
92
93
  DataEntry: () => DataEntry,
93
94
  DataFieldValue: () => DataFieldValue,
94
95
  DateCondition: () => DateCondition,
@@ -195,6 +196,7 @@ __export(events_exports, {
195
196
  QueryParamReaderFieldUpdateValue: () => QueryParamReaderFieldUpdateValue,
196
197
  QueryParamReaderFieldValue: () => QueryParamReaderFieldValue,
197
198
  QueryType: () => QueryType,
199
+ RECORD_WRITE_SCOPES: () => RECORD_WRITE_SCOPES,
198
200
  Range: () => Range,
199
201
  ReadActionInput: () => ReadActionInput,
200
202
  ReasonContent: () => ReasonContent,
@@ -203,6 +205,7 @@ __export(events_exports, {
203
205
  RegistrationCreationMetadata: () => RegistrationCreationMetadata,
204
206
  RejectCorrectionActionInput: () => RejectCorrectionActionInput,
205
207
  RejectDeclarationActionInput: () => RejectDeclarationActionInput,
208
+ RejectedCorrectionAction: () => RejectedCorrectionAction,
206
209
  RequestCorrectionActionInput: () => RequestCorrectionActionInput,
207
210
  SearchQuery: () => SearchQuery,
208
211
  SearchQueryParams: () => SearchQueryParams,
@@ -349,9 +352,11 @@ __export(events_exports, {
349
352
  getCurrentEventState: () => getCurrentEventState,
350
353
  getCustomActionFields: () => getCustomActionFields,
351
354
  getDeclaration: () => getDeclaration,
355
+ getDeclarationAfterEachAction: () => getDeclarationAfterEachAction,
352
356
  getDeclarationFieldById: () => getDeclarationFieldById,
353
357
  getDeclarationFields: () => getDeclarationFields,
354
358
  getDeclarationPages: () => getDeclarationPages,
359
+ getDeclarationWithPendingAction: () => getDeclarationWithPendingAction,
355
360
  getEventConfigById: () => getEventConfigById,
356
361
  getEventFlags: () => getEventFlags,
357
362
  getEventValidatorContext: () => getEventValidatorContext,
@@ -782,7 +787,9 @@ var RecordScopeTypeV2 = z7.enum([
782
787
  "record.request-correction",
783
788
  "record.correct",
784
789
  "record.unassign-others",
785
- "record.custom-action"
790
+ "record.custom-action",
791
+ "record.action.accept",
792
+ "record.action.reject"
786
793
  ]);
787
794
  var PlainScopeType = z7.enum([
788
795
  // Misc. system scopes
@@ -804,10 +811,7 @@ var PlainScopeType = z7.enum([
804
811
  // Performance dashboard
805
812
  "performance.read",
806
813
  "performance.read-dashboards",
807
- "performance.vital-statistics-export",
808
- // Scopes used exclusively by countryconfig integration token
809
- "record.confirm-registration",
810
- "record.reject-registration"
814
+ "performance.vital-statistics-export"
811
815
  ]);
812
816
  var scopeByEvent = z7.preprocess(
813
817
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -825,7 +829,9 @@ var userRole = z7.preprocess(
825
829
  ).describe("User role, e.g. admin, field agent");
826
830
  var scopeOptionsPlaceEvent = z7.object({
827
831
  event: scopeByEvent,
828
- placeOfEvent: JurisdictionFilter.optional()
832
+ placeOfEvent: JurisdictionFilter.optional(),
833
+ createdBy: UserFilter.optional(),
834
+ createdIn: JurisdictionFilter.optional()
829
835
  }).describe("Options applicable to all record scopes.");
830
836
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
831
837
  notifiedIn: JurisdictionFilter.optional(),
@@ -868,7 +874,9 @@ var AllScopeOptions = z7.object({
868
874
  var ScopeOptionKey = AllScopeOptions.keyof();
869
875
  var ResolvedScopeOptionsPlaceEvent = z7.object({
870
876
  event: scopeByEvent,
871
- placeOfEvent: UUID.nullish()
877
+ placeOfEvent: UUID.nullish(),
878
+ createdBy: z7.string().optional(),
879
+ createdIn: UUID.nullish()
872
880
  }).describe(
873
881
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
874
882
  );
@@ -915,6 +923,13 @@ var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
915
923
  "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."
916
924
  )
917
925
  });
926
+ var ActionConfirmationScopeType = RecordScopeTypeV2.extract([
927
+ "record.action.accept",
928
+ "record.action.reject"
929
+ ]);
930
+ var ActionConfirmationScopeOptions = AllRecordScopeOptions.describe(
931
+ "Options for confirming (accepting or rejecting) an action."
932
+ );
918
933
  var RecordScopeV2 = z7.discriminatedUnion("type", [
919
934
  z7.object({
920
935
  type: ScopesWithPlaceEventOptions,
@@ -935,6 +950,10 @@ var RecordScopeV2 = z7.discriminatedUnion("type", [
935
950
  z7.object({
936
951
  type: z7.literal("record.print-certified-copies"),
937
952
  options: ScopeOptionsPrintCertifiedCopies.optional()
953
+ }),
954
+ z7.object({
955
+ type: ActionConfirmationScopeType,
956
+ options: ActionConfirmationScopeOptions.optional()
938
957
  })
939
958
  ]).describe(
940
959
  "Scopes used to check user's permission to perform actions on a record."
@@ -1269,6 +1288,7 @@ var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
1269
1288
  operation: z9.literal("attachments.upload"),
1270
1289
  requestData: z9.object({
1271
1290
  transactionId: z9.string(),
1291
+ eventId: z9.string().optional(),
1272
1292
  path: z9.string().nullable()
1273
1293
  }),
1274
1294
  responseSummary: z9.object({ fileUrl: z9.string() })
@@ -1594,8 +1614,9 @@ var TextValue = z14.string();
1594
1614
  var HiddenFieldValue = z14.string();
1595
1615
  var NonEmptyTextValue = z14.string().trim().min(1);
1596
1616
  var DateValue = z14.iso.date().describe("Date in the format YYYY-MM-DD");
1617
+ var AGE_MAX_VALUE = 999;
1597
1618
  var AgeValue = z14.object({
1598
- age: z14.number(),
1619
+ age: z14.number().int().min(0).max(AGE_MAX_VALUE),
1599
1620
  asOfDateRef: z14.string()
1600
1621
  });
1601
1622
  var AgeUpdateValue = AgeValue.optional().nullable();
@@ -1925,7 +1946,7 @@ var RequestedCorrectionAction = ActionBase.extend(
1925
1946
  var ApprovedCorrectionAction = ActionBase.extend(
1926
1947
  z16.object({
1927
1948
  type: z16.literal(ActionType.APPROVE_CORRECTION),
1928
- requestId: z16.string(),
1949
+ requestId: UUID,
1929
1950
  // TODO move into 'content' property
1930
1951
  content: z16.object({ immediateCorrection: z16.boolean().optional() }).optional()
1931
1952
  }).shape
@@ -1933,7 +1954,7 @@ var ApprovedCorrectionAction = ActionBase.extend(
1933
1954
  var RejectedCorrectionAction = ActionBase.extend(
1934
1955
  z16.object({
1935
1956
  type: z16.literal(ActionType.REJECT_CORRECTION),
1936
- requestId: z16.string(),
1957
+ requestId: UUID,
1937
1958
  // TODO move into 'content' property
1938
1959
  content: ReasonContent
1939
1960
  }).shape
@@ -3264,6 +3285,9 @@ var PageConfigBase = z22.object({
3264
3285
  requireCompletionToContinue: z22.boolean().default(false).describe(
3265
3286
  "If true, all required fields must be filled before continuing to the next page"
3266
3287
  ),
3288
+ showClearButton: z22.boolean().optional().describe(
3289
+ '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'
3290
+ ),
3267
3291
  fields: z22.array(FieldConfig).describe("Fields to be rendered on the page"),
3268
3292
  conditional: Conditional.optional().describe(
3269
3293
  "Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
@@ -3444,7 +3468,10 @@ var ReadActionConfig = ActionConfigBase.extend(
3444
3468
  review: DeclarationReviewConfig.describe(
3445
3469
  "Configuration of the review page for read-only view."
3446
3470
  ),
3447
- conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals.")
3471
+ conditionals: z25.never().optional().describe("Read-action can not be disabled or hidden with conditionals."),
3472
+ flags: z25.never().optional().describe(
3473
+ "READ is a meta action excluded from flag resolution, so flags configured here would never apply."
3474
+ )
3448
3475
  }).shape
3449
3476
  );
3450
3477
  var NotifyConfig = ActionConfigBase.extend(
@@ -3876,7 +3903,7 @@ var ReferenceField = BaseField2.extend({
3876
3903
  var Field = BaseField2.extend({
3877
3904
  id: z29.string().describe("Identifier of the summary field."),
3878
3905
  value: TranslationConfig.describe(
3879
- 'Field value template supporting variables from configuration and EventMetadata (e.g. "{informant.phoneNo} {informant.email}").'
3906
+ '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}").'
3880
3907
  ),
3881
3908
  label: TranslationConfig
3882
3909
  }).describe("Custom field defined for the summary view.");
@@ -4467,21 +4494,23 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
4467
4494
  registrationNumber
4468
4495
  };
4469
4496
  }
4470
- var updateActions = ActionTypes.extract([
4471
- ActionType.CREATE,
4472
- ActionType.NOTIFY,
4473
- ActionType.EDIT,
4474
- ActionType.DECLARE,
4475
- ActionType.REGISTER,
4476
- ActionType.REJECT,
4477
- ActionType.ARCHIVE,
4478
- ActionType.UNARCHIVE,
4479
- ActionType.PRINT_CERTIFICATE,
4480
- ActionType.REQUEST_CORRECTION,
4481
- ActionType.APPROVE_CORRECTION,
4482
- ActionType.REJECT_CORRECTION,
4483
- ActionType.CUSTOM
4484
- ]);
4497
+ var updateActions = new Set(
4498
+ ActionTypes.extract([
4499
+ ActionType.CREATE,
4500
+ ActionType.NOTIFY,
4501
+ ActionType.EDIT,
4502
+ ActionType.DECLARE,
4503
+ ActionType.REGISTER,
4504
+ ActionType.REJECT,
4505
+ ActionType.ARCHIVE,
4506
+ ActionType.UNARCHIVE,
4507
+ ActionType.PRINT_CERTIFICATE,
4508
+ ActionType.REQUEST_CORRECTION,
4509
+ ActionType.APPROVE_CORRECTION,
4510
+ ActionType.REJECT_CORRECTION,
4511
+ ActionType.CUSTOM
4512
+ ]).options
4513
+ );
4485
4514
  function getActionUpdateMetadata(actions) {
4486
4515
  const createAction = getOrThrow(
4487
4516
  actions.find((action) => action.type === ActionType.CREATE),
@@ -4494,7 +4523,7 @@ function getActionUpdateMetadata(actions) {
4494
4523
  "createdAtLocation",
4495
4524
  "createdByRole"
4496
4525
  ];
4497
- return actions.filter(({ type }) => updateActions.safeParse(type).success).reduce(
4526
+ return actions.filter(({ type }) => updateActions.has(type)).reduce(
4498
4527
  (_2, action) => {
4499
4528
  if (action.originalActionId) {
4500
4529
  const originalAction = actions.find(({ id }) => id === action.originalActionId) ?? action;
@@ -4647,7 +4676,12 @@ function resolveInherentFlag(rule, acceptedActions, event2, eventConfiguration)
4647
4676
  }
4648
4677
  function resolveEventCustomFlags(event2, eventConfiguration) {
4649
4678
  const actions = getAcceptedActions(event2).filter(({ type }) => !isMetaAction(type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
4679
+ const declarations = getDeclarationAfterEachAction({ ...event2, actions });
4680
+ let annotation = {};
4650
4681
  return actions.reduce((acc, action, idx) => {
4682
+ if (action.annotation) {
4683
+ annotation = deepMerge(annotation, action.annotation);
4684
+ }
4651
4685
  let actionConfig;
4652
4686
  if (isActionConfigType(action.type)) {
4653
4687
  actionConfig = getActionConfig({
@@ -4659,13 +4693,7 @@ function resolveEventCustomFlags(event2, eventConfiguration) {
4659
4693
  if (!actionConfig) {
4660
4694
  return acc;
4661
4695
  }
4662
- const eventUpToThisAction = {
4663
- ...event2,
4664
- actions: actions.slice(0, idx + 1)
4665
- };
4666
- const declaration = aggregateActionDeclarations(eventUpToThisAction);
4667
- const annotation = aggregateActionAnnotations(eventUpToThisAction);
4668
- const form = { ...declaration, ...annotation };
4696
+ const form = { ...declarations[idx], ...annotation };
4669
4697
  const flagsWithMetConditions = (actionConfig.flags ?? []).filter(
4670
4698
  ({ conditional }) => (
4671
4699
  // If conditional is not provided, the flag is resolved
@@ -6104,47 +6132,69 @@ function runFieldValidations({
6104
6132
  });
6105
6133
  return [...fieldValidationResult, ...customValidationResults];
6106
6134
  }
6107
- function getValidatorsForField(fieldId, validations) {
6108
- return validations.map(({ validator, message }) => {
6109
- const jsonSchema = validator;
6110
- if (!jsonSchema.properties) {
6111
- return null;
6112
- }
6113
- const $form = jsonSchema.properties.$form;
6114
- if ($form.properties?.[fieldId]?.type === "object") {
6135
+ function extractFieldSchema(fieldId, jsonSchema) {
6136
+ if (!jsonSchema.properties) {
6137
+ if (Array.isArray(jsonSchema.allOf)) {
6138
+ const members = jsonSchema.allOf.map((member) => extractFieldSchema(fieldId, member)).filter((member) => member !== null).map(({ $id, ...member }) => member);
6139
+ if (members.length === 0) {
6140
+ return null;
6141
+ }
6115
6142
  return {
6116
- message,
6117
- validator: {
6118
- ...jsonSchema,
6119
- properties: {
6120
- $form: {
6121
- type: "object",
6122
- properties: $form.properties?.[fieldId]?.properties || {},
6123
- required: $form.properties?.[fieldId]?.required || []
6124
- }
6125
- }
6126
- }
6143
+ ...jsonSchema,
6144
+ /*
6145
+ * `validate()` looks schemas up from Ajv's cache by `$id`, so a
6146
+ * narrowed schema must not reuse the id its un-narrowed parent was
6147
+ * compiled under.
6148
+ */
6149
+ ...typeof jsonSchema.$id === "string" ? { $id: `${jsonSchema.$id}.${fieldId}` } : {},
6150
+ allOf: members
6127
6151
  };
6128
6152
  }
6129
- if (!$form.properties?.[fieldId]) {
6130
- return null;
6131
- }
6153
+ return null;
6154
+ }
6155
+ const $form = jsonSchema.properties.$form;
6156
+ if (!$form?.properties) {
6157
+ return null;
6158
+ }
6159
+ if ($form.properties?.[fieldId]?.type === "object") {
6132
6160
  return {
6133
- message,
6134
- validator: {
6135
- ...jsonSchema,
6136
- $id: jsonSchema.$id + "." + fieldId,
6137
- properties: {
6138
- $form: {
6139
- type: "object",
6140
- properties: {
6141
- [fieldId]: $form.properties?.[fieldId]
6142
- },
6143
- required: $form.required?.includes(fieldId) ? [fieldId] : []
6144
- }
6161
+ ...jsonSchema,
6162
+ // See the `$id` note in the `allOf` branch above: Ajv caches by `$id`,
6163
+ // so a narrowed schema must not reuse its parent's id.
6164
+ ...typeof jsonSchema.$id === "string" ? { $id: `${jsonSchema.$id}.${fieldId}` } : {},
6165
+ properties: {
6166
+ $form: {
6167
+ type: "object",
6168
+ properties: $form.properties?.[fieldId]?.properties || {},
6169
+ required: $form.properties?.[fieldId]?.required || []
6145
6170
  }
6146
6171
  }
6147
6172
  };
6173
+ }
6174
+ if (!$form.properties?.[fieldId]) {
6175
+ return null;
6176
+ }
6177
+ return {
6178
+ ...jsonSchema,
6179
+ $id: jsonSchema.$id + "." + fieldId,
6180
+ properties: {
6181
+ $form: {
6182
+ type: "object",
6183
+ properties: {
6184
+ [fieldId]: $form.properties?.[fieldId]
6185
+ },
6186
+ required: $form.required?.includes(fieldId) ? [fieldId] : []
6187
+ }
6188
+ }
6189
+ };
6190
+ }
6191
+ function getValidatorsForField(fieldId, validations) {
6192
+ return validations.map(({ validator, message }) => {
6193
+ const narrowed = extractFieldSchema(fieldId, validator);
6194
+ if (narrowed === null) {
6195
+ return null;
6196
+ }
6197
+ return { message, validator: narrowed };
6148
6198
  }).filter((x) => x !== null);
6149
6199
  }
6150
6200
  function areCertificateConditionsMet(conditions, values) {
@@ -6355,9 +6405,8 @@ function omitHiddenAnnotationFields(actionConfig, declaration, annotation, conte
6355
6405
  });
6356
6406
  }
6357
6407
  function deepMerge(currentDocument, actionDocument) {
6358
- const currentDocumentClone = (0, import_lodash4.cloneDeep)(currentDocument);
6359
6408
  return (0, import_lodash4.mergeWith)(
6360
- (0, import_lodash4.cloneDeep)(currentDocumentClone),
6409
+ (0, import_lodash4.cloneDeep)(currentDocument),
6361
6410
  actionDocument,
6362
6411
  (previousValue, incomingValue) => {
6363
6412
  if (incomingValue === void 0) {
@@ -6521,7 +6570,7 @@ function getPendingAction(actions) {
6521
6570
  );
6522
6571
  if (pendingActions.length !== 1) {
6523
6572
  throw new Error(
6524
- `Expected exactly one pending action, but found ${pendingActions.map(({ id }) => id).join(", ")}`
6573
+ `Expected exactly one pending action, but found ${pendingActions.length ? pendingActions.map(({ id }) => id).join(", ") : "none"}`
6525
6574
  );
6526
6575
  }
6527
6576
  return pendingActions[0];
@@ -6579,30 +6628,70 @@ var EXCLUDED_ACTIONS = [
6579
6628
  ActionType.PRINT_CERTIFICATE,
6580
6629
  ActionType.REJECT_CORRECTION
6581
6630
  ];
6631
+ function applyActionDeclaration(declaration, event2, action, acceptedActions) {
6632
+ if (action.type === ActionType.APPROVE_CORRECTION) {
6633
+ const requestAction = acceptedActions.find(
6634
+ ({ id }) => id === action.requestId
6635
+ );
6636
+ if (!requestAction) {
6637
+ return declaration;
6638
+ }
6639
+ const declarationWithApprovedCorrection = getCompleteActionDeclaration(
6640
+ declaration,
6641
+ event2,
6642
+ requestAction
6643
+ );
6644
+ return getCompleteActionDeclaration(
6645
+ declarationWithApprovedCorrection,
6646
+ event2,
6647
+ action
6648
+ );
6649
+ }
6650
+ return getCompleteActionDeclaration(declaration, event2, action);
6651
+ }
6582
6652
  function aggregateActionDeclarations(event2) {
6583
6653
  const allAcceptedActions = getAcceptedActions(event2);
6584
6654
  const aggregatedActions = allAcceptedActions.filter((a) => !EXCLUDED_ACTIONS.some((type) => type === a.type)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
6585
- return aggregatedActions.reduce((declaration, action) => {
6586
- if (action.type === ActionType.APPROVE_CORRECTION) {
6587
- const requestAction = allAcceptedActions.find(
6588
- ({ id }) => id === action.requestId
6589
- );
6590
- if (!requestAction) {
6591
- return declaration;
6592
- }
6593
- const declarationWithApprovedCorrection = getCompleteActionDeclaration(
6655
+ return aggregatedActions.reduce(
6656
+ (declaration, action) => applyActionDeclaration(declaration, event2, action, allAcceptedActions),
6657
+ {}
6658
+ );
6659
+ }
6660
+ function getDeclarationAfterEachAction(event2) {
6661
+ const acceptedActions = [];
6662
+ let declaration = {};
6663
+ return event2.actions.map((action, index) => {
6664
+ if (!isAcceptedAction(action)) {
6665
+ return declaration;
6666
+ }
6667
+ const eventUntilAction = {
6668
+ ...event2,
6669
+ actions: event2.actions.slice(0, index + 1)
6670
+ };
6671
+ const acceptedAction = {
6672
+ ...action,
6673
+ declaration: getCompleteActionDeclaration({}, eventUntilAction, action)
6674
+ };
6675
+ acceptedActions.push(acceptedAction);
6676
+ if (!EXCLUDED_ACTIONS.some((type) => type === action.type)) {
6677
+ declaration = applyActionDeclaration(
6594
6678
  declaration,
6595
- event2,
6596
- requestAction
6597
- );
6598
- return getCompleteActionDeclaration(
6599
- declarationWithApprovedCorrection,
6600
- event2,
6601
- action
6679
+ eventUntilAction,
6680
+ acceptedAction,
6681
+ acceptedActions
6602
6682
  );
6603
6683
  }
6604
- return getCompleteActionDeclaration(declaration, event2, action);
6605
- }, {});
6684
+ return declaration;
6685
+ });
6686
+ }
6687
+ function getDeclarationWithPendingAction(event2) {
6688
+ const pendingAction = getPendingAction(event2.actions);
6689
+ return applyActionDeclaration(
6690
+ aggregateActionDeclarations(event2),
6691
+ event2,
6692
+ pendingAction,
6693
+ getAcceptedActions(event2)
6694
+ );
6606
6695
  }
6607
6696
  function aggregateActionAnnotations(event2) {
6608
6697
  return event2.actions.reduce((ann, sortedAction) => {
@@ -7392,7 +7481,14 @@ var Draft = z40.object({
7392
7481
  "A temporary storage for an action. Stored with details of the event, creator and creation time."
7393
7482
  );
7394
7483
  var DraftInput = BaseActionInput.omit({ waitFor: true }).extend({
7395
- type: ActionTypes.exclude([ActionTypes.enum.DELETE]),
7484
+ /*
7485
+ * A draft can name a file that no action references. Such a file stays until
7486
+ * the record is deleted or the record's next action sweeps its prefix.
7487
+ * DECLARE is available only where one of those is still coming: a created
7488
+ * record, which can still be deleted, and a record part way through an edit,
7489
+ * which is about to be declared or registered.
7490
+ */
7491
+ type: z40.literal(ActionTypes.enum.DECLARE),
7396
7492
  status: z40.enum([
7397
7493
  ActionStatus.Requested,
7398
7494
  ActionStatus.Accepted,
@@ -7430,38 +7526,8 @@ var EventDocumentOnlyLastAction = EventDocument.extend({
7430
7526
  }).brand("EventDocumentOnlyLastAction");
7431
7527
 
7432
7528
  // ../commons/src/events/defineConfig.ts
7433
- var IGNORED_EVENT_TYPES = [
7434
- "FOOTBALL_CLUB_MEMBERSHIP",
7435
- "tennis-club-membership",
7436
- "library-membership",
7437
- "child-onboarding",
7438
- "digital-identity",
7439
- "event-with-optional-address"
7440
- ];
7441
- function warnOnConfigurationIssues2(config) {
7442
- const eventId = config.id;
7443
- if (IGNORED_EVENT_TYPES.includes(eventId)) {
7444
- return;
7445
- }
7446
- const validateDeclarationAction = config.actions.find(
7447
- (action) => action.type === ActionType.CUSTOM && action.customActionType === "VALIDATE_DECLARATION"
7448
- );
7449
- if (!validateDeclarationAction) {
7450
- console.warn(
7451
- `
7452
- ************** WARNING **************
7453
- A custom action with customActionType 'VALIDATE_DECLARATION' is not defined for event '${eventId}'!
7454
- For v2.0, we expect this to be defined for all events.
7455
-
7456
- The deprecated v1.9 'ActionType.VALIDATE' actions are migrated to customActionType 'VALIDATE_DECLARATION' in v2.0.
7457
- ************** WARNING **************
7458
- `
7459
- );
7460
- }
7461
- }
7462
7529
  var defineConfig = (config) => {
7463
7530
  const input = EventConfig.parse(config);
7464
- warnOnConfigurationIssues2(input);
7465
7531
  return input;
7466
7532
  };
7467
7533
 
@@ -8160,6 +8226,21 @@ var TENNIS_CLUB_DECLARATION_REVIEW = {
8160
8226
  description: "Title of the review page"
8161
8227
  },
8162
8228
  fields: [
8229
+ {
8230
+ id: "annotation.hidden",
8231
+ type: FieldType.TEXT,
8232
+ label: {
8233
+ id: "annotation.hidden.label",
8234
+ defaultMessage: "Show not be visible",
8235
+ description: "Catch for rendering"
8236
+ },
8237
+ conditionals: [
8238
+ {
8239
+ type: ConditionalType.SHOW,
8240
+ conditional: never2()
8241
+ }
8242
+ ]
8243
+ },
8163
8244
  {
8164
8245
  id: "review.comment",
8165
8246
  type: FieldType.TEXTAREA,
@@ -8216,7 +8297,23 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
8216
8297
  defaultMessage: "Who is applying for the membership?",
8217
8298
  description: "This is the title of the section"
8218
8299
  },
8300
+ showClearButton: true,
8219
8301
  fields: [
8302
+ {
8303
+ id: "declaration.hidden",
8304
+ type: FieldType.TEXT,
8305
+ label: {
8306
+ id: "declaration.hidden.label",
8307
+ defaultMessage: "Show not be visible",
8308
+ description: "Catch for rendering"
8309
+ },
8310
+ conditionals: [
8311
+ {
8312
+ type: ConditionalType.SHOW,
8313
+ conditional: never2()
8314
+ }
8315
+ ]
8316
+ },
8220
8317
  {
8221
8318
  id: "applicant.name",
8222
8319
  type: FieldType.NAME,
@@ -10049,6 +10146,23 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
10049
10146
  )) {
10050
10147
  return false;
10051
10148
  }
10149
+ if (opts?.createdBy === UserFilter.enum.user && event2.createdBy !== user2.id) {
10150
+ return false;
10151
+ }
10152
+ if (opts?.createdIn === JurisdictionFilter.enum.location && !matchesJurisdictionFilter(
10153
+ event2.createdAtLocation,
10154
+ JurisdictionFilter.enum.location,
10155
+ user2
10156
+ )) {
10157
+ return false;
10158
+ }
10159
+ if (opts?.createdIn === JurisdictionFilter.enum.administrativeArea && !matchesJurisdictionFilter(
10160
+ event2.createdAtLocation,
10161
+ JurisdictionFilter.enum.administrativeArea,
10162
+ user2
10163
+ )) {
10164
+ return false;
10165
+ }
10052
10166
  if (scopeUsesDeclaredOptions(scope)) {
10053
10167
  const { options } = scope;
10054
10168
  if (options?.status && (!event2.status || !options.status.includes(event2.status))) {
@@ -10916,7 +11030,10 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
10916
11030
  transactionId: input.transactionId ?? getUUID(),
10917
11031
  declaration,
10918
11032
  eventId,
10919
- keepAssignment: input.keepAssignment
11033
+ keepAssignment: input.keepAssignment,
11034
+ keepAssignmentIfAccepted: input.keepAssignmentIfAccepted,
11035
+ keepAssignmentIfRejected: input.keepAssignmentIfRejected,
11036
+ waitFor: input.waitFor
10920
11037
  };
10921
11038
  },
10922
11039
  edit: (eventId, input = {}) => ({
@@ -10932,14 +11049,16 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
10932
11049
  transactionId: input.transactionId ?? getUUID(),
10933
11050
  declaration: {},
10934
11051
  assignedTo: input.assignedTo ?? getUUID(),
10935
- eventId
11052
+ eventId,
11053
+ waitFor: input.waitFor
10936
11054
  }),
10937
11055
  unassign: (eventId, input = {}) => ({
10938
11056
  type: ActionType.UNASSIGN,
10939
11057
  transactionId: input.transactionId ?? getUUID(),
10940
11058
  declaration: {},
10941
11059
  assignedTo: null,
10942
- eventId
11060
+ eventId,
11061
+ waitFor: input.waitFor
10943
11062
  }),
10944
11063
  archive: (eventId, input = {}) => ({
10945
11064
  type: ActionType.ARCHIVE,
@@ -11012,7 +11131,10 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
11012
11131
  rng
11013
11132
  ),
11014
11133
  eventId,
11015
- keepAssignment: input.keepAssignment
11134
+ keepAssignment: input.keepAssignment,
11135
+ keepAssignmentIfAccepted: input.keepAssignmentIfAccepted,
11136
+ keepAssignmentIfRejected: input.keepAssignmentIfRejected,
11137
+ waitFor: input.waitFor
11016
11138
  }),
11017
11139
  approve: (eventId, requestId, input = {}) => ({
11018
11140
  type: ActionType.APPROVE_CORRECTION,
@@ -11025,7 +11147,10 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
11025
11147
  ),
11026
11148
  eventId,
11027
11149
  requestId,
11028
- keepAssignment: input.keepAssignment
11150
+ keepAssignment: input.keepAssignment,
11151
+ keepAssignmentIfAccepted: input.keepAssignmentIfAccepted,
11152
+ keepAssignmentIfRejected: input.keepAssignmentIfRejected,
11153
+ waitFor: input.waitFor
11029
11154
  }),
11030
11155
  reject: (eventId, requestId, input) => ({
11031
11156
  type: ActionType.REJECT_CORRECTION,
@@ -11038,8 +11163,11 @@ function eventPayloadGenerator(rng, configuration = tennisClubMembershipEvent) {
11038
11163
  ),
11039
11164
  eventId,
11040
11165
  requestId,
11166
+ content: input.content ?? { reason: "too late" },
11041
11167
  keepAssignment: input.keepAssignment,
11042
- content: input.content ?? { reason: "" }
11168
+ keepAssignmentIfAccepted: input.keepAssignmentIfAccepted,
11169
+ keepAssignmentIfRejected: input.keepAssignmentIfRejected,
11170
+ waitFor: input.waitFor
11043
11171
  })
11044
11172
  },
11045
11173
  duplicate: {
@@ -11307,11 +11435,6 @@ var generateTranslationConfig2 = (message) => ({
11307
11435
  description: "Description for ${message}",
11308
11436
  id: message.trim().replace(/\s+/g, "_").toLowerCase()
11309
11437
  });
11310
- var BearerTokenByUserType = {
11311
- fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJ3b3JrcXVldWVbaWQ9YWxsLWV2ZW50c3xhc3NpZ25lZC10by15b3V8cmVjZW50fHJlcXVpcmVzLXVwZGF0ZXN8c2VudC1mb3ItcmV2aWV3XSIsInR5cGU9cmVjb3JkLnNlYXJjaCZldmVudD1iaXJ0aCxkZWF0aCx0ZW5uaXMtY2x1Yi1tZW1iZXJzaGlwLGNoaWxkLW9uYm9hcmRpbmcsRk9PVEJBTExfQ0xVQl9NRU1CRVJTSElQIiwidHlwZT1yZWNvcmQuY3JlYXRlJmV2ZW50PWJpcnRoLGRlYXRoLHRlbm5pcy1jbHViLW1lbWJlcnNoaXAsY2hpbGQtb25ib2FyZGluZyIsInR5cGU9cmVjb3JkLnJlYWQmZXZlbnQ9YmlydGgsZGVhdGgsdGVubmlzLWNsdWItbWVtYmVyc2hpcCxjaGlsZC1vbmJvYXJkaW5nIiwicmVjb3JkLmRlY2xhcmVbZXZlbnQ9YmlydGh8ZGVhdGh8dGVubmlzLWNsdWItbWVtYmVyc2hpcHxjaGlsZC1vbmJvYXJkaW5nXSIsInJlY29yZC5ub3RpZnlbZXZlbnQ9YmlydGh8ZGVhdGh8dGVubmlzLWNsdWItbWVtYmVyc2hpcHxjaGlsZC1vbmJvYXJkaW5nXSIsInJlY29yZC5kZWNsYXJlZC5lZGl0W2V2ZW50PWJpcnRofGRlYXRofHRlbm5pcy1jbHViLW1lbWJlcnNoaXB8Y2hpbGQtb25ib2FyZGluZ10iXS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B5sT4Bq_38PwzsC2gshzl4Np9oh9bVWbZC5Z7SLqE4TJzXDOWaoKRt6wFEfZhJjG7MYnAD2PD0YzTWyPKFn4sqZI7-zNajHfUDC-yXyIiiohQNkI"
11314
- };
11315
11438
  var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
11316
11439
  {
11317
11440
  slug,
@@ -11332,7 +11455,8 @@ var generateEventConfig = ({
11332
11455
  id,
11333
11456
  fields,
11334
11457
  placeOfEventId,
11335
- dateOfEventId
11458
+ dateOfEventId,
11459
+ actions = []
11336
11460
  }) => {
11337
11461
  return defineConfig({
11338
11462
  id,
@@ -11369,7 +11493,8 @@ var generateEventConfig = ({
11369
11493
  title: generateTranslationConfig2("Review Declare Action"),
11370
11494
  fields: []
11371
11495
  }
11372
- }
11496
+ },
11497
+ ...actions
11373
11498
  ]
11374
11499
  });
11375
11500
  };
@@ -11489,6 +11614,24 @@ var ACTION_SCOPE_MAP = {
11489
11614
  [ActionType.DUPLICATE_DETECTED]: [],
11490
11615
  [ActionType.CUSTOM]: []
11491
11616
  };
11617
+ var RECORD_WRITE_SCOPES = (0, import_lodash6.uniq)(
11618
+ Object.entries(ACTION_SCOPE_MAP).filter(([action]) => action !== ActionType.READ).flatMap(([, scopes]) => scopes ?? [])
11619
+ );
11620
+ var DOCUMENT_DELETE_SCOPES = [
11621
+ "record.create",
11622
+ "record.notify",
11623
+ "record.declare",
11624
+ "record.register",
11625
+ "record.edit",
11626
+ "record.print-certified-copies",
11627
+ "record.request-correction",
11628
+ "record.correct",
11629
+ "record.review-duplicates",
11630
+ "record.archive",
11631
+ "record.unarchive",
11632
+ "record.reject",
11633
+ "user.edit"
11634
+ ];
11492
11635
  function hasAnyOfScopes(a, b) {
11493
11636
  return (0, import_lodash6.intersection)(a, b).length > 0;
11494
11637
  }
@@ -11738,10 +11881,11 @@ function getAvailableActionsForEvent(event2) {
11738
11881
 
11739
11882
  // ../commons/src/events/FileUtils.ts
11740
11883
  var import_lodash7 = require("lodash");
11884
+ function carriesFieldValues(action) {
11885
+ return "declaration" in action;
11886
+ }
11741
11887
  function getFilePathsFromEvent(event2) {
11742
- const filepaths = event2.actions.filter(
11743
- (action) => action.status !== ActionStatus.Rejected
11744
- ).flatMap((action) => {
11888
+ const filepaths = event2.actions.filter(carriesFieldValues).flatMap((action) => {
11745
11889
  const declarationValues = Object.values(action.declaration);
11746
11890
  const annotationValues = Object.values(action.annotation ?? {});
11747
11891
  const actionFilePaths = [