@opencrvs/toolkit 2.1.0-beta → 2.1.0-beta.2

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 (37) hide show
  1. package/README.md +2 -12
  2. package/create-countryconfig/index.js +21 -27
  3. package/dist/application-config/index.js +16 -14
  4. package/dist/authentication/index.js +6 -2
  5. package/dist/cli.js +43 -68
  6. package/dist/commons/api/router.d.ts +6 -42
  7. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  8. package/dist/commons/events/ActionConfig.d.ts +4 -0
  9. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  10. package/dist/commons/events/FieldConfig.d.ts +16 -5
  11. package/dist/commons/events/FormConfig.d.ts +6 -0
  12. package/dist/commons/events/PageConfig.d.ts +4 -0
  13. package/dist/commons/events/utils.d.ts +4 -0
  14. package/dist/conditionals/index.js +6 -2
  15. package/dist/environment/manage-users.js +1 -1
  16. package/dist/environment/setup-environment.js +19 -21
  17. package/dist/environment/templates.d.ts +0 -1
  18. package/dist/environment/templates.d.ts.map +1 -1
  19. package/dist/environment/templates.js +3 -8
  20. package/dist/environment/update-workflows.d.ts.map +1 -1
  21. package/dist/environment/update-workflows.js +4 -0
  22. package/dist/environment/utils.d.ts +0 -12
  23. package/dist/environment/utils.d.ts.map +1 -1
  24. package/dist/environment/utils.js +1 -28
  25. package/dist/events/index.js +37 -14
  26. package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
  27. package/dist/notification/index.js +20 -14
  28. package/dist/scopes/index.d.ts +108 -0
  29. package/dist/scopes/index.js +6 -2
  30. package/dist/translations/check.d.ts +2 -0
  31. package/dist/translations/check.d.ts.map +1 -1
  32. package/dist/translations/check.js +9 -4
  33. package/dist/verify/endpoints.js +1 -1
  34. package/opencrvs-toolkit-2.1.0-beta.2.tgz +0 -0
  35. package/package.json +1 -1
  36. package/tsconfig.build.tsbuildinfo +1 -1
  37. package/opencrvs-toolkit-2.1.0-beta.tgz +0 -0
@@ -140,6 +140,8 @@ export declare const FieldConfigSchema: z.ZodObject<{
140
140
  }>;
141
141
  $option: z.ZodEnum<{
142
142
  accessLevel: "accessLevel";
143
+ createdBy: "createdBy";
144
+ createdIn: "createdIn";
143
145
  declaredBy: "declaredBy";
144
146
  declaredIn: "declaredIn";
145
147
  event: "event";
@@ -324,6 +326,8 @@ export declare const EventFieldConfigSchema: z.ZodObject<{
324
326
  }>;
325
327
  $option: z.ZodEnum<{
326
328
  accessLevel: "accessLevel";
329
+ createdBy: "createdBy";
330
+ createdIn: "createdIn";
327
331
  declaredBy: "declaredBy";
328
332
  declaredIn: "declaredIn";
329
333
  event: "event";
@@ -484,6 +488,8 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
484
488
  }>;
485
489
  $option: z.ZodEnum<{
486
490
  accessLevel: "accessLevel";
491
+ createdBy: "createdBy";
492
+ createdIn: "createdIn";
487
493
  declaredBy: "declaredBy";
488
494
  declaredIn: "declaredIn";
489
495
  event: "event";
@@ -636,6 +642,8 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
636
642
  }>;
637
643
  $option: z.ZodEnum<{
638
644
  accessLevel: "accessLevel";
645
+ createdBy: "createdBy";
646
+ createdIn: "createdIn";
639
647
  declaredBy: "declaredBy";
640
648
  declaredIn: "declaredIn";
641
649
  event: "event";
@@ -799,6 +807,8 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
799
807
  }>;
800
808
  $option: z.ZodEnum<{
801
809
  accessLevel: "accessLevel";
810
+ createdBy: "createdBy";
811
+ createdIn: "createdIn";
802
812
  declaredBy: "declaredBy";
803
813
  declaredIn: "declaredIn";
804
814
  event: "event";
@@ -951,6 +961,8 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
951
961
  }>;
952
962
  $option: z.ZodEnum<{
953
963
  accessLevel: "accessLevel";
964
+ createdBy: "createdBy";
965
+ createdIn: "createdIn";
954
966
  declaredBy: "declaredBy";
955
967
  declaredIn: "declaredIn";
956
968
  event: "event";
@@ -1920,6 +1920,8 @@ declare const AdministrativeAreaField: z.ZodObject<{
1920
1920
  }>;
1921
1921
  $option: z.ZodEnum<{
1922
1922
  accessLevel: "accessLevel";
1923
+ createdBy: "createdBy";
1924
+ createdIn: "createdIn";
1923
1925
  declaredBy: "declaredBy";
1924
1926
  declaredIn: "declaredIn";
1925
1927
  event: "event";
@@ -1935,7 +1937,6 @@ declare const AdministrativeAreaField: z.ZodObject<{
1935
1937
  }>;
1936
1938
  }, z.core.$strip>]>;
1937
1939
  }, z.core.$strip>>;
