@opencrvs/toolkit 2.1.1-rc.52250d8 → 2.2.0-rc.3af310b
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.
- package/build.sh +2 -12
- package/create-countryconfig/package.json +1 -1
- package/dist/application-config/index.js +36 -4
- package/dist/authentication/index.js +14 -2
- package/dist/cli.js +833 -2019
- package/dist/commons/api/router.d.ts +1374 -71
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/ActionConfig.d.ts +146 -20
- package/dist/commons/events/ActionDocument.d.ts +88 -0
- package/dist/commons/events/ActionInput.d.ts +52 -0
- package/dist/commons/events/ActionType.d.ts +11 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +4 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +192 -18
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventConfig.d.ts +36 -6
- package/dist/commons/events/EventDocument.d.ts +88 -0
- package/dist/commons/events/EventIndex.d.ts +41 -4
- package/dist/commons/events/EventMetadata.d.ts +23 -1
- package/dist/commons/events/EventStatus.d.ts +1 -0
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/Flag.d.ts +0 -6
- package/dist/commons/events/WorkqueueConfig.d.ts +224 -33
- package/dist/commons/events/eventConfigValidation.d.ts +26 -1
- package/dist/commons/events/notificationFormFallback.d.ts +10 -0
- package/dist/commons/events/scopes.d.ts +2 -0
- package/dist/commons/events/state/flags.d.ts +1 -1
- package/dist/commons/events/state/index.d.ts +10 -2
- package/dist/commons/events/state/utils.d.ts +11 -1
- package/dist/commons/events/test.utils.d.ts +31 -1
- package/dist/commons/events/utils.d.ts +53 -20
- package/dist/conditionals/index.js +14 -2
- package/dist/environment/derived-variables.d.ts +6 -0
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +7 -0
- package/dist/environment/dockerhub.d.ts +15 -0
- package/dist/environment/dockerhub.d.ts.map +1 -0
- package/dist/environment/dockerhub.js +104 -0
- package/dist/environment/questions.d.ts +1 -1
- package/dist/environment/questions.d.ts.map +1 -1
- package/dist/environment/questions.js +4 -7
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +41 -2
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/events/index.js +461 -83
- package/dist/migrations/index.d.ts +9 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +847 -0
- package/dist/migrations/move-declaration-to-declare-action.d.ts +38 -0
- package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -0
- package/dist/migrations/move-declaration-to-declare-action.js +377 -0
- package/dist/migrations/{v2.1 → persistent}/add-translations.d.ts +7 -1
- package/dist/migrations/persistent/add-translations.d.ts.map +1 -0
- package/dist/migrations/{v2.1 → persistent}/add-translations.js +14 -12
- package/dist/migrations/persistent/check-upgrade-path.d.ts +36 -0
- package/dist/migrations/persistent/check-upgrade-path.d.ts.map +1 -0
- package/dist/migrations/persistent/check-upgrade-path.js +105 -0
- package/dist/migrations/persistent/update-toolkit-dependency.d.ts +7 -0
- package/dist/migrations/persistent/update-toolkit-dependency.d.ts.map +1 -0
- package/dist/migrations/persistent/update-toolkit-dependency.js +77 -0
- package/dist/migrations/read-declaration-through-helper.d.ts +39 -0
- package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -0
- package/dist/migrations/read-declaration-through-helper.js +257 -0
- package/dist/migrations/replace-incomplete-flag.d.ts +26 -0
- package/dist/migrations/replace-incomplete-flag.d.ts.map +1 -0
- package/dist/migrations/replace-incomplete-flag.js +126 -0
- package/dist/notification/index.js +401 -100
- package/dist/scopes/index.d.ts +29 -39
- package/dist/scopes/index.js +14 -2
- package/dist/templates/charts-values/dependencies/values.yaml +1 -1
- package/dist/templates/charts-values/opencrvs-services/values.yaml +1 -2
- package/dist/templates/charts-values/traefik/values.yaml +4 -3
- package/opencrvs-toolkit-2.2.0-rc.3af310b.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +0 -3
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +0 -234
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +0 -3
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +0 -1
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +0 -511
- package/dist/migrations/v2.1/add-translations.d.ts.map +0 -1
- package/dist/migrations/v2.1/enable-telemetry.d.ts +0 -3
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +0 -1
- package/dist/migrations/v2.1/enable-telemetry.js +0 -455
- package/dist/migrations/v2.1/index.d.ts +0 -6
- package/dist/migrations/v2.1/index.d.ts.map +0 -1
- package/dist/migrations/v2.1/index.js +0 -2233
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts +0 -14
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.d.ts.map +0 -1
- package/dist/migrations/v2.1/migrate-infrastructure-to-assets.js +0 -348
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts +0 -2
- package/dist/migrations/v2.1/remove-metabase-package-installs.d.ts.map +0 -1
- package/dist/migrations/v2.1/remove-metabase-package-installs.js +0 -161
- package/dist/migrations/v2.1/remove-sentry.d.ts +0 -3
- package/dist/migrations/v2.1/remove-sentry.d.ts.map +0 -1
- package/dist/migrations/v2.1/remove-sentry.js +0 -354
- package/dist/migrations/v2.1/remove-typings-from-dockerfile.d.ts +0 -3
- package/dist/migrations/v2.1/remove-typings-from-dockerfile.d.ts.map +0 -1
- package/dist/migrations/v2.1/remove-typings-from-dockerfile.js +0 -121
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts +0 -3
- package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +0 -1
- package/dist/migrations/v2.1/rename-trigger-paths.js +0 -216
- package/dist/migrations/v2.1/template-files.d.ts +0 -8
- package/dist/migrations/v2.1/template-files.d.ts.map +0 -1
- package/dist/migrations/v2.1/template-files.js +0 -49
- package/dist/migrations/v2.1/upgrade-tilt.d.ts +0 -8
- package/dist/migrations/v2.1/upgrade-tilt.d.ts.map +0 -1
- package/dist/migrations/v2.1/upgrade-tilt.js +0 -139
- package/dist/templates/countryconfig-template/.tiltignore +0 -1
- package/dist/templates/countryconfig-template/Dockerfile.assets +0 -7
- package/dist/templates/countryconfig-template/Tiltfile +0 -112
- package/dist/templates/countryconfig-template/assets/README.md +0 -1
- package/dist/templates/countryconfig-template/assets/clear-all-data-dev.sh +0 -61
- package/dist/templates/countryconfig-template/assets/deployment/deploy.sh +0 -455
- package/dist/templates/countryconfig-template/assets/deployment/reindex.sh +0 -168
- package/dist/templates/countryconfig-template/assets/deployment/validate-required-variables-in-compose-files.ts +0 -67
- package/dist/templates/countryconfig-template/assets/elasticsearch/reindex.sh +0 -168
- package/dist/templates/countryconfig-template/assets/metabase/README.md +0 -34
- package/dist/templates/countryconfig-template/assets/metabase/environment-configuration.sql +0 -36
- package/dist/templates/countryconfig-template/assets/metabase/initialize-database.sh +0 -46
- package/dist/templates/countryconfig-template/assets/metabase/metabase.init.db.sql +0 -27737
- package/dist/templates/countryconfig-template/assets/metabase/open-shell.sh +0 -21
- package/dist/templates/countryconfig-template/assets/metabase/package.json +0 -13
- package/dist/templates/countryconfig-template/assets/metabase/run-dev.sh +0 -108
- package/dist/templates/countryconfig-template/assets/metabase/run.sh +0 -120
- package/dist/templates/countryconfig-template/assets/metabase/update-database.sh +0 -40
- package/dist/templates/countryconfig-template/assets/postgres/setup-analytics.sh +0 -135
- package/dist/templates/countryconfig-template/assets/postgres/setup-reference-data.sh +0 -108
- package/dist/templates/countryconfig-template/tilt/clear-all-data.ps1 +0 -50
- package/dist/templates/countryconfig-template/tilt/clear-all-data.sh +0 -35
- package/dist/templates/countryconfig-template/tilt/common.tilt +0 -145
- package/dist/templates/countryconfig-template/tilt/examples/dependencies/values.yaml +0 -15
- package/dist/templates/countryconfig-template/tilt/examples/opencrvs-services/values.yaml +0 -56
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values-minikube.yaml +0 -21
- package/dist/templates/countryconfig-template/tilt/examples/traefik/values.yaml +0 -38
- package/dist/templates/countryconfig-template/tilt/helm/dependencies/values.yaml +0 -17
- package/dist/templates/countryconfig-template/tilt/helm/opencrvs-services/values.yaml +0 -16
- package/dist/templates/countryconfig-template/tilt/lib.tilt +0 -95
- package/dist/templates/countryconfig-template/tilt/opencrvs.tilt +0 -136
- package/opencrvs-toolkit-2.1.1-rc.52250d8.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,13 @@ 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 dropped, since it may refer to fields of the replaced declaration.
|
|
356
|
+
* `getNotificationForm` then derives it from the new declaration.
|
|
357
|
+
*
|
|
358
|
+
* @returns a copy of the configuration with the DECLARE action's declaration replaced.
|
|
359
|
+
*/
|
|
360
|
+
export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
|
|
331
361
|
/**
|
|
332
362
|
* Get the leaf administrative area IDs from a list of administrative areas.
|
|
333
363
|
*
|
|
@@ -8,24 +8,10 @@ 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[];
|
|
16
|
-
export declare function getDeclarationPages(configuration: EventConfig): {
|
|
17
|
-
id: string;
|
|
18
|
-
title: {
|
|
19
|
-
id: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
description: string;
|
|
22
|
-
};
|
|
23
|
-
requireCompletionToContinue: boolean;
|
|
24
|
-
showClearButton?: boolean | undefined;
|
|
25
|
-
fields: FieldConfig[];
|
|
26
|
-
conditional?: any;
|
|
27
|
-
type: "FORM";
|
|
28
|
-
}[];
|
|
29
15
|
export declare function getDeclaration(configuration: EventConfig): {
|
|
30
16
|
label: {
|
|
31
17
|
id: string;
|
|
@@ -46,6 +32,29 @@ export declare function getDeclaration(configuration: EventConfig): {
|
|
|
46
32
|
type: "FORM";
|
|
47
33
|
}[];
|
|
48
34
|
};
|
|
35
|
+
export declare function getDeclarationPages(configuration: EventConfig): {
|
|
36
|
+
id: string;
|
|
37
|
+
title: {
|
|
38
|
+
id: string;
|
|
39
|
+
defaultMessage: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
requireCompletionToContinue: boolean;
|
|
43
|
+
showClearButton?: boolean | undefined;
|
|
44
|
+
fields: FieldConfig[];
|
|
45
|
+
conditional?: any;
|
|
46
|
+
type: "FORM";
|
|
47
|
+
}[];
|
|
48
|
+
export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
|
|
49
|
+
/**
|
|
50
|
+
* @returns the notification form of the event: the one configured on the NOTIFY action,
|
|
51
|
+
* or the declaration with every field optional when none is configured.
|
|
52
|
+
*
|
|
53
|
+
* The fallback is derived here rather than in `defineConfig`, so that it is not part of the
|
|
54
|
+
* served event configuration.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getNotificationForm(configuration: EventConfig): DeclarationFormConfig;
|
|
57
|
+
export declare function getNotificationFields(configuration: EventConfig): FieldConfig[];
|
|
49
58
|
export declare function isActionConfigType(type: ActionType): type is ActionConfigTypes;
|
|
50
59
|
export declare function getActionConfig({ eventConfiguration, actionType, customActionType }: {
|
|
51
60
|
eventConfiguration: EventConfig;
|
|
@@ -55,10 +64,6 @@ export declare function getActionConfig({ eventConfiguration, actionType, custom
|
|
|
55
64
|
export declare function getCustomActionFields(eventConfiguration: EventConfig, customActionType: string): FieldConfig[];
|
|
56
65
|
/**
|
|
57
66
|
* 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
67
|
*/
|
|
63
68
|
export declare function getActionFormFields(eventConfiguration: EventConfig, actionType: ActionType, customActionType?: string): FieldConfig[];
|
|
64
69
|
export declare function getPrintCertificatePages(configuration: EventConfig): ({
|
|
@@ -277,6 +282,34 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
277
282
|
status: "Accepted" | "Rejected" | "Requested";
|
|
278
283
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
279
284
|
type: "UNARCHIVE";
|
|
285
|
+
} | {
|
|
286
|
+
id: string & import("zod").$brand<"UUID">;
|
|
287
|
+
transactionId: string;
|
|
288
|
+
createdByUserType: "system" | "user";
|
|
289
|
+
createdAt: string;
|
|
290
|
+
createdBy: string;
|
|
291
|
+
createdByRole?: string | undefined;
|
|
292
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
293
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
294
|
+
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
295
|
+
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
296
|
+
status: "Accepted" | "Rejected" | "Requested";
|
|
297
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
298
|
+
type: "REVOKE_REGISTRATION";
|
|
299
|
+
} | {
|
|
300
|
+
id: string & import("zod").$brand<"UUID">;
|
|
301
|
+
transactionId: string;
|
|
302
|
+
createdByUserType: "system" | "user";
|
|
303
|
+
createdAt: string;
|
|
304
|
+
createdBy: string;
|
|
305
|
+
createdByRole?: string | undefined;
|
|
306
|
+
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
307
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
308
|
+
declaration: Record<string, import("./FieldValue").FieldUpdateValue>;
|
|
309
|
+
annotation?: Record<string, import("./FieldValue").FieldUpdateValue> | null | undefined;
|
|
310
|
+
status: "Accepted" | "Rejected" | "Requested";
|
|
311
|
+
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
312
|
+
type: "REINSTATE_REGISTRATION";
|
|
280
313
|
} | {
|
|
281
314
|
id: string & import("zod").$brand<"UUID">;
|
|
282
315
|
transactionId: string;
|
|
@@ -472,7 +505,7 @@ export declare function findLastAssignmentAction(actions: Action[]): {
|
|
|
472
505
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
473
506
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
474
507
|
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";
|
|
508
|
+
type: "APPROVE_CORRECTION" | "ARCHIVE" | "CUSTOM" | "DECLARE" | "EDIT" | "NOTIFY" | "PRINT_CERTIFICATE" | "REGISTER" | "REINSTATE_REGISTRATION" | "REJECT" | "REJECT_CORRECTION" | "REQUEST_CORRECTION" | "REVOKE_REGISTRATION" | "UNARCHIVE";
|
|
476
509
|
status: "Rejected";
|
|
477
510
|
} | undefined;
|
|
478
511
|
/**
|
|
@@ -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,
|
|
@@ -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",
|
|
@@ -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
|
]);
|
|
@@ -136,5 +136,11 @@ export declare const derivedVariables: readonly [{
|
|
|
136
136
|
readonly valueType: 'VARIABLE';
|
|
137
137
|
readonly type: 'disabled';
|
|
138
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';
|
|
139
145
|
}];
|
|
140
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,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,E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AAE,wBAAwB;aAC9B,UAAU,EAAE,wBAAwB;aACpC,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;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;aAC9C,SAAS,EAAE,QAAQ;aACnB,IAAI,EAAE,UA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U,EAAE,yBAAyB;aACrC,SAAS,EAAE,QAAQ;aACnB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,wBAAwB;aAC9B,UAAU,EAAE,wBAAwB;aACpC,SAAS,EAAE,QAAQ;aACnB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,0BAA0B;aAChC,UAAU,EAAE,0BAA0B;aACtC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;;aAGpB,IAAI,EAAE,0BAA0B;aAChC,UAAU,EAAE,0BAA0B;aACtC,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,wBAAwB;aAC9B,UAAU,EAAE,wBAAwB;aACpC,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,oBAAoB;aAC1B,UAAU,EAAE,oBAAoB;aAChC,SAAS,EAAE,UAAU;aACrB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,aAAa;EAEd,CAAA"}
|
|
@@ -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
|
+
}
|
|
@@ -138,7 +138,7 @@ export declare const diskQuestions: {
|
|
|
138
138
|
type: 'text';
|
|
139
139
|
message: string;
|
|
140
140
|
valueType: 'VARIABLE';
|
|
141
|
-
validate:
|
|
141
|
+
validate: typeof notEmpty;
|
|
142
142
|
valueLabel: string;
|
|
143
143
|
initial: string;
|
|
144
144
|
scope: 'ENVIRONMENT';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/environment/questions.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,QAAQ,UAAW,MAAM,GAAG,MAAM,kCAC4B,CAAA;AAepE,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAgBnD;AAED,eAAO,MAAM,kBAAkB;;UAGrB,MAAM;;eAED,QAAQ;;;;WAIZ,YAAY;GAiCtB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;;;WAIL,YAAY;GAUtB,CAAA;AACD,eAAO,MAAM,oBAAoB;;UAGvB,MAAM;;;eAGD,UAAU;;WAEd,YAAY;;;;;UAIb,QAAQ;;;;;;eAaH,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AACD,eAAO,MAAM,mBAA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;;WAGd,YAAY;GAEtB,CAAA;AAED,eAAO,MAAM,uBAAuB;;UAG1B,MAAM;;eAED,UAAU;;;;WAId,aAAa;;;;UAId,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;UAsBd,MAAM;;eAED,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;UAGzB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,eAAe;;;;UAGlB,MAAM;;eAED,UAAU;;;WAGd,aAAa;;;;UAId,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;UAId,QAAQ;;;;;;eAYH,UAAU;;;;WAId,aAAa;IAEvB,CAAA;AAED,eAAO,MAAM,aAAa;;UAGhB,MAAM;;eAID,UAAU;;;;WAId,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,8BAA8B;;UAGjC,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,cAAc;;;UAGjB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;;;UAkCd,QAAQ;;;;;;eAYH,QAAQ;;;;WAIZ,aAAa;IAuBvB,CAAA;AAED,eAAO,MAAM,eAAe;;UAGlB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAEvB,CAAA;AAED,eAAO,MAAM,sBAAsB;eAEpB,QAAQ;;UAEb,MAAM;;;WAIL,aAAa;;GAYvB,CAAA"}
|
|
@@ -270,14 +270,11 @@ exports.diskQuestions = [
|
|
|
270
270
|
{
|
|
271
271
|
name: 'diskSpace',
|
|
272
272
|
type: 'text',
|
|
273
|
-
message:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
kleur_1.default.red('DO NOT USE ALL DISK SPACE FOR OPENCRVS!'),
|
|
277
|
-
'Each node needs this much free space on its root partition, plus 50g or 10% of this size, whichever is larger.'
|
|
278
|
-
].join('\n'),
|
|
273
|
+
message: `What is the amount of diskspace that should be dedicated to OpenCRVS data and will become the size of an encrypted cryptfs data directory.
|
|
274
|
+
\n${kleur_1.default.red('DO NOT USE ALL DISKSPACE FOR OPENCRVS!')}
|
|
275
|
+
\nLeave at least 50g available for OS use.`,
|
|
279
276
|
valueType: 'VARIABLE',
|
|
280
|
-
validate:
|
|
277
|
+
validate: notEmpty,
|
|
281
278
|
valueLabel: 'DISK_SPACE',
|
|
282
279
|
initial: process.env.DISK_SPACE || '200g',
|
|
283
280
|
scope: 'ENVIRONMENT'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-environment.d.ts","sourceRoot":"","sources":["../../src/environment/setup-environment.ts"],"names":[],"mappings":"AAiUA,wBAAsB,mBAAmB,kBA2pCxC"}
|
|
@@ -65,6 +65,7 @@ const update_workflows_1 = require("./update-workflows");
|
|
|
65
65
|
const questions_1 = require("./questions");
|
|
66
66
|
const editor_questions_1 = require("./editor-questions");
|
|
67
67
|
const questions_helper_1 = require("./questions-helper");
|
|
68
|
+
const dockerhub_1 = require("./dockerhub");
|
|
68
69
|
const manage_users_1 = require("./manage-users");
|
|
69
70
|
const paths_1 = require("./paths");
|
|
70
71
|
function questionToPrompt(_a) {
|
|
@@ -175,6 +176,23 @@ function promptAndStoreAnswer(questions, existingValues) {
|
|
|
175
176
|
return Object.assign(Object.assign({}, Object.fromEntries(existingValuesForQuestions)), result);
|
|
176
177
|
});
|
|
177
178
|
}
|
|
179
|
+
function promptAndValidateDockerhub(existingValues) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const answers = yield promptAndStoreAnswer(questions_1.dockerhubQuestions, existingValues);
|
|
182
|
+
const result = yield (0, dockerhub_1.validateDockerHubCredentials)(answers.dockerhubOrganisation, answers.dockerhubRepository, answers.dockerhubUsername, answers.dockerhubToken);
|
|
183
|
+
if (result.status === 'valid' || result.status === 'skipped') {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
(0, logger_1.error)(`\n${result.status}: ${result.reason || 'Generic error'}\n`);
|
|
187
|
+
const continueNotValidated = yield confirm({
|
|
188
|
+
message: 'Docker Hub credentials are not validated. Continue anyway?',
|
|
189
|
+
default: false
|
|
190
|
+
});
|
|
191
|
+
if (!continueNotValidated) {
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
178
196
|
ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOtherQuestions, ...questions_1.dockerhubQuestions, ...questions_1.diskQuestions, ...questions_1.infrastructureQuestions, ...questions_1.backupQuestions, ...questions_1.countryQuestions, ...questions_1.databaseAndMonitoringQuestions, ...questions_1.emailQuestions, ...questions_1.sentryQuestions, ...derived_variables_1.derivedVariables, ...questions_1.metabaseAdminQuestions);
|
|
179
197
|
function runSetupEnvironment() {
|
|
180
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -280,7 +298,7 @@ function runSetupEnvironment() {
|
|
|
280
298
|
(0, logger_1.warn)('2FA is disabled on a production-like environment. Logins will accept the fixed test code 000000, exposing real citizen data. Only do this if you know what you are doing.');
|
|
281
299
|
}
|
|
282
300
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
|
|
283
|
-
yield
|
|
301
|
+
yield promptAndValidateDockerhub(existingValues);
|
|
284
302
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
|
|
285
303
|
const infrastructure = yield promptAndStoreAnswer(questions_1.infrastructureQuestions, existingValues);
|
|
286
304
|
const kubeWorkerNodes = infrastructure.kubeWorkerNodes
|
|
@@ -419,7 +437,18 @@ function runSetupEnvironment() {
|
|
|
419
437
|
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Restore is disabled'));
|
|
420
438
|
}
|
|
421
439
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Monitoring'));
|
|
422
|
-
|
|
440
|
+
const existingMonitoringEnabled = (0, utils_1.findExistingValue)('MONITORING_ENABLED', 'VARIABLE', 'ENVIRONMENT', existingValues);
|
|
441
|
+
const monitoringDefault = process.env.MONITORING_ENABLED || (existingMonitoringEnabled === null || existingMonitoringEnabled === void 0 ? void 0 : existingMonitoringEnabled.value);
|
|
442
|
+
const monitoring_enabled = yield confirm({
|
|
443
|
+
message: 'Enable monitoring (Kibana, APM, Filebeat, Metricbeat, Elastalert, OpenTelemetry Collector and tracing)? Disable it if this environment does not need its own monitoring stack.',
|
|
444
|
+
default: monitoringDefault ? monitoringDefault === 'true' : true
|
|
445
|
+
});
|
|
446
|
+
if (monitoring_enabled) {
|
|
447
|
+
yield promptAndStoreAnswer(questions_1.databaseAndMonitoringQuestions, existingValues);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
(0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Monitoring is disabled'));
|
|
451
|
+
}
|
|
423
452
|
const sentryDSNExists = (0, utils_1.findExistingValue)('SENTRY_DSN', 'SECRET', 'ENVIRONMENT', existingValues);
|
|
424
453
|
(0, logger_1.log)('\n', kleur_1.default.bold().underline('Sentry'));
|
|
425
454
|
if (sentryDSNExists) {
|
|
@@ -478,6 +507,15 @@ function runSetupEnvironment() {
|
|
|
478
507
|
value: two_fa_enabled ? 'true' : 'false',
|
|
479
508
|
scope: 'ENVIRONMENT'
|
|
480
509
|
});
|
|
510
|
+
// Read by the deployment workflows (vars.MONITORING_ENABLED) to decide
|
|
511
|
+
// whether the OpenTelemetry Collector is installed
|
|
512
|
+
derivedUpdates.push({
|
|
513
|
+
name: 'MONITORING_ENABLED',
|
|
514
|
+
type: 'VARIABLE',
|
|
515
|
+
didExist: existingMonitoringEnabled,
|
|
516
|
+
value: monitoring_enabled ? 'true' : 'false',
|
|
517
|
+
scope: 'ENVIRONMENT'
|
|
518
|
+
});
|
|
481
519
|
derivedUpdates.push(...ssl_answers);
|
|
482
520
|
if (configureBackup) {
|
|
483
521
|
derivedUpdates.push({
|
|
@@ -772,6 +810,7 @@ function runSetupEnvironment() {
|
|
|
772
810
|
env: environment,
|
|
773
811
|
environment_type: environment_type,
|
|
774
812
|
two_fa_enabled,
|
|
813
|
+
monitoring_enabled,
|
|
775
814
|
traefik_mode: traefikConfOption,
|
|
776
815
|
restore_enabled: restoreEnvironmentName ? true : false,
|
|
777
816
|
restore_environment_name: restoreEnvironmentName || '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AA0BA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAepD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAWpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CASnD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,CAStD;AAGD;;;;GAIG;AACH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QA0CzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AA0BA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAepD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAWpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CASnD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,EAAE,CAStD;AAGD;;;;GAIG;AACH;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QA0CzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAyBzE"}
|