@catladder/cli 0.0.0-main-344735ad → 0.0.0-main-209fcf0b
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/dist/apps/cli/cli.js +2 -0
- package/dist/apps/cli/cli.js.map +1 -1
- package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts} +0 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +150 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
- package/dist/apps/cli/commands/{project/commandCopyDB.js → cloudSQL/index.js} +9 -39
- package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
- package/dist/apps/cli/commands/project/index.js +0 -2
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/bundles/catenv/index.js +1 -1
- package/dist/bundles/cli/index.js +217 -90
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/apps/cli/cli.ts +2 -0
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +132 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/cli/commands/project/index.ts +1 -2
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
- package/src/apps/cli/commands/project/commandCopyDB.ts +0 -92
package/dist/apps/cli/cli.js
CHANGED
|
@@ -45,6 +45,7 @@ var packageInfos_1 = __importDefault(require("../../packageInfos"));
|
|
|
45
45
|
var portForward_1 = require("../../utils/portForward");
|
|
46
46
|
var general_1 = __importDefault(require("./commands/general"));
|
|
47
47
|
var mongodb_1 = __importDefault(require("./commands/mongodb"));
|
|
48
|
+
var cloudSQL_1 = __importDefault(require("./commands/cloudSQL"));
|
|
48
49
|
var project_1 = __importDefault(require("./commands/project"));
|
|
49
50
|
var theStuffThatReallyMatters_1 = __importDefault(require("./commands/theStuffThatReallyMatters"));
|
|
50
51
|
var verify_1 = require("./verify");
|
|
@@ -69,6 +70,7 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
69
70
|
(0, verify_1.verify)(vorpal);
|
|
70
71
|
(0, general_1["default"])(vorpal);
|
|
71
72
|
(0, project_1["default"])(vorpal);
|
|
73
|
+
(0, cloudSQL_1["default"])(vorpal);
|
|
72
74
|
(0, mongodb_1["default"])(vorpal);
|
|
73
75
|
(0, theStuffThatReallyMatters_1["default"])(vorpal);
|
|
74
76
|
process.on("exit", function () {
|
package/dist/apps/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/apps/cli/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,2CAA2C;AAC3C,oEAA8C;AAC9C,uDAA8D;AAC9D,+DAAyC;AACzC,+DAAyC;AACzC,+DAAyC;AACzC,mGAA6E;AAE7E,mCAAkC;AAClC,gFAA+E;AAE/E,sBAAe;;;;;gBACP,MAAM,GAAG,IAAI,mBAAM,EAAE,CAAC;gBAEtB,cAAc,GAAG,8CAA6B,yBAAY,CAAC,OAAO,CAAE,CAAC;gBAE3E,MAAM;qBACH,SAAS,CAAC,aAAa,CAAC,CAAC,2EAA2E;qBACpG,OAAO,CAAC,WAAW,CAAC;qBACpB,IAAI,EAAE;qBACN,GAAG,CAAC,EAAE,CAAC;qBACP,GAAG,CAAC,cAAc,CAAC;qBACnB,GAAG,CAAC,EAAE,CAAC,CAAC;gBAEX,qBAAM,IAAA,qCAAiB,EAAC,MAAM,CAAC,EAAA;;gBAA/B,SAA+B,CAAC;gBAEhC,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC;gBAEf,IAAA,oBAAO,EAAC,MAAM,CAAC,CAAC;gBAChB,IAAA,oBAAO,EAAC,MAAM,CAAC,CAAC;gBAChB,IAAA,oBAAO,EAAC,MAAM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,CAAC,CAAC,CAAC;;;;KACJ,EAAC"}
|
package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
var child_process_promise_1 = require("child-process-promise");
|
|
40
|
+
var createProxy = function (instance, port) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var proxy, stop;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
proxy = (0, child_process_promise_1.spawn)("cloud_sql_proxy -instances ".concat(instance, "=tcp:").concat(port), [], { shell: "bash" });
|
|
46
|
+
// wait until it starts
|
|
47
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)("echo -n \"Waiting for proxy\"\n until echo > /dev/tcp/localhost/".concat(port, "; do\n sleep 0.2\n echo -n \".\"\n done 2>/dev/null"), [], { shell: "bash" })];
|
|
48
|
+
case 1:
|
|
49
|
+
// wait until it starts
|
|
50
|
+
_a.sent();
|
|
51
|
+
stop = function () { return proxy.childProcess.kill(); };
|
|
52
|
+
process.on("beforeExit", stop);
|
|
53
|
+
return [2 /*return*/, {
|
|
54
|
+
stop: stop
|
|
55
|
+
}];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); };
|
|
59
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
return [2 /*return*/, vorpal
|
|
62
|
+
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
63
|
+
.action(function restoreDb() {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
+
var sourceInstance, SOURCE_INSTANCE_PORT, TARGET_INSTANCE_PORT, sourceProxy, sourcePassword, sourceDbName, targetInstance, targetProxy, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0: return [4 /*yield*/, this.prompt({
|
|
69
|
+
type: "input",
|
|
70
|
+
name: "sourceInstance",
|
|
71
|
+
message: "Source instance (connection string)? 🤔 "
|
|
72
|
+
})];
|
|
73
|
+
case 1:
|
|
74
|
+
sourceInstance = (_a.sent()).sourceInstance;
|
|
75
|
+
SOURCE_INSTANCE_PORT = 54399;
|
|
76
|
+
TARGET_INSTANCE_PORT = 54499;
|
|
77
|
+
return [4 /*yield*/, createProxy(sourceInstance, SOURCE_INSTANCE_PORT)];
|
|
78
|
+
case 2:
|
|
79
|
+
sourceProxy = _a.sent();
|
|
80
|
+
return [4 /*yield*/, this.prompt({
|
|
81
|
+
type: "input",
|
|
82
|
+
name: "sourcePassword",
|
|
83
|
+
message: "Source Password? 🤔 "
|
|
84
|
+
})];
|
|
85
|
+
case 3:
|
|
86
|
+
sourcePassword = (_a.sent()).sourcePassword;
|
|
87
|
+
return [4 /*yield*/, this.prompt({
|
|
88
|
+
type: "input",
|
|
89
|
+
name: "sourceDbName",
|
|
90
|
+
message: "Source DB name? 🤔 "
|
|
91
|
+
})];
|
|
92
|
+
case 4:
|
|
93
|
+
sourceDbName = (_a.sent()).sourceDbName;
|
|
94
|
+
return [4 /*yield*/, this.prompt({
|
|
95
|
+
type: "input",
|
|
96
|
+
name: "targetInstance",
|
|
97
|
+
message: "Targe INSTANCE (connection string)? 🤔 "
|
|
98
|
+
})];
|
|
99
|
+
case 5:
|
|
100
|
+
targetInstance = (_a.sent()).targetInstance;
|
|
101
|
+
return [4 /*yield*/, createProxy(targetInstance, TARGET_INSTANCE_PORT)];
|
|
102
|
+
case 6:
|
|
103
|
+
targetProxy = _a.sent();
|
|
104
|
+
return [4 /*yield*/, this.prompt({
|
|
105
|
+
type: "input",
|
|
106
|
+
name: "targetPassword",
|
|
107
|
+
message: "Target Password? 🤔 "
|
|
108
|
+
})];
|
|
109
|
+
case 7:
|
|
110
|
+
targetPassword = (_a.sent()).targetPassword;
|
|
111
|
+
return [4 /*yield*/, this.prompt({
|
|
112
|
+
type: "input",
|
|
113
|
+
name: "targetDbName",
|
|
114
|
+
message: "Target DB name? 🤔 "
|
|
115
|
+
})];
|
|
116
|
+
case 8:
|
|
117
|
+
targetDbName = (_a.sent()).targetDbName;
|
|
118
|
+
return [4 /*yield*/, this.prompt({
|
|
119
|
+
type: "confirm",
|
|
120
|
+
name: "shouldContinue",
|
|
121
|
+
message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
122
|
+
})];
|
|
123
|
+
case 9:
|
|
124
|
+
shouldContinue = (_a.sent()).shouldContinue;
|
|
125
|
+
if (!shouldContinue) {
|
|
126
|
+
return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
targetPSQL = function (command) {
|
|
129
|
+
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(TARGET_INSTANCE_PORT, " --host=localhost --user=postgres -q ").concat(command);
|
|
130
|
+
};
|
|
131
|
+
copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(SOURCE_INSTANCE_PORT, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
|
|
132
|
+
_a.label = 10;
|
|
133
|
+
case 10:
|
|
134
|
+
_a.trys.push([10, , 12, 13]);
|
|
135
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
|
|
136
|
+
case 11:
|
|
137
|
+
_a.sent();
|
|
138
|
+
return [3 /*break*/, 13];
|
|
139
|
+
case 12:
|
|
140
|
+
sourceProxy.stop();
|
|
141
|
+
targetProxy.stop();
|
|
142
|
+
return [7 /*endfinally*/];
|
|
143
|
+
case 13: return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
})];
|
|
148
|
+
});
|
|
149
|
+
}); });
|
|
150
|
+
//# sourceMappingURL=commandRestoreDb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAG9C,IAAM,WAAW,GAAG,UAAO,QAAgB,EAAE,IAAY;;;;;gBACjD,KAAK,GAAG,IAAA,6BAAK,EACjB,qCAA8B,QAAQ,kBAAQ,IAAI,CAAE,EACpD,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;gBACF,uBAAuB;gB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IAAA,6BAAK,EAAC,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAA;;gCAAlE,SAAkE,CAAC;;;gCAEnE,WAAW,CAAC,IAAI,EAAE,CAAC;gCACnB,WAAW,CAAC,IAAI,EAAE,CAAC;;;;;;aAEtB,CAAC,EAAA;;KAAA,EAAC"}
|
|
@@ -35,46 +35,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
38
41
|
exports.__esModule = true;
|
|
39
|
-
|
|
40
|
-
var
|
|
42
|
+
//import commandInitProject from "./commandInitProject.old";
|
|
43
|
+
var commandRestoreDb_1 = __importDefault(require("./commandRestoreDb"));
|
|
41
44
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
case 0:
|
|
46
|
-
_b = (_a = vorpal
|
|
47
|
-
.command("copy-db <envComponent>", "replace local db with the one from an env"))
|
|
48
|
-
.autocomplete;
|
|
49
|
-
return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
|
|
50
|
-
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
|
|
51
|
-
.action(function copyDB(_a) {
|
|
52
|
-
var envComponent = _a.envComponent;
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var _b, env, componentName, _c, customerName, appName, shouldContinue;
|
|
55
|
-
return __generator(this, function (_d) {
|
|
56
|
-
switch (_d.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
_b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
|
|
59
|
-
return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
60
|
-
case 1:
|
|
61
|
-
_c = _d.sent(), customerName = _c.customerName, appName = _c.appName;
|
|
62
|
-
return [4 /*yield*/, this.prompt({
|
|
63
|
-
type: "confirm",
|
|
64
|
-
name: "shouldContinue",
|
|
65
|
-
message: "This will drop your local database and replace it with the remote one. Continue? 🤔 "
|
|
66
|
-
})];
|
|
67
|
-
case 2:
|
|
68
|
-
shouldContinue = (_d.sent()).shouldContinue;
|
|
69
|
-
if (!shouldContinue) {
|
|
70
|
-
return [2 /*return*/];
|
|
71
|
-
}
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
})];
|
|
77
|
-
}
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
(0, commandRestoreDb_1["default"])(vorpal);
|
|
47
|
+
return [2 /*return*/];
|
|
78
48
|
});
|
|
79
49
|
}); });
|
|
80
|
-
//# sourceMappingURL=
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA4D;AAE5D,wEAAkD;AAElD,sBAAe,UAAO,MAAc;;QAClC,IAAA,6BAAgB,EAAC,MAAM,CAAC,CAAC;;;KAC1B,EAAC"}
|
|
@@ -41,7 +41,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
exports.__esModule = true;
|
|
42
42
|
var commandCloudSqlProxy_1 = __importDefault(require("./commandCloudSqlProxy"));
|
|
43
43
|
var commandConfigSecrets_1 = __importDefault(require("./commandConfigSecrets"));
|
|
44
|
-
var commandCopyDB_1 = __importDefault(require("./commandCopyDB"));
|
|
45
44
|
var commandDeletePods_1 = __importDefault(require("./commandDeletePods"));
|
|
46
45
|
var commandDeleteProject_1 = __importDefault(require("./commandDeleteProject"));
|
|
47
46
|
var commandEnvVars_1 = __importDefault(require("./commandEnvVars"));
|
|
@@ -84,7 +83,6 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
84
83
|
(0, commandConfigSecrets_1["default"])(vorpal);
|
|
85
84
|
(0, commandSecretsClearBackups_1["default"])(vorpal);
|
|
86
85
|
(0, commandDeletePods_1["default"])(vorpal);
|
|
87
|
-
(0, commandCopyDB_1["default"])(vorpal);
|
|
88
86
|
(0, commandGetShell_1["default"])(vorpal);
|
|
89
87
|
(0, commandPortForward_1["default"])(vorpal);
|
|
90
88
|
(0, commandGitlabCi_1["default"])(vorpal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gFAA0D;AAC1D,gFAA0D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gFAA0D;AAC1D,gFAA0D;AAE1D,0EAAoD;AACpD,gFAA0D;AAC1D,oEAA8C;AAC9C,0FAAoE;AACpE,sEAAgD;AAChD,sEAAgD;AAChD,gEAA0C;AAC1C,4DAA4D;AAC5D,sEAAgD;AAChD,8EAAwD;AACxD,wEAAkD;AAClD,wFAAkE;AAClE,gFAA0D;AAC1D,oEAA8C;AAC9C,oEAA8C;AAC9C,sEAAgD;AAChD,8EAAwD;AACxD,4EAAsD;AACtD,4EAAsD;AACtD,kFAA4D;AAE5D,kFAA4D;AAC5D,4FAAsE;AAEtE,sBAAe,UAAO,MAAc;;QAClC,IAAA,yBAAY,EAAC,MAAM,CAAC,CAAC;QAErB,IAAA,2BAAc,EAAC,MAAM,CAAC,CAAC;QAEvB,IAAA,6BAAgB,EAAC,MAAM,CAAC,CAAC;QACzB,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QACxB,IAAA,gCAAmB,EAAC,MAAM,CAAC,CAAC;QAC5B,IAAA,iCAAoB,EAAC,MAAM,CAAC,CAAC;QAE7B,IAAA,iCAAoB,EAAC,MAAM,CAAC,CAAC;QAE7B,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QAExB,IAAA,qCAAwB,EAAC,MAAM,CAAC,CAAC;QAEjC,IAAA,+BAAkB,EAAC,MAAM,CAAC,CAAC;QAC3B,IAAA,kCAAqB,EAAC,MAAM,CAAC,CAAC;QAC9B,IAAA,iCAAoB,EAAC,MAAM,CAAC,CAAC;QAC7B,IAAA,2BAAc,EAAC,MAAM,CAAC,CAAC;QACvB,IAAA,2BAAc,EAAC,MAAM,CAAC,CAAC;QACvB,IAAA,kCAAqB,EAAC,MAAM,CAAC,CAAC;QAC9B,IAAA,iCAAoB,EAAC,MAAM,CAAC,CAAC;QAC7B,IAAA,uCAA0B,EAAC,MAAM,CAAC,CAAC;QACnC,IAAA,8BAAiB,EAAC,MAAM,CAAC,CAAC;QAE1B,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QACxB,IAAA,+BAAkB,EAAC,MAAM,CAAC,CAAC;QAE3B,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QAExB,IAAA,sCAAyB,EAAC,MAAM,CAAC,CAAC;QAClC,IAAA,gCAAmB,EAAC,MAAM,CAAC,CAAC;;;KAC7B,EAAC"}
|
|
@@ -40296,7 +40296,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
40296
40296
|
|
|
40297
40297
|
exports.__esModule = true;
|
|
40298
40298
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
40299
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
40299
|
+
exports.PIPELINE_IMAGE_TAG = "main-209fcf0b" || 0;
|
|
40300
40300
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
40301
40301
|
|
|
40302
40302
|
/***/ }),
|
|
@@ -52,6 +52,7 @@ var packageInfos_1 = __importDefault(__nccwpck_require__(71628));
|
|
|
52
52
|
var portForward_1 = __nccwpck_require__(34353);
|
|
53
53
|
var general_1 = __importDefault(__nccwpck_require__(3605));
|
|
54
54
|
var mongodb_1 = __importDefault(__nccwpck_require__(52934));
|
|
55
|
+
var cloudSQL_1 = __importDefault(__nccwpck_require__(6675));
|
|
55
56
|
var project_1 = __importDefault(__nccwpck_require__(44143));
|
|
56
57
|
var theStuffThatReallyMatters_1 = __importDefault(__nccwpck_require__(36265));
|
|
57
58
|
var verify_1 = __nccwpck_require__(98434);
|
|
@@ -76,6 +77,7 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
76
77
|
(0, verify_1.verify)(vorpal);
|
|
77
78
|
(0, general_1["default"])(vorpal);
|
|
78
79
|
(0, project_1["default"])(vorpal);
|
|
80
|
+
(0, cloudSQL_1["default"])(vorpal);
|
|
79
81
|
(0, mongodb_1["default"])(vorpal);
|
|
80
82
|
(0, theStuffThatReallyMatters_1["default"])(vorpal);
|
|
81
83
|
process.on("exit", function () {
|
|
@@ -89,6 +91,220 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
89
91
|
|
|
90
92
|
/***/ }),
|
|
91
93
|
|
|
94
|
+
/***/ 61833:
|
|
95
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
|
|
99
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
100
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
101
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
102
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
103
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
104
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
105
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
109
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
110
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
111
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
112
|
+
function step(op) {
|
|
113
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
+
while (_) try {
|
|
115
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
116
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
117
|
+
switch (op[0]) {
|
|
118
|
+
case 0: case 1: t = op; break;
|
|
119
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
120
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
121
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
122
|
+
default:
|
|
123
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
124
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
125
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
126
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
127
|
+
if (t[2]) _.ops.pop();
|
|
128
|
+
_.trys.pop(); continue;
|
|
129
|
+
}
|
|
130
|
+
op = body.call(thisArg, _);
|
|
131
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
132
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.__esModule = true;
|
|
136
|
+
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
137
|
+
var createProxy = function (instance, port) { return __awaiter(void 0, void 0, void 0, function () {
|
|
138
|
+
var proxy, stop;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
proxy = (0, child_process_promise_1.spawn)("cloud_sql_proxy -instances ".concat(instance, "=tcp:").concat(port), [], { shell: "bash" });
|
|
143
|
+
// wait until it starts
|
|
144
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)("echo -n \"Waiting for proxy\"\n until echo > /dev/tcp/localhost/".concat(port, "; do\n sleep 0.2\n echo -n \".\"\n done 2>/dev/null"), [], { shell: "bash" })];
|
|
145
|
+
case 1:
|
|
146
|
+
// wait until it starts
|
|
147
|
+
_a.sent();
|
|
148
|
+
stop = function () { return proxy.childProcess.kill(); };
|
|
149
|
+
process.on("beforeExit", stop);
|
|
150
|
+
return [2 /*return*/, {
|
|
151
|
+
stop: stop
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}); };
|
|
156
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
return [2 /*return*/, vorpal
|
|
159
|
+
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
160
|
+
.action(function restoreDb() {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var sourceInstance, SOURCE_INSTANCE_PORT, TARGET_INSTANCE_PORT, sourceProxy, sourcePassword, sourceDbName, targetInstance, targetProxy, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
switch (_a.label) {
|
|
165
|
+
case 0: return [4 /*yield*/, this.prompt({
|
|
166
|
+
type: "input",
|
|
167
|
+
name: "sourceInstance",
|
|
168
|
+
message: "Source instance (connection string)? 🤔 "
|
|
169
|
+
})];
|
|
170
|
+
case 1:
|
|
171
|
+
sourceInstance = (_a.sent()).sourceInstance;
|
|
172
|
+
SOURCE_INSTANCE_PORT = 54399;
|
|
173
|
+
TARGET_INSTANCE_PORT = 54499;
|
|
174
|
+
return [4 /*yield*/, createProxy(sourceInstance, SOURCE_INSTANCE_PORT)];
|
|
175
|
+
case 2:
|
|
176
|
+
sourceProxy = _a.sent();
|
|
177
|
+
return [4 /*yield*/, this.prompt({
|
|
178
|
+
type: "input",
|
|
179
|
+
name: "sourcePassword",
|
|
180
|
+
message: "Source Password? 🤔 "
|
|
181
|
+
})];
|
|
182
|
+
case 3:
|
|
183
|
+
sourcePassword = (_a.sent()).sourcePassword;
|
|
184
|
+
return [4 /*yield*/, this.prompt({
|
|
185
|
+
type: "input",
|
|
186
|
+
name: "sourceDbName",
|
|
187
|
+
message: "Source DB name? 🤔 "
|
|
188
|
+
})];
|
|
189
|
+
case 4:
|
|
190
|
+
sourceDbName = (_a.sent()).sourceDbName;
|
|
191
|
+
return [4 /*yield*/, this.prompt({
|
|
192
|
+
type: "input",
|
|
193
|
+
name: "targetInstance",
|
|
194
|
+
message: "Targe INSTANCE (connection string)? 🤔 "
|
|
195
|
+
})];
|
|
196
|
+
case 5:
|
|
197
|
+
targetInstance = (_a.sent()).targetInstance;
|
|
198
|
+
return [4 /*yield*/, createProxy(targetInstance, TARGET_INSTANCE_PORT)];
|
|
199
|
+
case 6:
|
|
200
|
+
targetProxy = _a.sent();
|
|
201
|
+
return [4 /*yield*/, this.prompt({
|
|
202
|
+
type: "input",
|
|
203
|
+
name: "targetPassword",
|
|
204
|
+
message: "Target Password? 🤔 "
|
|
205
|
+
})];
|
|
206
|
+
case 7:
|
|
207
|
+
targetPassword = (_a.sent()).targetPassword;
|
|
208
|
+
return [4 /*yield*/, this.prompt({
|
|
209
|
+
type: "input",
|
|
210
|
+
name: "targetDbName",
|
|
211
|
+
message: "Target DB name? 🤔 "
|
|
212
|
+
})];
|
|
213
|
+
case 8:
|
|
214
|
+
targetDbName = (_a.sent()).targetDbName;
|
|
215
|
+
return [4 /*yield*/, this.prompt({
|
|
216
|
+
type: "confirm",
|
|
217
|
+
name: "shouldContinue",
|
|
218
|
+
message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
219
|
+
})];
|
|
220
|
+
case 9:
|
|
221
|
+
shouldContinue = (_a.sent()).shouldContinue;
|
|
222
|
+
if (!shouldContinue) {
|
|
223
|
+
return [2 /*return*/];
|
|
224
|
+
}
|
|
225
|
+
targetPSQL = function (command) {
|
|
226
|
+
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(TARGET_INSTANCE_PORT, " --host=localhost --user=postgres -q ").concat(command);
|
|
227
|
+
};
|
|
228
|
+
copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(SOURCE_INSTANCE_PORT, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
|
|
229
|
+
_a.label = 10;
|
|
230
|
+
case 10:
|
|
231
|
+
_a.trys.push([10, , 12, 13]);
|
|
232
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
|
|
233
|
+
case 11:
|
|
234
|
+
_a.sent();
|
|
235
|
+
return [3 /*break*/, 13];
|
|
236
|
+
case 12:
|
|
237
|
+
sourceProxy.stop();
|
|
238
|
+
targetProxy.stop();
|
|
239
|
+
return [7 /*endfinally*/];
|
|
240
|
+
case 13: return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
})];
|
|
245
|
+
});
|
|
246
|
+
}); });
|
|
247
|
+
//# sourceMappingURL=commandRestoreDb.js.map
|
|
248
|
+
|
|
249
|
+
/***/ }),
|
|
250
|
+
|
|
251
|
+
/***/ 6675:
|
|
252
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
253
|
+
|
|
254
|
+
"use strict";
|
|
255
|
+
|
|
256
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
257
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
258
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
259
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
260
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
261
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
262
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
266
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
267
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
268
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
269
|
+
function step(op) {
|
|
270
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
271
|
+
while (_) try {
|
|
272
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
273
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
274
|
+
switch (op[0]) {
|
|
275
|
+
case 0: case 1: t = op; break;
|
|
276
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
277
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
278
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
279
|
+
default:
|
|
280
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
281
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
282
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
283
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
284
|
+
if (t[2]) _.ops.pop();
|
|
285
|
+
_.trys.pop(); continue;
|
|
286
|
+
}
|
|
287
|
+
op = body.call(thisArg, _);
|
|
288
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
289
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
293
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
294
|
+
};
|
|
295
|
+
exports.__esModule = true;
|
|
296
|
+
//import commandInitProject from "./commandInitProject.old";
|
|
297
|
+
var commandRestoreDb_1 = __importDefault(__nccwpck_require__(61833));
|
|
298
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
+
return __generator(this, function (_a) {
|
|
300
|
+
(0, commandRestoreDb_1["default"])(vorpal);
|
|
301
|
+
return [2 /*return*/];
|
|
302
|
+
});
|
|
303
|
+
}); });
|
|
304
|
+
//# sourceMappingURL=index.js.map
|
|
305
|
+
|
|
306
|
+
/***/ }),
|
|
307
|
+
|
|
92
308
|
/***/ 3605:
|
|
93
309
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
94
310
|
|
|
@@ -1664,93 +1880,6 @@ var templateObject_1;
|
|
|
1664
1880
|
|
|
1665
1881
|
/***/ }),
|
|
1666
1882
|
|
|
1667
|
-
/***/ 45420:
|
|
1668
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1669
|
-
|
|
1670
|
-
"use strict";
|
|
1671
|
-
|
|
1672
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1673
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1674
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1675
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1676
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1677
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1678
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1679
|
-
});
|
|
1680
|
-
};
|
|
1681
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
1682
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1683
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1684
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1685
|
-
function step(op) {
|
|
1686
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1687
|
-
while (_) try {
|
|
1688
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1689
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1690
|
-
switch (op[0]) {
|
|
1691
|
-
case 0: case 1: t = op; break;
|
|
1692
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
1693
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1694
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1695
|
-
default:
|
|
1696
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1697
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1698
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1699
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1700
|
-
if (t[2]) _.ops.pop();
|
|
1701
|
-
_.trys.pop(); continue;
|
|
1702
|
-
}
|
|
1703
|
-
op = body.call(thisArg, _);
|
|
1704
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1705
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
exports.__esModule = true;
|
|
1709
|
-
var getProjectConfig_1 = __nccwpck_require__(24146);
|
|
1710
|
-
var autocompletions_1 = __nccwpck_require__(41373);
|
|
1711
|
-
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1712
|
-
var _a, _b;
|
|
1713
|
-
return __generator(this, function (_c) {
|
|
1714
|
-
switch (_c.label) {
|
|
1715
|
-
case 0:
|
|
1716
|
-
_b = (_a = vorpal
|
|
1717
|
-
.command("copy-db <envComponent>", "replace local db with the one from an env"))
|
|
1718
|
-
.autocomplete;
|
|
1719
|
-
return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
|
|
1720
|
-
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
|
|
1721
|
-
.action(function copyDB(_a) {
|
|
1722
|
-
var envComponent = _a.envComponent;
|
|
1723
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1724
|
-
var _b, env, componentName, _c, customerName, appName, shouldContinue;
|
|
1725
|
-
return __generator(this, function (_d) {
|
|
1726
|
-
switch (_d.label) {
|
|
1727
|
-
case 0:
|
|
1728
|
-
_b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
|
|
1729
|
-
return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
1730
|
-
case 1:
|
|
1731
|
-
_c = _d.sent(), customerName = _c.customerName, appName = _c.appName;
|
|
1732
|
-
return [4 /*yield*/, this.prompt({
|
|
1733
|
-
type: "confirm",
|
|
1734
|
-
name: "shouldContinue",
|
|
1735
|
-
message: "This will drop your local database and replace it with the remote one. Continue? 🤔 "
|
|
1736
|
-
})];
|
|
1737
|
-
case 2:
|
|
1738
|
-
shouldContinue = (_d.sent()).shouldContinue;
|
|
1739
|
-
if (!shouldContinue) {
|
|
1740
|
-
return [2 /*return*/];
|
|
1741
|
-
}
|
|
1742
|
-
return [2 /*return*/];
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
});
|
|
1746
|
-
})];
|
|
1747
|
-
}
|
|
1748
|
-
});
|
|
1749
|
-
}); });
|
|
1750
|
-
//# sourceMappingURL=commandCopyDB.js.map
|
|
1751
|
-
|
|
1752
|
-
/***/ }),
|
|
1753
|
-
|
|
1754
1883
|
/***/ 77042:
|
|
1755
1884
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1756
1885
|
|
|
@@ -3889,7 +4018,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3889
4018
|
exports.__esModule = true;
|
|
3890
4019
|
var commandCloudSqlProxy_1 = __importDefault(__nccwpck_require__(23526));
|
|
3891
4020
|
var commandConfigSecrets_1 = __importDefault(__nccwpck_require__(80883));
|
|
3892
|
-
var commandCopyDB_1 = __importDefault(__nccwpck_require__(45420));
|
|
3893
4021
|
var commandDeletePods_1 = __importDefault(__nccwpck_require__(77042));
|
|
3894
4022
|
var commandDeleteProject_1 = __importDefault(__nccwpck_require__(75582));
|
|
3895
4023
|
var commandEnvVars_1 = __importDefault(__nccwpck_require__(31692));
|
|
@@ -3932,7 +4060,6 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3932
4060
|
(0, commandConfigSecrets_1["default"])(vorpal);
|
|
3933
4061
|
(0, commandSecretsClearBackups_1["default"])(vorpal);
|
|
3934
4062
|
(0, commandDeletePods_1["default"])(vorpal);
|
|
3935
|
-
(0, commandCopyDB_1["default"])(vorpal);
|
|
3936
4063
|
(0, commandGetShell_1["default"])(vorpal);
|
|
3937
4064
|
(0, commandPortForward_1["default"])(vorpal);
|
|
3938
4065
|
(0, commandGitlabCi_1["default"])(vorpal);
|
|
@@ -351247,7 +351374,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351247
351374
|
|
|
351248
351375
|
exports.__esModule = true;
|
|
351249
351376
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351250
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
351377
|
+
exports.PIPELINE_IMAGE_TAG = "main-209fcf0b" || 0;
|
|
351251
351378
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351252
351379
|
|
|
351253
351380
|
/***/ }),
|