1938
- listHistoricalNames: z.ZodOptional<z.ZodBoolean>;
1939
1940
  activeOnly: z.ZodOptional<z.ZodBoolean>;
1940
1941
  anchorToDateOfEvent: z.ZodOptional<z.ZodBoolean>;
1941
1942
  }, z.core.$strip>;
@@ -2056,6 +2057,8 @@ declare const LocationInput: z.ZodObject<{
2056
2057
  }>;
2057
2058
  $option: z.ZodEnum<{
2058
2059
  accessLevel: "accessLevel";
2060
+ createdBy: "createdBy";
2061
+ createdIn: "createdIn";
2059
2062
  declaredBy: "declaredBy";
2060
2063
  declaredIn: "declaredIn";
2061
2064
  event: "event";
@@ -2071,7 +2074,6 @@ declare const LocationInput: z.ZodObject<{
2071
2074
  }>;
2072
2075
  }, z.core.$strip>]>;
2073
2076
  }, z.core.$strip>>;
2074
- listHistoricalNames: z.ZodOptional<z.ZodBoolean>;
2075
2077
  activeOnly: z.ZodOptional<z.ZodBoolean>;
2076
2078
  anchorToDateOfEvent: z.ZodOptional<z.ZodBoolean>;
2077
2079
  }, z.core.$strip>>;
@@ -2263,6 +2265,8 @@ declare const Facility: z.ZodObject<{
2263
2265
  }>;
2264
2266
  $option: z.ZodEnum<{
2265
2267
  accessLevel: "accessLevel";
2268
+ createdBy: "createdBy";
2269
+ createdIn: "createdIn";
2266
2270
  declaredBy: "declaredBy";
2267
2271
  declaredIn: "declaredIn";
2268
2272
  event: "event";
@@ -2278,7 +2282,6 @@ declare const Facility: z.ZodObject<{
2278
2282
  }>;
2279
2283
  }, z.core.$strip>]>;
2280
2284
  }, z.core.$strip>>;
2281
- listHistoricalNames: z.ZodOptional<z.ZodBoolean>;
2282
2285
  activeOnly: z.ZodOptional<z.ZodBoolean>;
2283
2286
  anchorToDateOfEvent: z.ZodOptional<z.ZodBoolean>;
2284
2287
  }, z.core.$strip>>;
@@ -2385,6 +2388,8 @@ declare const Office: z.ZodObject<{
2385
2388
  }>;
2386
2389
  $option: z.ZodEnum<{
2387
2390
  accessLevel: "accessLevel";
2391
+ createdBy: "createdBy";
2392
+ createdIn: "createdIn";
2388
2393
  declaredBy: "declaredBy";
2389
2394
  declaredIn: "declaredIn";
2390
2395
  event: "event";
@@ -2400,7 +2405,6 @@ declare const Office: z.ZodObject<{
2400
2405
  }>;
2401
2406
  }, z.core.$strip>]>;
