@opencrvs/toolkit 2.1.0-rc.c8d2a48 → 2.1.0-rc.cebd0a2

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 (79) hide show
  1. package/README.md +0 -1
  2. package/dist/application-config/index.js +1 -2
  3. package/dist/cli.js +125 -191
  4. package/dist/commons/api/router.d.ts +1644 -1627
  5. package/dist/commons/application-config/index.d.ts +6 -6
  6. package/dist/commons/conditionals/conditionals.d.ts +323 -32
  7. package/dist/commons/events/ActionConfig.d.ts +105 -105
  8. package/dist/commons/events/ActionDocument.d.ts +119 -119
  9. package/dist/commons/events/ActionInput.d.ts +6 -0
  10. package/dist/commons/events/ActionType.d.ts +62 -62
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +507 -507
  12. package/dist/commons/events/AuditLog.d.ts +43 -43
  13. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  14. package/dist/commons/events/Conditional.d.ts +3 -3
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  16. package/dist/commons/events/Draft.d.ts +37 -37
  17. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  18. package/dist/commons/events/EventConfig.d.ts +5 -5
  19. package/dist/commons/events/EventDocument.d.ts +48 -48
  20. package/dist/commons/events/EventIndex.d.ts +62 -62
  21. package/dist/commons/events/EventMetadata.d.ts +40 -40
  22. package/dist/commons/events/FieldConfig.d.ts +337 -337
  23. package/dist/commons/events/FieldType.d.ts +51 -51
  24. package/dist/commons/events/FieldTypeMapping.d.ts +100 -100
  25. package/dist/commons/events/FieldValue.d.ts +12 -12
  26. package/dist/commons/events/Flag.d.ts +15 -15
  27. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  28. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  29. package/dist/commons/events/WorkqueueConfig.d.ts +820 -820
  30. package/dist/commons/events/deduplication.d.ts +1 -1
  31. package/dist/commons/events/event.d.ts +2 -2
  32. package/dist/commons/events/field.d.ts +198 -69
  33. package/dist/commons/events/locations.d.ts +6 -96
  34. package/dist/commons/events/mocks.test.utils.d.ts +4 -18
  35. package/dist/commons/events/scopes.d.ts +4 -4
  36. package/dist/commons/events/state/index.d.ts +17 -17
  37. package/dist/commons/events/state/utils.d.ts +7 -7
  38. package/dist/commons/events/test.utils.d.ts +43 -40
  39. package/dist/commons/events/utils.d.ts +114 -114
  40. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  41. package/dist/environment/derived-variables.d.ts +131 -119
  42. package/dist/environment/derived-variables.d.ts.map +1 -1
  43. package/dist/environment/derived-variables.js +14 -0
  44. package/dist/environment/index.d.ts +0 -1
  45. package/dist/environment/index.d.ts.map +1 -1
  46. package/dist/environment/index.js +0 -10
  47. package/dist/environment/logger.d.ts +12 -3
  48. package/dist/environment/logger.d.ts.map +1 -1
  49. package/dist/environment/manage-users.js +7 -17
  50. package/dist/environment/questions.d.ts +74 -75
  51. package/dist/environment/questions.d.ts.map +1 -1
  52. package/dist/environment/setup-environment.js +29 -10
  53. package/dist/environment/swarm-to-k8s.js +7 -17
  54. package/dist/environment/templates.d.ts.map +1 -1
  55. package/dist/environment/templates.js +1 -2
  56. package/dist/environment/update-workflows.d.ts.map +1 -1
  57. package/dist/environment/update-workflows.js +10 -21
  58. package/dist/environment/users.js +20 -28
  59. package/dist/environment/utils.d.ts +1 -1
  60. package/dist/environment/utils.js +7 -17
  61. package/dist/events/deduplication.d.ts +1 -1
  62. package/dist/events/index.js +58 -62
  63. package/dist/migrations/v2.0/convert-config-files-to-ts.js +7 -17
  64. package/dist/migrations/v2.0/migrate-application-config-url.js +3 -4
  65. package/dist/migrations/v2.0/remove-hearth-migrations.js +7 -17
  66. package/dist/notification/index.js +57 -48
  67. package/dist/scopes/index.d.ts +146 -146
  68. package/dist/templates/charts-values/dependencies/values.yaml +3 -0
  69. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -0
  70. package/opencrvs-toolkit-2.1.0-rc.cebd0a2.tgz +0 -0
  71. package/package.json +4 -3
  72. package/tsconfig.tsbuildinfo +1 -1
  73. package/dist/environment/paths.d.ts +0 -11
  74. package/dist/environment/paths.d.ts.map +0 -1
  75. package/dist/environment/paths.js +0 -89
  76. package/dist/environment/upgrade.d.ts +0 -2
  77. package/dist/environment/upgrade.d.ts.map +0 -1
  78. package/dist/environment/upgrade.js +0 -80
  79. package/opencrvs-toolkit-2.1.0-rc.c8d2a48.tgz +0 -0
