@opencrvs/toolkit 2.1.1 → 2.2.0-rc.045257f

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 (144) hide show
  1. package/build.sh +2 -12
  2. package/create-countryconfig/package.json +1 -1
  3. package/dist/application-config/index.js +41 -9
  4. package/dist/authentication/index.d.ts +1 -0
  5. package/dist/authentication/index.js +30 -6
  6. package/dist/cli.js +944 -2044
  7. package/dist/commons/api/router.d.ts +1546 -243
  8. package/dist/commons/application-config/index.d.ts +2 -2
  9. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  10. package/dist/commons/conditionals/index.d.ts +1 -0
  11. package/dist/commons/conditionals/validate.d.ts +5 -0
  12. package/dist/commons/events/ActionConfig.d.ts +146 -20
  13. package/dist/commons/events/ActionDocument.d.ts +89 -0
  14. package/dist/commons/events/ActionInput.d.ts +56 -4
  15. package/dist/commons/events/ActionType.d.ts +11 -1
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  17. package/dist/commons/events/AuditLog.d.ts +4 -0
  18. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  19. package/dist/commons/events/CountryConfigQueryInput.d.ts +192 -18
  20. package/dist/commons/events/Draft.d.ts +2 -0
  21. package/dist/commons/events/EventConfig.d.ts +27 -6
  22. package/dist/commons/events/EventDocument.d.ts +88 -0
  23. package/dist/commons/events/EventIndex.d.ts +43 -6
  24. package/dist/commons/events/EventMetadata.d.ts +23 -1
  25. package/dist/commons/events/EventStatus.d.ts +1 -0
  26. package/dist/commons/events/FieldConfig.d.ts +11 -1
  27. package/dist/commons/events/FieldTypeMapping.d.ts +6 -6
  28. package/dist/commons/events/Flag.d.ts +1 -7
  29. package/dist/commons/events/PlainDate.d.ts +1 -0
  30. package/dist/commons/events/WorkqueueConfig.d.ts +224 -33
  31. package/dist/commons/events/eventConfigValidation.d.ts +26 -1
  32. package/dist/commons/events/index.d.ts +3 -0
  33. package/dist/commons/events/scopes.d.ts +2 -0
  34. package/dist/commons/events/state/flags.d.ts +1 -1
  35. package/dist/commons/events/state/index.d.ts +10 -2
  36. package/dist/commons/events/state/utils.d.ts +11 -1
  37. package/dist/commons/events/test.utils.d.ts +30 -1
  38. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  39. package/dist/commons/events/utils.d.ts +62 -8
  40. package/dist/conditionals/index.js +16 -4
  41. package/dist/environment/derived-variables.d.ts +16 -4
  42. package/dist/environment/derived-variables.d.ts.map +1 -1
  43. package/dist/environment/derived-variables.js +18 -4
  44. package/dist/environment/dockerhub.d.ts +15 -0
  45. package/dist/environment/dockerhub.d.ts.map +1 -0
  46. package/dist/environment/dockerhub.js +104 -0
  47. package/dist/environment/questions.js +1 -1
  48. package/dist/environment/setup-environment.d.ts.map +1 -1
  49. package/dist/environment/setup-environment.js +67 -18
  50. package/dist/environment/templates.d.ts.map +1 -1
  51. package/dist/events/index.js +496 -129
  52. package/dist/migrations/index.d.ts +9 -0
  53. package/dist/migrations/index.d.ts.map +1 -0
  54. package/dist/migrations/index.js +847 -0
  55. package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
  56. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
  57. package/dist/migrations/move-declaration-to-declare-action.js +377 -0
  58. package/dist/migrations/{v2.1 → persistent}/add-translations.d.ts +7 -1
  59. package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
  60. package/dist/migrations/{v2.1 → persistent}/add-translations.js +14 -12
  61. package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
  62. package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
  63. package/dist/migrations/persistent/check-upgrade-path.js +105 -0
  64. package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
  65. package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
  66. package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
  67. package/dist/migrations/read-declaration-through-helper.d.ts +39 -0
  68. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
  69. package/dist/migrations/read-declaration-through-helper.js +257 -0
  70. package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
  71. package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
  72. package/dist/migrations/replace-incomplete-flag.js +126 -0
  73. package/dist/notification/index.js +390 -106
  74. package/dist/scopes/index.d.ts +83 -90
  75. package/dist/scopes/index.js +26 -6
  76. package/dist/templates/charts-values/dependencies/values.yaml +1 -1
  77. package/dist/templates/charts-values/opencrvs-services/values.yaml +3 -5
  78. package/dist/templates/charts-values/traefik/values.yaml +4 -3
  79. package/opencrvs-toolkit-2.2.0-rc.045257f.tgz +0 -0
  80. package/package.json +2 -2
  81. package/tsconfig.build.tsbuildinfo +1 -1
  82. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
  83. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
  84. package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
  85. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
  86. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
  87. package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
  88. package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
  89. package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
  90. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
  91. package/dist/migrations/v2.1/enable-telemetry.js +0 -455
  92. package/dist/migrations/v2.1/index.d.ts +0 -6
  93. package/dist/migrations/v2.1/index.d.ts.map +0 -1
  94. package/dist/migrations/v2.1/index.js +0 -2170
  95. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -14
  96. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
  97. package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
  98. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
  99. package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
  100. package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
  101. package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
  102. package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
  103. package/dist/migrations/v2.1/remove-sentry.js +0 -354
  104. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
  105. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
  106. package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
  107. package/dist/migrations/v2.1/template-files.d.ts +0 -8
  108. package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
  109. package/dist/migrations/v2.1/template-files.js +0 -49
  110. package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -8
  111. package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
  112. package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
  113. package/dist/templates/countryconfig-template/.tiltignore +0 -1
  114. package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
  115. package/dist/templates/countryconfig-template/Tiltfile +0 -112
  116. package/dist/templates/countryconfig-template/assets/README.md +0 -1
  117. package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
  118. package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
  119. package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
  120. package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
  121. package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
  122. package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
  123. package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
  124. package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
  125. package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
  126. package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
  127. package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
  128. package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
  129. package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
  130. package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
  131. package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
  132. package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
  133. package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
  134. package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
  135. package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
  136. package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
  137. package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
  138. package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
  139. package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
  140. package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
  141. package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
  142. package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
  143. package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
  144. package/opencrvs-toolkit-2.1.1.tgz +0 -0
