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
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstanceLogs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const path_1 =
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const inquirer_1 =
|
|
8
|
-
const cli_ux_1 =
|
|
7
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
10
|
-
const chalk_1 =
|
|
11
|
-
const
|
|
10
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
11
|
+
const emoji_1 = require("../../support/emoji");
|
|
12
12
|
const common_1 = require("../../common");
|
|
13
13
|
const execute_1 = require("../../support/execute");
|
|
14
14
|
class InstanceLogs extends common_1.Kommand {
|
|
@@ -47,7 +47,7 @@ class InstanceLogs extends common_1.Kommand {
|
|
|
47
47
|
}
|
|
48
48
|
async killInstance(instanceName) {
|
|
49
49
|
const docoFilename = path_1.default.join(this.kourouDir, `kuzzle-${instanceName}.yml`);
|
|
50
|
-
cli_ux_1.default.action.start(`${
|
|
50
|
+
cli_ux_1.default.action.start(`${emoji_1.emoji.boom} Killing Kuzzle instance ${instanceName}`, undefined, {
|
|
51
51
|
stdout: true,
|
|
52
52
|
});
|
|
53
53
|
const instanceKill = (0, child_process_1.spawn)("docker", [
|
|
@@ -60,10 +60,10 @@ class InstanceLogs extends common_1.Kommand {
|
|
|
60
60
|
]);
|
|
61
61
|
return new Promise((resolve) => instanceKill.on("close", (code) => {
|
|
62
62
|
if (code === 0) {
|
|
63
|
-
cli_ux_1.default.action.stop(chalk_1.default.green(`\n${
|
|
63
|
+
cli_ux_1.default.action.stop(chalk_1.default.green(`\n${emoji_1.emoji.thumbsUp} Instance ${instanceName} successfully killed.`));
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
cli_ux_1.default.action.stop(chalk_1.default.red(`\n${
|
|
66
|
+
cli_ux_1.default.action.stop(chalk_1.default.red(`\n${emoji_1.emoji.thumbsDown} Something went wrong whilde killing instance ${instanceName}.`));
|
|
67
67
|
}
|
|
68
68
|
resolve(undefined);
|
|
69
69
|
}));
|
|
@@ -35,7 +35,12 @@ class InstanceList extends common_1.Kommand {
|
|
|
35
35
|
c.match(/stack-\d{0,3}_redis_1/));
|
|
36
36
|
const stacks = [
|
|
37
37
|
...new Set(containersList.map((container) => container.split("_")[0])),
|
|
38
|
-
].sort((stackA, stackB) =>
|
|
38
|
+
].sort((stackA, stackB) => {
|
|
39
|
+
if (stackA > stackB) {
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
return stackA < stackB ? -1 : 0;
|
|
43
|
+
});
|
|
39
44
|
const formatedStacks = stacks.map((stack) => ({
|
|
40
45
|
name: stack,
|
|
41
46
|
status: "",
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.InstanceLogs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const inquirer_1 =
|
|
6
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const execute_1 = require("../../support/execute");
|
|
9
9
|
class InstanceLogs extends common_1.Kommand {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 =
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
const net_1 =
|
|
6
|
+
const net_1 = tslib_1.__importDefault(require("net"));
|
|
7
7
|
const command_1 = require("@oclif/command");
|
|
8
|
-
const chalk_1 =
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
9
|
const child_process_1 = require("child_process");
|
|
10
|
-
const cli_ux_1 =
|
|
11
|
-
const
|
|
10
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
11
|
+
const emoji_1 = require("../../support/emoji");
|
|
12
12
|
const common_1 = require("../../common");
|
|
13
13
|
const execute_1 = require("../../support/execute");
|
|
14
14
|
const checkPrerequisites_1 = require("../../support/docker/checkPrerequisites");
|
|
@@ -86,10 +86,10 @@ class InstanceSpawn extends common_1.Kommand {
|
|
|
86
86
|
? await (0, checkPrerequisites_1.checkPrerequisites)(this)
|
|
87
87
|
: true;
|
|
88
88
|
if (this.flags.check && successfullCheck) {
|
|
89
|
-
this.log(`\n${
|
|
89
|
+
this.log(`\n${emoji_1.emoji.okHand} Prerequisites are ${chalk_1.default.green.bold("OK")}!`);
|
|
90
90
|
}
|
|
91
91
|
else if (this.flags.check && !successfullCheck) {
|
|
92
|
-
throw new Error(`${
|
|
92
|
+
throw new Error(`${emoji_1.emoji.shrug} Your system doesn't satisfy all the prerequisites. Cannot run Kuzzle.`);
|
|
93
93
|
}
|
|
94
94
|
this.log(chalk_1.default.grey(`\nWriting docker compose file to ${docoFilename}...`));
|
|
95
95
|
(0, fs_1.writeFileSync)(docoFilename, this.generateDocoFile(this.flags.version, portIndex));
|
|
@@ -104,13 +104,13 @@ class InstanceSpawn extends common_1.Kommand {
|
|
|
104
104
|
"up",
|
|
105
105
|
"-d",
|
|
106
106
|
]);
|
|
107
|
-
cli_ux_1.default.action.start(` ${
|
|
107
|
+
cli_ux_1.default.action.start(` ${emoji_1.emoji.rocket} Kuzzle version ${this.flags.version} is launching`, undefined, {
|
|
108
108
|
stdout: true,
|
|
109
109
|
});
|
|
110
110
|
doco.on("close", (docoCode) => {
|
|
111
111
|
if (docoCode === 0) {
|
|
112
112
|
cli_ux_1.default.action.stop("done");
|
|
113
|
-
this.log(`\n${
|
|
113
|
+
this.log(`\n${emoji_1.emoji.thumbsUp} ${chalk_1.default.bold("Kuzzle is booting")} in the background right now.`);
|
|
114
114
|
this.log(chalk_1.default.grey("To watch the logs, run"));
|
|
115
115
|
this.log(chalk_1.default.grey(` docker compose -f ${docoFilename} -p stack-${portIndex} logs -f\n`));
|
|
116
116
|
this.log(` Kuzzle port: ${7512 + portIndex}`);
|
|
@@ -150,7 +150,6 @@ class InstanceSpawn extends common_1.Kommand {
|
|
|
150
150
|
}
|
|
151
151
|
async findAvailablePort() {
|
|
152
152
|
let i = 0;
|
|
153
|
-
// eslint-disable-next-line
|
|
154
153
|
while (true) {
|
|
155
154
|
if (await this.isPortAvailable(7512 + i)) {
|
|
156
155
|
return i;
|
|
@@ -159,7 +158,6 @@ class InstanceSpawn extends common_1.Kommand {
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
exports.default = InstanceSpawn;
|
|
163
161
|
InstanceSpawn.initSdk = false;
|
|
164
162
|
InstanceSpawn.description = "Spawn a new Kuzzle instance";
|
|
165
163
|
InstanceSpawn.flags = {
|
|
@@ -174,3 +172,4 @@ InstanceSpawn.flags = {
|
|
|
174
172
|
default: "2",
|
|
175
173
|
}),
|
|
176
174
|
};
|
|
175
|
+
exports.default = InstanceSpawn;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 =
|
|
5
|
-
const node_fetch_1 = (0, tslib_1.__importDefault)(require("node-fetch"));
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
5
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const cli_ux_1 =
|
|
6
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
8
7
|
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
9
8
|
const child_process_1 = require("child_process");
|
|
10
9
|
class PaasLogin extends PaasKommand_1.PaasKommand {
|
|
@@ -50,18 +49,16 @@ class PaasLogin extends PaasKommand_1.PaasKommand {
|
|
|
50
49
|
}),
|
|
51
50
|
};
|
|
52
51
|
const targetUrl = `https://${this.packagesHost}/-/user/org.couchdb.user:${username}`;
|
|
53
|
-
const response = await (
|
|
54
|
-
const json = await response.json();
|
|
52
|
+
const response = await fetch(targetUrl, options);
|
|
53
|
+
const json = (await response.json());
|
|
55
54
|
if (response.status !== 201) {
|
|
56
55
|
throw new Error(json.error);
|
|
57
56
|
}
|
|
58
57
|
const { token } = json;
|
|
59
|
-
(
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`https://${this.packagesHost}`,
|
|
64
|
-
], { stdio: "inherit" });
|
|
58
|
+
if (!token) {
|
|
59
|
+
throw new Error("The registry accepted the credentials but returned no authentication token");
|
|
60
|
+
}
|
|
61
|
+
(0, child_process_1.spawnSync)("npm", ["config", "set", "@kuzzleio:registry", `https://${this.packagesHost}`], { stdio: "inherit" });
|
|
65
62
|
(0, child_process_1.spawnSync)("npm", ["set", `//${this.packagesHost}/:_authToken`, token], {
|
|
66
63
|
stdio: "inherit",
|
|
67
64
|
});
|
|
@@ -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 fs_1 =
|
|
5
|
-
const path_1 =
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -35,7 +35,6 @@ class ProfileExport extends common_1.Kommand {
|
|
|
35
35
|
return profiles;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.default = ProfileExport;
|
|
39
38
|
ProfileExport.description = "Exports profiles";
|
|
40
39
|
ProfileExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
|
|
41
40
|
description: "Dump directory",
|
|
@@ -44,3 +43,4 @@ ProfileExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({
|
|
|
44
43
|
description: "Kuzzle protocol (http or websocket)",
|
|
45
44
|
default: "ws",
|
|
46
45
|
}) });
|
|
46
|
+
exports.default = ProfileExport;
|
|
@@ -2,7 +2,7 @@
|
|
|
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 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
8
8
|
const restore_securities_1 = require("../../support/restore-securities");
|
|
@@ -14,10 +14,10 @@ class ProfileImport extends common_1.Kommand {
|
|
|
14
14
|
this.logOk(`${count} profiles restored`);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = ProfileImport;
|
|
18
17
|
ProfileImport.description = "Imports profiles";
|
|
19
18
|
ProfileImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
|
|
20
19
|
description: "Kuzzle protocol (http or websocket)",
|
|
21
20
|
default: "ws",
|
|
22
21
|
}) });
|
|
23
22
|
ProfileImport.args = [{ name: "path", description: "Dump file", required: true }];
|
|
23
|
+
exports.default = ProfileImport;
|
|
@@ -2,7 +2,7 @@
|
|
|
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 lodash_1 =
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
8
8
|
class RealtimeSubscribe extends common_1.Kommand {
|
|
@@ -29,11 +29,9 @@ class RealtimeSubscribe extends common_1.Kommand {
|
|
|
29
29
|
volatile: this.parseJs(this.flags.volatile),
|
|
30
30
|
});
|
|
31
31
|
this.logInfo(`Waiting for realtime notifications on "${this.args.index}":"${this.args.collection}" ...`);
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
33
32
|
await new Promise(() => { });
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
exports.default = RealtimeSubscribe;
|
|
37
35
|
RealtimeSubscribe.description = "Subscribes to realtime notifications";
|
|
38
36
|
RealtimeSubscribe.examples = [
|
|
39
37
|
"kourou realtime:subscribe iot-data sensors",
|
|
@@ -66,3 +64,4 @@ RealtimeSubscribe.args = [
|
|
|
66
64
|
{ name: "filters", description: "Set of Koncorde filters" },
|
|
67
65
|
];
|
|
68
66
|
RealtimeSubscribe.readStdin = true;
|
|
67
|
+
exports.default = RealtimeSubscribe;
|
|
@@ -39,7 +39,6 @@ class RedisListKeys extends common_1.Kommand {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.default = RedisListKeys;
|
|
43
42
|
RedisListKeys.description = "Lists keys stored in Redis";
|
|
44
43
|
RedisListKeys.flags = Object.assign({ help: command_1.flags.help(), remove: command_1.flags.boolean({
|
|
45
44
|
description: "Remove matching keys",
|
|
@@ -63,3 +62,4 @@ RedisListKeys.examples = [
|
|
|
63
62
|
'kourou redis:list-keys "counters/*" --remove',
|
|
64
63
|
];
|
|
65
64
|
RedisListKeys.readStdin = true;
|
|
65
|
+
exports.default = RedisListKeys;
|
|
@@ -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 fs_1 =
|
|
5
|
-
const path_1 =
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
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 RoleDump extends common_1.Kommand {
|
|
|
34
34
|
return roles;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
exports.default = RoleDump;
|
|
38
37
|
RoleDump.description = "Exports roles";
|
|
39
38
|
RoleDump.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
|
|
40
39
|
description: "Dump directory",
|
|
@@ -43,3 +42,4 @@ RoleDump.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), p
|
|
|
43
42
|
description: "Kuzzle protocol (http or websocket)",
|
|
44
43
|
default: "ws",
|
|
45
44
|
}) });
|
|
45
|
+
exports.default = RoleDump;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 =
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -14,7 +14,6 @@ class RoleImport extends common_1.Kommand {
|
|
|
14
14
|
this.logOk(`${count} roles restored`);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = RoleImport;
|
|
18
17
|
RoleImport.description = "Import roles";
|
|
19
18
|
RoleImport.flags = Object.assign(Object.assign({ "preserve-anonymous": command_1.flags.boolean({
|
|
20
19
|
description: "Preserve anonymous rights",
|
|
@@ -24,3 +23,4 @@ RoleImport.flags = Object.assign(Object.assign({ "preserve-anonymous": command_1
|
|
|
24
23
|
default: "ws",
|
|
25
24
|
}) });
|
|
26
25
|
RoleImport.args = [{ name: "path", description: "Dump file", required: true }];
|
|
26
|
+
exports.default = RoleImport;
|
|
@@ -6,8 +6,8 @@ const lodash_1 = require("lodash");
|
|
|
6
6
|
const editor_1 = require("../../support/editor");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
9
|
-
const typescript_1 =
|
|
10
|
-
const node_vm_1 =
|
|
9
|
+
const typescript_1 = tslib_1.__importDefault(require("typescript"));
|
|
10
|
+
const node_vm_1 = tslib_1.__importDefault(require("node:vm"));
|
|
11
11
|
class SdkExecute extends common_1.Kommand {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -20,7 +20,9 @@ class SdkExecute extends common_1.Kommand {
|
|
|
20
20
|
}
|
|
21
21
|
catch (e) {
|
|
22
22
|
if (e.name === "SyntaxError") {
|
|
23
|
-
const result = typescript_1.default.transpileModule(this.code, {
|
|
23
|
+
const result = typescript_1.default.transpileModule(this.code, {
|
|
24
|
+
compilerOptions: { module: typescript_1.default.ModuleKind.CommonJS },
|
|
25
|
+
});
|
|
24
26
|
this.code = result.outputText;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -81,7 +83,6 @@ ${this.getVariables()}
|
|
|
81
83
|
}
|
|
82
84
|
if (!userError && (this.haveSubscription || this.flags["keep-alive"])) {
|
|
83
85
|
this.logInfo("Keep alive for realtime notifications ...");
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
85
86
|
await new Promise(() => { });
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
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 lodash_1 =
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
8
8
|
class SdkQuery extends common_1.Kommand {
|
|
@@ -34,7 +34,7 @@ class SdkQuery extends common_1.Kommand {
|
|
|
34
34
|
const display = this.flags.display === ""
|
|
35
35
|
? response
|
|
36
36
|
: lodash_1.default.get(response, this.flags.display);
|
|
37
|
-
|
|
37
|
+
this.log(JSON.stringify(display, null, 2));
|
|
38
38
|
this.logOk(`Successfully executed "${controller}:${action}"`);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -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 fs_1 =
|
|
5
|
-
const path_1 =
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -20,7 +20,6 @@ class UserExportMappings extends common_1.Kommand {
|
|
|
20
20
|
this.logOk("Users collection mappings dumped");
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.default = UserExportMappings;
|
|
24
23
|
UserExportMappings.description = "Exports users collection mappings to JSON.";
|
|
25
24
|
UserExportMappings.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
|
|
26
25
|
description: "Dump directory",
|
|
@@ -29,3 +28,4 @@ UserExportMappings.flags = Object.assign(Object.assign({ help: command_1.flags.h
|
|
|
29
28
|
description: "Kuzzle protocol (http or websocket)",
|
|
30
29
|
default: "ws",
|
|
31
30
|
}) });
|
|
31
|
+
exports.default = UserExportMappings;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 =
|
|
5
|
-
const lodash_1 =
|
|
6
|
-
const crypto_1 =
|
|
7
|
-
const path_1 =
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
|
+
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
const command_1 = require("@oclif/command");
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
@@ -67,7 +67,6 @@ class UserExport extends common_1.Kommand {
|
|
|
67
67
|
return users;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
exports.default = UserExport;
|
|
71
70
|
UserExport.description = `
|
|
72
71
|
Exports users to JSON.
|
|
73
72
|
|
|
@@ -110,3 +109,4 @@ UserExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}),
|
|
|
110
109
|
description: "Kuzzle protocol (http or websocket)",
|
|
111
110
|
default: "ws",
|
|
112
111
|
}) });
|
|
112
|
+
exports.default = UserExport;
|
|
@@ -2,7 +2,7 @@
|
|
|
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 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
8
8
|
class UserImportMappings extends common_1.Kommand {
|
|
@@ -14,10 +14,10 @@ class UserImportMappings extends common_1.Kommand {
|
|
|
14
14
|
this.logOk("Users collecction mappings restored");
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = UserImportMappings;
|
|
18
17
|
UserImportMappings.description = "Imports users collection mappings";
|
|
19
18
|
UserImportMappings.flags = Object.assign(Object.assign({ help: command_1.flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
|
|
20
19
|
description: "Kuzzle protocol (http or websocket)",
|
|
21
20
|
default: "ws",
|
|
22
21
|
}) });
|
|
23
22
|
UserImportMappings.args = [{ name: "path", description: "Dump file", required: true }];
|
|
23
|
+
exports.default = UserImportMappings;
|
|
@@ -2,7 +2,7 @@
|
|
|
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 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const common_1 = require("../../common");
|
|
7
7
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
8
8
|
const restore_securities_1 = require("../../support/restore-securities");
|
|
@@ -14,10 +14,10 @@ class UserImport extends common_1.Kommand {
|
|
|
14
14
|
this.logOk(`${count} users restored`);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.default = UserImport;
|
|
18
17
|
UserImport.description = "Imports users";
|
|
19
18
|
UserImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
|
|
20
19
|
description: "Kuzzle protocol (http or websocket)",
|
|
21
20
|
default: "ws",
|
|
22
21
|
}) });
|
|
23
22
|
UserImport.args = [{ name: "path", description: "Dump file", required: true }];
|
|
23
|
+
exports.default = UserImport;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultAdd = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const lodash_1 =
|
|
7
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
8
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
class VaultAdd extends common_1.Kommand {
|
|
@@ -23,7 +23,7 @@ class VaultAdd extends common_1.Kommand {
|
|
|
23
23
|
try {
|
|
24
24
|
cryptonomicon.decryptObject(encryptedSecrets);
|
|
25
25
|
}
|
|
26
|
-
catch (
|
|
26
|
+
catch (_a) {
|
|
27
27
|
throw new Error("Trying to add a secret encrypted with a different key");
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VaultDecrypt = 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,9 +2,9 @@
|
|
|
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 path_1 =
|
|
7
|
-
const lodash_1 =
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
8
|
const command_1 = require("@oclif/command");
|
|
9
9
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
10
10
|
const common_1 = require("../../common");
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VaultShow = 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 chalk_1 =
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
9
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
10
10
|
const common_1 = require("../../common");
|
|
11
11
|
class VaultShow extends common_1.Kommand {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VaultTest = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const lodash_1 =
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const kuzzle_vault_1 = require("kuzzle-vault");
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
9
|
class VaultTest extends common_1.Kommand {
|
package/lib/common.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Kommand = void 0;
|
|
4
|
+
exports.pickValues = pickValues;
|
|
5
|
+
exports.formatValueForCSV = formatValueForCSV;
|
|
4
6
|
const tslib_1 = require("tslib");
|
|
5
|
-
const os_1 =
|
|
6
|
-
const fs_1 =
|
|
7
|
-
const path_1 =
|
|
7
|
+
const os_1 = tslib_1.__importDefault(require("os"));
|
|
8
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
9
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
10
|
const command_1 = require("@oclif/command");
|
|
9
|
-
const chalk_1 =
|
|
10
|
-
const
|
|
11
|
-
const get_1 =
|
|
12
|
-
const isObject_1 =
|
|
13
|
-
const kepler_companion_1 =
|
|
11
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
12
|
+
const emoji_1 = require("./support/emoji");
|
|
13
|
+
const get_1 = tslib_1.__importDefault(require("lodash/get"));
|
|
14
|
+
const isObject_1 = tslib_1.__importDefault(require("lodash/isObject"));
|
|
15
|
+
const kepler_companion_1 = tslib_1.__importDefault(require("kepler-companion"));
|
|
14
16
|
const kuzzle_1 = require("./support/kuzzle");
|
|
15
17
|
const editor_1 = require("./support/editor");
|
|
16
18
|
class Kommand extends command_1.Command {
|
|
@@ -41,7 +43,7 @@ class Kommand extends command_1.Command {
|
|
|
41
43
|
.split("\n")
|
|
42
44
|
.filter((line) => line.length > 0)[0];
|
|
43
45
|
this.log("");
|
|
44
|
-
this.log(`${chalk_1.default.blue.bold(`${
|
|
46
|
+
this.log(`${chalk_1.default.blue.bold(`${emoji_1.emoji.rocket} Kourou`)} - ${shortDescription}`);
|
|
45
47
|
this.log("");
|
|
46
48
|
}
|
|
47
49
|
log(message) {
|
|
@@ -188,7 +190,6 @@ Kommand.keepAuth = false;
|
|
|
188
190
|
function pickValues(object, fields) {
|
|
189
191
|
return fields.map((f) => formatValueForCSV((0, get_1.default)(object, f)));
|
|
190
192
|
}
|
|
191
|
-
exports.pickValues = pickValues;
|
|
192
193
|
/**
|
|
193
194
|
* Formats the value for correct CSV output, avoiding to return
|
|
194
195
|
* values that would badly serialize in CSV.
|
|
@@ -202,4 +203,3 @@ function formatValueForCSV(value) {
|
|
|
202
203
|
}
|
|
203
204
|
return value;
|
|
204
205
|
}
|
|
205
|
-
exports.formatValueForCSV = formatValueForCSV;
|
|
@@ -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 chalk_1 =
|
|
5
|
-
const query_1 =
|
|
4
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
5
|
+
const query_1 = tslib_1.__importDefault(require("../../commands/sdk/query"));
|
|
6
6
|
/**
|
|
7
7
|
* Hooks that run the corresponding API action with sdk:query.
|
|
8
8
|
*
|
|
@@ -28,11 +28,13 @@ const query_1 = (0, tslib_1.__importDefault)(require("../../commands/sdk/query")
|
|
|
28
28
|
* - kourou document:create index collection foobar-1 '{}'
|
|
29
29
|
* - kourou bulk:import index collection '{bulkData: []}'
|
|
30
30
|
*/
|
|
31
|
-
const hook = async function (opts) {
|
|
31
|
+
const hook = async function apiActionHook(opts) {
|
|
32
32
|
const [controller, action] = opts.id.split(":");
|
|
33
33
|
if (!controller || !action) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
+
// oclif binds the hook to its own context before calling it
|
|
37
|
+
// eslint-disable-next-line no-invalid-this
|
|
36
38
|
this.log(chalk_1.default.yellow(`[ℹ] Unknown command "${opts.id}", fallback to API action`));
|
|
37
39
|
const args = process.argv.slice(3);
|
|
38
40
|
const commandArgs = [opts.id];
|
package/lib/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PaasKommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
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("./kuzzle");
|
|
9
9
|
class PaasKommand extends common_1.Kommand {
|