@@ -1,199 +1,198 @@
1
- declare const notEmpty: (value: string | number) => "Please enter a value" | true;
2
1
  declare function validateCIDRs(input: string): true | string;
3
2
  export declare const dockerhubQuestions: {
4
3
  name: string;
5
- type: 'text';
4
+ type: "text";
6
5
  message: string;
7
- valueType: 'SECRET';
6
+ valueType: "SECRET";
8
7
  valueLabel: string;
9
- validate: typeof notEmpty;
8
+ validate: (value: string | number) => true | "Please enter a value";
10
9
  initial: string | undefined;
11
- scope: 'REPOSITORY';
10
+ scope: "REPOSITORY";
12
11
  }[];
13
12
  export declare const githubQuestions: {
14
13
  name: string;
15
- type: 'text';
14
+ type: "text";
16
15
  message: string;
17
- validate: typeof notEmpty;
16
+ validate: (value: string | number) => true | "Please enter a value";
18
17
  initial: string;
19
- scope: 'REPOSITORY';
18
+ scope: "REPOSITORY";
20
19
  }[];
21
20
  export declare const githubOtherQuestions: ({
22
21
  name: string;
23
- type: 'text';
22
+ type: "text";
24
23
  message: string;
25
24
  initial: string | undefined;
26
- valueType: 'VARIABLE';
25
+ valueType: "VARIABLE";
27
26
  valueLabel: string;
28
- scope: 'REPOSITORY';
27
+ scope: "REPOSITORY";
29
28
  choices?: undefined;
30
29
  validate?: undefined;
31
30
  } | {
32
31
  name: string;
33
- type: 'select';
32
+ type: "select";
34
33
  message: string;
35
34
  choices: {
36
35
  title: string;
37
36
  value: string;
38
37
  }[];
39
- valueType: 'VARIABLE';
40
- validate: typeof notEmpty;
38
+ valueType: "VARIABLE";
39
+ validate: (value: string | number) => true | "Please enter a value";
41
40
  valueLabel: string;
42
41
  initial: string | undefined;
43
- scope: 'ENVIRONMENT';
42
+ scope: "ENVIRONMENT";
44
43
  })[];
45
44
  export declare const githubTokenQuestion: {
46
45
  name: string;
47
- type: 'text';
46
+ type: "text";
48
47
  message: string;
49
- validate: typeof notEmpty;
48
+ validate: (value: string | number) => true | "Please enter a value";
50
49
  initial: string | undefined;
51
- valueType: 'SECRET';
52
- scope: 'REPOSITORY';
50
+ valueType: "SECRET";
51
+ scope: "REPOSITORY";
53
52
  valueLabel: string;
54
53
  }[];
55
54
  export declare const countryQuestions: {
56
55
  name: string;
57
- type: 'text';
56
+ type: "text";
58
57
  message: string;
59
- valueType: 'VARIABLE';
58
+ valueType: "VARIABLE";
60
59
  valueLabel: string;
61
60
  initial: string | undefined;
62
- scope: 'REPOSITORY';
61
+ scope: "REPOSITORY";
63
62
  }[];