@@ -1,4 +1,5 @@
1
1
  import { Action } from '../ActionDocument';
2
+ import { EventStatus } from '../EventMetadata';
2
3
  /**
3
4
  * Returns the creation metadata of the last update action (Requested or Accepted).
4
5
  * Requested actions are included so that async flows (202) correctly reflect the
@@ -29,7 +30,7 @@ export declare function getActionUpdateMetadata(actions: Action[]): Pick<{
29
30
  * @returns the legal statuses of the event. Event is considered legal if it has been accepted.
30
31
  * @see EventIndex for the description of the returned object.
31
32
  */
32
- export declare function getLegalStatuses(actions: Action[]): {
33
+ export declare function getLegalStatuses(actions: Action[], status: EventStatus): {
33
34
  NOTIFIED: {
34
35
  createdAt: string;
35
36
  createdBy: string;
@@ -57,5 +58,14 @@ export declare function getLegalStatuses(actions: Action[]): {
57
58
  createdByRole: string | undefined;
58
59
  registrationNumber: string | null | undefined;
59
60
  } | null;
61
+ REVOKED: {
62
+ createdAt: string;
63
+ createdBy: string;
64
+ createdByUserType: "system" | "user";
65
+ createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
66
+ acceptedAt: string;
67
+ createdByRole: string | undefined;
68
+ registrationNumber: string | null | undefined;
69
+ } | null;
60
70
  };
61
71
  //# sourceMappingURL=utils.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { UUID } from '../uuid';
2
2
  import { ActionDocument, ActionUpdate } from './ActionDocument';
3
3
  import { ValidatorContext } from '../conditionals/validate';
4
- import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput } from './ActionInput';
4
+ import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput, RevokeRegistrationActionInput, ReinstateRegistrationActionInput } from './ActionInput';
5
5
  import { ActionType } from './ActionType';
