kourou 0.20.7 → 0.21.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 +70 -10
- package/package.json +7 -11
- package/lib/commands/api-key/check.d.ts +0 -24
- package/lib/commands/api-key/check.js +0 -25
- package/lib/commands/api-key/create.d.ts +0 -26
- package/lib/commands/api-key/create.js +0 -30
- package/lib/commands/api-key/delete.d.ts +0 -24
- package/lib/commands/api-key/delete.js +0 -21
- package/lib/commands/api-key/search.d.ts +0 -24
- package/lib/commands/api-key/search.js +0 -39
- package/lib/commands/app/scaffold.d.ts +0 -17
- package/lib/commands/app/scaffold.js +0 -94
- package/lib/commands/app/start-services.d.ts +0 -11
- package/lib/commands/app/start-services.js +0 -108
- package/lib/commands/collection/create.d.ts +0 -27
- package/lib/commands/collection/create.js +0 -25
- package/lib/commands/collection/export.d.ts +0 -30
- package/lib/commands/collection/export.js +0 -74
- package/lib/commands/collection/import.d.ts +0 -26
- package/lib/commands/collection/import.js +0 -39
- package/lib/commands/config/diff.d.ts +0 -17
- package/lib/commands/config/diff.js +0 -80
- package/lib/commands/document/search.d.ts +0 -33
- package/lib/commands/document/search.js +0 -60
- package/lib/commands/es/indices/cat.d.ts +0 -12
- package/lib/commands/es/indices/cat.js +0 -37
- package/lib/commands/es/indices/get.d.ts +0 -16
- package/lib/commands/es/indices/get.js +0 -31
- package/lib/commands/es/indices/insert.d.ts +0 -18
- package/lib/commands/es/indices/insert.js +0 -38
- package/lib/commands/es/migrate.d.ts +0 -20
- package/lib/commands/es/migrate.js +0 -116
- package/lib/commands/es/snapshot/create-repository.d.ts +0 -17
- package/lib/commands/es/snapshot/create-repository.js +0 -42
- package/lib/commands/es/snapshot/create.d.ts +0 -16
- package/lib/commands/es/snapshot/create.js +0 -32
- package/lib/commands/es/snapshot/list.d.ts +0 -16
- package/lib/commands/es/snapshot/list.js +0 -44
- package/lib/commands/file/decrypt.d.ts +0 -18
- package/lib/commands/file/decrypt.js +0 -64
- package/lib/commands/file/encrypt.d.ts +0 -18
- package/lib/commands/file/encrypt.js +0 -64
- package/lib/commands/file/test.d.ts +0 -16
- package/lib/commands/file/test.js +0 -52
- package/lib/commands/import.d.ts +0 -26
- package/lib/commands/import.js +0 -132
- package/lib/commands/index/export.d.ts +0 -27
- package/lib/commands/index/export.js +0 -58
- package/lib/commands/index/import.d.ts +0 -26
- package/lib/commands/index/import.js +0 -54
- package/lib/commands/instance/kill.d.ts +0 -13
- package/lib/commands/instance/kill.js +0 -99
- package/lib/commands/instance/list.d.ts +0 -7
- package/lib/commands/instance/list.js +0 -73
- package/lib/commands/instance/logs.d.ts +0 -13
- package/lib/commands/instance/logs.js +0 -69
- package/lib/commands/instance/spawn.d.ts +0 -16
- package/lib/commands/instance/spawn.js +0 -232
- package/lib/commands/profile/export.d.ts +0 -19
- package/lib/commands/profile/export.js +0 -46
- package/lib/commands/profile/import.d.ts +0 -22
- package/lib/commands/profile/import.js +0 -25
- package/lib/commands/realtime/subscribe.d.ts +0 -34
- package/lib/commands/realtime/subscribe.js +0 -68
- package/lib/commands/redis/list-keys.d.ts +0 -27
- package/lib/commands/redis/list-keys.js +0 -61
- package/lib/commands/role/export.d.ts +0 -19
- package/lib/commands/role/export.js +0 -45
- package/lib/commands/role/import.d.ts +0 -23
- package/lib/commands/role/import.js +0 -28
- package/lib/commands/sdk/execute.d.ts +0 -31
- package/lib/commands/sdk/execute.js +0 -122
- package/lib/commands/sdk/query.d.ts +0 -32
- package/lib/commands/sdk/query.js +0 -123
- package/lib/commands/user/export-mappings.d.ts +0 -18
- package/lib/commands/user/export-mappings.js +0 -31
- package/lib/commands/user/export.d.ts +0 -25
- package/lib/commands/user/export.js +0 -111
- package/lib/commands/user/import-mappings.d.ts +0 -22
- package/lib/commands/user/import-mappings.js +0 -23
- package/lib/commands/user/import.d.ts +0 -22
- package/lib/commands/user/import.js +0 -25
- package/lib/commands/vault/add.d.ts +0 -16
- package/lib/commands/vault/add.js +0 -59
- package/lib/commands/vault/decrypt.d.ts +0 -18
- package/lib/commands/vault/decrypt.js +0 -71
- package/lib/commands/vault/encrypt.d.ts +0 -18
- package/lib/commands/vault/encrypt.js +0 -83
- package/lib/commands/vault/show.d.ts +0 -20
- package/lib/commands/vault/show.js +0 -71
- package/lib/commands/vault/test.d.ts +0 -16
- package/lib/commands/vault/test.js +0 -45
- package/lib/common.d.ts +0 -48
- package/lib/common.js +0 -181
- package/lib/hooks/command_not_found/api-action.d.ts +0 -28
- package/lib/hooks/command_not_found/api-action.js +0 -93
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -5
- package/lib/support/dump-collection.d.ts +0 -2
- package/lib/support/dump-collection.js +0 -244
- package/lib/support/editor.d.ts +0 -12
- package/lib/support/editor.js +0 -47
- package/lib/support/execute.d.ts +0 -23
- package/lib/support/execute.js +0 -49
- package/lib/support/kuzzle.d.ts +0 -48
- package/lib/support/kuzzle.js +0 -168
- package/lib/support/restore-collection.d.ts +0 -29
- package/lib/support/restore-collection.js +0 -147
- package/lib/support/restore-securities.d.ts +0 -3
- package/lib/support/restore-securities.js +0 -53
- package/oclif.manifest.json +0 -1
- package/scripts/postinstall.sh +0 -10
- package/templates.tgz +0 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ The CLI that helps you manage your Kuzzle instances.
|
|
|
13
13
|
* [Commands](#commands)
|
|
14
14
|
* [Where does this weird name come from?](#where-does-this-weird-name-come-from)
|
|
15
15
|
* [Have fun with a quine](#have-fun-with-a-quine)
|
|
16
|
-
* [
|
|
16
|
+
* [Telemetry](#telemetry)
|
|
17
17
|
<!-- tocstop -->
|
|
18
18
|
|
|
19
19
|
:warning: This project is currently in beta and breaking changes may occur until the 1.0.0
|
|
@@ -26,7 +26,7 @@ $ npm install -g kourou
|
|
|
26
26
|
$ kourou COMMAND
|
|
27
27
|
running command...
|
|
28
28
|
$ kourou (-v|--version|version)
|
|
29
|
-
kourou/0.
|
|
29
|
+
kourou/0.21.0 linux-x64 node-v16.13.2
|
|
30
30
|
$ kourou --help [COMMAND]
|
|
31
31
|
USAGE
|
|
32
32
|
$ kourou COMMAND
|
|
@@ -129,7 +129,7 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
129
129
|
* [`kourou api-key:create USER`](#kourou-api-keycreate-user)
|
|
130
130
|
* [`kourou api-key:delete USER ID`](#kourou-api-keydelete-user-id)
|
|
131
131
|
* [`kourou api-key:search USER`](#kourou-api-keysearch-user)
|
|
132
|
-
* [`kourou app:scaffold
|
|
132
|
+
* [`kourou app:scaffold DESTINATION`](#kourou-appscaffold-destination)
|
|
133
133
|
* [`kourou app:start-services`](#kourou-appstart-services)
|
|
134
134
|
* [`kourou autocomplete [SHELL]`](#kourou-autocomplete-shell)
|
|
135
135
|
* [`kourou collection:create INDEX COLLECTION [BODY]`](#kourou-collectioncreate-index-collection-body)
|
|
@@ -155,6 +155,9 @@ All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
|
155
155
|
* [`kourou instance:list`](#kourou-instancelist)
|
|
156
156
|
* [`kourou instance:logs`](#kourou-instancelogs)
|
|
157
157
|
* [`kourou instance:spawn`](#kourou-instancespawn)
|
|
158
|
+
* [`kourou paas:init USERNAME NAMESPACE`](#kourou-paasinit-username-namespace)
|
|
159
|
+
* [`kourou paas:login`](#kourou-paaslogin)
|
|
160
|
+
* [`kourou paas:publish PROJECT IMAGE`](#kourou-paaspublish-project-image)
|
|
158
161
|
* [`kourou profile:export`](#kourou-profileexport)
|
|
159
162
|
* [`kourou profile:import PATH`](#kourou-profileimport-path)
|
|
160
163
|
* [`kourou realtime:subscribe INDEX COLLECTION [FILTERS]`](#kourou-realtimesubscribe-index-collection-filters)
|
|
@@ -284,19 +287,20 @@ OPTIONS
|
|
|
284
287
|
|
|
285
288
|
_See code: [src/commands/api-key/search.ts](src/commands/api-key/search.ts)_
|
|
286
289
|
|
|
287
|
-
## `kourou app:scaffold
|
|
290
|
+
## `kourou app:scaffold DESTINATION`
|
|
288
291
|
|
|
289
292
|
Scaffolds a new Kuzzle application
|
|
290
293
|
|
|
291
294
|
```
|
|
292
295
|
USAGE
|
|
293
|
-
$ kourou app:scaffold
|
|
296
|
+
$ kourou app:scaffold DESTINATION
|
|
294
297
|
|
|
295
298
|
ARGUMENTS
|
|
296
|
-
|
|
299
|
+
DESTINATION Directory to scaffold the app
|
|
297
300
|
|
|
298
301
|
OPTIONS
|
|
299
|
-
--
|
|
302
|
+
--flavor=flavor [default: generic] Template flavor ("generic", "iot-platform")
|
|
303
|
+
--help show CLI help
|
|
300
304
|
```
|
|
301
305
|
|
|
302
306
|
_See code: [src/commands/app/scaffold.ts](src/commands/app/scaffold.ts)_
|
|
@@ -337,7 +341,7 @@ EXAMPLES
|
|
|
337
341
|
$ kourou autocomplete --refresh-cache
|
|
338
342
|
```
|
|
339
343
|
|
|
340
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/
|
|
344
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.2.0/src/commands/autocomplete/index.ts)_
|
|
341
345
|
|
|
342
346
|
## `kourou collection:create INDEX COLLECTION [BODY]`
|
|
343
347
|
|
|
@@ -911,6 +915,60 @@ OPTIONS
|
|
|
911
915
|
|
|
912
916
|
_See code: [src/commands/instance/spawn.ts](src/commands/instance/spawn.ts)_
|
|
913
917
|
|
|
918
|
+
## `kourou paas:init USERNAME NAMESPACE`
|
|
919
|
+
|
|
920
|
+
Initialize a PaaS namespace in current directory
|
|
921
|
+
|
|
922
|
+
```
|
|
923
|
+
USAGE
|
|
924
|
+
$ kourou paas:init USERNAME NAMESPACE
|
|
925
|
+
|
|
926
|
+
ARGUMENTS
|
|
927
|
+
USERNAME Username
|
|
928
|
+
NAMESPACE Namespace
|
|
929
|
+
|
|
930
|
+
OPTIONS
|
|
931
|
+
--help show CLI help
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
_See code: [src/commands/paas/init.ts](src/commands/paas/init.ts)_
|
|
935
|
+
|
|
936
|
+
## `kourou paas:login`
|
|
937
|
+
|
|
938
|
+
Login for a PaaS namespace
|
|
939
|
+
|
|
940
|
+
```
|
|
941
|
+
USAGE
|
|
942
|
+
$ kourou paas:login
|
|
943
|
+
|
|
944
|
+
OPTIONS
|
|
945
|
+
--help show CLI help
|
|
946
|
+
--namespace=namespace Current PaaS namespace
|
|
947
|
+
--username=username PaaS username
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
_See code: [src/commands/paas/login.ts](src/commands/paas/login.ts)_
|
|
951
|
+
|
|
952
|
+
## `kourou paas:publish PROJECT IMAGE`
|
|
953
|
+
|
|
954
|
+
Deploy a new version of the application in the PaaS
|
|
955
|
+
|
|
956
|
+
```
|
|
957
|
+
USAGE
|
|
958
|
+
$ kourou paas:publish PROJECT IMAGE
|
|
959
|
+
|
|
960
|
+
ARGUMENTS
|
|
961
|
+
PROJECT Project name
|
|
962
|
+
IMAGE Image name and hash
|
|
963
|
+
|
|
964
|
+
OPTIONS
|
|
965
|
+
--help show CLI help
|
|
966
|
+
--namespace=namespace Current PaaS namespace
|
|
967
|
+
--token=token Authentication token
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
_See code: [src/commands/paas/publish.ts](src/commands/paas/publish.ts)_
|
|
971
|
+
|
|
914
972
|
## `kourou profile:export`
|
|
915
973
|
|
|
916
974
|
Exports profiles
|
|
@@ -1555,8 +1613,10 @@ $ kourou sdk:execute --print-raw '(
|
|
|
1555
1613
|
|
|
1556
1614
|
(Kuzzle must be accessible and running in local)
|
|
1557
1615
|
|
|
1558
|
-
#
|
|
1616
|
+
# Telemetry
|
|
1617
|
+
|
|
1618
|
+
We use a custom Open Source analytics backend (you can check the code [here](https://gihtub.com/kuzzleio/kepler)) to record the use of Kourou by users.
|
|
1559
1619
|
|
|
1560
|
-
We use a custom Open Source analytics backend (you can check the code [here](https://gihtub.com/kuzzleio/kepler)) to record the use of Kourou by users.
|
|
1561
1620
|
Collected metrics will allow us to study the use of our products in order to improve them. We do not collect any personal data about users.
|
|
1621
|
+
|
|
1562
1622
|
You can disable usage metrics collection by setting the `KOUROU_USAGE` environment variable to `false`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kourou",
|
|
3
3
|
"description": "The CLI that helps you manage your Kuzzle instances",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.21.0",
|
|
5
5
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kourou": "./bin/run"
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
"build": "tsc -b",
|
|
12
12
|
"dev": "./bin/run",
|
|
13
13
|
"postpack": "rm -f oclif.manifest.json",
|
|
14
|
-
"prepack": "tar czf templates.tgz templates/ && rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
|
|
15
|
-
"postinstall": "scripts/postinstall.sh",
|
|
16
14
|
"version": "oclif-dev readme && git add README.md",
|
|
17
15
|
"test:lint": "eslint src/ test/ --ext .ts",
|
|
18
16
|
"test:lint:fix": "eslint src/ test/ --ext .ts --fix",
|
|
@@ -22,9 +20,9 @@
|
|
|
22
20
|
},
|
|
23
21
|
"dependencies": {
|
|
24
22
|
"@elastic/elasticsearch": "^7.12.0",
|
|
25
|
-
"@oclif/command": "^1.8.
|
|
26
|
-
"@oclif/config": "^1.
|
|
27
|
-
"@oclif/plugin-autocomplete": "^
|
|
23
|
+
"@oclif/command": "^1.8.16",
|
|
24
|
+
"@oclif/config": "^1.18.3",
|
|
25
|
+
"@oclif/plugin-autocomplete": "^1.2.0",
|
|
28
26
|
"@oclif/plugin-help": "3.2.2",
|
|
29
27
|
"@types/bluebird": "^3.5.33",
|
|
30
28
|
"@types/inquirer": "^7.3.1",
|
|
@@ -68,8 +66,8 @@
|
|
|
68
66
|
"prettier-eslint": "^12.0.0",
|
|
69
67
|
"should": "^13.2.3",
|
|
70
68
|
"source-map-support": "^0.5.19",
|
|
71
|
-
"ts-node": "^
|
|
72
|
-
"typescript": "^4.
|
|
69
|
+
"ts-node": "^10.8.0",
|
|
70
|
+
"typescript": "^4.7.2"
|
|
73
71
|
},
|
|
74
72
|
"engines": {
|
|
75
73
|
"node": ">=10.0.0"
|
|
@@ -78,9 +76,7 @@
|
|
|
78
76
|
"/bin",
|
|
79
77
|
"/lib",
|
|
80
78
|
"/npm-shrinkwrap.json",
|
|
81
|
-
"/oclif.manifest.json"
|
|
82
|
-
"/templates.tgz",
|
|
83
|
-
"/scripts"
|
|
79
|
+
"/oclif.manifest.json"
|
|
84
80
|
],
|
|
85
81
|
"homepage": "https://github.com/kuzzleio/kourou",
|
|
86
82
|
"keywords": [
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
|
-
import { Kommand } from '../../common';
|
|
3
|
-
declare class ApiKeyCheck extends Kommand {
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
host: flags.IOptionFlag<string>;
|
|
7
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
-
ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
-
username: flags.IOptionFlag<string>;
|
|
10
|
-
password: flags.IOptionFlag<string | undefined>;
|
|
11
|
-
protocol: flags.IOptionFlag<string>;
|
|
12
|
-
as: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
'api-key': flags.IOptionFlag<string | undefined>;
|
|
14
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
15
|
-
};
|
|
16
|
-
static args: {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
required: boolean;
|
|
20
|
-
}[];
|
|
21
|
-
static examples: string[];
|
|
22
|
-
runSafe(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export default ApiKeyCheck;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
const kuzzle_1 = require("../../support/kuzzle");
|
|
6
|
-
class ApiKeyCheck extends common_1.Kommand {
|
|
7
|
-
async runSafe() {
|
|
8
|
-
const { valid } = await this.sdk.auth.checkToken(this.args.token);
|
|
9
|
-
if (valid) {
|
|
10
|
-
this.logOk('API key is still valid');
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
this.logKo('API key is not valid');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
ApiKeyCheck.description = 'Checks an API key validity';
|
|
18
|
-
ApiKeyCheck.flags = Object.assign({ help: command_1.flags.help() }, kuzzle_1.kuzzleFlags);
|
|
19
|
-
ApiKeyCheck.args = [
|
|
20
|
-
{ name: 'token', description: 'API key token', required: true },
|
|
21
|
-
];
|
|
22
|
-
ApiKeyCheck.examples = [
|
|
23
|
-
'kourou api-key:check eyJhbG...QxfQrc'
|
|
24
|
-
];
|
|
25
|
-
exports.default = ApiKeyCheck;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
|
-
import { Kommand } from '../../common';
|
|
3
|
-
declare class ApiKeyCreate extends Kommand {
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
host: flags.IOptionFlag<string>;
|
|
7
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
-
ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
-
username: flags.IOptionFlag<string>;
|
|
10
|
-
password: flags.IOptionFlag<string | undefined>;
|
|
11
|
-
protocol: flags.IOptionFlag<string>;
|
|
12
|
-
as: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
'api-key': flags.IOptionFlag<string | undefined>;
|
|
14
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
15
|
-
description: flags.IOptionFlag<string>;
|
|
16
|
-
id: flags.IOptionFlag<string | undefined>;
|
|
17
|
-
expire: flags.IOptionFlag<string>;
|
|
18
|
-
};
|
|
19
|
-
static args: {
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
required: boolean;
|
|
23
|
-
}[];
|
|
24
|
-
runSafe(): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
export default ApiKeyCreate;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
const kuzzle_1 = require("../../support/kuzzle");
|
|
6
|
-
class ApiKeyCreate extends common_1.Kommand {
|
|
7
|
-
async runSafe() {
|
|
8
|
-
const apiKey = await this.sdk.security.createApiKey(this.args.user, this.flags.description, {
|
|
9
|
-
_id: this.flags.id,
|
|
10
|
-
expiresIn: this.flags.expire
|
|
11
|
-
});
|
|
12
|
-
this.logOk(`Successfully created API Key "${apiKey._id}" for user "${this.args.user}"`);
|
|
13
|
-
this.log(apiKey._source.token);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
ApiKeyCreate.description = 'Creates a new API Key for a user';
|
|
17
|
-
ApiKeyCreate.flags = Object.assign({ help: command_1.flags.help(), description: command_1.flags.string({
|
|
18
|
-
char: 'd',
|
|
19
|
-
description: 'API Key description',
|
|
20
|
-
required: true,
|
|
21
|
-
}), id: command_1.flags.string({
|
|
22
|
-
description: 'API Key unique ID',
|
|
23
|
-
}), expire: command_1.flags.string({
|
|
24
|
-
description: 'API Key validity',
|
|
25
|
-
default: '-1',
|
|
26
|
-
}) }, kuzzle_1.kuzzleFlags);
|
|
27
|
-
ApiKeyCreate.args = [
|
|
28
|
-
{ name: 'user', description: 'User kuid', required: true },
|
|
29
|
-
];
|
|
30
|
-
exports.default = ApiKeyCreate;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
|
-
import { Kommand } from '../../common';
|
|
3
|
-
declare class ApiKeyDelete extends Kommand {
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
host: flags.IOptionFlag<string>;
|
|
7
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
-
ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
-
username: flags.IOptionFlag<string>;
|
|
10
|
-
password: flags.IOptionFlag<string | undefined>;
|
|
11
|
-
protocol: flags.IOptionFlag<string>;
|
|
12
|
-
as: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
'api-key': flags.IOptionFlag<string | undefined>;
|
|
14
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
15
|
-
};
|
|
16
|
-
static args: {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
required: boolean;
|
|
20
|
-
}[];
|
|
21
|
-
static examples: string[];
|
|
22
|
-
runSafe(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export default ApiKeyDelete;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
const kuzzle_1 = require("../../support/kuzzle");
|
|
6
|
-
class ApiKeyDelete extends common_1.Kommand {
|
|
7
|
-
async runSafe() {
|
|
8
|
-
await this.sdk.security.deleteApiKey(this.args.user, this.args.id);
|
|
9
|
-
this.logOk(`Successfully deleted API Key "${this.args.id}" of user "${this.args.user}"`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
ApiKeyDelete.description = 'Deletes an API key.';
|
|
13
|
-
ApiKeyDelete.flags = Object.assign({ help: command_1.flags.help() }, kuzzle_1.kuzzleFlags);
|
|
14
|
-
ApiKeyDelete.args = [
|
|
15
|
-
{ name: 'user', description: 'User kuid', required: true },
|
|
16
|
-
{ name: 'id', description: 'API Key unique ID', required: true },
|
|
17
|
-
];
|
|
18
|
-
ApiKeyDelete.examples = [
|
|
19
|
-
'kourou vault:delete sigfox-gateway 1k-BF3EBjsXdvA2PR8x'
|
|
20
|
-
];
|
|
21
|
-
exports.default = ApiKeyDelete;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { flags } from '@oclif/command';
|
|
2
|
-
import { Kommand } from '../../common';
|
|
3
|
-
declare class ApiKeySearch extends Kommand {
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
host: flags.IOptionFlag<string>;
|
|
7
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
-
ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
9
|
-
username: flags.IOptionFlag<string>;
|
|
10
|
-
password: flags.IOptionFlag<string | undefined>;
|
|
11
|
-
protocol: flags.IOptionFlag<string>;
|
|
12
|
-
as: flags.IOptionFlag<string | undefined>;
|
|
13
|
-
'api-key': flags.IOptionFlag<string | undefined>;
|
|
14
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
15
|
-
filter: flags.IOptionFlag<string | undefined>;
|
|
16
|
-
};
|
|
17
|
-
static args: {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
required: boolean;
|
|
21
|
-
}[];
|
|
22
|
-
runSafe(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export default ApiKeySearch;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const command_1 = require("@oclif/command");
|
|
4
|
-
const common_1 = require("../../common");
|
|
5
|
-
const kuzzle_1 = require("../../support/kuzzle");
|
|
6
|
-
class ApiKeySearch extends common_1.Kommand {
|
|
7
|
-
async runSafe() {
|
|
8
|
-
let query = {};
|
|
9
|
-
if (this.flags.filter) {
|
|
10
|
-
query = {
|
|
11
|
-
match: {
|
|
12
|
-
description: this.flags.filter,
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const result = await this.sdk.security.searchApiKeys(this.args.user, query, {
|
|
17
|
-
from: 0,
|
|
18
|
-
size: 100
|
|
19
|
-
});
|
|
20
|
-
this.logOk(`${result.total} API Keys found for user ${this.args.user}`);
|
|
21
|
-
if (result.total !== 0) {
|
|
22
|
-
this.log('');
|
|
23
|
-
for (const { _id, _source } of result.hits) {
|
|
24
|
-
this.log(` - Key "${_id}"`);
|
|
25
|
-
this.log(` Description: ${_source.description}`);
|
|
26
|
-
this.log(` Fingerprint: ${_source.fingerprint}`);
|
|
27
|
-
this.log(` Expires at: ${_source.expiresAt}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
ApiKeySearch.description = 'Lists a user\'s API Keys.';
|
|
33
|
-
ApiKeySearch.flags = Object.assign({ help: command_1.flags.help(), filter: command_1.flags.string({
|
|
34
|
-
description: 'Filter to match the API Key descriptions',
|
|
35
|
-
}) }, kuzzle_1.kuzzleFlags);
|
|
36
|
-
ApiKeySearch.args = [
|
|
37
|
-
{ name: 'user', description: 'User kuid', required: true },
|
|
38
|
-
];
|
|
39
|
-
exports.default = ApiKeySearch;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Kommand } from '../../common';
|
|
2
|
-
export default class AppScaffold extends Kommand {
|
|
3
|
-
static initSdk: boolean;
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
-
};
|
|
8
|
-
static args: {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
required: boolean;
|
|
12
|
-
}[];
|
|
13
|
-
checkKebabCase(name: string): boolean;
|
|
14
|
-
convertToKebabCase(name: string): string;
|
|
15
|
-
runSafe(): Promise<void>;
|
|
16
|
-
renderTemplates(directory: string, templatePath: string): Promise<void>;
|
|
17
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
5
|
-
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
|
-
const command_1 = require("@oclif/command");
|
|
7
|
-
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
8
|
-
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
9
|
-
const listr_1 = (0, tslib_1.__importDefault)(require("listr"));
|
|
10
|
-
const inquirer_1 = (0, tslib_1.__importDefault)(require("inquirer"));
|
|
11
|
-
const common_1 = require("../../common");
|
|
12
|
-
const execute_1 = require("../../support/execute");
|
|
13
|
-
const templatesDir = path_1.default.join(__dirname, '..', '..', '..', 'templates');
|
|
14
|
-
const TEMPLATED_ENTRIES = [
|
|
15
|
-
'package.json',
|
|
16
|
-
'app.ts',
|
|
17
|
-
'README.md'
|
|
18
|
-
];
|
|
19
|
-
const KEBAB_CASE_REGEX = /^[a-z-\d]+$/;
|
|
20
|
-
class AppScaffold extends common_1.Kommand {
|
|
21
|
-
checkKebabCase(name) {
|
|
22
|
-
return KEBAB_CASE_REGEX.test(name);
|
|
23
|
-
}
|
|
24
|
-
convertToKebabCase(name) {
|
|
25
|
-
return name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
26
|
-
}
|
|
27
|
-
async runSafe() {
|
|
28
|
-
if (!this.checkKebabCase(this.args.name)) {
|
|
29
|
-
this.logKo(`The application name must be in kebab-case`);
|
|
30
|
-
const kebabCasedName = this.convertToKebabCase(this.args.name);
|
|
31
|
-
const response = await inquirer_1.default.prompt([
|
|
32
|
-
{
|
|
33
|
-
name: 'kebabCaseConversion',
|
|
34
|
-
type: 'confirm',
|
|
35
|
-
message: `Would you like to convert "${this.args.name}" to "${kebabCasedName}"`
|
|
36
|
-
}
|
|
37
|
-
]);
|
|
38
|
-
if (!response.kebabCaseConversion) {
|
|
39
|
-
process.exit(0);
|
|
40
|
-
}
|
|
41
|
-
this.args.name = kebabCasedName;
|
|
42
|
-
}
|
|
43
|
-
const templatePath = path_1.default.join(templatesDir, 'app-scaffold', 'ts');
|
|
44
|
-
const tasks = new listr_1.default([
|
|
45
|
-
{
|
|
46
|
-
title: `Creating directory: ${chalk_1.default.gray(this.args.name + path_1.default.sep)}`,
|
|
47
|
-
task: () => (0, execute_1.execute)('mkdir', this.args.name)
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: 'Creating and rendering application files',
|
|
51
|
-
task: () => this.renderTemplates(templatePath, templatePath)
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: 'Installing dependencies (this can take some time)',
|
|
55
|
-
task: () => (0, execute_1.execute)('npm', 'run', 'install:docker', { cwd: this.args.name })
|
|
56
|
-
},
|
|
57
|
-
]);
|
|
58
|
-
await tasks.run();
|
|
59
|
-
this.logOk(`Scaffolding complete! Use "${chalk_1.default.grey('cd ' + this.args.name + ' && npm run dev:docker')}" to run your application`);
|
|
60
|
-
}
|
|
61
|
-
async renderTemplates(directory, templatePath) {
|
|
62
|
-
const entries = fs_1.default.readdirSync(directory);
|
|
63
|
-
for (const entry of entries) {
|
|
64
|
-
const entryPath = path_1.default.join(directory, entry);
|
|
65
|
-
const entryDir = path_1.default.dirname(path_1.default.join(this.args.name, entryPath));
|
|
66
|
-
const entryInfo = fs_1.default.statSync(entryPath);
|
|
67
|
-
if (entryInfo.isDirectory()) {
|
|
68
|
-
fs_1.default.mkdirSync(entryDir.replace(templatePath, ''), { recursive: true });
|
|
69
|
-
await this.renderTemplates(entryPath, templatePath);
|
|
70
|
-
}
|
|
71
|
-
else if (entryInfo.isFile() || entryInfo.isSymbolicLink()) {
|
|
72
|
-
const content = fs_1.default.readFileSync(entryPath, 'utf8');
|
|
73
|
-
// Only render a whitelist a files who need it
|
|
74
|
-
const rendered = TEMPLATED_ENTRIES.includes(entry)
|
|
75
|
-
? lodash_1.default.template(content)({ appName: this.args.name })
|
|
76
|
-
: content;
|
|
77
|
-
fs_1.default.mkdirSync(entryDir.replace(templatePath, ''), { recursive: true });
|
|
78
|
-
fs_1.default.writeFileSync(path_1.default.join(this.args.name, entryPath.replace(templatePath, '')), rendered);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
this.logInfo(`Skipped ${entryPath} because it's not a regular file`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.default = AppScaffold;
|
|
87
|
-
AppScaffold.initSdk = false;
|
|
88
|
-
AppScaffold.description = 'Scaffolds a new Kuzzle application';
|
|
89
|
-
AppScaffold.flags = {
|
|
90
|
-
help: command_1.flags.help(),
|
|
91
|
-
};
|
|
92
|
-
AppScaffold.args = [
|
|
93
|
-
{ name: 'name', description: 'Application name', required: true },
|
|
94
|
-
];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Kommand } from '../../common';
|
|
2
|
-
export default class AppStartServices extends Kommand {
|
|
3
|
-
static initSdk: boolean;
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
7
|
-
check: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
8
|
-
};
|
|
9
|
-
runSafe(): Promise<void>;
|
|
10
|
-
checkPrerequisites(): Promise<boolean>;
|
|
11
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const command_1 = require("@oclif/command");
|
|
6
|
-
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
7
|
-
const listr_1 = (0, tslib_1.__importDefault)(require("listr"));
|
|
8
|
-
const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
|
|
9
|
-
const common_1 = require("../../common");
|
|
10
|
-
const execute_1 = require("../../support/execute");
|
|
11
|
-
const MIN_DOCO_VERSION = '1.12.0';
|
|
12
|
-
const kuzzleServicesFile = `
|
|
13
|
-
version: '3'
|
|
14
|
-
|
|
15
|
-
services:
|
|
16
|
-
redis:
|
|
17
|
-
image: redis:5
|
|
18
|
-
ports:
|
|
19
|
-
- "6379:6379"
|
|
20
|
-
|
|
21
|
-
elasticsearch:
|
|
22
|
-
image: kuzzleio/elasticsearch:7
|
|
23
|
-
ports:
|
|
24
|
-
- "9200:9200"
|
|
25
|
-
ulimits:
|
|
26
|
-
nofile: 65536
|
|
27
|
-
`;
|
|
28
|
-
class AppStartServices extends common_1.Kommand {
|
|
29
|
-
async runSafe() {
|
|
30
|
-
const docoFilename = '/tmp/kuzzle-services.yml';
|
|
31
|
-
const successfullCheck = this.flags.check ?
|
|
32
|
-
await this.checkPrerequisites() :
|
|
33
|
-
true;
|
|
34
|
-
if (this.flags.check && successfullCheck) {
|
|
35
|
-
this.log(`\n${node_emoji_1.default.get('ok_hand')} Prerequisites are ${chalk_1.default.green.bold('OK')}!`);
|
|
36
|
-
}
|
|
37
|
-
else if (this.flags.check && !successfullCheck) {
|
|
38
|
-
throw new Error(`${node_emoji_1.default.get('shrug')} Your system doesn't satisfy all the prerequisites. Cannot run Kuzzle services.`);
|
|
39
|
-
}
|
|
40
|
-
this.log(chalk_1.default.grey(`\nWriting docker-compose file to ${docoFilename}...\n`));
|
|
41
|
-
(0, fs_1.writeFileSync)(docoFilename, kuzzleServicesFile);
|
|
42
|
-
// clean up
|
|
43
|
-
await (0, execute_1.execute)('docker-compose', '-f', docoFilename, 'down');
|
|
44
|
-
try {
|
|
45
|
-
await (0, execute_1.execute)('docker-compose', '-f', docoFilename, 'up', '-d');
|
|
46
|
-
this.logOk('Elasticsearch and Redis are booting in the background right now.');
|
|
47
|
-
this.log(chalk_1.default.grey('\nTo watch the logs, run'));
|
|
48
|
-
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} logs -f\n`));
|
|
49
|
-
this.log(' Elasticsearch port: 9200');
|
|
50
|
-
this.log(' Redis port: 6379');
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
this.logKo(` Something went wrong: ${error.message}`);
|
|
54
|
-
this.log(chalk_1.default.grey('If you want to investigate the problem, try running'));
|
|
55
|
-
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} up\n`));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async checkPrerequisites() {
|
|
59
|
-
this.log(chalk_1.default.grey('Checking prerequisites...'));
|
|
60
|
-
const checks = new listr_1.default([
|
|
61
|
-
{
|
|
62
|
-
title: `docker-compose exists and the version is at least ${MIN_DOCO_VERSION}`,
|
|
63
|
-
task: async () => {
|
|
64
|
-
try {
|
|
65
|
-
const docov = await (0, execute_1.execute)('docker-compose', '-v');
|
|
66
|
-
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
|
|
67
|
-
if (matches === null) {
|
|
68
|
-
throw new Error('Unable to read docker-compose verson. This is weird.');
|
|
69
|
-
}
|
|
70
|
-
const docoVersion = matches.length > 0 ? matches[1] : null;
|
|
71
|
-
if (docoVersion === null) {
|
|
72
|
-
throw new Error('Unable to read docker-compose version. This is weird.');
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
if (docoVersion < MIN_DOCO_VERSION) {
|
|
76
|
-
throw new Error(`The detected version of docker-compose (${docoVersion}) is not recent enough (${MIN_DOCO_VERSION})`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
throw new Error(error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
throw new Error('No docker-compose found. Are you sure docker-compose is installed?');
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
]);
|
|
89
|
-
try {
|
|
90
|
-
await checks.run();
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
this.logKo(error.message);
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.default = AppStartServices;
|
|
100
|
-
AppStartServices.initSdk = false;
|
|
101
|
-
AppStartServices.description = 'Starts Kuzzle services (Elasticsearch and Redis)';
|
|
102
|
-
AppStartServices.flags = {
|
|
103
|
-
help: command_1.flags.help(),
|
|
104
|
-
check: command_1.flags.boolean({
|
|
105
|
-
description: 'Check prerequisite before running services',
|
|
106
|
-
default: false,
|
|
107
|
-
}),
|
|
108
|
-
};
|