@opencrvs/toolkit 2.1.0-rc.00fa07b → 2.1.0-rc.03f553a
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/README.md +0 -1
- package/dist/application-config/index.js +0 -1
- package/dist/cli.js +58 -174
- package/dist/commons/api/router.d.ts +0 -85
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -6
- package/dist/commons/events/AuditLog.d.ts +0 -37
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +0 -7
- package/dist/conditionals/index.js +0 -1
- package/dist/environment/index.d.ts +0 -1
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +0 -10
- package/dist/environment/setup-environment.js +1 -2
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +1 -2
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +5 -17
- package/dist/environment/users.js +13 -11
- package/dist/events/index.js +0 -88
- package/dist/notification/index.js +25 -99
- package/dist/scopes/index.d.ts +1 -3
- package/dist/scopes/index.js +0 -1
- package/opencrvs-toolkit-2.1.0-rc.03f553a.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/locationPayloads.d.ts +0 -95
- package/dist/environment/paths.d.ts +0 -7
- package/dist/environment/paths.d.ts.map +0 -1
- package/dist/environment/paths.js +0 -72
- package/dist/environment/upgrade.d.ts +0 -2
- package/dist/environment/upgrade.d.ts.map +0 -1
- package/dist/environment/upgrade.js +0 -82
- package/opencrvs-toolkit-2.1.0-rc.00fa07b.tgz +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.upgradeEnvironmentLayout = upgradeEnvironmentLayout;
|
|
26
|
-
const fs_1 = require("fs");
|
|
27
|
-
const path_1 = require("path");
|
|
28
|
-
const kleur_1 = __importDefault(require("kleur"));
|
|
29
|
-
const logger_1 = require("./logger");
|
|
30
|
-
const paths_1 = require("./paths");
|
|
31
|
-
const update_workflows_1 = require("./update-workflows");
|
|
32
|
-
function moveFileIfDestinationMissing(sourcePath, destinationPath) {
|
|
33
|
-
if (!(0, fs_1.existsSync)(sourcePath)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if ((0, fs_1.existsSync)(destinationPath)) {
|
|
37
|
-
(0, logger_1.warn)(`⚠️ Skipped ${sourcePath}; destination already exists at ${destinationPath}`);
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
(0, fs_1.mkdirSync)((0, path_1.dirname)(destinationPath), { recursive: true });
|
|
41
|
-
(0, fs_1.renameSync)(sourcePath, destinationPath);
|
|
42
|
-
(0, logger_1.log)(` ✓ Moved ${sourcePath} -> ${destinationPath}`);
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
function migrateInventoryFiles() {
|
|
46
|
-
const oldInventoryFiles = (0, paths_1.findOldInventoryFiles)();
|
|
47
|
-
if (oldInventoryFiles.length === 0) {
|
|
48
|
-
(0, logger_1.log)(`ℹ️ No old inventory files found at ${paths_1.OLD_INVENTORY_DIR}`);
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
(0, logger_1.log)(kleur_1.default.bold('\nMigrating Ansible inventory files'));
|
|
52
|
-
let didMoveInventory = false;
|
|
53
|
-
for (const oldInventoryFile of oldInventoryFiles) {
|
|
54
|
-
const environment = (0, paths_1.getEnvironmentNameFromOldInventoryPath)(oldInventoryFile);
|
|
55
|
-
didMoveInventory =
|
|
56
|
-
moveFileIfDestinationMissing(oldInventoryFile, (0, paths_1.getEnvironmentInventoryPath)(environment)) || didMoveInventory;
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
if ((0, fs_1.existsSync)(paths_1.OLD_INVENTORY_DIR) &&
|
|
60
|
-
(0, fs_1.readdirSync)(paths_1.OLD_INVENTORY_DIR).length === 0) {
|
|
61
|
-
(0, fs_1.rmdirSync)(paths_1.OLD_INVENTORY_DIR);
|
|
62
|
-
(0, logger_1.log)(` ✓ Removed empty ${paths_1.OLD_INVENTORY_DIR}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch (_a) {
|
|
66
|
-
(0, logger_1.warn)(`⚠️ Could not remove ${paths_1.OLD_INVENTORY_DIR}; please review it manually`);
|
|
67
|
-
}
|
|
68
|
-
return didMoveInventory;
|
|
69
|
-
}
|
|
70
|
-
function upgradeEnvironmentLayout() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const didMoveInventory = migrateInventoryFiles();
|
|
73
|
-
yield (0, update_workflows_1.updateWorkflowEnvironments)();
|
|
74
|
-
if (didMoveInventory) {
|
|
75
|
-
(0, logger_1.success)('\n✅ Environment layout upgrade completed successfully.');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
(0, logger_1.success)('\n✅ Environment layout already uses the current structure.');
|
|
79
|
-
}
|
|
80
|
-
(0, logger_1.log)('\nCommit changes into git after upgrade');
|
|
81
|
-
});
|
|
82
|
-
}
|
|
Binary file
|