6
6
  import { Draft } from './Draft';
7
7
  import { EventConfig, EventConfigInput } from './EventConfig';
@@ -10,6 +10,7 @@ import { EventIndex } from './EventIndex';
10
10
  import { EventInput } from './EventInput';
11
11
  import { TranslationConfig } from './TranslationConfig';
12
12
  import { FieldConfig } from './FieldConfig';
13
+ import { DeclarationFormConfig } from './FormConfig';
13
14
  import { LocationVersion, SetLocationPayload, SetAdministrativeAreaPayload, ClientAdministrativeArea } from './locations';
14
15
  import { WorkqueueConfig } from './WorkqueueConfig';
15
16
  import * as z from 'zod/v4';
@@ -158,6 +159,28 @@ export declare function eventPayloadGenerator(rng: () => number, configuration?:
158
159
  annotation: {};
159
160
  eventId: string;
160
161
  };
162
+ revokeRegistration: (eventId: string, input?: Partial<Pick<RevokeRegistrationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
163
+ keepAssignment?: boolean | undefined;
164
+ keepAssignmentIfAccepted?: boolean | undefined;
165
+ keepAssignmentIfRejected?: boolean | undefined;
166
+ waitFor?: boolean | undefined;
167
+ type: "REVOKE_REGISTRATION";
168
+ transactionId: string;
169
+ declaration: {};
170
+ annotation: {};
171
+ eventId: string;
172
+ };
173
+ reinstateRegistration: (eventId: string, input?: Partial<Pick<ReinstateRegistrationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfRejected' | 'keepAssignmentIfAccepted' | 'waitFor'>>) => {
174
+ keepAssignment?: boolean | undefined;
175
+ keepAssignmentIfAccepted?: boolean | undefined;
176
+ keepAssignmentIfRejected?: boolean | undefined;
177
+ waitFor?: boolean | undefined;
178
+ type: "REINSTATE_REGISTRATION";
179
+ transactionId: string;
180
+ declaration: {};
181
+ annotation: {};
182
+ eventId: string;
183
+ };
161
184
  reject: (eventId: string, input?: Partial<Pick<RejectDeclarationActionInput, 'transactionId' | 'annotation' | 'keepAssignment' | 'keepAssignmentIfAccepted' | 'keepAssignmentIfRejected' | 'waitFor'>>) => {
162
185
  keepAssignment?: boolean | undefined;
163
186
  keepAssignmentIfAccepted?: boolean | undefined;
@@ -328,6 +351,12 @@ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfE
328
351
  /** Extra actions appended to the default READ + DECLARE pair, e.g. a REQUEST_CORRECTION action with its own correctionForm. */
329
352
  actions?: EventConfigInput['actions'];
330
353
  }) => EventConfig;
354
+ /**
355
+ * The notification form is replaced too, since it may refer to fields of the replaced declaration.
356
+ *
357
+ * @returns a copy of the configuration with the DECLARE action's declaration replaced, and the NOTIFY action's notification form made from it.
358
+ */
359
+ export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
331
360
  /**
332
361
  * Get the leaf administrative area IDs from a list of administrative areas.
333
362
  *
@@ -0,0 +1,17 @@
1
+ import * as z from 'zod/v4';
2
+ import { DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig';
3
+ import { DeclarationReviewConfig } from './ActionConfig';
4
+ type DeclarationReviewConfigInput = z.input<typeof DeclarationReviewConfig>;
5
+ type DeclarationReviewConfigOutput = z.infer<typeof DeclarationReviewConfig>;
6
+ /**
7
+ * NOTIFY submits incomplete records, and its notification form is validated like any form.
8
+ *
9
+ * @returns a copy of the declaration form with every field optional and without validations, to use as the NOTIFY `notificationForm`.
10
+ */
11
+ export declare function toNotificationForm<F extends DeclarationFormConfig | DeclarationFormConfigInput>(declaration: F): F;
12
+ /**
13
+ * @returns a copy of the DECLARE review with every field optional and without validations, to use as the NOTIFY `review`.
14
+ */
15
+ export declare function toNotificationReview<R extends DeclarationReviewConfigOutput | DeclarationReviewConfigInput>(review: R): R;
16
+ export {};
17
+ //# sourceMappingURL=toNotificationForm.d.ts.map
@@ -8,11 +8,30 @@ import { Draft } from './Draft';
8
8
  import { EventDocument } from './EventDocument';