64
63
  export declare const infrastructureQuestions: ({
65
64
  name: string;
66
- type: 'text';
65
+ type: "text";
67
66
  message: string;
68
- valueType: 'VARIABLE';
69
- validate: typeof notEmpty;
67
+ valueType: "VARIABLE";
68
+ validate: (value: string | number) => true | "Please enter a value";
70
69
  valueLabel: string;
71
70
  initial: string | undefined;
72
- scope: 'ENVIRONMENT';
71
+ scope: "ENVIRONMENT";
73
72
  } | {
74
- validate?: undefined;
75
73
  name: string;
76
- type: 'text';
74
+ type: "text";
77
75
  message: string;
78
- valueType: 'VARIABLE';
76
+ valueType: "VARIABLE";
79
77
  valueLabel: string;
80
78
  initial: string | undefined;
81
- scope: 'ENVIRONMENT';
79
+ scope: "ENVIRONMENT";
80
+ validate?: undefined;
82
81
  } | {
83
82
  name: string;
84
- type: 'text';
83
+ type: "text";
85
84
  message: string;
86
- valueType: 'VARIABLE';
85
+ valueType: "VARIABLE";
87
86
  validate: typeof validateCIDRs;
88
87
  valueLabel: string;
89
88
  initial: string;
90
- scope: 'ENVIRONMENT';
89
+ scope: "ENVIRONMENT";
91
90
  })[];
92
91
  export declare const staticSSLCertQuestions: {
93
92
  name: string;
94
- type: 'text';
93
+ type: "text";
95
94
  message: string;
96
- valueType: 'SECRET';
97
- validate: typeof notEmpty;
95
+ valueType: "SECRET";
96
+ validate: (value: string | number) => true | "Please enter a value";
98
97
  valueLabel: string;
99
98
  initial: string | undefined;
100
- scope: 'ENVIRONMENT';
99
+ scope: "ENVIRONMENT";
101
100
  }[];
102
101
  export declare const backupQuestions: ({
103
- choices?: undefined;
104
- validate?: undefined;
105
102
  name: string;
106
- type: 'text';
103
+ type: "text";
107
104
  message: string;
108
- valueType: 'VARIABLE';
105
+ valueType: "VARIABLE";
109
106
  valueLabel: string;
110
107
  initial: string;
111
- scope: 'ENVIRONMENT';
112
- } | {
108
+ scope: "ENVIRONMENT";
109
+ validate?: undefined;
113
110
  choices?: undefined;
111
+ } | {
114
112
  name: string;
115
- type: 'text';
113
+ type: "text";
116
114
  message: string;
117
- valueType: 'SECRET';
118
- validate: typeof notEmpty;
115
+ valueType: "SECRET";
116
+ validate: (value: string | number) => true | "Please enter a value";
119
117
  valueLabel: string;
120
118
  initial: string;
121
- scope: 'ENVIRONMENT';
119
+ scope: "ENVIRONMENT";
120
+ choices?: undefined;
122
121
  } | {
123
122
  name: string;
124
- type: 'select';
123
+ type: "select";
125
124
  message: string;
126
125
  choices: {
127
126
  title: string;
128
127
  value: string;
129
128
  }[];
130
- valueType: 'VARIABLE';
131
- validate: typeof notEmpty;
129
+ valueType: "VARIABLE";
130
+ validate: (value: string | number) => true | "Please enter a value";
132
131
  valueLabel: string;
133
132
  initial: string | undefined;
134
- scope: 'ENVIRONMENT';
133
+ scope: "ENVIRONMENT";
135
134
  })[];
136
135
  export declare const diskQuestions: {
137
136
  name: string;
138
- type: 'text';
137
+ type: "text";
139
138
  message: string;
140
- valueType: 'VARIABLE';
141
- validate: typeof notEmpty;
139
+ valueType: "VARIABLE";
140
+ validate: (value: string | number) => true | "Please enter a value";
142
141
  valueLabel: string;
143
142
  initial: string;
144
- scope: 'ENVIRONMENT';
143
+ scope: "ENVIRONMENT";
145
144
  }[];
146
145
  export declare const databaseAndMonitoringQuestions: {
147
146
  name: string;
148
- type: 'text';
147
+ type: "text";
149
148
  message: string;
150
- valueType: 'SECRET';
151
- validate: typeof notEmpty;
149
+ valueType: "SECRET";
150
+ validate: (value: string | number) => true | "Please enter a value";
152
151
  valueLabel: string;
153
152
  initial: string;
154
- scope: 'ENVIRONMENT';
153
+ scope: "ENVIRONMENT";
155
154
  }[];
