kourou 0.19.0 → 0.19.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 +51 -23
- package/lib/commands/app/scaffold.js +7 -7
- package/lib/commands/app/start-services.js +7 -7
- package/lib/commands/collection/export.js +4 -4
- package/lib/commands/collection/import.js +4 -4
- package/lib/commands/config/diff.js +5 -5
- package/lib/commands/document/search.d.ts +1 -0
- package/lib/commands/document/search.js +7 -2
- package/lib/commands/es/indices/cat.d.ts +1 -2
- package/lib/commands/es/indices/cat.js +18 -20
- package/lib/commands/es/indices/get.d.ts +1 -2
- package/lib/commands/es/indices/get.js +5 -12
- package/lib/commands/es/indices/insert.d.ts +1 -2
- package/lib/commands/es/indices/insert.js +5 -12
- package/lib/commands/es/migrate.js +3 -3
- package/lib/commands/es/snapshot/create-repository.d.ts +1 -2
- package/lib/commands/es/snapshot/create-repository.js +5 -12
- package/lib/commands/es/snapshot/create.d.ts +1 -2
- package/lib/commands/es/snapshot/create.js +5 -12
- package/lib/commands/es/snapshot/list.d.ts +1 -2
- package/lib/commands/es/snapshot/list.js +5 -12
- package/lib/commands/es/snapshot/restore.d.ts +1 -2
- package/lib/commands/es/snapshot/restore.js +5 -12
- 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 +7 -7
- package/lib/commands/index/export.d.ts +2 -0
- package/lib/commands/index/export.js +13 -5
- package/lib/commands/index/import.js +4 -4
- package/lib/commands/instance/kill.js +6 -6
- package/lib/commands/instance/list.js +1 -1
- package/lib/commands/instance/logs.js +3 -3
- package/lib/commands/instance/spawn.js +10 -10
- package/lib/commands/profile/export.js +2 -2
- package/lib/commands/profile/import.js +2 -2
- package/lib/commands/realtime/subscribe.js +1 -1
- package/lib/commands/role/export.js +2 -2
- package/lib/commands/role/import.js +2 -2
- package/lib/commands/sdk/execute.js +2 -2
- 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 +2 -2
- 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.js +8 -4
- package/lib/hooks/command_not_found/api-action.js +2 -2
- package/lib/support/dump-collection.js +4 -4
- package/lib/support/editor.js +3 -3
- package/lib/support/execute.js +1 -1
- package/lib/support/kuzzle.d.ts +1 -1
- package/lib/support/kuzzle.js +1 -0
- package/lib/support/restore-collection.js +5 -5
- package/lib/support/restore-securities.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +20 -18
- package/templates.tgz +0 -0
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ $ npm install -g kourou
|
|
|
25
25
|
$ kourou COMMAND
|
|
26
26
|
running command...
|
|
27
27
|
$ kourou (-v|--version|version)
|
|
28
|
-
kourou/0.19.
|
|
28
|
+
kourou/0.19.4 linux-x64 node-v12.22.7
|
|
29
29
|
$ kourou --help [COMMAND]
|
|
30
30
|
USAGE
|
|
31
31
|
$ kourou COMMAND
|
|
@@ -48,7 +48,7 @@ By command line:
|
|
|
48
48
|
--ssl [default: true for port 443] Use SSL to connect to Kuzzle
|
|
49
49
|
--protocol [default: ws] Protocol used to connect to Kuzzle ( `http` or `ws` )
|
|
50
50
|
|
|
51
|
-
```
|
|
51
|
+
```
|
|
52
52
|
|
|
53
53
|
By environment variables:
|
|
54
54
|
```
|
|
@@ -61,7 +61,7 @@ By environment variables:
|
|
|
61
61
|
KUZZLE_SSL Use SSL to connect to Kuzzle
|
|
62
62
|
KUZZLE_PROTOCOL Protocol used to connect to Kuzzle ( `http` or `ws` )
|
|
63
63
|
|
|
64
|
-
```
|
|
64
|
+
```
|
|
65
65
|
|
|
66
66
|
## User impersonation
|
|
67
67
|
|
|
@@ -81,11 +81,11 @@ $ kourou sdk:query auth:getCurrentUser --as gordon --username admin --password a
|
|
|
81
81
|
|
|
82
82
|
## Automatic command infering for API actions
|
|
83
83
|
|
|
84
|
-
When no command is found, Kourou will try to execute the given command with the `sdk:query` command.
|
|
84
|
+
When no command is found, Kourou will try to execute the given command with the `sdk:query` command.
|
|
85
85
|
|
|
86
86
|
The first argument has to be the name of the controller and the action separated by a semicolon (eg `document:create` )
|
|
87
87
|
|
|
88
|
-
Kourou will try to infer common arguments like `index` , `collection` , `_id` or `body` .
|
|
88
|
+
Kourou will try to infer common arguments like `index` , `collection` , `_id` or `body` .
|
|
89
89
|
|
|
90
90
|
It will automatically infer and accept the following lists of arguments:
|
|
91
91
|
- `<command> <index>`
|
|
@@ -116,7 +116,10 @@ It will automatically infer and accept the following lists of arguments:
|
|
|
116
116
|
- `<command> <index> <collection> <id> <body>`
|
|
117
117
|
- _eg: `kourou document:create iot sensors sigfox-123 '{temperature: 42}'` _
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
All other arguments and options will be passed as-is to the `sdk:query` method.
|
|
120
|
+
|
|
121
|
+
> Note: you can pass arguments to the API actions with the `--arg` or `-a` option in your command, e.g.
|
|
122
|
+
> `kourou security:createFirstAdmin '{ ...credentials here... }' -a reset=true`
|
|
120
123
|
|
|
121
124
|
# Commands
|
|
122
125
|
|
|
@@ -127,6 +130,7 @@ Then any argument will be passed as-is to the `sdk:query` method.
|
|
|
127
130
|
* [`kourou api-key:search USER`](#kourou-api-keysearch-user)
|
|
128
131
|
* [`kourou app:scaffold NAME`](#kourou-appscaffold-name)
|
|
129
132
|
* [`kourou app:start-services`](#kourou-appstart-services)
|
|
133
|
+
* [`kourou autocomplete [SHELL]`](#kourou-autocomplete-shell)
|
|
130
134
|
* [`kourou collection:create INDEX COLLECTION [BODY]`](#kourou-collectioncreate-index-collection-body)
|
|
131
135
|
* [`kourou collection:export INDEX COLLECTION`](#kourou-collectionexport-index-collection)
|
|
132
136
|
* [`kourou collection:import PATH`](#kourou-collectionimport-path)
|
|
@@ -312,6 +316,29 @@ OPTIONS
|
|
|
312
316
|
|
|
313
317
|
_See code: [src/commands/app/start-services.ts](src/commands/app/start-services.ts)_
|
|
314
318
|
|
|
319
|
+
## `kourou autocomplete [SHELL]`
|
|
320
|
+
|
|
321
|
+
display autocomplete installation instructions
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
USAGE
|
|
325
|
+
$ kourou autocomplete [SHELL]
|
|
326
|
+
|
|
327
|
+
ARGUMENTS
|
|
328
|
+
SHELL shell type
|
|
329
|
+
|
|
330
|
+
OPTIONS
|
|
331
|
+
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
332
|
+
|
|
333
|
+
EXAMPLES
|
|
334
|
+
$ kourou autocomplete
|
|
335
|
+
$ kourou autocomplete bash
|
|
336
|
+
$ kourou autocomplete zsh
|
|
337
|
+
$ kourou autocomplete --refresh-cache
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_
|
|
341
|
+
|
|
315
342
|
## `kourou collection:create INDEX COLLECTION [BODY]`
|
|
316
343
|
|
|
317
344
|
Creates a collection
|
|
@@ -447,7 +474,7 @@ USAGE
|
|
|
447
474
|
ARGUMENTS
|
|
448
475
|
INDEX Index name
|
|
449
476
|
COLLECTION Collection name
|
|
450
|
-
QUERY
|
|
477
|
+
QUERY Search query in JS or JSON format.
|
|
451
478
|
|
|
452
479
|
OPTIONS
|
|
453
480
|
--api-key=api-key Kuzzle user api-key
|
|
@@ -456,6 +483,7 @@ OPTIONS
|
|
|
456
483
|
--from=from Optional offset
|
|
457
484
|
--help show CLI help
|
|
458
485
|
--host=host [default: localhost] Kuzzle server host
|
|
486
|
+
--lang=lang [default: koncorde] Specify the query language to use
|
|
459
487
|
--password=password Kuzzle user password
|
|
460
488
|
--port=port [default: 7512] Kuzzle server port
|
|
461
489
|
--protocol=protocol [default: ws] Kuzzle protocol (http or ws)
|
|
@@ -466,7 +494,8 @@ OPTIONS
|
|
|
466
494
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
467
495
|
|
|
468
496
|
EXAMPLES
|
|
469
|
-
kourou document:search iot sensors '{
|
|
497
|
+
kourou document:search iot sensors '{ equals: { name: "corona" } }'
|
|
498
|
+
kourou document:search iot sensors '{ match: { name: "cOrOnna" } }' -a lang=elasticsearch
|
|
470
499
|
kourou document:search iot sensors --editor
|
|
471
500
|
```
|
|
472
501
|
|
|
@@ -482,8 +511,7 @@ USAGE
|
|
|
482
511
|
|
|
483
512
|
OPTIONS
|
|
484
513
|
-g, --grep=grep Match output with pattern
|
|
485
|
-
-
|
|
486
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
514
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
487
515
|
--help show CLI help
|
|
488
516
|
```
|
|
489
517
|
|
|
@@ -502,8 +530,7 @@ ARGUMENTS
|
|
|
502
530
|
ID Document ID
|
|
503
531
|
|
|
504
532
|
OPTIONS
|
|
505
|
-
-
|
|
506
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
533
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
507
534
|
--help show CLI help
|
|
508
535
|
```
|
|
509
536
|
|
|
@@ -521,8 +548,7 @@ ARGUMENTS
|
|
|
521
548
|
INDEX ES Index name
|
|
522
549
|
|
|
523
550
|
OPTIONS
|
|
524
|
-
-
|
|
525
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
551
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
526
552
|
--body=body [default: {}] Document body in JSON
|
|
527
553
|
--help show CLI help
|
|
528
554
|
--id=id Document ID
|
|
@@ -567,8 +593,7 @@ ARGUMENTS
|
|
|
567
593
|
NAME ES snapshot name
|
|
568
594
|
|
|
569
595
|
OPTIONS
|
|
570
|
-
-
|
|
571
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
596
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
572
597
|
--help show CLI help
|
|
573
598
|
```
|
|
574
599
|
|
|
@@ -587,8 +612,7 @@ ARGUMENTS
|
|
|
587
612
|
LOCATION ES snapshot repository location
|
|
588
613
|
|
|
589
614
|
OPTIONS
|
|
590
|
-
-
|
|
591
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
615
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
592
616
|
--compress Compress data when storing them
|
|
593
617
|
--help show CLI help
|
|
594
618
|
```
|
|
@@ -607,8 +631,7 @@ ARGUMENTS
|
|
|
607
631
|
REPOSITORY Name of repository from which to fetch the snapshot information
|
|
608
632
|
|
|
609
633
|
OPTIONS
|
|
610
|
-
-
|
|
611
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
634
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
612
635
|
--help show CLI help
|
|
613
636
|
```
|
|
614
637
|
|
|
@@ -627,8 +650,7 @@ ARGUMENTS
|
|
|
627
650
|
NAME ES snapshot name
|
|
628
651
|
|
|
629
652
|
OPTIONS
|
|
630
|
-
-
|
|
631
|
-
-p, --port=port [default: 9200] Elasticsearch server port
|
|
653
|
+
-n, --node=node [default: http://localhost:9200] Elasticsearch server URL
|
|
632
654
|
--help show CLI help
|
|
633
655
|
```
|
|
634
656
|
|
|
@@ -715,7 +737,7 @@ OPTIONS
|
|
|
715
737
|
--all see all commands in CLI
|
|
716
738
|
```
|
|
717
739
|
|
|
718
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.
|
|
740
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.3/src/commands/help.ts)_
|
|
719
741
|
|
|
720
742
|
## `kourou import PATH`
|
|
721
743
|
|
|
@@ -775,9 +797,15 @@ OPTIONS
|
|
|
775
797
|
|
|
776
798
|
--protocol=protocol [default: ws] Kuzzle protocol (http or websocket)
|
|
777
799
|
|
|
800
|
+
--query=query [default: {}] Only dump documents in collections matching the query (JS or JSON format)
|
|
801
|
+
|
|
778
802
|
--ssl Use SSL to connect to Kuzzle
|
|
779
803
|
|
|
780
804
|
--username=username [default: anonymous] Kuzzle username (local strategy)
|
|
805
|
+
|
|
806
|
+
EXAMPLES
|
|
807
|
+
kourou index:export nyc-open-data
|
|
808
|
+
kourou index:export nyc-open-data --query '{"range":{"_kuzzle_info.createdAt":{"gt":1632935638866}}}'
|
|
781
809
|
```
|
|
782
810
|
|
|
783
811
|
_See code: [src/commands/index/export.ts](src/commands/index/export.ts)_
|
|
@@ -1,12 +1,12 @@
|
|
|
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 = tslib_1.__importDefault(require("fs"));
|
|
4
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
6
|
const command_1 = require("@oclif/command");
|
|
7
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
-
const listr_1 = tslib_1.__importDefault(require("listr"));
|
|
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
10
|
const common_1 = require("../../common");
|
|
11
11
|
const execute_1 = require("../../support/execute");
|
|
12
12
|
const templatesDir = path_1.default.join(__dirname, '..', '..', '..', 'templates');
|
|
@@ -21,7 +21,7 @@ class AppScaffold extends common_1.Kommand {
|
|
|
21
21
|
const tasks = new listr_1.default([
|
|
22
22
|
{
|
|
23
23
|
title: `Creating directory: ${chalk_1.default.gray(this.args.name + path_1.default.sep)}`,
|
|
24
|
-
task: () => execute_1.execute('mkdir', this.args.name)
|
|
24
|
+
task: () => (0, execute_1.execute)('mkdir', this.args.name)
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
title: 'Creating and rendering application files',
|
|
@@ -29,7 +29,7 @@ class AppScaffold extends common_1.Kommand {
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
title: 'Installing dependencies (this can take some time)',
|
|
32
|
-
task: () => execute_1.execute('npm', 'run', 'install:docker', { cwd: this.args.name })
|
|
32
|
+
task: () => (0, execute_1.execute)('npm', 'run', 'install:docker', { cwd: this.args.name })
|
|
33
33
|
},
|
|
34
34
|
]);
|
|
35
35
|
await tasks.run();
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
7
|
-
const listr_1 = tslib_1.__importDefault(require("listr"));
|
|
8
|
-
const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
|
|
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
9
|
const common_1 = require("../../common");
|
|
10
10
|
const execute_1 = require("../../support/execute");
|
|
11
11
|
const MIN_DOCO_VERSION = '1.12.0';
|
|
@@ -38,11 +38,11 @@ class AppStartServices extends common_1.Kommand {
|
|
|
38
38
|
throw new Error(`${node_emoji_1.default.get('shrug')} Your system doesn't satisfy all the prerequisites. Cannot run Kuzzle services.`);
|
|
39
39
|
}
|
|
40
40
|
this.log(chalk_1.default.grey(`\nWriting docker-compose file to ${docoFilename}...\n`));
|
|
41
|
-
fs_1.writeFileSync(docoFilename, kuzzleServicesFile);
|
|
41
|
+
(0, fs_1.writeFileSync)(docoFilename, kuzzleServicesFile);
|
|
42
42
|
// clean up
|
|
43
|
-
await execute_1.execute('docker-compose', '-f', docoFilename, 'down');
|
|
43
|
+
await (0, execute_1.execute)('docker-compose', '-f', docoFilename, 'down');
|
|
44
44
|
try {
|
|
45
|
-
await execute_1.execute('docker-compose', '-f', docoFilename, 'up', '-d');
|
|
45
|
+
await (0, execute_1.execute)('docker-compose', '-f', docoFilename, 'up', '-d');
|
|
46
46
|
this.logOk('Elasticsearch and Redis are booting in the background right now.');
|
|
47
47
|
this.log(chalk_1.default.grey('\nTo watch the logs, run'));
|
|
48
48
|
this.log(chalk_1.default.grey(` docker-compose -f ${docoFilename} logs -f\n`));
|
|
@@ -62,7 +62,7 @@ class AppStartServices extends common_1.Kommand {
|
|
|
62
62
|
title: `docker-compose exists and the version is at least ${MIN_DOCO_VERSION}`,
|
|
63
63
|
task: async () => {
|
|
64
64
|
try {
|
|
65
|
-
const docov = await execute_1.execute('docker-compose', '-v');
|
|
65
|
+
const docov = await (0, execute_1.execute)('docker-compose', '-v');
|
|
66
66
|
const matches = docov.stdout.match(/[^0-9.]*([0-9.]*).*/);
|
|
67
67
|
if (matches === null) {
|
|
68
68
|
throw new Error('Unable to read docker-compose verson. This is weird.');
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
5
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
6
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const kuzzle_1 = require("../../support/kuzzle");
|
|
9
9
|
const dump_collection_1 = require("../../support/dump-collection");
|
|
@@ -20,8 +20,8 @@ class CollectionExport extends common_1.Kommand {
|
|
|
20
20
|
const count = await this.sdk.document.count(this.args.index, this.args.collection, { query });
|
|
21
21
|
this.logInfo(`Dumping ${count} of ${countAll} documents from collection "${this.args.index}:${this.args.collection}" in ${path_1.default} ...`);
|
|
22
22
|
fs_1.default.mkdirSync(exportPath, { recursive: true });
|
|
23
|
-
await dump_collection_1.dumpCollectionMappings(this.sdk, this.args.index, this.args.collection, exportPath, this.flags.format);
|
|
24
|
-
await dump_collection_1.dumpCollectionData(this.sdk, this.args.index, this.args.collection, Number(this.flags['batch-size']), exportPath, query, this.flags.format);
|
|
23
|
+
await (0, dump_collection_1.dumpCollectionMappings)(this.sdk, this.args.index, this.args.collection, exportPath, this.flags.format);
|
|
24
|
+
await (0, dump_collection_1.dumpCollectionData)(this.sdk, this.args.index, this.args.collection, Number(this.flags['batch-size']), exportPath, query, this.flags.format);
|
|
25
25
|
this.logOk(`Collection ${this.args.index}:${this.args.collection} dumped`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -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 = tslib_1.__importDefault(require("path"));
|
|
5
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
4
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
5
|
+
const fs_1 = (0, 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");
|
|
@@ -13,9 +13,9 @@ class CollectionImport extends common_1.Kommand {
|
|
|
13
13
|
if (!this.flags['no-mappings']) {
|
|
14
14
|
const mappingsPath = path_1.default.join(this.args.path, 'mappings.json');
|
|
15
15
|
const dump = JSON.parse(fs_1.default.readFileSync(mappingsPath, 'utf8'));
|
|
16
|
-
await restore_collection_1.restoreCollectionMappings(this.sdk, dump, this.flags.index, this.flags.collection);
|
|
16
|
+
await (0, restore_collection_1.restoreCollectionMappings)(this.sdk, dump, this.flags.index, this.flags.collection);
|
|
17
17
|
}
|
|
18
|
-
const { index, collection, total } = await restore_collection_1.restoreCollectionData(this.sdk, this.log.bind(this), Number(this.flags['batch-size']), path_1.default.join(this.args.path, 'documents.jsonl'), this.flags.index, this.flags.collection);
|
|
18
|
+
const { index, collection, total } = await (0, restore_collection_1.restoreCollectionData)(this.sdk, this.log.bind(this), Number(this.flags['batch-size']), path_1.default.join(this.args.path, 'documents.jsonl'), this.flags.index, this.flags.collection);
|
|
19
19
|
this.logOk(`Successfully imported ${total} documents from "${this.args.path}" in "${index}:${collection}"`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ConfigKeyDiff = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const command_1 = require("@oclif/command");
|
|
6
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
8
|
-
const strip_json_comments_1 = tslib_1.__importDefault(require("strip-json-comments"));
|
|
6
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
7
|
+
const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
|
|
8
|
+
const strip_json_comments_1 = (0, tslib_1.__importDefault)(require("strip-json-comments"));
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
class ConfigKeyDiff extends common_1.Kommand {
|
|
11
11
|
async runSafe() {
|
|
@@ -15,8 +15,8 @@ class ConfigKeyDiff extends common_1.Kommand {
|
|
|
15
15
|
if (!fs_1.default.existsSync(this.args.second)) {
|
|
16
16
|
throw new Error(`File "${this.args.second}" does not exists`);
|
|
17
17
|
}
|
|
18
|
-
const first = JSON.parse(strip_json_comments_1.default(fs_1.default.readFileSync(this.args.first, 'utf8')));
|
|
19
|
-
const second = JSON.parse(strip_json_comments_1.default(fs_1.default.readFileSync(this.args.second, 'utf8')));
|
|
18
|
+
const first = JSON.parse((0, strip_json_comments_1.default)(fs_1.default.readFileSync(this.args.first, 'utf8')));
|
|
19
|
+
const second = JSON.parse((0, strip_json_comments_1.default)(fs_1.default.readFileSync(this.args.second, 'utf8')));
|
|
20
20
|
const changes = this._keyChanges(first, second);
|
|
21
21
|
if (lodash_1.default.isEmpty(changes)) {
|
|
22
22
|
this.logOk('No differences between keys in the provided configurations');
|
|
@@ -16,6 +16,7 @@ export default class DocumentSearch extends Kommand {
|
|
|
16
16
|
from: flags.IOptionFlag<string | undefined>;
|
|
17
17
|
size: flags.IOptionFlag<string | undefined>;
|
|
18
18
|
scroll: flags.IOptionFlag<string | undefined>;
|
|
19
|
+
lang: flags.IOptionFlag<string>;
|
|
19
20
|
editor: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
20
21
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
21
22
|
};
|
|
@@ -13,6 +13,7 @@ class DocumentSearch extends common_1.Kommand {
|
|
|
13
13
|
from: this.flags.from,
|
|
14
14
|
size: this.flags.size,
|
|
15
15
|
scroll: this.flags.scroll,
|
|
16
|
+
lang: this.flags.lang,
|
|
16
17
|
body: {
|
|
17
18
|
query: this.parseJs(this.args.query || '{}'),
|
|
18
19
|
sort: this.parseJs(this.flags.sort)
|
|
@@ -33,7 +34,8 @@ class DocumentSearch extends common_1.Kommand {
|
|
|
33
34
|
exports.default = DocumentSearch;
|
|
34
35
|
DocumentSearch.description = 'Searches for documents';
|
|
35
36
|
DocumentSearch.examples = [
|
|
36
|
-
'kourou document:search iot sensors \'{
|
|
37
|
+
'kourou document:search iot sensors \'{ equals: { name: "corona" } }\'',
|
|
38
|
+
'kourou document:search iot sensors \'{ match: { name: "cOrOnna" } }\' -a lang=elasticsearch',
|
|
37
39
|
'kourou document:search iot sensors --editor',
|
|
38
40
|
];
|
|
39
41
|
DocumentSearch.flags = Object.assign({ sort: command_1.flags.string({
|
|
@@ -45,11 +47,14 @@ DocumentSearch.flags = Object.assign({ sort: command_1.flags.string({
|
|
|
45
47
|
description: 'Optional page size',
|
|
46
48
|
}), scroll: command_1.flags.string({
|
|
47
49
|
description: 'Optional scroll TTL'
|
|
50
|
+
}), lang: command_1.flags.string({
|
|
51
|
+
description: 'Specify the query language to use',
|
|
52
|
+
default: 'koncorde'
|
|
48
53
|
}), editor: command_1.flags.boolean({
|
|
49
54
|
description: 'Open an editor (EDITOR env variable) to edit the request before sending'
|
|
50
55
|
}), help: command_1.flags.help() }, kuzzle_1.kuzzleFlags);
|
|
51
56
|
DocumentSearch.args = [
|
|
52
57
|
{ name: 'index', description: 'Index name', required: true },
|
|
53
58
|
{ name: 'collection', description: 'Collection name', required: true },
|
|
54
|
-
{ name: 'query', description: '
|
|
59
|
+
{ name: 'query', description: 'Search query in JS or JSON format.' },
|
|
55
60
|
];
|
|
@@ -5,8 +5,7 @@ export default class EsListIndex extends Kommand {
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
7
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
-
|
|
9
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
+
node: flags.IOptionFlag<string>;
|
|
10
9
|
grep: flags.IOptionFlag<string | undefined>;
|
|
11
10
|
};
|
|
12
11
|
runSafe(): Promise<void>;
|
|
@@ -5,16 +5,19 @@ const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsListIndex extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
9
|
+
try {
|
|
10
|
+
const { body } = await esClient.cat.indices({ format: 'json' });
|
|
11
|
+
// nice typescript destructuring syntax (:
|
|
12
|
+
const indexes = body
|
|
13
|
+
.map(({ index }) => index)
|
|
14
|
+
.filter((index) => (this.flags.grep ? index.match(new RegExp(this.flags.grep)) : true))
|
|
15
|
+
.sort();
|
|
16
|
+
this.log(JSON.stringify(indexes, null, 2));
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.log(error);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
exports.default = EsListIndex;
|
|
@@ -22,18 +25,13 @@ EsListIndex.initSdk = false;
|
|
|
22
25
|
EsListIndex.description = 'Lists available ES indexes';
|
|
23
26
|
EsListIndex.flags = {
|
|
24
27
|
help: command_1.flags.help(),
|
|
25
|
-
|
|
26
|
-
char: '
|
|
27
|
-
description: 'Elasticsearch server
|
|
28
|
-
default:
|
|
29
|
-
}),
|
|
30
|
-
port: command_1.flags.string({
|
|
31
|
-
char: 'p',
|
|
32
|
-
description: 'Elasticsearch server port',
|
|
33
|
-
default: process.env.KUZZLE_PORT || '9200',
|
|
28
|
+
node: command_1.flags.string({
|
|
29
|
+
char: 'n',
|
|
30
|
+
description: 'Elasticsearch server URL',
|
|
31
|
+
default: 'http://localhost:9200',
|
|
34
32
|
}),
|
|
35
33
|
grep: command_1.flags.string({
|
|
36
34
|
char: 'g',
|
|
37
35
|
description: 'Match output with pattern',
|
|
38
|
-
})
|
|
36
|
+
}),
|
|
39
37
|
};
|
|
@@ -5,8 +5,7 @@ export default class EsGet extends Kommand {
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
7
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
-
|
|
9
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
+
node: flags.IOptionFlag<string>;
|
|
10
9
|
};
|
|
11
10
|
static args: {
|
|
12
11
|
name: string;
|
|
@@ -5,9 +5,7 @@ const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsGet extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
|
|
9
|
-
const node = `http://${this.flags.host}:${this.flags.port}`;
|
|
10
|
-
const esClient = new elasticsearch_1.Client({ node });
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
11
9
|
const esRequest = {
|
|
12
10
|
index: this.args.index,
|
|
13
11
|
id: this.args.id
|
|
@@ -21,15 +19,10 @@ EsGet.initSdk = false;
|
|
|
21
19
|
EsGet.description = 'Gets a document from ES';
|
|
22
20
|
EsGet.flags = {
|
|
23
21
|
help: command_1.flags.help(),
|
|
24
|
-
|
|
25
|
-
char: '
|
|
26
|
-
description: 'Elasticsearch server
|
|
27
|
-
default:
|
|
28
|
-
}),
|
|
29
|
-
port: command_1.flags.string({
|
|
30
|
-
char: 'p',
|
|
31
|
-
description: 'Elasticsearch server port',
|
|
32
|
-
default: process.env.KUZZLE_PORT || '9200',
|
|
22
|
+
node: command_1.flags.string({
|
|
23
|
+
char: 'n',
|
|
24
|
+
description: 'Elasticsearch server URL',
|
|
25
|
+
default: 'http://localhost:9200',
|
|
33
26
|
}),
|
|
34
27
|
};
|
|
35
28
|
EsGet.args = [
|
|
@@ -6,8 +6,7 @@ export default class EsInsert extends Kommand {
|
|
|
6
6
|
static flags: {
|
|
7
7
|
body: flags.IOptionFlag<string>;
|
|
8
8
|
id: flags.IOptionFlag<string | undefined>;
|
|
9
|
-
|
|
10
|
-
port: flags.IOptionFlag<string>;
|
|
9
|
+
node: flags.IOptionFlag<string>;
|
|
11
10
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
12
11
|
};
|
|
13
12
|
static args: {
|
|
@@ -5,9 +5,7 @@ const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsInsert extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
|
|
9
|
-
const node = `http://${this.flags.host}:${this.flags.port}`;
|
|
10
|
-
const esClient = new elasticsearch_1.Client({ node });
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
11
9
|
const esRequest = {
|
|
12
10
|
index: this.args.index,
|
|
13
11
|
id: this.flags.id,
|
|
@@ -28,15 +26,10 @@ EsInsert.flags = {
|
|
|
28
26
|
id: command_1.flags.string({
|
|
29
27
|
description: 'Document ID'
|
|
30
28
|
}),
|
|
31
|
-
|
|
32
|
-
char: '
|
|
33
|
-
description: 'Elasticsearch server
|
|
34
|
-
default:
|
|
35
|
-
}),
|
|
36
|
-
port: command_1.flags.string({
|
|
37
|
-
char: 'p',
|
|
38
|
-
description: 'Elasticsearch server port',
|
|
39
|
-
default: process.env.KUZZLE_PORT || '9200',
|
|
29
|
+
node: command_1.flags.string({
|
|
30
|
+
char: 'n',
|
|
31
|
+
description: 'Elasticsearch server URL',
|
|
32
|
+
default: 'http://localhost:9200',
|
|
40
33
|
}),
|
|
41
34
|
help: command_1.flags.help(),
|
|
42
35
|
};
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const command_1 = require("@oclif/command");
|
|
5
5
|
const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
6
|
-
const cli_ux_1 = tslib_1.__importDefault(require("cli-ux"));
|
|
7
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
-
const node_emoji_1 = tslib_1.__importDefault(require("node-emoji"));
|
|
6
|
+
const cli_ux_1 = (0, tslib_1.__importDefault)(require("cli-ux"));
|
|
7
|
+
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
8
|
+
const node_emoji_1 = (0, tslib_1.__importDefault)(require("node-emoji"));
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
class EsMigrate extends common_1.Kommand {
|
|
11
11
|
async migrateMappings(index) {
|
|
@@ -5,8 +5,7 @@ export default class EsSnapshotsCreateRepository extends Kommand {
|
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
7
|
compress: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
8
|
-
|
|
9
|
-
port: flags.IOptionFlag<string>;
|
|
8
|
+
node: flags.IOptionFlag<string>;
|
|
10
9
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
11
10
|
};
|
|
12
11
|
static args: {
|
|
@@ -5,9 +5,7 @@ const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsCreateRepository extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
|
|
9
|
-
const node = `http://${this.flags.host}:${this.flags.port}`;
|
|
10
|
-
const esClient = new elasticsearch_1.Client({ node });
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
11
9
|
const esRequest = {
|
|
12
10
|
repository: this.args.repository,
|
|
13
11
|
verify: true,
|
|
@@ -31,15 +29,10 @@ EsSnapshotsCreateRepository.flags = {
|
|
|
31
29
|
description: 'Compress data when storing them',
|
|
32
30
|
default: false
|
|
33
31
|
}),
|
|
34
|
-
|
|
35
|
-
char: '
|
|
36
|
-
description: 'Elasticsearch server
|
|
37
|
-
default:
|
|
38
|
-
}),
|
|
39
|
-
port: command_1.flags.string({
|
|
40
|
-
char: 'p',
|
|
41
|
-
description: 'Elasticsearch server port',
|
|
42
|
-
default: process.env.KUZZLE_PORT || '9200',
|
|
32
|
+
node: command_1.flags.string({
|
|
33
|
+
char: 'n',
|
|
34
|
+
description: 'Elasticsearch server URL',
|
|
35
|
+
default: 'http://localhost:9200',
|
|
43
36
|
}),
|
|
44
37
|
help: command_1.flags.help(),
|
|
45
38
|
};
|
|
@@ -4,8 +4,7 @@ export default class EsSnapshotsCreate extends Kommand {
|
|
|
4
4
|
static initSdk: boolean;
|
|
5
5
|
static description: string;
|
|
6
6
|
static flags: {
|
|
7
|
-
|
|
8
|
-
port: flags.IOptionFlag<string>;
|
|
7
|
+
node: flags.IOptionFlag<string>;
|
|
9
8
|
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
10
9
|
};
|
|
11
10
|
static args: {
|
|
@@ -5,9 +5,7 @@ const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
|
5
5
|
const common_1 = require("../../../common");
|
|
6
6
|
class EsSnapshotsCreate extends common_1.Kommand {
|
|
7
7
|
async runSafe() {
|
|
8
|
-
|
|
9
|
-
const node = `http://${this.flags.host}:${this.flags.port}`;
|
|
10
|
-
const esClient = new elasticsearch_1.Client({ node });
|
|
8
|
+
const esClient = new elasticsearch_1.Client({ node: this.flags.node });
|
|
11
9
|
const esRequest = {
|
|
12
10
|
repository: this.args.repository,
|
|
13
11
|
snapshot: this.args.name,
|
|
@@ -21,15 +19,10 @@ exports.default = EsSnapshotsCreate;
|
|
|
21
19
|
EsSnapshotsCreate.initSdk = false;
|
|
22
20
|
EsSnapshotsCreate.description = 'Create a snapshot repository inside an ES instance';
|
|
23
21
|
EsSnapshotsCreate.flags = {
|
|
24
|
-
|
|
25
|
-
char: '
|
|
26
|
-
description: 'Elasticsearch server
|
|
27
|
-
default:
|
|
28
|
-
}),
|
|
29
|
-
port: command_1.flags.string({
|
|
30
|
-
char: 'p',
|
|
31
|
-
description: 'Elasticsearch server port',
|
|
32
|
-
default: process.env.KUZZLE_PORT || '9200',
|
|
22
|
+
node: command_1.flags.string({
|
|
23
|
+
char: 'n',
|
|
24
|
+
description: 'Elasticsearch server URL',
|
|
25
|
+
default: 'http://localhost:9200',
|
|
33
26
|
}),
|
|
34
27
|
help: command_1.flags.help(),
|
|
35
28
|
};
|