2402
2407
  }, z.core.$strip>>;
2403
- listHistoricalNames: z.ZodOptional<z.ZodBoolean>;
2404
2408
  activeOnly: z.ZodOptional<z.ZodBoolean>;
2405
2409
  anchorToDateOfEvent: z.ZodOptional<z.ZodBoolean>;
2406
2410
  }, z.core.$strip>>;
@@ -2593,6 +2597,8 @@ declare const Address: z.ZodObject<{
2593
2597
  }>;
2594
2598
  $option: z.ZodEnum<{
2595
2599
  accessLevel: "accessLevel";
2600
+ createdBy: "createdBy";
2601
+ createdIn: "createdIn";
2596
2602
  declaredBy: "declaredBy";
2597
2603
  declaredIn: "declaredIn";
2598
2604
  event: "event";
@@ -2608,7 +2614,6 @@ declare const Address: z.ZodObject<{
2608
2614
  }>;
2609
2615
  }, z.core.$strip>]>;
2610
2616
  }, z.core.$strip>>;
2611
- listHistoricalNames: z.ZodOptional<z.ZodBoolean>;
2612
2617
  activeOnly: z.ZodOptional<z.ZodBoolean>;
2613
2618
  anchorToDateOfEvent: z.ZodOptional<z.ZodBoolean>;
2614
2619
  }, z.core.$strip>>;
@@ -2827,13 +2832,19 @@ declare const ButtonField: z.ZodObject<{
2827
2832
  }, z.core.$strip>;
2828
2833
  }, z.core.$strip>;
2829
2834
  export type ButtonField = z.infer<typeof ButtonField>;
2835
+ declare const FieldGroupConfiguration: z.ZodObject<{
2836
+ separator: z.ZodOptional<z.ZodString>;
2837
+ hideEmptyFields: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2838
+ }, z.core.$strip>;
2830
2839
  type FieldGroupInput = z.input<typeof BaseField> & {
2831
2840
  type: typeof FieldType.FIELD_GROUP;
2832
2841
  fields: FieldConfigInput[];
2842
+ configuration?: z.input<typeof FieldGroupConfiguration>;
2833
2843
  };
2834
2844
  export type FieldGroup = BaseField & {
2835
2845
  type: typeof FieldType.FIELD_GROUP;
2836
2846
  fields: FieldConfig[];
2847
+ configuration?: z.infer<typeof FieldGroupConfiguration>;
2837
2848
  };