156
155
  export declare const emailQuestions: ({
157
- choices?: undefined;
158
156
  name: string;
159
- type: 'text';
157
+ type: "text";
160
158
  message: string;
161
- valueType: 'SECRET';
162
- validate: typeof notEmpty;
159
+ valueType: "SECRET";
160
+ validate: (value: string | number) => true | "Please enter a value";
163
161
  valueLabel: string;
164
162
  initial: string | undefined;
165
- scope: 'ENVIRONMENT';
163
+ scope: "ENVIRONMENT";
164
+ choices?: undefined;
166
165
  } | {
167
166
  name: string;
168
- type: 'select';
167
+ type: "select";
169
168
  message: string;
170
169
  choices: {
171
170
  title: string;
172
171
  value: string;
173
172
  }[];
174
- valueType: 'SECRET';
175
- validate: typeof notEmpty;
173
+ valueType: "SECRET";
174
+ validate: (value: string | number) => true | "Please enter a value";
176
175
  valueLabel: string;
177
176
  initial: string | undefined;
178
- scope: 'ENVIRONMENT';
177
+ scope: "ENVIRONMENT";
179
178
  })[];
180
179
  export declare const sentryQuestions: {
181
180
  name: string;
182
- type: 'text';
181
+ type: "text";
183
182
  message: string;
184
- valueType: 'SECRET';
185
- validate: typeof notEmpty;
183
+ valueType: "SECRET";
184
+ validate: (value: string | number) => true | "Please enter a value";
186
185
  valueLabel: string;
187
186
  initial: string | undefined;
188
- scope: 'ENVIRONMENT';
187
+ scope: "ENVIRONMENT";
189
188
  }[];
190
189
  export declare const metabaseAdminQuestions: {
191
- valueType: 'SECRET';
190
+ valueType: "SECRET";
192
191
  name: string;
193
- type: 'text';
192
+ type: "text";
194
193
  message: string;
195
194
  valueLabel: string;
196
- scope: 'ENVIRONMENT';
195
+ scope: "ENVIRONMENT";
197
196
  initial: string;
198
197
  }[];
199
198
  export {};
@@ -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,mBAAmB;;UAGtB,MAAM;;;;eAID,QAAQ;WACZ,YAAY;;GAGtB,CAAA;AAED,eAAO,MAAM,gBAAgB;;UAGnB,MAAM;;eAGD,UAAU;;;WAGd,YAAY;GAEtB,CAAA;AAED,eAAO,MAAM,uBAAuB;;UAG1B,MAAM;;eAED,UAAU;;;;WAId,aAAa;;;;UAId,MAAM;;eAED,UAAU;;;WAId,aAAa;;;UAId,MAAM;;eAED,UAAU;;;;WAId,aAAa;IAYvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;UAGzB,MAAM;;eAED,QAAQ;;;;WAIZ,aAAa;GAYvB,CAAA;AAED,eAAO,MAAM,eAAe;;;;UAGlB,MAAM;;eAED,UAAU;;;WAId,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;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AAED,eAAO,MAAM,8BAA8B;;;;;sBAtRlB,MAAM,GAAG,MAAM;;;;GA2SvC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;sBA7SF,MAAM,GAAG,MAAM;;;;;;;;;;;;;;sBAAf,MAAM,GAAG,MAAM;;;;IA+XvC,CAAA;AAED,eAAO,MAAM,eAAe;;;;;sBAjYH,MAAM,GAAG,MAAM;;;;GA4YvC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;GAoBlC,CAAA"}
@@ -59,7 +59,6 @@ const questions_1 = require("./questions");
59
59
  const editor_questions_1 = require("./editor-questions");
60
60
  const questions_helper_1 = require("./questions-helper");
61
61
  const manage_users_1 = require("./manage-users");
