kourou 1.4.0-dev.2 → 1.4.0-dev.4
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 +1 -1
- package/lib/commands/app/debug-proxy.js +3 -3
- package/lib/commands/app/doctor.js +10 -7
- package/lib/commands/app/scaffold.js +4 -4
- package/lib/commands/app/start-services.js +6 -6
- package/lib/commands/collection/create.js +1 -1
- package/lib/commands/collection/export.js +3 -3
- package/lib/commands/collection/import.js +3 -3
- package/lib/commands/collection/migrate.js +7 -8
- package/lib/commands/config/diff.js +5 -4
- package/lib/commands/document/search.js +1 -1
- package/lib/commands/es/aliases/cat.d.ts +2 -2
- package/lib/commands/es/aliases/cat.js +10 -10
- package/lib/commands/es/indices/cat.js +2 -2
- package/lib/commands/es/indices/get.js +1 -1
- package/lib/commands/es/indices/insert.js +1 -1
- package/lib/commands/es/migrate.js +8 -10
- package/lib/commands/es/snapshot/create-repository.js +1 -1
- package/lib/commands/es/snapshot/create.js +1 -1
- package/lib/commands/es/snapshot/list.js +1 -1
- package/lib/commands/es/snapshot/restore.js +1 -1
- package/lib/commands/file/decrypt.js +2 -2
- package/lib/commands/file/encrypt.js +2 -2
- package/lib/commands/file/test.js +2 -2
- package/lib/commands/import.js +3 -3
- package/lib/commands/index/export.js +4 -4
- package/lib/commands/index/import.js +3 -3
- package/lib/commands/instance/kill.js +8 -8
- package/lib/commands/instance/list.js +6 -1
- package/lib/commands/instance/logs.js +1 -1
- package/lib/commands/instance/spawn.js +10 -11
- package/lib/commands/paas/login.js +8 -11
- package/lib/commands/profile/export.js +3 -3
- package/lib/commands/profile/import.js +2 -2
- package/lib/commands/realtime/subscribe.js +2 -3
- package/lib/commands/redis/list-keys.js +1 -1
- package/lib/commands/role/export.js +3 -3
- package/lib/commands/role/import.js +2 -2
- package/lib/commands/sdk/execute.js +5 -4
- package/lib/commands/sdk/query.js +2 -2
- package/lib/commands/user/export-mappings.js +3 -3
- package/lib/commands/user/export.js +5 -5
- package/lib/commands/user/import-mappings.js +2 -2
- package/lib/commands/user/import.js +2 -2
- package/lib/commands/vault/add.js +3 -3
- package/lib/commands/vault/decrypt.js +2 -2
- package/lib/commands/vault/encrypt.js +3 -3
- package/lib/commands/vault/show.js +3 -3
- package/lib/commands/vault/test.js +1 -1
- package/lib/common.js +12 -12
- package/lib/hooks/command_not_found/api-action.js +5 -3
- package/lib/index.js +0 -1
- package/lib/support/PaasKommand.d.ts +1 -1
- package/lib/support/PaasKommand.js +2 -2
- package/lib/support/docker/checkPrerequisites.js +2 -3
- package/lib/support/dump-collection.js +7 -11
- package/lib/support/editor.js +2 -2
- package/lib/support/emoji.d.ts +17 -0
- package/lib/support/emoji.js +20 -0
- package/lib/support/execute.d.ts +1 -2
- package/lib/support/execute.js +2 -2
- package/lib/support/kuzzle.d.ts +0 -1
- package/lib/support/kuzzle.js +2 -2
- package/lib/support/migrate/providers/bulk.js +2 -3
- package/lib/support/migrate/providers/elasticsearch7.js +6 -8
- package/lib/support/migrate/providers/elasticsearch8.js +6 -8
- package/lib/support/migrate/providers/elasticsearchTypes.d.ts +1 -1
- package/lib/support/migrate/providers/file.js +7 -8
- package/lib/support/migrate/providers/index.js +6 -13
- package/lib/support/migrate/types.d.ts +1 -1
- package/lib/support/restore-collection.js +6 -7
- package/lib/support/restore-securities.js +31 -12
- package/package.json +16 -24
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
7
|
-
const http_1 =
|
|
8
|
-
const ws_1 =
|
|
7
|
+
const http_1 = tslib_1.__importDefault(require("http"));
|
|
8
|
+
const ws_1 = tslib_1.__importDefault(require("ws"));
|
|
9
9
|
// Add the proper headers and send the body in the response
|
|
10
10
|
function sendResponse(response, bodyObject) {
|
|
11
11
|
response.setHeader("Content-Type", "application/json; charset=UTF-8");
|
|
@@ -159,7 +159,6 @@ class DebugProxy extends common_1.Kommand {
|
|
|
159
159
|
await promise;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
exports.default = DebugProxy;
|
|
163
162
|
DebugProxy.description = "Create a Proxy Server that allows Chrome to debug Kuzzle remotely using the DebugController";
|
|
164
163
|
DebugProxy.flags = Object.assign({ help: command_1.flags.help(), forwardPort: command_1.flags.integer({
|
|
165
164
|
description: "Port of the forwarding server",
|
|
@@ -184,3 +183,4 @@ DebugProxy.flags = Object.assign({ help: command_1.flags.help(), forwardPort: co
|
|
|
184
183
|
DebugProxy.sdkOptions = {
|
|
185
184
|
protocol: "ws",
|
|
186
185
|
};
|
|
186
|
+
exports.default = DebugProxy;
|
|
@@ -6,7 +6,7 @@ const common_1 = require("../../common");
|
|
|
6
6
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
7
7
|
const sdk_es7_1 = require("sdk-es7");
|
|
8
8
|
const execute_1 = require("../../support/execute");
|
|
9
|
-
const lodash_1 =
|
|
9
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
10
10
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
11
11
|
class AppDoctor extends common_1.Kommand {
|
|
12
12
|
constructor() {
|
|
@@ -36,9 +36,9 @@ class AppDoctor extends common_1.Kommand {
|
|
|
36
36
|
async runSafe() {
|
|
37
37
|
const suggestions = [];
|
|
38
38
|
const [nodeVersion, adminExists, anonymous] = await Promise.all([
|
|
39
|
-
this.sdk.query({ controller: "debug", action: "nodeVersion"
|
|
39
|
+
this.sdk.query({ controller: "debug", action: "nodeVersion" }),
|
|
40
40
|
this.sdk.server.adminExists({}),
|
|
41
|
-
this.sdk.security.getRole("anonymous")
|
|
41
|
+
this.sdk.security.getRole("anonymous"),
|
|
42
42
|
]);
|
|
43
43
|
this.log(`----------------- DoKtor begin his job ! -----------------`);
|
|
44
44
|
this.log(`General checks`);
|
|
@@ -96,7 +96,7 @@ class AppDoctor extends common_1.Kommand {
|
|
|
96
96
|
this.logInfo("No config found for the server");
|
|
97
97
|
}
|
|
98
98
|
// Redis
|
|
99
|
-
if (
|
|
99
|
+
if ((await this.sdk.ms.ping()) === "PONG") {
|
|
100
100
|
this.logOk("Redis Memory Storage is running");
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
@@ -131,9 +131,12 @@ class AppDoctor extends common_1.Kommand {
|
|
|
131
131
|
this.logOk(`ElasticSearch Status: ${info.meta.connection.status}`);
|
|
132
132
|
const nodes = await client.cat.nodes({ format: "json" });
|
|
133
133
|
this.log(`ElasticSearch nodes`);
|
|
134
|
+
// oclif has no tabular output helper, console.table is the only option
|
|
135
|
+
// eslint-disable-next-line no-console
|
|
134
136
|
console.table(nodes.body.map((i) => ({ node_name: i.name, ip: i.ip })));
|
|
135
137
|
const indices = await client.cat.indices({ format: "json" });
|
|
136
138
|
this.log(`ElasticSearch indices`);
|
|
139
|
+
// eslint-disable-next-line no-console
|
|
137
140
|
console.table(indices.body.map((i) => ({
|
|
138
141
|
indice_name: i.index,
|
|
139
142
|
health: i.health,
|
|
@@ -141,7 +144,7 @@ class AppDoctor extends common_1.Kommand {
|
|
|
141
144
|
count_docs: i["docs.count"],
|
|
142
145
|
})));
|
|
143
146
|
}
|
|
144
|
-
catch (
|
|
147
|
+
catch (_a) {
|
|
145
148
|
this.logKo("=> Cannot show more information about ElasticSearch (cluster name, nodes, indices) because it's not accessible");
|
|
146
149
|
}
|
|
147
150
|
let librairies = [];
|
|
@@ -161,7 +164,7 @@ class AppDoctor extends common_1.Kommand {
|
|
|
161
164
|
this.logOk(` ${lib} is installed`);
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
|
-
catch (
|
|
167
|
+
catch (_b) {
|
|
165
168
|
this.logKo(` => ${lib} is not installed`);
|
|
166
169
|
notInstalled.push(lib);
|
|
167
170
|
}
|
|
@@ -182,7 +185,6 @@ class AppDoctor extends common_1.Kommand {
|
|
|
182
185
|
this.log(`-------------------------------------------------------------`);
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
|
-
exports.default = AppDoctor;
|
|
186
188
|
AppDoctor.description = "Analyze a Kuzzle application";
|
|
187
189
|
AppDoctor.flags = Object.assign({ help: command_1.flags.help(), elasticsearch: command_1.flags.string({
|
|
188
190
|
description: "Elasticsearch server URL",
|
|
@@ -190,3 +192,4 @@ AppDoctor.flags = Object.assign({ help: command_1.flags.help(), elasticsearch: c
|
|
|
190
192
|
}) }, kuzzle_1.kuzzleFlags);
|
|
191
193
|
AppDoctor.args = [];
|
|
192
194
|
AppDoctor.readStdin = true;
|
|
195
|
+
exports.default = AppDoctor;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const chalk_1 =
|
|
6
|
-
const listr_1 =
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const listr_1 = tslib_1.__importDefault(require("listr"));
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const execute_1 = require("../../support/execute");
|
|
9
9
|
class AppScaffold extends common_1.Kommand {
|
|
@@ -87,7 +87,7 @@ class AppScaffold extends common_1.Kommand {
|
|
|
87
87
|
const { stdout } = await (0, execute_1.execute)("gh", "auth", "token");
|
|
88
88
|
return stdout.trim() || undefined;
|
|
89
89
|
}
|
|
90
|
-
catch (
|
|
90
|
+
catch (_a) {
|
|
91
91
|
// GitHub CLI is not installed or not authenticated
|
|
92
92
|
return undefined;
|
|
93
93
|
}
|
|
@@ -152,7 +152,6 @@ class AppScaffold extends common_1.Kommand {
|
|
|
152
152
|
await (0, execute_1.execute)("rm", "-rf", `${destination}/.git`);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
exports.default = AppScaffold;
|
|
156
155
|
AppScaffold.initSdk = false;
|
|
157
156
|
AppScaffold.description = "Scaffolds a new Kuzzle application";
|
|
158
157
|
AppScaffold.flags = {
|
|
@@ -173,3 +172,4 @@ AppScaffold.args = [
|
|
|
173
172
|
required: true,
|
|
174
173
|
},
|
|
175
174
|
];
|
|
175
|
+
exports.default = AppScaffold;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
|
-
const path_1 =
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const chalk_1 =
|
|
8
|
-
const
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const emoji_1 = require("../../support/emoji");
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
const execute_1 = require("../../support/execute");
|
|
11
11
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
@@ -31,10 +31,10 @@ class AppStartServices extends common_1.Kommand {
|
|
|
31
31
|
? await (0, checkPrerequisites_1.checkPrerequisites)(this)
|
|
32
32
|
: true;
|
|
33
33
|
if (this.flags.check && successfullCheck) {
|
|
34
|
-
this.log(`\n${
|
|
34
|
+
this.log(`\n${emoji_1.emoji.okHand} Prerequisites are ${chalk_1.default.green.bold("OK")}!`);
|
|
35
35
|
}
|
|
36
36
|
else if (this.flags.check && !successfullCheck) {
|
|
37
|
-
throw new Error(`${
|
|
37
|
+
throw new Error(`${emoji_1.emoji.shrug} Your system doesn't satisfy all the prerequisites. Cannot run Kuzzle services.`);
|
|
38
38
|
}
|
|
39
39
|
this.log(chalk_1.default.grey(`\nWriting the Docker Compose file to ${docoFilename}...\n`));
|
|
40
40
|
(0, fs_1.writeFileSync)(docoFilename, kuzzleServicesFile);
|
|
@@ -55,7 +55,6 @@ class AppStartServices extends common_1.Kommand {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
exports.default = AppStartServices;
|
|
59
58
|
AppStartServices.initSdk = false;
|
|
60
59
|
AppStartServices.description = "Starts Kuzzle services (Elasticsearch and Redis)";
|
|
61
60
|
AppStartServices.flags = {
|
|
@@ -65,3 +64,4 @@ AppStartServices.flags = {
|
|
|
65
64
|
default: false,
|
|
66
65
|
}),
|
|
67
66
|
};
|
|
67
|
+
exports.default = AppStartServices;
|
|
@@ -14,7 +14,6 @@ class CollectionCreate extends common_1.Kommand {
|
|
|
14
14
|
this.logOk(`Collection "${this.args.index}":"${this.args.collection}" created`);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = CollectionCreate;
|
|
18
17
|
CollectionCreate.description = "Creates a collection";
|
|
19
18
|
CollectionCreate.flags = Object.assign({ help: command_1.flags.help() }, kuzzle_1.kuzzleFlags);
|
|
20
19
|
CollectionCreate.args = [
|
|
@@ -26,3 +25,4 @@ CollectionCreate.args = [
|
|
|
26
25
|
},
|
|
27
26
|
];
|
|
28
27
|
CollectionCreate.readStdin = true;
|
|
28
|
+
exports.default = CollectionCreate;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const path_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
9
9
|
const dump_collection_1 = require("../../support/dump-collection");
|
|
@@ -35,7 +35,6 @@ class CollectionExport extends common_1.Kommand {
|
|
|
35
35
|
this.logOk(`Collection ${this.args.index}:${this.args.collection} dumped`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.default = CollectionExport;
|
|
39
38
|
CollectionExport.keepAuth = true;
|
|
40
39
|
CollectionExport.description = "Exports a collection (JSONL format)";
|
|
41
40
|
CollectionExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
|
|
@@ -81,3 +80,4 @@ CollectionExport.examples = [
|
|
|
81
80
|
"kourou collection:export nyc-open-data yellow-taxi",
|
|
82
81
|
"kourou collection:export nyc-open-data yellow-taxi --query '{ term: { city: \"Saigon\" } }'",
|
|
83
82
|
];
|
|
83
|
+
exports.default = CollectionExport;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 =
|
|
5
|
-
const fs_1 =
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -19,7 +19,6 @@ class CollectionImport extends common_1.Kommand {
|
|
|
19
19
|
this.logOk(`Successfully imported ${total} documents from "${this.args.path}" in "${index}:${collection}"`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.default = CollectionImport;
|
|
23
22
|
CollectionImport.keepAuth = true;
|
|
24
23
|
CollectionImport.description = "Imports a collection";
|
|
25
24
|
CollectionImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), "batch-size": command_1.flags.string({
|
|
@@ -38,3 +37,4 @@ CollectionImport.flags = Object.assign(Object.assign({ help: command_1.flags.hel
|
|
|
38
37
|
CollectionImport.args = [
|
|
39
38
|
{ name: "path", description: "Dump directory path", required: true },
|
|
40
39
|
];
|
|
40
|
+
exports.default = CollectionImport;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 =
|
|
5
|
-
const fs_1 =
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -16,14 +16,12 @@ class CollectionMigrate extends common_1.Kommand {
|
|
|
16
16
|
}
|
|
17
17
|
getMigrationFunction() {
|
|
18
18
|
const migrationScript = fs_1.default.readFileSync(this.args.script, "utf8");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return migrationFunction;
|
|
19
|
+
// Evaluating user-supplied code is the whole point of the command: the
|
|
20
|
+
// script argument is the migration function itself.
|
|
21
|
+
// eslint-disable-next-line no-eval
|
|
22
|
+
return eval(`var f = ${migrationScript}; f`);
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
exports.default = CollectionMigrate;
|
|
27
25
|
CollectionMigrate.keepAuth = true;
|
|
28
26
|
CollectionMigrate.description = "Migrate a collection by transforming documents from a dump file and importing them into Kuzzle";
|
|
29
27
|
CollectionMigrate.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), "batch-size": command_1.flags.string({
|
|
@@ -41,3 +39,4 @@ CollectionMigrate.args = [
|
|
|
41
39
|
{ name: "script", description: "Migration script path", required: true },
|
|
42
40
|
{ name: "path", description: "Collection dump path", required: true },
|
|
43
41
|
];
|
|
42
|
+
exports.default = CollectionMigrate;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConfigKeyDiff = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const lodash_1 =
|
|
7
|
-
const fs_1 =
|
|
8
|
-
const strip_json_comments_1 =
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const strip_json_comments_1 = tslib_1.__importDefault(require("strip-json-comments"));
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
class ConfigKeyDiff extends common_1.Kommand {
|
|
11
11
|
async runSafe() {
|
|
@@ -52,7 +52,8 @@ class ConfigKeyDiff extends common_1.Kommand {
|
|
|
52
52
|
walkObject(_base[key], _object[key], [...path, key]);
|
|
53
53
|
}
|
|
54
54
|
else if (this.flags.values && _base[key] !== _object[key]) {
|
|
55
|
-
changes[[...path, key].join(".")] =
|
|
55
|
+
changes[[...path, key].join(".")] =
|
|
56
|
+
`value is "${_object[key]}" and was "${_base[key]}"`;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
};
|
|
@@ -31,7 +31,6 @@ class DocumentSearch extends common_1.Kommand {
|
|
|
31
31
|
this.logOk(`${result === null || result === void 0 ? void 0 : result.hits.length} documents fetched on a total of ${result === null || result === void 0 ? void 0 : result.total}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
exports.default = DocumentSearch;
|
|
35
34
|
DocumentSearch.description = "Searches for documents";
|
|
36
35
|
DocumentSearch.examples = [
|
|
37
36
|
"kourou document:search iot sensors '{ equals: { name: \"corona\" } }'",
|
|
@@ -58,3 +57,4 @@ DocumentSearch.args = [
|
|
|
58
57
|
{ name: "collection", description: "Collection name", required: true },
|
|
59
58
|
{ name: "query", description: "Search query in JS or JSON format." },
|
|
60
59
|
];
|
|
60
|
+
exports.default = DocumentSearch;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { flags } from
|
|
2
|
-
import { Kommand } from
|
|
1
|
+
import { flags } from "@oclif/command";
|
|
2
|
+
import { Kommand } from "../../../common";
|
|
3
3
|
export default class EsListAliases extends Kommand {
|
|
4
4
|
static initSdk: boolean;
|
|
5
5
|
static description: string;
|
|
@@ -7,30 +7,30 @@ class EsListAliases extends common_1.Kommand {
|
|
|
7
7
|
async runSafe() {
|
|
8
8
|
const esClient = new sdk_es7_1.Client({ node: this.flags.node });
|
|
9
9
|
try {
|
|
10
|
-
const { body } = await esClient.cat.aliases({ format:
|
|
10
|
+
const { body } = await esClient.cat.aliases({ format: "json" });
|
|
11
11
|
const elements = body
|
|
12
12
|
.map((e) => ({ index: e.index, alias: e.alias }))
|
|
13
|
-
.filter((e) =>
|
|
13
|
+
.filter((e) => this.flags.grep ? e.alias.match(new RegExp(this.flags.grep)) : true)
|
|
14
14
|
.sort();
|
|
15
15
|
this.log(JSON.stringify(elements, null, 2));
|
|
16
16
|
}
|
|
17
17
|
catch (error) {
|
|
18
|
-
|
|
18
|
+
this.logKo(error.message);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.default = EsListAliases;
|
|
23
22
|
EsListAliases.initSdk = false;
|
|
24
|
-
EsListAliases.description =
|
|
23
|
+
EsListAliases.description = "Lists available ES aliases";
|
|
25
24
|
EsListAliases.flags = {
|
|
26
25
|
help: command_1.flags.help(),
|
|
27
26
|
node: command_1.flags.string({
|
|
28
|
-
char:
|
|
29
|
-
description:
|
|
30
|
-
default:
|
|
27
|
+
char: "n",
|
|
28
|
+
description: "Elasticsearch server URL",
|
|
29
|
+
default: "http://localhost:9200",
|
|
31
30
|
}),
|
|
32
31
|
grep: command_1.flags.string({
|
|
33
|
-
char:
|
|
34
|
-
description:
|
|
32
|
+
char: "g",
|
|
33
|
+
description: "Match output with pattern",
|
|
35
34
|
}),
|
|
36
35
|
};
|
|
36
|
+
exports.default = EsListAliases;
|
|
@@ -16,11 +16,10 @@ class EsListIndex extends common_1.Kommand {
|
|
|
16
16
|
this.log(JSON.stringify(indexes, null, 2));
|
|
17
17
|
}
|
|
18
18
|
catch (error) {
|
|
19
|
-
|
|
19
|
+
this.logKo(error.message);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.default = EsListIndex;
|
|
24
23
|
EsListIndex.initSdk = false;
|
|
25
24
|
EsListIndex.description = "Lists available ES indexes";
|
|
26
25
|
EsListIndex.flags = {
|
|
@@ -35,3 +34,4 @@ EsListIndex.flags = {
|
|
|
35
34
|
description: "Match output with pattern",
|
|
36
35
|
}),
|
|
37
36
|
};
|
|
37
|
+
exports.default = EsListIndex;
|
|
@@ -14,7 +14,6 @@ class EsGet extends common_1.Kommand {
|
|
|
14
14
|
this.log(JSON.stringify(body, null, 2));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = EsGet;
|
|
18
17
|
EsGet.initSdk = false;
|
|
19
18
|
EsGet.description = "Gets a document from ES";
|
|
20
19
|
EsGet.flags = {
|
|
@@ -29,3 +28,4 @@ EsGet.args = [
|
|
|
29
28
|
{ name: "index", description: "ES Index name", required: true },
|
|
30
29
|
{ name: "id", description: "Document ID", required: true },
|
|
31
30
|
];
|
|
31
|
+
exports.default = EsGet;
|
|
@@ -15,7 +15,6 @@ class EsInsert extends common_1.Kommand {
|
|
|
15
15
|
this.logOk("Document successfully inserted.");
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
exports.default = EsInsert;
|
|
19
18
|
EsInsert.initSdk = false;
|
|
20
19
|
EsInsert.description = "Inserts a document directly into ES (will replace if exists)";
|
|
21
20
|
EsInsert.flags = {
|
|
@@ -36,3 +35,4 @@ EsInsert.flags = {
|
|
|
36
35
|
EsInsert.args = [
|
|
37
36
|
{ name: "index", description: "ES Index name", required: true },
|
|
38
37
|
];
|
|
38
|
+
exports.default = EsInsert;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const path_1 =
|
|
6
|
-
const cli_ux_1 =
|
|
7
|
-
const chalk_1 =
|
|
8
|
-
const
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const emoji_1 = require("../../support/emoji");
|
|
9
9
|
const fs_1 = require("fs");
|
|
10
10
|
const common_1 = require("../../common");
|
|
11
11
|
const providers_1 = require("../../support/migrate/providers");
|
|
@@ -34,9 +34,7 @@ class EsMigrate extends common_1.Kommand {
|
|
|
34
34
|
}
|
|
35
35
|
return new providers_1.File(provider);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
throw new Error(`Unknown provider type: ${provider}. You should provide either an Elasticsearch URL or a file path.`);
|
|
39
|
-
}
|
|
37
|
+
throw new Error(`Unknown provider type: ${provider}. You should provide either an Elasticsearch URL or a file path.`);
|
|
40
38
|
}
|
|
41
39
|
async migrateIndex(index) {
|
|
42
40
|
const indexDefinition = await this.src.getIndex(index);
|
|
@@ -89,8 +87,8 @@ class EsMigrate extends common_1.Kommand {
|
|
|
89
87
|
this.dest = await this.detectProviderType(this.flags.dest);
|
|
90
88
|
if (this.flags.reset) {
|
|
91
89
|
if (!this.flags["no-interactive"]) {
|
|
92
|
-
this.log(chalk_1.default.red(`${
|
|
93
|
-
await cli_ux_1.default.confirm(chalk_1.default.redBright(` ${
|
|
90
|
+
this.log(chalk_1.default.red(`${emoji_1.emoji.fire} Are you sure you want to reset ${chalk_1.default.bold(this.flags.dest)}?`));
|
|
91
|
+
await cli_ux_1.default.confirm(chalk_1.default.redBright(` ${emoji_1.emoji.fire} You will lose all the data stored in it (Type "yes" to confirm)`));
|
|
94
92
|
}
|
|
95
93
|
await this.dest.clear();
|
|
96
94
|
}
|
|
@@ -107,7 +105,6 @@ class EsMigrate extends common_1.Kommand {
|
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
|
-
exports.default = EsMigrate;
|
|
111
108
|
EsMigrate.initSdk = false;
|
|
112
109
|
EsMigrate.description = "Migrate all the index from an Elasticsearch (or a file) to another Elasticsearch";
|
|
113
110
|
EsMigrate.flags = {
|
|
@@ -164,3 +161,4 @@ EsMigrate.examples = [
|
|
|
164
161
|
"kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive",
|
|
165
162
|
"kourou es:migrate --src ./my-backup --dest http://elasticsearch:9200 --reset --batch-size 2000 --no-interactive --esVersion 8",
|
|
166
163
|
];
|
|
164
|
+
exports.default = EsMigrate;
|
|
@@ -21,7 +21,6 @@ class EsSnapshotsCreateRepository extends common_1.Kommand {
|
|
|
21
21
|
this.logOk(`Success ${JSON.stringify(response.body)}`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.default = EsSnapshotsCreateRepository;
|
|
25
24
|
EsSnapshotsCreateRepository.initSdk = false;
|
|
26
25
|
EsSnapshotsCreateRepository.description = "Create a FS snapshot repository inside an ES instance";
|
|
27
26
|
EsSnapshotsCreateRepository.flags = {
|
|
@@ -44,3 +43,4 @@ EsSnapshotsCreateRepository.args = [
|
|
|
44
43
|
required: true,
|
|
45
44
|
},
|
|
46
45
|
];
|
|
46
|
+
exports.default = EsSnapshotsCreateRepository;
|
|
@@ -26,7 +26,6 @@ class EsSnapshotsCreate extends common_1.Kommand {
|
|
|
26
26
|
this.logOk(`Success ${JSON.stringify(response.body)}`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
exports.default = EsSnapshotsCreate;
|
|
30
29
|
EsSnapshotsCreate.initSdk = false;
|
|
31
30
|
EsSnapshotsCreate.description = "Create a snapshot repository inside an ES instance";
|
|
32
31
|
EsSnapshotsCreate.flags = {
|
|
@@ -46,3 +45,4 @@ EsSnapshotsCreate.args = [
|
|
|
46
45
|
{ name: "repository", description: "ES repository name", required: true },
|
|
47
46
|
{ name: "name", description: "ES snapshot name", required: true },
|
|
48
47
|
];
|
|
48
|
+
exports.default = EsSnapshotsCreate;
|
|
@@ -28,7 +28,6 @@ class EsSnapshotsList extends common_1.Kommand {
|
|
|
28
28
|
this.logOk(`Success: ${JSON.stringify(result, null, 2)}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
exports.default = EsSnapshotsList;
|
|
32
31
|
EsSnapshotsList.initSdk = false;
|
|
33
32
|
EsSnapshotsList.description = "List all snapshot from a repository acknowledge by an ES instance";
|
|
34
33
|
EsSnapshotsList.flags = {
|
|
@@ -46,3 +45,4 @@ EsSnapshotsList.args = [
|
|
|
46
45
|
required: true,
|
|
47
46
|
},
|
|
48
47
|
];
|
|
48
|
+
exports.default = EsSnapshotsList;
|
|
@@ -30,7 +30,6 @@ class EsSnapshotsRestore extends common_1.Kommand {
|
|
|
30
30
|
this.logOk(`Success ${JSON.stringify(response.body)}`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.default = EsSnapshotsRestore;
|
|
34
33
|
EsSnapshotsRestore.initSdk = false;
|
|
35
34
|
EsSnapshotsRestore.description = "Restore a snapshot repository inside an ES instance";
|
|
36
35
|
EsSnapshotsRestore.flags = {
|
|
@@ -50,3 +49,4 @@ EsSnapshotsRestore.args = [
|
|
|
50
49
|
{ name: "repository", description: "ES repository name", required: true },
|
|
51
50
|
{ name: "name", description: "ES snapshot name", required: true },
|
|
52
51
|
];
|
|
52
|
+
exports.default = EsSnapshotsRestore;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileDecrypt = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const lodash_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
8
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
9
9
|
const common_1 = require("../../common");
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultEncrypt = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const lodash_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
8
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
9
9
|
const common_1 = require("../../common");
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileTest = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const lodash_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
8
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
9
9
|
const common_1 = require("../../common");
|
package/lib/commands/import.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const path_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
7
|
const common_1 = require("../common");
|
|
8
8
|
const kuzzle_1 = require("../support/kuzzle");
|
|
9
9
|
const restore_collection_1 = require("../support/restore-collection");
|
|
@@ -122,7 +122,6 @@ class Import extends common_1.Kommand {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
exports.default = Import;
|
|
126
125
|
Import.keepAuth = true;
|
|
127
126
|
Import.description = "Recursively imports dump files from a root directory";
|
|
128
127
|
Import.flags = Object.assign(Object.assign({ "preserve-anonymous": command_1.flags.boolean({
|
|
@@ -142,3 +141,4 @@ Import.args = [
|
|
|
142
141
|
required: true,
|
|
143
142
|
},
|
|
144
143
|
];
|
|
144
|
+
exports.default = Import;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 =
|
|
6
|
-
const cli_ux_1 =
|
|
7
|
-
const path_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
9
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
10
10
|
const dump_collection_1 = require("../../support/dump-collection");
|
|
@@ -39,7 +39,6 @@ class IndexExport extends common_1.Kommand {
|
|
|
39
39
|
this.logOk(`Index ${this.args.index} dumped`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.default = IndexExport;
|
|
43
42
|
IndexExport.keepAuth = true;
|
|
44
43
|
IndexExport.description = "Exports an index (JSONL or Kuzzle format)";
|
|
45
44
|
IndexExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
|
|
@@ -69,3 +68,4 @@ IndexExport.examples = [
|
|
|
69
68
|
"kourou index:export nyc-open-data",
|
|
70
69
|
'kourou index:export nyc-open-data --query \'{"range":{"_kuzzle_info.createdAt":{"gt":1632935638866}}}\'',
|
|
71
70
|
];
|
|
71
|
+
exports.default = IndexExport;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 =
|
|
5
|
-
const fs_1 =
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -34,7 +34,6 @@ class IndexImport extends common_1.Kommand {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
exports.default = IndexImport;
|
|
38
37
|
IndexImport.keepAuth = true;
|
|
39
38
|
IndexImport.description = "Imports an index (JSONL format)";
|
|
40
39
|
IndexImport.examples = [
|
|
@@ -55,3 +54,4 @@ IndexImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({})
|
|
|
55
54
|
IndexImport.args = [
|
|
56
55
|
{ name: "path", description: "Dump directory or file", required: true },
|
|
57
56
|
];
|
|
57
|
+
exports.default = IndexImport;
|