9
9
  import { UUID } from '../uuid';
10
10
  import { ActionConfig, ActionConfigTypes } from './ActionConfig';
11
- import { FormConfig } from './FormConfig';
11
+ import { DeclarationFormConfig, FormConfig } from './FormConfig';
12
12
  import { PlainDate, SelectDateRangeValue } from './FieldValue';
13
13
  import { EventIndex } from './EventIndex';
14
14
  export declare function ageToDate(age: number, asOfDate: PlainDate): string & import("zod").$brand<"PlainDate">;
15
- export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
15
+ export declare function getDeclaration(configuration: EventConfig): {
16
+ label: {
17
+ id: string;
18
+ defaultMessage: string;
19
+ description: string;
20
+ };
21
+ pages: {
22
+ id: string;
23
+ title: {
24
+ id: string;
25
+ defaultMessage: string;
26
+ description: string;
27
+ };
28
+ requireCompletionToContinue: boolean;
29
+ showClearButton?: boolean | undefined;
30
+ fields: FieldConfig[];
31
+ conditional?: any;
32
+ type: "FORM";
33
+ }[];
34
+ };
16
35
  export declare function getDeclarationPages(configuration: EventConfig): {
17
36
  id: string;
18
37
  title: {
@@ -26,7 +45,18 @@ export declare function getDeclarationPages(configuration: EventConfig): {
26
45
  conditional?: any;
27
46
  type: "FORM";
28
47
  }[];
29
- export declare function getDeclaration(configuration: EventConfig): {
48
+ export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
49
+ /**
50
+ * @returns the notification form configured on the NOTIFY action.
51
+ * @throws when the event has no NOTIFY action.
52
+ */
53
+ export declare function getNotificationForm(configuration: EventConfig): DeclarationFormConfig;
54
+ export declare function getNotificationFields(configuration: EventConfig): FieldConfig[];
55
+ /**
56
+ * Form a user fills in to submit the given action:
57
+ * the notification form for NOTIFY, the declaration form for DECLARE.
58
+ */
59
+ export declare function getActionForm(configuration: EventConfig, actionType: typeof ActionType.NOTIFY | typeof ActionType.DECLARE): {
30
60
  label: {
31
61
  id: string;
32
62
  defaultMessage: string;
@@ -55,10 +85,6 @@ export declare function getActionConfig({ eventConfiguration, actionType, custom
55
85
  export declare function getCustomActionFields(eventConfiguration: EventConfig, customActionType: string): FieldConfig[];
56
86
  /**
57
87
  * Returns the fields configured for an action's confirmation dialog.
58
- *
59
- * Unlike review fields and supporting copy, NOTIFY does NOT fall back to the
60
- * DECLARE config here: dialog fields always come from the action's own
61
- * configuration entry.
62
88
  */
63
89
  export declare function getActionFormFields(eventConfiguration: EventConfig, actionType: ActionType, customActionType?: string): FieldConfig[];
64
90
  export declare function getPrintCertificatePages(configuration: EventConfig): ({
@@ -277,6 +303,34 @@ export declare function findLastAssignmentAction(actions: Action[]): {
277
303
  status: "Accepted" | "Rejected" | "Requested";
278
304
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
279
305
  type: "UNARCHIVE";
306
+ } | {
307
+ id: string & import("zod").$brand<"UUID">;
308
+ transactionId: string;
309
+ createdByUserType: "system" | "user";
310
+ createdAt: string;
311
+ createdBy: string;
312
+ createdByRole?: string | undefined;
313
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
314
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
315
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
316
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
317
+ status: "Accepted" | "Rejected" | "Requested";
318
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
319
+ type: "REVOKE_REGISTRATION";
320
+ } | {
321
+ id: string & import("zod").$brand<"UUID">;
322
+ transactionId: string;
323
+ createdByUserType: "system" | "user";
324
+ createdAt: string;
325
+ createdBy: string;
326
+ createdByRole?: string | undefined;
327
+ createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
328
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
329
+ declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
330
+ annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
331
+ status: "Accepted" | "Rejected" | "Requested";
332
+ originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
333
+ type: "REINSTATE_REGISTRATION";
280
334
  } | {
281
335
  id: string & import("zod").$brand<"UUID">;
282
336
  transactionId: string;
@@ -472,7 +526,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
472
526
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
473
527
  createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
474
528
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
475
- type: "APPROVE_CORRECTION" | "ARCHIVE" | "CUSTOM" | "DECLARE" | "EDIT" | "NOTIFY" | "PRINT_CERTIFICATE" | "REGISTER" | "REJECT" | "REJECT_CORRECTION" | "REQUEST_CORRECTION" | "UNARCHIVE";
529
+ type: "APPROVE_CORRECTION" | "ARCHIVE" | "CUSTOM" | "DECLARE" | "EDIT" | "NOTIFY" | "PRINT_CERTIFICATE" | "REGISTER" | "REINSTATE_REGISTRATION" | "REJECT" | "REJECT_CORRECTION" | "REQUEST_CORRECTION" | "REVOKE_REGISTRATION" | "UNARCHIVE";
476
530
  status: "Rejected";
477
531
  } | undefined;
478
532
  /**
@@ -162,6 +162,8 @@ var ActionType = {
162
162
  REQUEST_CORRECTION: "REQUEST_CORRECTION",
163
163
  REJECT_CORRECTION: "REJECT_CORRECTION",
164
164
  APPROVE_CORRECTION: "APPROVE_CORRECTION",
165
+ REVOKE_REGISTRATION: "REVOKE_REGISTRATION",
166
+ REINSTATE_REGISTRATION: "REINSTATE_REGISTRATION",
165
167
  // General actions
166
168
  READ: "READ",
167
169
  ASSIGN: "ASSIGN",
@@ -181,6 +183,8 @@ var ConfirmableActions = [
181
183
  ActionType.REQUEST_CORRECTION,
182
184
  ActionType.APPROVE_CORRECTION,
183
185
  ActionType.REJECT_CORRECTION,
186
+ ActionType.REVOKE_REGISTRATION,
187
+ ActionType.REINSTATE_REGISTRATION,
184
188
  ActionType.CUSTOM
185
189
  ];
186
190
  var ActionTypes = z6.enum([
@@ -200,6 +204,8 @@ var ActionTypes = z6.enum([
200
204
  "REQUEST_CORRECTION",
201
205
  "REJECT_CORRECTION",
202
206
  "APPROVE_CORRECTION",
207
+ "REVOKE_REGISTRATION",
208
+ "REINSTATE_REGISTRATION",
203
209
  "READ",
204
210
  "ASSIGN",
205
211
  "UNASSIGN",
@@ -238,7 +244,9 @@ var WorkqueueActionType = ActionTypes.extract([
238
244
  ActionType.ARCHIVE,
239
245
  ActionType.UNARCHIVE,
240
246
  ActionType.PRINT_CERTIFICATE,
241
- ActionType.REQUEST_CORRECTION
247
+ ActionType.REQUEST_CORRECTION,
248
+ ActionType.REVOKE_REGISTRATION,
249
+ ActionType.REINSTATE_REGISTRATION
242
250
  ]);
243
251
  var META_ACTIONS = [
244
252
  ActionType.ASSIGN,
@@ -254,7 +262,7 @@ var ActionStatus = {
254
262
  };
255
263
 
256
264
  // ../commons/src/events/Flag.ts
257
- var z9 = __toESM(require("zod/v4"));
265
+ var z9 = __toESM(require("zod"));
258
266
 
259
267
  // ../commons/src/events/TranslationConfig.ts
260
268
  var z7 = __toESM(require("zod/v4"));
@@ -323,7 +331,6 @@ var FieldConditional = z8.discriminatedUnion("type", [
323
331
 
324
332
  // ../commons/src/events/Flag.ts
325
333
  var InherentFlags = {
326
- INCOMPLETE: "incomplete",
327
334
  REJECTED: "rejected",
328
335
  CORRECTION_REQUESTED: "correction-requested",
329
336
  POTENTIAL_DUPLICATE: "potential-duplicate",
@@ -351,7 +358,7 @@ var CustomFlag = z9.string().refine((val) => !Object.values(InherentFlags).inclu
351
358
  message: `Custom flag cannot be one of the inherent flags: ${Object.values(
352
359
  InherentFlags
353
360
  ).join(", ")}`
354
- }).refine((val) => !ActionFlag.safeParse(val).success, {
361
+ }).refine((val) => !ActionFlag.validate(val), {
355
362
  message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
356
363
  }).describe("Custom flag identifier defined by the country config.");
357
364
  var Flag = ActionFlag.or(z9.enum(InherentFlags)).or(CustomFlag);
@@ -390,6 +397,7 @@ var EventStatus = z10.enum([
390
397
  "NOTIFIED",
391
398
  "DECLARED",
392
399
  "REGISTERED",
400
+ "REVOKED",
393
401
  "ARCHIVED"
394
402
  ]);
395
403
 
@@ -413,6 +421,8 @@ var RecordScopeTypeV2 = z11.enum([
413
421
  "record.print-certified-copies",
414
422
  "record.request-correction",
415
423
  "record.correct",
424
+ "record.revoke-registration",
425
+ "record.reinstate-registration",
416
426
  "record.unassign-others",
417
427
  "record.custom-action",
418
428
  "record.action.accept",
@@ -539,6 +549,8 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
539
549
  "record.read",
540
550
  "record.request-correction",
541
551
  "record.correct",
552
+ "record.revoke-registration",
553
+ "record.reinstate-registration",
542
554
  "record.unassign-others",
543
555
  "record.review-duplicates"
544
556
  ]);
@@ -47,14 +47,14 @@ export declare const derivedVariables: readonly [{
47
47
  readonly type: 'disabled';
48
48
  readonly scope: 'ENVIRONMENT';
49
49
  }, {
50
- readonly name: 'MINIO_ROOT_USER';
51
- readonly valueLabel: 'MINIO_ROOT_USER';
50
+ readonly name: 'S3_ADMIN_ACCESS_KEY';
51
+ readonly valueLabel: 'S3_ADMIN_ACCESS_KEY';
52
52
  readonly valueType: 'SECRET';
53
53
  readonly type: 'disabled';
54
54
  readonly scope: 'ENVIRONMENT';
55
55
  }, {
56
- readonly name: 'MINIO_ROOT_PASSWORD';
57
- readonly valueLabel: 'MINIO_ROOT_PASSWORD';
56
+ readonly name: 'S3_ADMIN_SECRET_KEY';
57
+ readonly valueLabel: 'S3_ADMIN_SECRET_KEY';
58
58
  readonly valueType: 'SECRET';
59
59
  readonly type: 'disabled';
60
60
  readonly scope: 'ENVIRONMENT';
@@ -130,5 +130,17 @@ export declare const derivedVariables: readonly [{
130
130
  readonly valueType: 'VARIABLE';
131
131
  readonly type: 'disabled';
132
132
  readonly scope: 'ENVIRONMENT';
133
+ }, {
134
+ readonly name: 'TWO_FA_ENABLED';
135
+ readonly valueLabel: 'TWO_FA_ENABLED';
136
+ readonly valueType: 'VARIABLE';
137
+ readonly type: 'disabled';
138
+ readonly scope: 'ENVIRONMENT';
139
+ }, {
140
+ readonly name: 'MONITORING_ENABLED';
141
+ readonly valueLabel: 'MONITORING_ENABLED';
142
+ readonly valueType: 'VARIABLE';
143
+ readonly type: 'disabled';
144
+ readonly scope: 'ENVIRONMENT';
133
145
  }];
134
146
  //# sourceMappingURL=derived-variables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"derived-variables.d.ts","sourceRoot":"","sources":["../../src/environment/derived-variables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;aAEzB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAA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AAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,cAAc;aACpB,UAAU,EAAE,cAAc;aAC1B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,wBAAwB;aAC9B,UAAU,EAAE,wBAAwB;aACpC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;EAEd,CAAA"}
1
+ {"version":3,"file":"derived-variables.d.ts","sourceRoot":"","sources":["../../src/environment/derived-variables.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;aAEzB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,qBAAqB;aAC3B,UAAU,EAAE,qBAAqB;aACjC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,cAAc;aACpB,UAAU,EAAE,cAAc;aAC1B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,kCAAkC;aACxC,UAAU,EAAE,kCAAkC;aAC9C,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,gBAAgB;aACtB,UAAU,EAAE,gBAAgB;aAC5B,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,WAAW;aACjB,UAAU,EAAE,WAAW;aACvB,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,kCAAkC;aACxC,UAAU,EAAE,kCAAkC;aA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N_ACCESS_KEY',
74
74
  valueType: 'SECRET',
75
75
  type: 'disabled',
76
76
  scope: 'ENVIRONMENT'
77
77
  },
78
78
  {
79
- name: 'MINIO_ROOT_PASSWORD',
80
- valueLabel: 'MINIO_ROOT_PASSWORD',
79
+ name: 'S3_ADMIN_SECRET_KEY',
80
+ valueLabel: 'S3_ADMIN_SECRET_KEY',
81
81
  valueType: 'SECRET',
82
82
  type: 'disabled',
83
83
  scope: 'ENVIRONMENT'
@@ -165,5 +165,19 @@ exports.derivedVariables = [
165
165
  valueType: 'VARIABLE',
166
166
  type: 'disabled',
167
167
  scope: 'ENVIRONMENT'
168
+ },
169
+ {
170
+ name: 'TWO_FA_ENABLED',
171
+ valueLabel: 'TWO_FA_ENABLED',
172
+ valueType: 'VARIABLE',
173
+ type: 'disabled',
174
+ scope: 'ENVIRONMENT'
175
+ },
176
+ {
177
+ name: 'MONITORING_ENABLED',
178
+ valueLabel: 'MONITORING_ENABLED',
179
+ valueType: 'VARIABLE',
180
+ type: 'disabled',
181
+ scope: 'ENVIRONMENT'
168
182
  }
169
183
  ];
@@ -0,0 +1,15 @@
1
+ type DockerHubValidationResult = {
2
+ status: 'valid' | 'skipped' | 'invalid-credentials' | 'repository-not-found' | 'unreachable';
3
+ reason?: string;
4
+ };
5
+ /**
6
+ * Checks that the username/token pair is accepted by Docker Hub and that the
7
+ * organisation/repository exists and is visible to that account. An empty
8
+ * repository is fine, only its existence matters.
9
+ *
10
+ * Existing GitHub secrets cannot be read back, so when any value is missing
11
+ * (kept from an existing secret) the check is skipped.
12
+ */
13
+ export declare function validateDockerHubCredentials(organisation: string | undefined, repository: string | undefined, username: string | undefined, token: string | undefined): Promise<DockerHubValidationResult>;
14
+ export {};
15
+ //# sourceMappingURL=dockerhub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dockerhub.d.ts","sourceRoot":"","sources":["../../src/environment/dockerhub.ts"],"names":[],"mappings":"AAcA,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EACF,OAAO,GAEP,SAAS,GACT,qBAAqB,GACrB,sBAAsB,GAEtB,aAAa,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,OAAO,CAAC,yBAAyB,CAAC,CAoFpC"}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /*
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
6
+ *
7
+ * OpenCRVS is also distributed under the terms of the Civil Registration
8
+ * & Healthcare Disclaimer located at http://opencrvs.org/license.
9
+ *
10
+ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
11
+ */
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.validateDockerHubCredentials = validateDockerHubCredentials;
23
+ const DOCKER_HUB_API = 'https://hub.docker.com/v2';
24
+ const REQUEST_TIMEOUT_MS = 10000;
25
+ /**
26
+ * Checks that the username/token pair is accepted by Docker Hub and that the
27
+ * organisation/repository exists and is visible to that account. An empty
28
+ * repository is fine, only its existence matters.
29
+ *
30
+ * Existing GitHub secrets cannot be read back, so when any value is missing
31
+ * (kept from an existing secret) the check is skipped.
32
+ */
33
+ function validateDockerHubCredentials(organisation, repository, username, token) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ var _a;
36
+ if (!organisation || !repository || !username || !token) {
37
+ return {
38
+ status: 'skipped',
39
+ reason: 'Some values are kept from existing GitHub secrets, which cannot be read back'
40
+ };
41
+ }
42
+ try {
43
+ const login = yield fetch(`${DOCKER_HUB_API}/auth/token`, {
44
+ method: 'POST',
45
+ headers: { 'Content-Type': 'application/json' },
46
+ body: JSON.stringify({ identifier: username, secret: token }),
47
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
48
+ });
49
+ if (login.status === 401 || login.status === 403) {
50
+ return {
51
+ status: 'invalid-credentials',
52
+ reason: 'Docker Hub rejected the username or token. Check DOCKER_USERNAME and DOCKER_TOKEN'
53
+ };
54
+ }
55
+ if (!login.ok) {
56
+ return {
57
+ status: 'unreachable',
58
+ reason: `Docker Hub login responded with HTTP ${login.status}`
59
+ };
60
+ }
61
+ const body = (yield login.json());
62
+ const accessToken = (_a = body.access_token) !== null && _a !== void 0 ? _a : body.token;
63
+ if (!accessToken) {
64
+ return {
65
+ status: 'unreachable',
66
+ reason: 'Docker Hub login response did not contain an access token'
67
+ };
68
+ }
69
+ const repositoryResponse = yield fetch(`${DOCKER_HUB_API}/repositories/${encodeURIComponent(organisation)}/${encodeURIComponent(repository)}/`, {
70
+ headers: { Authorization: `Bearer ${accessToken}` },
71
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
72
+ });
73
+ if (repositoryResponse.ok) {
74
+ return { status: 'valid' };
75
+ }
76
+ // Docker Hub answers 404 for private repositories the account cannot see
77
+ if (repositoryResponse.status === 404) {
78
+ return {
79
+ status: 'repository-not-found',
80
+ reason: `Login succeeded, but repository ${organisation}/${repository} was not found or is not accessible with this token. Check DOCKERHUB_ACCOUNT and DOCKERHUB_REPO`
81
+ };
82
+ }
83
+ if (repositoryResponse.status === 401 ||
84
+ repositoryResponse.status === 403) {
85
+ return {
86
+ status: 'invalid-credentials',
87
+ reason: `Login succeeded, but the token is not allowed to read repository ${organisation}/${repository}`
88
+ };
89
+ }
90
+ return {
91
+ status: 'unreachable',
92
+ reason: `Docker Hub repository lookup responded with HTTP ${repositoryResponse.status}`
93
+ };
94
+ }
95
+ catch (err) {
96
+ if (!(err instanceof Error)) {
97
+ return { status: 'unreachable', reason: String(err) };
98
+ }
99
+ // fetch only reports "fetch failed", the real error (e.g. ENOTFOUND) is its cause
100
+ const cause = err.cause instanceof Error ? `: ${err.cause.message}` : '';
101
+ return { status: 'unreachable', reason: `${err.message}${cause}` };
102
+ }
103
+ });
104
+ }
@@ -201,7 +201,7 @@ exports.infrastructureQuestions = [
201
201
  valueLabel: 'KUBE_API_ALLOWED_CIDRS',
202
202
  initial: process.env.KUBE_API_ALLOWED_CIDRS || '',
203
203
  scope: 'ENVIRONMENT'
204
- },
204
+ }
205
205
  ];
206
206
  exports.staticSSLCertQuestions = [
207
207
  {
@@ -1 +1 @@
1
- {"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AAwSA,wBAAsB,mBAAmB,kBAgnCxC"}
1
+ {"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AAiUA,wBAAsB,mBAAmB,kBA2pCxC"}