62
- const paths_1 = require("./paths");
63
62
  function questionToPrompt(_a) {
64
63
  var { valueType, valueLabel, scope } = _a, promptOptions = __rest(_a, ["valueType", "valueLabel", "scope"]);
65
64
  return promptOptions;
@@ -162,10 +161,13 @@ function promptAndStoreAnswer(environment, questions, existingValues) {
162
161
  const existingValuesForQuestions = questions
163
162
  // Only variables can have previous values we can use
164
163
  .filter((question) => question.valueType === 'VARIABLE')
165
- .map((question) => { var _a; return [
166
- question.name,
167
- (_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
168
- ]; });
164
+ .map((question) => {
165
+ var _a;
166
+ return [
167
+ question.name,
168
+ (_a = (0, utils_1.findExistingValue)(question.valueLabel, 'VARIABLE', question.scope, existingValues)) === null || _a === void 0 ? void 0 : _a.value
169
+ ];
170
+ });
169
171
  return Object.assign(Object.assign({}, Object.fromEntries(existingValuesForQuestions)), result);
170
172
  });
171
173
  }
@@ -272,7 +274,7 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
272
274
  ? infrastructure.kubeWorkerNodes.split(',').map((ip) => ip.trim())
273
275
  : [];
274
276
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('SSH Users'), '\n');
275
- const users = yield (0, manage_users_1.manageUsers)((0, paths_1.getEnvironmentInventoryPath)(environment));
277
+ const users = yield (0, manage_users_1.manageUsers)(`infrastructure/server-setup/inventory/${environment}.yml`);
276
278
  (0, logger_1.log)('\n', kleur_1.default.bold().underline('Traefik SSL Certificate'), '\n');
277
279
  const sslCertExists = (0, utils_1.findExistingValue)('SSL_CRT', 'SECRET', 'ENVIRONMENT', existingValues);
278
280
  let ssl_answers = [];
@@ -488,6 +490,20 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
488
490
  value: findExistingOrDefine('MINIO_ROOT_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
489
491
  scope: 'ENVIRONMENT'
490
492
  },
