kourou 0.20.7 → 0.22.0
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 +92 -10
- package/lib/commands/app/scaffold.d.ts +3 -3
- package/lib/commands/app/scaffold.js +16 -69
- package/lib/commands/app/start-services.js +6 -4
- package/lib/commands/collection/export.d.ts +1 -0
- package/lib/commands/collection/export.js +3 -2
- package/lib/commands/collection/import.d.ts +1 -0
- package/lib/commands/collection/import.js +3 -2
- package/lib/commands/config/diff.js +3 -3
- package/lib/commands/es/migrate.d.ts +5 -2
- package/lib/commands/es/migrate.js +51 -30
- 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.d.ts +1 -0
- package/lib/commands/import.js +3 -2
- package/lib/commands/index/export.d.ts +1 -0
- package/lib/commands/index/export.js +4 -3
- package/lib/commands/index/import.d.ts +1 -0
- package/lib/commands/index/import.js +3 -2
- package/lib/commands/instance/kill.js +7 -5
- package/lib/commands/instance/logs.js +1 -1
- package/lib/commands/instance/spawn.js +8 -7
- package/lib/commands/paas/deploy.d.ts +18 -0
- package/lib/commands/paas/deploy.js +66 -0
- package/lib/commands/paas/init.d.ts +14 -0
- package/lib/commands/paas/init.js +31 -0
- package/lib/commands/paas/login.d.ts +15 -0
- package/lib/commands/paas/login.js +64 -0
- package/lib/commands/paas/logs.d.ts +17 -0
- package/lib/commands/paas/logs.js +54 -0
- package/lib/commands/profile/export.js +2 -2
- package/lib/commands/profile/import.js +1 -1
- package/lib/commands/realtime/subscribe.js +1 -1
- package/lib/commands/role/export.js +2 -2
- package/lib/commands/role/import.js +1 -1
- package/lib/commands/sdk/query.js +1 -1
- package/lib/commands/user/export-mappings.js +2 -2
- package/lib/commands/user/export.js +4 -4
- package/lib/commands/user/import-mappings.js +1 -1
- package/lib/commands/user/import.js +1 -1
- package/lib/commands/vault/add.js +2 -2
- package/lib/commands/vault/decrypt.js +2 -2
- package/lib/commands/vault/encrypt.js +2 -2
- package/lib/commands/vault/show.js +3 -3
- package/lib/commands/vault/test.js +1 -1
- package/lib/common.d.ts +6 -1
- package/lib/common.js +32 -15
- package/lib/hooks/command_not_found/api-action.js +10 -6
- package/lib/support/PaasKommand.d.ts +22 -0
- package/lib/support/PaasKommand.js +58 -0
- package/lib/support/dump-collection.js +4 -4
- package/lib/support/editor.js +2 -2
- package/lib/support/kuzzle.d.ts +3 -1
- package/lib/support/kuzzle.js +14 -10
- package/lib/support/restore-collection.js +3 -3
- package/lib/support/restore-securities.js +2 -2
- package/package.json +10 -11
- package/oclif.manifest.json +0 -1
- package/scripts/postinstall.sh +0 -10
- package/templates.tgz +0 -0
|
@@ -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");
|
|
@@ -33,6 +33,7 @@ class IndexImport extends common_1.Kommand {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
exports.default = IndexImport;
|
|
36
|
+
IndexImport.keepAuth = true;
|
|
36
37
|
IndexImport.description = 'Imports an index (JSONL format)';
|
|
37
38
|
IndexImport.examples = [
|
|
38
39
|
'kourou index:import ./dump/iot-data',
|
|
@@ -2,16 +2,18 @@
|
|
|
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 = tslib_1.__importDefault(require("path"));
|
|
5
6
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const inquirer_1 =
|
|
7
|
-
const cli_ux_1 =
|
|
7
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
8
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
8
9
|
const child_process_1 = require("child_process");
|
|
9
|
-
const chalk_1 =
|
|
10
|
-
const node_emoji_1 =
|
|
10
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
11
|
+
const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
|
|
11
12
|
const common_1 = require("../../common");
|
|
12
13
|
const execute_1 = require("../../support/execute");
|
|
13
14
|
class InstanceLogs extends common_1.Kommand {
|
|
14
15
|
async runSafe() {
|
|
16
|
+
this.createKourouDir();
|
|
15
17
|
let instance = this.flags.instance;
|
|
16
18
|
const all = this.flags.all;
|
|
17
19
|
const instancesList = await this.getInstancesList();
|
|
@@ -44,7 +46,7 @@ class InstanceLogs extends common_1.Kommand {
|
|
|
44
46
|
await this.killInstance(instance);
|
|
45
47
|
}
|
|
46
48
|
async killInstance(instanceName) {
|
|
47
|
-
const docoFilename =
|
|
49
|
+
const docoFilename = path_1.default.join(this.kourouDir, `kuzzle-${instanceName}.yml`);
|
|
48
50
|
cli_ux_1.default.action.start(`${node_emoji_1.default.get('boom')} Killing Kuzzle instance ${instanceName}`, undefined, {
|
|
49
51
|
stdout: true
|
|
50
52
|
});
|
|
@@ -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,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const net_1 = tslib_1.__importDefault(require("net"));
|
|
4
7
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const chalk_1 =
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
9
|
const child_process_1 = require("child_process");
|
|
7
|
-
const cli_ux_1 =
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const net_1 = (0, tslib_1.__importDefault)(require("net"));
|
|
11
|
-
const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
|
|
10
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
11
|
+
const listr_1 = tslib_1.__importDefault(require("listr"));
|
|
12
|
+
const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
|
|
12
13
|
const common_1 = require("../../common");
|
|
13
14
|
const execute_1 = require("../../support/execute");
|
|
14
15
|
const MIN_MAX_MAP_COUNT = 262144;
|
|
@@ -86,7 +87,7 @@ services:
|
|
|
86
87
|
class InstanceSpawn extends common_1.Kommand {
|
|
87
88
|
async runSafe() {
|
|
88
89
|
const portIndex = await this.findAvailablePort();
|
|
89
|
-
const docoFilename =
|
|
90
|
+
const docoFilename = path_1.default.join(this.kourouDir, `kuzzle-stack-${portIndex}.yml`);
|
|
90
91
|
const successfullCheck = this.flags.check ?
|
|
91
92
|
await this.checkPrerequisites() :
|
|
92
93
|
true;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import { PaasKommand } from '../../support/PaasKommand';
|
|
3
|
+
declare class PaasDeploy extends PaasKommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
token: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
};
|
|
10
|
+
static args: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}[];
|
|
15
|
+
runSafe(): Promise<void>;
|
|
16
|
+
getCredentials(): Promise<any>;
|
|
17
|
+
}
|
|
18
|
+
export default PaasDeploy;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const command_1 = require("@oclif/command");
|
|
6
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
7
|
+
const login_1 = tslib_1.__importDefault(require("./login"));
|
|
8
|
+
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
9
|
+
class PaasDeploy extends PaasKommand_1.PaasKommand {
|
|
10
|
+
async runSafe() {
|
|
11
|
+
const apiKey = await this.getCredentials();
|
|
12
|
+
await this.initPaasClient({ apiKey });
|
|
13
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
14
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
15
|
+
const [image, tag] = this.args.image.split(':');
|
|
16
|
+
this.logInfo(`Deploy application with image "${image}:${tag}"`);
|
|
17
|
+
await this.paas.query({
|
|
18
|
+
controller: 'application',
|
|
19
|
+
action: 'deploy',
|
|
20
|
+
environmentId: this.args.environment,
|
|
21
|
+
projectId: this.flags.project || this.getProject(),
|
|
22
|
+
applicationId: 'kuzzle',
|
|
23
|
+
body: {
|
|
24
|
+
image: {
|
|
25
|
+
name: image,
|
|
26
|
+
tag,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
this.logOk('Deployment in progress');
|
|
31
|
+
}
|
|
32
|
+
async getCredentials() {
|
|
33
|
+
const project = this.getProject();
|
|
34
|
+
const projectFile = this.fileProjectCredentials(project);
|
|
35
|
+
if (!fs_1.default.existsSync(projectFile)) {
|
|
36
|
+
this.log('');
|
|
37
|
+
const nextStep = await cli_ux_1.default.prompt('Cannot find credentials for this project. Do you want to login first? [Y/N]', { type: 'single' });
|
|
38
|
+
this.log('');
|
|
39
|
+
if (nextStep.toLowerCase().startsWith('y')) {
|
|
40
|
+
await login_1.default.run(['--project', project]);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
this.logKo('Aborting.');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, 'utf8'));
|
|
48
|
+
return credentials.apiKey;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
PaasDeploy.description = 'Deploy a new version of the application in the PaaS';
|
|
52
|
+
PaasDeploy.flags = {
|
|
53
|
+
help: command_1.flags.help(),
|
|
54
|
+
token: command_1.flags.string({
|
|
55
|
+
default: process.env.KUZZLE_PAAS_TOKEN,
|
|
56
|
+
description: 'Authentication token'
|
|
57
|
+
}),
|
|
58
|
+
project: command_1.flags.string({
|
|
59
|
+
description: 'Current PaaS project',
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
PaasDeploy.args = [
|
|
63
|
+
{ name: 'environment', description: 'Project environment name', required: true },
|
|
64
|
+
{ name: 'image', description: 'Image name and hash as myimage:mytag', required: true },
|
|
65
|
+
];
|
|
66
|
+
exports.default = PaasDeploy;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PaasKommand } from '../../support/PaasKommand';
|
|
2
|
+
declare class PaasInit extends PaasKommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
6
|
+
};
|
|
7
|
+
static args: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
runSafe(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export default PaasInit;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
+
const command_1 = require("@oclif/command");
|
|
7
|
+
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
8
|
+
class PaasInit extends PaasKommand_1.PaasKommand {
|
|
9
|
+
async runSafe() {
|
|
10
|
+
const packageJsonPath = path_1.default.join(process.cwd(), 'package.json');
|
|
11
|
+
if (!fs_1.default.existsSync(packageJsonPath)) {
|
|
12
|
+
throw new Error(`Cannot find package json in current directory. (${packageJsonPath})`);
|
|
13
|
+
}
|
|
14
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
15
|
+
this.logInfo('Add the "kuzzle" property inside project package.json.');
|
|
16
|
+
packageJson.kuzzle = {
|
|
17
|
+
paas: {
|
|
18
|
+
project: this.args.project,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
PaasInit.description = 'Initialize a PaaS project in current directory';
|
|
25
|
+
PaasInit.flags = {
|
|
26
|
+
help: command_1.flags.help(),
|
|
27
|
+
};
|
|
28
|
+
PaasInit.args = [
|
|
29
|
+
{ name: 'project', description: 'Kuzzle PaaS project name', required: true },
|
|
30
|
+
];
|
|
31
|
+
exports.default = PaasInit;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { flags } from '@oclif/command';
|
|
2
|
+
import { ApiKey } from 'kuzzle-sdk';
|
|
3
|
+
import { PaasKommand } from '../../support/PaasKommand';
|
|
4
|
+
declare class PaasLogin extends PaasKommand {
|
|
5
|
+
static description: string;
|
|
6
|
+
static flags: {
|
|
7
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
9
|
+
username: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
};
|
|
11
|
+
runSafe(): Promise<void>;
|
|
12
|
+
createProjectCredentials(apiKey: ApiKey): void;
|
|
13
|
+
authenticateNPM(username: string, password: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export default PaasLogin;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
|
+
const command_1 = require("@oclif/command");
|
|
7
|
+
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
8
|
+
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
10
|
+
class PaasLogin extends PaasKommand_1.PaasKommand {
|
|
11
|
+
async runSafe() {
|
|
12
|
+
this.createKourouDir();
|
|
13
|
+
const username = this.flags.username
|
|
14
|
+
? this.flags.username
|
|
15
|
+
: await cli_ux_1.default.prompt(` Username`);
|
|
16
|
+
const password = process.env.KUZZLE_PAAS_PASSWORD
|
|
17
|
+
? process.env.KUZZLE_PAAS_PASSWORD
|
|
18
|
+
: await cli_ux_1.default.prompt(` Password`, { type: 'hide' });
|
|
19
|
+
await this.initPaasClient({ username, password });
|
|
20
|
+
const apiKey = await this.paas.auth.createApiKey('Kourou PaaS API Key');
|
|
21
|
+
this.createProjectCredentials(apiKey);
|
|
22
|
+
await this.authenticateNPM(username, password);
|
|
23
|
+
this.logOk(`Successfully logged in as ${username}. Your Kuzzle Enterprise license is now enabled on this host.`);
|
|
24
|
+
}
|
|
25
|
+
createProjectCredentials(apiKey) {
|
|
26
|
+
const project = this.getProject();
|
|
27
|
+
const projectFile = this.fileProjectCredentials(project);
|
|
28
|
+
const credentials = {
|
|
29
|
+
apiKey: apiKey._source.token,
|
|
30
|
+
};
|
|
31
|
+
this.logInfo(`Saving credentials for project "${project}" in "${projectFile}".`);
|
|
32
|
+
fs_1.default.writeFileSync(projectFile, JSON.stringify(credentials, null, 2));
|
|
33
|
+
fs_1.default.chmodSync(projectFile, 0o600);
|
|
34
|
+
}
|
|
35
|
+
async authenticateNPM(username, password) {
|
|
36
|
+
const options = {
|
|
37
|
+
method: 'PUT',
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
'Accept': 'application/json',
|
|
41
|
+
'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`
|
|
42
|
+
},
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
name: username,
|
|
45
|
+
password,
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
const response = await (0, node_fetch_1.default)(`https://packages.paas.kuzzle.io/-/user/org.couchdb.user:${username}`, options);
|
|
49
|
+
const { token } = await response.json();
|
|
50
|
+
(0, child_process_1.spawnSync)('npm', ['config', 'set', '@kuzzleio:registry', 'https://packages.paas.kuzzle.io'], { stdio: 'inherit' });
|
|
51
|
+
(0, child_process_1.spawnSync)('npm', ['set', '//packages.paas.kuzzle.io/:_authToken', token], { stdio: 'inherit' });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
PaasLogin.description = 'Login for a PaaS project';
|
|
55
|
+
PaasLogin.flags = {
|
|
56
|
+
help: command_1.flags.help(),
|
|
57
|
+
project: command_1.flags.string({
|
|
58
|
+
description: 'Current PaaS project'
|
|
59
|
+
}),
|
|
60
|
+
username: command_1.flags.string({
|
|
61
|
+
description: 'PaaS username',
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
exports.default = PaasLogin;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flags } from "@oclif/command";
|
|
2
|
+
import { PaasKommand } from "../../support/PaasKommand";
|
|
3
|
+
declare class PaasLogs extends PaasKommand {
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
+
project: flags.IOptionFlag<string | undefined>;
|
|
8
|
+
};
|
|
9
|
+
static args: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
}[];
|
|
14
|
+
runSafe(): Promise<void>;
|
|
15
|
+
getCredentials(): Promise<any>;
|
|
16
|
+
}
|
|
17
|
+
export default PaasLogs;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const command_1 = require("@oclif/command");
|
|
5
|
+
const PaasKommand_1 = require("../../support/PaasKommand");
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
|
+
const login_1 = tslib_1.__importDefault(require("./login"));
|
|
8
|
+
const cli_ux_1 = require("cli-ux");
|
|
9
|
+
class PaasLogs extends PaasKommand_1.PaasKommand {
|
|
10
|
+
async runSafe() {
|
|
11
|
+
const apiKey = await this.getCredentials();
|
|
12
|
+
await this.initPaasClient({ apiKey });
|
|
13
|
+
const user = await this.paas.auth.getCurrentUser();
|
|
14
|
+
this.logInfo(`Logged as "${user._id}" for project "${this.flags.project || this.getProject()}"`);
|
|
15
|
+
const logs = await this.paas.query({
|
|
16
|
+
controller: 'application',
|
|
17
|
+
action: 'logs',
|
|
18
|
+
environmentId: this.args.environment,
|
|
19
|
+
projectId: this.flags.project || this.getProject(),
|
|
20
|
+
applicationId: this.args.application,
|
|
21
|
+
});
|
|
22
|
+
this.logOk(logs.result.join('\n '));
|
|
23
|
+
}
|
|
24
|
+
async getCredentials() {
|
|
25
|
+
const project = this.getProject();
|
|
26
|
+
const projectFile = this.fileProjectCredentials(project);
|
|
27
|
+
if (!fs_1.default.existsSync(projectFile)) {
|
|
28
|
+
this.log('');
|
|
29
|
+
const nextStep = await cli_ux_1.cli.prompt('Cannot find credentials for this project. Do you want to login first? [Y/N]', { type: 'single' });
|
|
30
|
+
this.log('');
|
|
31
|
+
if (nextStep.toLowerCase().startsWith('y')) {
|
|
32
|
+
await login_1.default.run(['--project', project]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.logKo('Aborting.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const credentials = JSON.parse(fs_1.default.readFileSync(projectFile, 'utf8'));
|
|
40
|
+
return credentials.apiKey;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
PaasLogs.description = 'Show logs of the targeted application';
|
|
44
|
+
PaasLogs.flags = {
|
|
45
|
+
help: command_1.flags.help(),
|
|
46
|
+
project: command_1.flags.string({
|
|
47
|
+
description: 'Current PaaS project'
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
PaasLogs.args = [
|
|
51
|
+
{ name: 'environment', description: 'Kuzzle PaaS environment', required: true },
|
|
52
|
+
{ name: 'application', description: 'Kuzzle PaaS application', required: true },
|
|
53
|
+
];
|
|
54
|
+
exports.default = PaasLogs;
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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 {
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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 {
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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 {
|
|
@@ -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");
|
|
@@ -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 {
|
|
@@ -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,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");
|
|
@@ -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.d.ts
CHANGED
|
@@ -8,16 +8,21 @@ export declare abstract class Kommand extends Command {
|
|
|
8
8
|
args: any;
|
|
9
9
|
flags: any;
|
|
10
10
|
static initSdk: boolean;
|
|
11
|
+
static disableLog: boolean;
|
|
11
12
|
static readStdin: boolean;
|
|
13
|
+
static keepAuth: boolean;
|
|
12
14
|
stdin: string | undefined;
|
|
13
15
|
sdkOptions: any;
|
|
16
|
+
protected kourouDir: string;
|
|
14
17
|
constructor(argv: any, config: any);
|
|
18
|
+
private get logSilent();
|
|
19
|
+
protected createKourouDir(): void;
|
|
15
20
|
printCommand(): void;
|
|
16
21
|
log(message?: string): void;
|
|
17
22
|
logOk(message: string): void;
|
|
18
23
|
logInfo(message: string): void;
|
|
19
24
|
logKo(message?: string): void;
|
|
20
|
-
run(): Promise<
|
|
25
|
+
run(): Promise<number>;
|
|
21
26
|
beforeConnect(): void;
|
|
22
27
|
runSafe(): Promise<void>;
|
|
23
28
|
/**
|