2838
2849
  declare const AlphaPrintButton: z.ZodObject<{
2839
2850
  id: z.ZodString;
@@ -5,6 +5,7 @@ export declare const DeclarationFormConfig: z.ZodObject<{
5
5
  id: z.ZodString;
6
6
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
7
7
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
8
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
8
9
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
9
10
  conditional: z.ZodOptional<z.ZodAny>;
10
11
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -18,6 +19,7 @@ export declare const ActionFormConfig: z.ZodObject<{
18
19
  id: z.ZodString;
19
20
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
20
21
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
22
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
21
23
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
22
24
  conditional: z.ZodOptional<z.ZodAny>;
23
25
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -25,6 +27,7 @@ export declare const ActionFormConfig: z.ZodObject<{
25
27
  id: z.ZodString;
26
28
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
27
29
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
30
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
28
31
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
29
32
  conditional: z.ZodOptional<z.ZodAny>;
30
33
  type: z.ZodLiteral<"VERIFICATION">;
@@ -50,6 +53,7 @@ export declare const FormConfig: z.ZodUnion<readonly [z.ZodObject<{
50
53
  id: z.ZodString;
51
54
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
52
55
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
56
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
53
57
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
54
58
  conditional: z.ZodOptional<z.ZodAny>;
55
59
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -60,6 +64,7 @@ export declare const FormConfig: z.ZodUnion<readonly [z.ZodObject<{
60
64
  id: z.ZodString;
61
65
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
62
66
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
67
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
63
68
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
64
69
  conditional: z.ZodOptional<z.ZodAny>;
65
70
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -67,6 +72,7 @@ export declare const FormConfig: z.ZodUnion<readonly [z.ZodObject<{
67
72
  id: z.ZodString;
68
73
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
69
74
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
75
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
70
76
  fields: z.ZodArray<z.ZodType<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<import("./FieldConfig").FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
71
77
  conditional: z.ZodOptional<z.ZodAny>;
72
78
  type: z.ZodLiteral<"VERIFICATION">;
@@ -9,6 +9,7 @@ export declare const FormPageConfig: z.ZodObject<{
9
9
  id: z.ZodString;
10
10
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
11
11
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
12
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
12
13
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
13
14
  conditional: z.ZodOptional<z.ZodAny>;
14
15
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -31,6 +32,7 @@ export declare const VerificationPageConfig: z.ZodObject<{
31
32
  id: z.ZodString;
32
33
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
33
34
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
35
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
34
36
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
35
37
  conditional: z.ZodOptional<z.ZodAny>;
36
38
  type: z.ZodLiteral<"VERIFICATION">;
@@ -52,6 +54,7 @@ export declare const PageConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
54
  id: z.ZodString;
53
55
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
54
56
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
57
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
55
58
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
56
59
  conditional: z.ZodOptional<z.ZodAny>;
57
60
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
@@ -59,6 +62,7 @@ export declare const PageConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
59
62
  id: z.ZodString;
60
63
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
61
64
  requireCompletionToContinue: z.ZodDefault<z.ZodBoolean>;
65
+ showClearButton: z.ZodOptional<z.ZodBoolean>;
62
66
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
63
67
  conditional: z.ZodOptional<z.ZodAny>;
64
68
  type: z.ZodLiteral<"VERIFICATION">;
@@ -21,6 +21,7 @@ export declare function getDeclarationPages(configuration: EventConfig): {
21
21
  description: string;
22
22
  };
23
23
  requireCompletionToContinue: boolean;
24
+ showClearButton?: boolean | undefined;
24
25
  fields: FieldConfig[];
25
26
  conditional?: any;
26
27
  type: "FORM";
@@ -39,6 +40,7 @@ export declare function getDeclaration(configuration: EventConfig): {
39
40
  description: string;
40
41
  };
41
42
  requireCompletionToContinue: boolean;
43
+ showClearButton?: boolean | undefined;
42
44
  fields: FieldConfig[];
43
45
  conditional?: any;
44
46
  type: "FORM";
@@ -67,6 +69,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
67
69
  description: string;
68
70
  };
69
71
  requireCompletionToContinue: boolean;
72
+ showClearButton?: boolean | undefined;
70
73
  fields: FieldConfig[];
71
74
  conditional?: any;
72
75
  type: "FORM";
@@ -78,6 +81,7 @@ export declare function getPrintCertificatePages(configuration: EventConfig): ({
78
81
  description: string;
79
82
  };
80
83
  requireCompletionToContinue: boolean;
84
+ showClearButton?: boolean | undefined;
81
85
  fields: FieldConfig[];
82
86
  conditional?: any;
83
87
  type: "VERIFICATION";
@@ -457,7 +457,9 @@ var userRole = z11.preprocess(
457
457
  ).describe("User role, e.g. admin, field agent");
458
458
  var scopeOptionsPlaceEvent = z11.object({
459
459
  event: scopeByEvent,
460
- placeOfEvent: JurisdictionFilter.optional()
460
+ placeOfEvent: JurisdictionFilter.optional(),
461
+ createdBy: UserFilter.optional(),
462
+ createdIn: JurisdictionFilter.optional()
461
463
  }).describe("Options applicable to all record scopes.");
462
464
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
463
465
  notifiedIn: JurisdictionFilter.optional(),
@@ -500,7 +502,9 @@ var AllScopeOptions = z11.object({
500
502
  var ScopeOptionKey = AllScopeOptions.keyof();
501
503
  var ResolvedScopeOptionsPlaceEvent = z11.object({
502
504
  event: scopeByEvent,
503
- placeOfEvent: UUID.nullish()
505
+ placeOfEvent: UUID.nullish(),
506
+ createdBy: z11.string().optional(),
507
+ createdIn: UUID.nullish()
504
508
  }).describe(
505
509
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
506
510
  );
@@ -95,7 +95,7 @@ function updateInventoryFile(filePath, users) {
95
95
  function parseInventoryFile(filePath) {
96
96
  try {
97
97
  const data = (0, utils_1.readYamlFile)(filePath);
98
- return (0, templates_1.getUsers)(data);
98
+ return (0, templates_1.extractAndModifyUsers)(data);
99
99
  }
100
100
  catch (_a) {
101
101
  return [];
@@ -34,7 +34,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
34
34
  };
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const core_1 = require("@octokit/core");
37
- const dotenv_1 = __importDefault(require("dotenv"));
38
37
  const kleur_1 = __importDefault(require("kleur"));
39
38
  const prompts_1 = __importDefault(require("prompts"));
40
39
  function confirm(options) {
@@ -111,7 +110,7 @@ function getAnswers(existingValues) {
111
110
  });
112
111
  });
113
112
  }
114
- function promptAndStoreAnswer(environment, questions, existingValues) {
113
+ function promptAndStoreAnswer(questions, existingValues) {
115
114
  return __awaiter(this, void 0, void 0, function* () {
116
115
  (0, logger_1.log)('');
117
116
  const processedQuestions = questions.flatMap((question) => {
@@ -164,7 +163,6 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
164
163
  }
165
164
  });
166
165
  ALL_ANSWERS.push(result);
167
- (0, utils_1.storeSecrets)(environment, getAnswers(existingValues));
168
166
  const existingValuesForQuestions = questions
169
167
  // Only variables can have previous values we can use
170
168
  .filter((question) => question.valueType === 'VARIABLE')
@@ -184,7 +182,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
184
182
  process.exit(1);
185
183
  }
186
184
  });
187
- const { githubToken } = yield promptAndStoreAnswer('', questions_1.githubTokenQuestion, []);
185
+ const { githubToken } = yield promptAndStoreAnswer(questions_1.githubTokenQuestion, []);
188
186
  const octokit = new core_1.Octokit({
189
187
  auth: githubToken
190
188
  });
@@ -244,10 +242,6 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
244
242
  if (!environment) {
245
243
  process.exit(1);
246
244
  }
247
- // Read users .env file based on the environment name they gave above, e.g. .env.production
248
- dotenv_1.default.config({
249
- path: `${process.cwd()}/.env.${environment}`
250
- });
251
245
  yield (0, github_1.createEnvironment)(octokit, environment, githubOrganisation, githubRepository);
252
246
  const repositoryId = yield (0, github_1.getRepositoryId)(octokit, githubOrganisation, githubRepository);
253
247
  const existingRepositorySecrets = yield (0, github_1.listRepositorySecrets)(octokit, githubOrganisation, githubRepository);
@@ -268,12 +262,12 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
268
262
  (0, logger_1.log)('\n', kleur_1.default
269
263
  .yellow()
270
264
  .bold('WARNING! You are setting up a production environment.\n Make sure you have read the deployment guide carefully before proceeding.\n'));
271
- yield promptAndStoreAnswer(environment, questions_1.githubOtherQuestions, existingValues);
265
+ yield promptAndStoreAnswer(questions_1.githubOtherQuestions, existingValues);
272
266
  }
273
267
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Docker Hub'));
274
- yield promptAndStoreAnswer(environment, questions_1.dockerhubQuestions, existingValues);
268
+ yield promptAndStoreAnswer(questions_1.dockerhubQuestions, existingValues);
275
269
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Kubernetes & Runtime'));
276
- const infrastructure = yield promptAndStoreAnswer(environment, questions_1.infrastructureQuestions, existingValues);
270
+ const infrastructure = yield promptAndStoreAnswer(questions_1.infrastructureQuestions, existingValues);
277
271
  const kubeWorkerNodes = infrastructure.kubeWorkerNodes
278
272
  ? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
279
273
  : [];
@@ -315,7 +309,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
315
309
  }
316
310
  if (enableEncryption && !encryption_key_defined && !environment_exists) {
317
311
  (0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow(' Disk encryption is enabled'));
318
- yield promptAndStoreAnswer(environment, questions_1.diskQuestions, existingValues);
312
+ yield promptAndStoreAnswer(questions_1.diskQuestions, existingValues);
319
313
  }
320
314
  else {
321
315
  if (!enableEncryption && !encryption_key_defined && environment_exists) {
@@ -353,7 +347,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
353
347
  let backupHostPrivateKey = '';
354
348
  let backupHostPublicKey = '';
355
349
  if (configureBackup) {
356
- const backupAnswers = yield promptAndStoreAnswer(environment, questions_1.backupQuestions, existingValues);
350
+ const backupAnswers = yield promptAndStoreAnswer(questions_1.backupQuestions, existingValues);
357
351
  const backupHostPrivateKeyExists = (0, utils_1.findExistingValue)('BACKUP_HOST_PRIVATE_KEY', 'SECRET', 'ENVIRONMENT', existingValues);
358
352
  backupType = backupAnswers.backupType;
359
353
  backupHost = backupAnswers.backupHost || backupHost;
@@ -409,11 +403,11 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
409
403
  (0, logger_1.log)(kleur_1.default.bold().green('✔'), kleur_1.default.bold().yellow('Restore is disabled'));
410
404
  }
411
405
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Monitoring'));
412
- yield promptAndStoreAnswer(environment, questions_1.databaseAndMonitoringQuestions, existingValues);
406
+ yield promptAndStoreAnswer(questions_1.databaseAndMonitoringQuestions, existingValues);
413
407
  const sentryDSNExists = (0, utils_1.findExistingValue)('SENTRY_DSN', 'SECRET', 'ENVIRONMENT', existingValues);
414
408
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Sentry'));
415
409
  if (sentryDSNExists) {
416
- yield promptAndStoreAnswer(environment, questions_1.sentryQuestions, existingValues);
410
+ yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
417
411
  }
418
412
  else {
419
413
  const { useSentry } = yield (0, prompts_1.default)([
@@ -425,13 +419,13 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
425
419
  }
426
420
  ]);
427
421
  if (useSentry) {
428
- yield promptAndStoreAnswer(environment, questions_1.sentryQuestions, existingValues);
422
+ yield promptAndStoreAnswer(questions_1.sentryQuestions, existingValues);
429
423
  }
430
424
  }
431
425
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('METABASE ADMIN'));
432
- yield promptAndStoreAnswer(environment, questions_1.metabaseAdminQuestions, existingValues);
426
+ yield promptAndStoreAnswer(questions_1.metabaseAdminQuestions, existingValues);
433
427
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('SMTP'));
434
- yield promptAndStoreAnswer(environment, questions_1.emailQuestions, existingValues);
428
+ yield promptAndStoreAnswer(questions_1.emailQuestions, existingValues);
435
429
  const allAnswers = ALL_ANSWERS.reduce((acc, answer) => {
436
430
  return Object.assign(Object.assign({}, acc), answer);
437
431
  });
@@ -609,7 +603,6 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
609
603
  // Only update values that changed
610
604
  (variable.type !== 'VARIABLE' ||
611
605
  variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value)); });
612
- (0, utils_1.storeSecrets)(environment, updates);
613
606
  /*
614
607
  * List out all updates to the variables and confirm with the user
615
608
  */
@@ -688,6 +681,10 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
688
681
  .concat(updatedVariables).length === 0) {
689
682
  process.exit(0);
690
683
  }
684
+ (0, logger_1.log)(kleur_1.default
685
+ .bold()
686
+ .red("⚠️ COPY THESE NOW INTO A PASSWORD MANAGER — YOU WON'T SEE THEM AGAIN"));
687
+ (0, logger_1.log)('');
691
688
  const saveChanges = yield confirm({
692
689
  message: 'Do you want to continue?',
693
690
  default: true
@@ -790,6 +787,7 @@ ${addon_message}
790
787
  ${kleur_1.default.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
791
788
  ${kleur_1.default.yellow('Please KINDLY read hints above')}
792
789
  `);
793
- (0, logger_1.log)('\nAll variables stored in', kleur_1.default.cyan(`.env.${environment}`));
794
- (0, logger_1.log)(kleur_1.default.bold().yellow('DO NOT COMMIT THIS FILE TO GIT!'));
790
+ (0, logger_1.log)('\nAll secrets and variables were printed above.', kleur_1.default
791
+ .bold()
792
+ .yellow('Store them in a password manager — they are not saved to disk.'));
795
793
  }))();
@@ -1,4 +1,3 @@
1
- export declare function getUsers(data: any): any;
2
1
  export declare function extractAndModifyUsers(data: any): any;
3
2
  export declare function dockerManagerFirst(data: any): string;
4
3
  export declare function extractBackupNode(data: any): string;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAKvC;AAID,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAYpD;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,QAsBzE"}
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,QAsBzE"}
@@ -24,7 +24,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
24
24
  return (mod && mod.__esModule) ? mod : { "default": mod };
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.getUsers = getUsers;
28
27
  exports.extractAndModifyUsers = extractAndModifyUsers;
29
28
  exports.dockerManagerFirst = dockerManagerFirst;
30
29
  exports.extractBackupNode = extractBackupNode;
@@ -40,13 +39,6 @@ const handlebars_1 = __importDefault(require("handlebars"));
40
39
  handlebars_1.default.registerHelper('data_label_idx', function (value) {
41
40
  return parseInt(value) + 2;
42
41
  });
43
- function getUsers(data) {
44
- var _a, _b;
45
- if (!((_b = (_a = data === null || data === void 0 ? void 0 : data.all) === null || _a === void 0 ? void 0 : _a.vars) === null || _b === void 0 ? void 0 : _b.users)) {
46
- return { users: [] };
47
- }
48
- return data.all.vars.users;
49
- }
50
42
  // START: TEMPORAL SECTION FOR TRANSITION FROM DOCKER SWARM TO K8s
51
43
  // Extract users from the old inventory
52
44
  // Docker swarm format to new
@@ -56,6 +48,9 @@ function extractAndModifyUsers(data) {
56
48
  return { users: [] };
57
49
  }
58
50
  const users = data.all.vars.users.map((user) => {
51
+ if (user.role) {
52
+ return user;
53
+ }
59
54
  const { sudoer } = user, rest = __rest(user, ["sudoer"]);
60
55
  return Object.assign(Object.assign({}, rest), { role: sudoer ? 'admin' : 'operator' });
61
56
  });
@@ -1 +1 @@
1
- {"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"AA+HA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
1
+ {"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"AAmIA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
@@ -121,6 +121,10 @@ function updateWorkflows(envList, config) {
121
121
  var _a, _b, _c, _d;
122
122
  const { workflows } = config;
123
123
  for (const workflowPath of workflows) {
124
+ if (!(0, fs_1.existsSync)(workflowPath)) {
125
+ (0, logger_1.log)(` ↷ Skipped ${workflowPath} (not found in this repository)`);
126
+ continue;
127
+ }
124
128
  try {
125
129
  const fileContents = (0, fs_1.readFileSync)(workflowPath, 'utf8');
126
130
  // Verify the file is valid YAML and has the expected structure
@@ -1,18 +1,6 @@
1
1
  import { Secret, Variable } from './github';
2
- import { Answers } from './custom-types';
3
2
  export declare function generateLongPassword(): string;
4
3
  export declare function findExistingValue<T extends string>(name: string, type: T, scope: 'ENVIRONMENT' | 'REPOSITORY', existingValues: Array<Secret | Variable>): (T extends 'SECRET' ? Secret : T extends 'VARIABLE' ? Variable : never) | undefined;
5
- /**
6
- * Merges and stores secrets in `.env.{environment}` file.
7
- * Updates existing variables, preserves unchanged ones, adds new ones.
8
- *
9
- * @param environment - Environment name (e.g., 'production')
10
- * @param answers - Variables to update: `[{ name: 'KEY', value: 'val' }]`
11
- *
12
- * @example
13
- * storeSecrets('prod', [{ name: 'API_KEY', value: 'abc123' }]);
14
- */
15
- export declare function storeSecrets(environment: string, answers: Answers): void;
16
4
  export declare function readYamlFile(filePath: any): any;
17
5
  export declare function writeYamlFile(filePath: string, data: any): void;
18
6
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/environment/utils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,wBAAgB,oBAAoB,WAMnC;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,aAAa,GAAG,YAAY,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GAMpC,CAAC,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,CAAC,SAAS,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,GACvE,SAAS,CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAoBjE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CAG/C;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAcxD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/environment/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE3C,wBAAgB,oBAAoB,WAMnC;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,aAAa,GAAG,YAAY,EACnC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GAMpC,CAAC,CAAC,SAAS,QAAQ,GAAG,MAAM,GAAG,CAAC,SAAS,UAAU,GAAG,QAAQ,GAAG,KAAK,CAAC,GACvE,SAAS,CACd;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,CAG/C;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,QAcxD"}
@@ -48,12 +48,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
49
  exports.generateLongPassword = generateLongPassword;
50
50
  exports.findExistingValue = findExistingValue;
51
- exports.storeSecrets = storeSecrets;
52
51
  exports.readYamlFile = readYamlFile;
53
52
  exports.writeYamlFile = writeYamlFile;
54
- const fs_1 = __importStar(require("fs"));
53
+ const fs_1 = __importDefault(require("fs"));
55
54
  const yaml = __importStar(require("js-yaml"));
56
- const dotenv_1 = __importDefault(require("dotenv"));
57
55
  function generateLongPassword() {
58
56
  const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
59
57
  let result = '';
@@ -64,31 +62,6 @@ function generateLongPassword() {
64
62
  function findExistingValue(name, type, scope, existingValues) {
65
63
  return existingValues.find((value) => value.name === name && value.type === type && value.scope === scope);
66
64
  }
67
- /**
68
- * Merges and stores secrets in `.env.{environment}` file.
69
- * Updates existing variables, preserves unchanged ones, adds new ones.
70
- *
71
- * @param environment - Environment name (e.g., 'production')
72
- * @param answers - Variables to update: `[{ name: 'KEY', value: 'val' }]`
73
- *
74
- * @example
75
- * storeSecrets('prod', [{ name: 'API_KEY', value: 'abc123' }]);
76
- */
77
- function storeSecrets(environment, answers) {
78
- let envConfig = {};
79
- try {
80
- envConfig = dotenv_1.default.parse((0, fs_1.readFileSync)(`${process.cwd()}/.env.${environment}`));
81
- }
82
- catch (error) {
83
- envConfig = {};
84
- }
85
- const linesFromAnswers = answers.map((update) => `${update.name}="${update.value}"`);
86
- const linesFromEnvConfig = Object.entries(envConfig)
87
- .filter(([name]) => !answers.find((update) => update.name === name))
88
- .map(([name, value]) => `${name}="${value}"`);
89
- const allLines = [...linesFromEnvConfig, ...linesFromAnswers].sort();
90
- (0, fs_1.writeFileSync)(`.env.${environment}`, allLines.join('\n'));
91
- }
92
65
  function readYamlFile(filePath) {
93
66
  const fileContent = fs_1.default.readFileSync(filePath, 'utf8');
94
67
  return yaml.load(fileContent);