493
+ {
494
+ name: 'MONGODB_ADMIN_USER',
495
+ type: 'SECRET',
496
+ didExist: (0, utils_1.findExistingValue)('MONGODB_ADMIN_USER', 'SECRET', 'ENVIRONMENT', existingValues),
497
+ value: findExistingOrDefine('MONGODB_ADMIN_USER', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
498
+ scope: 'ENVIRONMENT'
499
+ },
500
+ {
501
+ name: 'MONGODB_ADMIN_PASSWORD',
502
+ type: 'SECRET',
503
+ didExist: (0, utils_1.findExistingValue)('MONGODB_ADMIN_PASSWORD', 'SECRET', 'ENVIRONMENT', existingValues),
504
+ value: findExistingOrDefine('MONGODB_ADMIN_PASSWORD', 'SECRET', 'ENVIRONMENT', (0, utils_1.generateLongPassword)()),
505
+ scope: 'ENVIRONMENT'
506
+ },
491
507
  {
492
508
  name: 'POSTGRES_USER',
493
509
  type: 'SECRET',
@@ -587,10 +603,13 @@ ALL_QUESTIONS.push(...questions_1.githubTokenQuestion, ...questions_1.githubOthe
587
603
  derivedUpdates.push(...applicationServerUpdates);
588
604
  const updates = getAnswers(existingValues)
589
605
  .concat(...derivedUpdates.filter((update) => update.value !== null))
590
- .filter((variable) => { var _a; return Boolean(variable.value) &&
591
- // Only update values that changed
592
- (variable.type !== 'VARIABLE' ||
593
- variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value)); });
606
+ .filter((variable) => {
607
+ var _a;
608
+ return Boolean(variable.value) &&
609
+ // Only update values that changed
610
+ (variable.type !== 'VARIABLE' ||
611
+ variable.value !== ((_a = variable.didExist) === null || _a === void 0 ? void 0 : _a.value));
612
+ });
594
613
  (0, utils_1.storeSecrets)(environment, updates);
595
614
  /*
596
615
  * List out all updates to the variables and confirm with the user
@@ -25,23 +25,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || (function () {
29
- var ownKeys = function(o) {
30
- ownKeys = Object.getOwnPropertyNames || function (o) {
31
- var ar = [];
32
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
- return ar;
34
- };
35
- return ownKeys(o);
36
- };
37
- return function (mod) {
38
- if (mod && mod.__esModule) return mod;
39
- var result = {};
40
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
- __setModuleDefault(result, mod);
42
- return result;
43
- };
44
- })();
28
+ var __importStar = (this && this.__importStar) || function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
45
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
46
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/environment/templates.ts"],"names":[],"mappings":"AAuBA,wBAAgB,QAAQ,CAAC,IAAI,EAA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AAG,CAAC,QA4BzE"}
@@ -34,7 +34,6 @@ exports.generateInventory = generateInventory;
34
34
  const fs_1 = __importDefault(require("fs"));
35
35
  const path_1 = __importDefault(require("path"));
36
36
  const logger_1 = require("./logger");
37
- const paths_1 = require("./paths");
38
37
  const handlebars_1 = __importDefault(require("handlebars"));
39
38
  // Register a helper to increment numbers
40
39
  handlebars_1.default.registerHelper('data_label_idx', function (value) {
@@ -150,7 +149,7 @@ function copyChartsValues(env, values) {
150
149
  function generateInventory(env, values) {
151
150
  // Template and output paths
152
151
  const templatePath = path_1.default.join(__dirname, 'templates', 'inventory', 'inventory.template.yml');
153
- const outputPath = path_1.default.resolve(process.cwd(), (0, paths_1.getEnvironmentInventoryPath)(env));
152
+ const outputPath = path_1.default.join(process.cwd(), 'infrastructure', 'server-setup', 'inventory', `${env}.yml`);
154
153
  const templateFile = fs_1.default.readFileSync(templatePath, 'utf-8');
155
154
  const template = handlebars_1.default.compile(templateFile);
156
155
  values['single_node'] =
@@ -1 +1 @@
1
- {"version":3,"file":"update-workflows.d.ts","sourceRoot":"","sources":["../../src/environment/update-workflows.ts"],"names":[],"mappings":"AAiHA,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":"AAgHA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAgDhE"}
@@ -25,23 +25,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || (function () {
29
- var ownKeys = function(o) {
30
- ownKeys = Object.getOwnPropertyNames || function (o) {
31
- var ar = [];
32
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
- return ar;
34
- };
35
- return ownKeys(o);
36
- };
37
- return function (mod) {
38
- if (mod && mod.__esModule) return mod;
39
- var result = {};
40
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
- __setModuleDefault(result, mod);
42
- return result;
43
- };
44
- })();
28
+ var __importStar = (this && this.__importStar) || function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
45
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
46
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -60,13 +50,12 @@ const path_1 = require("path");
60
50
  const glob = __importStar(require("glob"));
61
51
  const yaml = __importStar(require("js-yaml"));
62
52
  const logger_1 = require("./logger");
63
- const paths_1 = require("./paths");
64
53
  function extractInfrastructureNames() {
65
54
  return __awaiter(this, void 0, void 0, function* () {
66
- const files = glob.sync((0, path_1.join)('environments', '*', paths_1.INVENTORY_FILE_NAME));
67
- const infraEnvironments = files.map((file) => (0, path_1.basename)((0, path_1.dirname)(file)));
55
+ const files = glob.sync('infrastructure/server-setup/inventory/*.yml');
56
+ const infraEnvironments = files.map((file) => (0, path_1.basename)(file, '.yml'));
68
57
  if (infraEnvironments.length === 0) {
69
- console.log(`⚠️ Warning: No environment inventory files found at environments/*/${paths_1.INVENTORY_FILE_NAME}`);
58
+ console.log('⚠️ Warning: No environment directories found in infrastructure/server-setup/inventory/');
70
59
  return [];
71
60
  }
72
61
  (0, logger_1.log)('🔍 Found infrastructure configurations:', infraEnvironments.join(', '));
@@ -25,23 +25,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || (function () {
29
- var ownKeys = function(o) {
30
- ownKeys = Object.getOwnPropertyNames || function (o) {
31
- var ar = [];
32
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
- return ar;
34
- };
35
- return ownKeys(o);
36
- };
37
- return function (mod) {
38
- if (mod && mod.__esModule) return mod;
39
- var result = {};
40
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
- __setModuleDefault(result, mod);
42
- return result;
43
- };
44
- })();
28
+ var __importStar = (this && this.__importStar) || function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
45
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
46
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
47
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -62,7 +52,6 @@ const path = __importStar(require("path"));
62
52
  const kleur_1 = __importDefault(require("kleur"));
63
53
  const manage_users_1 = require("./manage-users");
64
54
  const logger_1 = require("./logger");
65
- const paths_1 = require("./paths");
66
55
  function select(options) {
67
56
  return __awaiter(this, void 0, void 0, function* () {
68
57
  const inquirer = yield import('@inquirer/prompts');
@@ -77,29 +66,32 @@ function select(options) {
77
66
  * * @returns {string} Inventory file
78
67
  */
79
68
  function selectInventoryFile() {
80
- return __awaiter(this, arguments, void 0, function* (dirPath = './environments') {
69
+ return __awaiter(this, arguments, void 0, function* (dirPath = './infrastructure/server-setup/inventory/') {
81
70
  // Check if directory exists
82
71
  if (!fs.existsSync(dirPath)) {
83
72
  (0, logger_1.warn)(`⚠️ No environment configuration directory found at ${dirPath}`);
84
73
  (0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
85
74
  return null;
86
75
  }
87
- const environments = fs
76
+ // Read and filter files
77
+ const files = fs
88
78
  .readdirSync(dirPath)
89
- .filter((entry) => {
90
- const filePath = path.join(dirPath, entry);
91
- return (fs.statSync(filePath).isDirectory() &&
92
- fs.existsSync((0, paths_1.getEnvironmentInventoryPath)(entry)));
79
+ .filter((file) => {
80
+ const filePath = path.join(dirPath, file);
81
+ const isFile = fs.statSync(filePath).isFile();
82
+ const ext = path.extname(file).slice(1).toLowerCase();
83
+ return isFile && (ext === 'yml' || ext === 'yaml');
93
84
  })
94
85
  .sort();
95
- if (environments.length === 0) {
86
+ if (files.length === 0) {
96
87
  (0, logger_1.warn)(`⚠️ No environment configuration files found at ${dirPath}`);
97
88
  (0, logger_1.warn)('Hint: If this is a new infrastructure repository, run `opencrvs environment init` first.');
98
89
  return null;
99
90
  }
100
- const choices = environments.map((environment) => ({
101
- name: environment,
102
- value: (0, paths_1.getEnvironmentInventoryPath)(environment)
91
+ // Create choices - remove extension from display
92
+ const choices = files.map((file) => ({
93
+ name: path.basename(file, path.extname(file)),
94
+ value: path.join(dirPath, file)
103
95
  }));
104
96
  const selectedFile = yield select({
105
97
  message: 'Select environment (inventory file) to load users:',
@@ -1,7 +1,7 @@
1
1
  import { Secret, Variable } from './github';
2
2
  import { Answers } from './custom-types';
3
3
  export declare function generateLongPassword(): string;
4
- 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;
4
+ 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
5
  /**
6
6
  * Merges and stores secrets in `.env.{environment}` file.
7
7
  * Updates existing variables, preserves unchanged ones, adds new ones.
@@ -25,23 +25,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25
25
  }) : function(o, v) {
26
26
  o["default"] = v;
27
27
  });
28
- var __importStar = (this && this.__importStar) || (function () {
29
- var ownKeys = function(o) {
30
- ownKeys = Object.getOwnPropertyNames || function (o) {
31
- var ar = [];
32
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
- return ar;
34
- };
35
- return ownKeys(o);
36
- };
37
- return function (mod) {
38
- if (mod && mod.__esModule) return mod;
39
- var result = {};
40
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
- __setModuleDefault(result, mod);
42
- return result;
43
- };
44
- })();
28
+ var __importStar = (this && this.__importStar) || function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
45
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
46
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
37
  };
@@ -59,8 +59,8 @@ export declare function field(fieldId: string): {
59
59
  fieldId: string;
60
60
  type: "dateRange";
61
61
  options: {
62
- pivot?: number | undefined;
63
62
  days: number;
63
+ pivot?: number | undefined;
64
64
  boost?: number | undefined;
65
65
  matchAgainst?: string | undefined;
66
66
  };