kourou 0.24.2 → 0.25.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.
Files changed (132) hide show
  1. package/README.md +98 -12
  2. package/lib/commands/api-key/check.d.ts +3 -3
  3. package/lib/commands/api-key/check.js +5 -7
  4. package/lib/commands/api-key/create.d.ts +3 -3
  5. package/lib/commands/api-key/create.js +8 -10
  6. package/lib/commands/api-key/delete.d.ts +3 -3
  7. package/lib/commands/api-key/delete.js +4 -6
  8. package/lib/commands/api-key/search.d.ts +3 -3
  9. package/lib/commands/api-key/search.js +5 -7
  10. package/lib/commands/app/debug-proxy.d.ts +3 -3
  11. package/lib/commands/app/debug-proxy.js +57 -55
  12. package/lib/commands/app/doctor.d.ts +24 -0
  13. package/lib/commands/app/doctor.js +201 -0
  14. package/lib/commands/app/scaffold.d.ts +2 -2
  15. package/lib/commands/app/scaffold.js +20 -15
  16. package/lib/commands/app/start-services.d.ts +1 -1
  17. package/lib/commands/app/start-services.js +26 -26
  18. package/lib/commands/collection/create.d.ts +3 -3
  19. package/lib/commands/collection/create.js +9 -6
  20. package/lib/commands/collection/export.d.ts +5 -5
  21. package/lib/commands/collection/export.js +25 -26
  22. package/lib/commands/collection/import.d.ts +5 -5
  23. package/lib/commands/collection/import.js +17 -17
  24. package/lib/commands/collection/migrate.d.ts +27 -0
  25. package/lib/commands/collection/migrate.js +43 -0
  26. package/lib/commands/config/diff.d.ts +1 -1
  27. package/lib/commands/config/diff.js +27 -21
  28. package/lib/commands/document/search.d.ts +3 -3
  29. package/lib/commands/document/search.js +20 -20
  30. package/lib/commands/es/aliases/cat.d.ts +12 -0
  31. package/lib/commands/es/aliases/cat.js +36 -0
  32. package/lib/commands/es/indices/cat.d.ts +2 -2
  33. package/lib/commands/es/indices/cat.js +8 -8
  34. package/lib/commands/es/indices/get.d.ts +2 -2
  35. package/lib/commands/es/indices/get.js +7 -7
  36. package/lib/commands/es/indices/insert.d.ts +2 -2
  37. package/lib/commands/es/indices/insert.js +9 -9
  38. package/lib/commands/es/migrate.d.ts +10 -8
  39. package/lib/commands/es/migrate.js +86 -82
  40. package/lib/commands/es/snapshot/create-repository.d.ts +2 -2
  41. package/lib/commands/es/snapshot/create-repository.js +16 -12
  42. package/lib/commands/es/snapshot/create.d.ts +2 -2
  43. package/lib/commands/es/snapshot/create.js +7 -7
  44. package/lib/commands/es/snapshot/list.d.ts +2 -2
  45. package/lib/commands/es/snapshot/list.js +12 -8
  46. package/lib/commands/file/decrypt.d.ts +4 -4
  47. package/lib/commands/file/decrypt.js +21 -21
  48. package/lib/commands/file/encrypt.d.ts +4 -4
  49. package/lib/commands/file/encrypt.js +20 -22
  50. package/lib/commands/file/test.d.ts +3 -3
  51. package/lib/commands/file/test.js +13 -13
  52. package/lib/commands/import.d.ts +5 -5
  53. package/lib/commands/import.js +39 -28
  54. package/lib/commands/index/export.d.ts +5 -4
  55. package/lib/commands/index/export.js +21 -19
  56. package/lib/commands/index/import.d.ts +5 -5
  57. package/lib/commands/index/import.js +21 -19
  58. package/lib/commands/instance/kill.d.ts +2 -2
  59. package/lib/commands/instance/kill.js +34 -34
  60. package/lib/commands/instance/list.d.ts +1 -1
  61. package/lib/commands/instance/list.js +33 -30
  62. package/lib/commands/instance/logs.d.ts +2 -2
  63. package/lib/commands/instance/logs.js +26 -22
  64. package/lib/commands/instance/spawn.d.ts +2 -2
  65. package/lib/commands/instance/spawn.js +46 -40
  66. package/lib/commands/paas/deploy.d.ts +2 -2
  67. package/lib/commands/paas/deploy.js +33 -21
  68. package/lib/commands/paas/init.d.ts +1 -1
  69. package/lib/commands/paas/init.js +10 -6
  70. package/lib/commands/paas/login.d.ts +3 -3
  71. package/lib/commands/paas/login.js +30 -19
  72. package/lib/commands/paas/logs.d.ts +27 -0
  73. package/lib/commands/paas/logs.js +137 -18
  74. package/lib/commands/profile/export.d.ts +3 -3
  75. package/lib/commands/profile/export.js +12 -12
  76. package/lib/commands/profile/import.d.ts +3 -3
  77. package/lib/commands/profile/import.js +6 -8
  78. package/lib/commands/realtime/subscribe.d.ts +3 -3
  79. package/lib/commands/realtime/subscribe.js +25 -25
  80. package/lib/commands/redis/list-keys.d.ts +3 -3
  81. package/lib/commands/redis/list-keys.js +15 -11
  82. package/lib/commands/role/export.d.ts +3 -3
  83. package/lib/commands/role/export.js +11 -11
  84. package/lib/commands/role/import.d.ts +4 -4
  85. package/lib/commands/role/import.js +10 -12
  86. package/lib/commands/sdk/execute.d.ts +5 -5
  87. package/lib/commands/sdk/execute.js +23 -19
  88. package/lib/commands/sdk/query.d.ts +5 -4
  89. package/lib/commands/sdk/query.js +30 -24
  90. package/lib/commands/user/export-mappings.d.ts +3 -3
  91. package/lib/commands/user/export-mappings.js +11 -11
  92. package/lib/commands/user/export.d.ts +6 -6
  93. package/lib/commands/user/export.js +34 -33
  94. package/lib/commands/user/import-mappings.d.ts +3 -3
  95. package/lib/commands/user/import-mappings.js +7 -7
  96. package/lib/commands/user/import.d.ts +3 -3
  97. package/lib/commands/user/import.js +6 -8
  98. package/lib/commands/vault/add.d.ts +3 -3
  99. package/lib/commands/vault/add.js +27 -19
  100. package/lib/commands/vault/decrypt.d.ts +4 -4
  101. package/lib/commands/vault/decrypt.js +24 -20
  102. package/lib/commands/vault/encrypt.d.ts +4 -4
  103. package/lib/commands/vault/encrypt.js +24 -20
  104. package/lib/commands/vault/show.d.ts +3 -3
  105. package/lib/commands/vault/show.js +24 -20
  106. package/lib/commands/vault/test.d.ts +3 -3
  107. package/lib/commands/vault/test.js +16 -12
  108. package/lib/common.d.ts +3 -3
  109. package/lib/common.js +28 -29
  110. package/lib/hooks/command_not_found/api-action.d.ts +2 -2
  111. package/lib/hooks/command_not_found/api-action.js +20 -22
  112. package/lib/index.d.ts +1 -1
  113. package/lib/support/PaasKommand.d.ts +2 -2
  114. package/lib/support/PaasKommand.js +9 -9
  115. package/lib/support/dump-collection.js +50 -41
  116. package/lib/support/editor.js +12 -10
  117. package/lib/support/execute.d.ts +6 -1
  118. package/lib/support/execute.js +9 -8
  119. package/lib/support/kuzzle.d.ts +12 -4
  120. package/lib/support/kuzzle.js +65 -31
  121. package/lib/support/migrate/providers/elasticsearch.d.ts +16 -0
  122. package/lib/support/migrate/providers/elasticsearch.js +74 -0
  123. package/lib/support/migrate/providers/file.d.ts +15 -0
  124. package/lib/support/migrate/providers/file.js +74 -0
  125. package/lib/support/migrate/providers/index.d.ts +12 -0
  126. package/lib/support/migrate/providers/index.js +16 -0
  127. package/lib/support/migrate/types.d.ts +8 -0
  128. package/lib/support/migrate/types.js +2 -0
  129. package/lib/support/restore-collection.d.ts +2 -1
  130. package/lib/support/restore-collection.js +37 -26
  131. package/lib/support/restore-securities.js +22 -19
  132. package/package.json +16 -15
@@ -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");
@@ -10,31 +10,31 @@ const restore_collection_1 = require("../../support/restore-collection");
10
10
  class CollectionImport extends common_1.Kommand {
11
11
  async runSafe() {
12
12
  this.logInfo(`Start importing dump from ${this.args.path}`);
13
- if (!this.flags['no-mappings']) {
14
- const mappingsPath = path_1.default.join(this.args.path, 'mappings.json');
15
- const dump = JSON.parse(fs_1.default.readFileSync(mappingsPath, 'utf8'));
13
+ if (!this.flags["no-mappings"]) {
14
+ const mappingsPath = path_1.default.join(this.args.path, "mappings.json");
15
+ const dump = JSON.parse(fs_1.default.readFileSync(mappingsPath, "utf8"));
16
16
  await (0, restore_collection_1.restoreCollectionMappings)(this.sdk, dump, this.flags.index, this.flags.collection);
17
17
  }
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);
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
  }
22
22
  exports.default = CollectionImport;
23
23
  CollectionImport.keepAuth = true;
24
- CollectionImport.description = 'Imports a collection';
25
- CollectionImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), 'batch-size': command_1.flags.string({
26
- description: 'Maximum batch size (see limits.documentsWriteCount config)',
27
- default: '200'
24
+ CollectionImport.description = "Imports a collection";
25
+ CollectionImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), "batch-size": command_1.flags.string({
26
+ description: "Maximum batch size (see limits.documentsWriteCount config)",
27
+ default: "200",
28
28
  }), index: command_1.flags.string({
29
- description: 'If set, override the index destination name',
29
+ description: "If set, override the index destination name",
30
30
  }), collection: command_1.flags.string({
31
- description: 'If set, override the collection destination name',
32
- }), 'no-mappings': command_1.flags.boolean({
33
- description: 'Skip collection mappings'
31
+ description: "If set, override the collection destination name",
32
+ }), "no-mappings": command_1.flags.boolean({
33
+ description: "Skip collection mappings",
34
34
  }) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
35
- description: 'Kuzzle protocol (http or websocket)',
36
- default: 'ws',
35
+ description: "Kuzzle protocol (http or websocket)",
36
+ default: "ws",
37
37
  }) });
38
38
  CollectionImport.args = [
39
- { name: 'path', description: 'Dump directory path', required: true },
39
+ { name: "path", description: "Dump directory path", required: true },
40
40
  ];
@@ -0,0 +1,27 @@
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../common";
3
+ export default class CollectionMigrate extends Kommand {
4
+ static keepAuth: boolean;
5
+ static description: string;
6
+ static flags: {
7
+ protocol: flags.IOptionFlag<string>;
8
+ host: flags.IOptionFlag<string>;
9
+ port: flags.IOptionFlag<string>;
10
+ ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11
+ username: flags.IOptionFlag<string>;
12
+ password: flags.IOptionFlag<string | undefined>;
13
+ as: flags.IOptionFlag<string | undefined>;
14
+ "api-key": flags.IOptionFlag<string | undefined>;
15
+ help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
16
+ "batch-size": flags.IOptionFlag<string>;
17
+ index: flags.IOptionFlag<string | undefined>;
18
+ collection: flags.IOptionFlag<string | undefined>;
19
+ };
20
+ static args: {
21
+ name: string;
22
+ description: string;
23
+ required: boolean;
24
+ }[];
25
+ runSafe(): Promise<void>;
26
+ private getMigrationFunction;
27
+ }
@@ -0,0 +1,43 @@
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 common_1 = require("../../common");
8
+ const kuzzle_1 = require("../../support/kuzzle");
9
+ const restore_collection_1 = require("../../support/restore-collection");
10
+ class CollectionMigrate extends common_1.Kommand {
11
+ async runSafe() {
12
+ this.logInfo(`Start migration documents with ${this.args.script} from ${this.args.path}`);
13
+ const migrateDocument = this.getMigrationFunction();
14
+ 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, migrateDocument);
15
+ this.logOk(`Successfully migrated ${total} documents from "${this.args.path}" in "${index}:${collection}"`);
16
+ }
17
+ getMigrationFunction() {
18
+ const migrationScript = fs_1.default.readFileSync(this.args.script, "utf8");
19
+ let migrationFunction;
20
+ {
21
+ migrationFunction = eval(`var f = ${migrationScript}; f`);
22
+ }
23
+ return migrationFunction;
24
+ }
25
+ }
26
+ exports.default = CollectionMigrate;
27
+ CollectionMigrate.keepAuth = true;
28
+ CollectionMigrate.description = "Migrate a collection";
29
+ CollectionMigrate.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), "batch-size": command_1.flags.string({
30
+ description: "Maximum batch size (see limits.documentsWriteCount config)",
31
+ default: "200",
32
+ }), index: command_1.flags.string({
33
+ description: "If set, override the index destination name",
34
+ }), collection: command_1.flags.string({
35
+ description: "If set, override the collection destination name",
36
+ }) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
37
+ description: "Kuzzle protocol (http or websocket)",
38
+ default: "ws",
39
+ }) });
40
+ CollectionMigrate.args = [
41
+ { name: "script", description: "Migration script path", required: true },
42
+ { name: "path", description: "Collection dump path", required: true },
43
+ ];
@@ -1,4 +1,4 @@
1
- import { Kommand } from '../../common';
1
+ import { Kommand } from "../../common";
2
2
  export declare class ConfigKeyDiff extends Kommand {
3
3
  static initSdk: boolean;
4
4
  static description: string;
@@ -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,19 +15,19 @@ 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((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')));
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
- this.logOk('No differences between keys in the provided configurations');
22
+ this.logOk("No differences between keys in the provided configurations");
23
23
  return;
24
24
  }
25
- this.logInfo('Found differences between keys in the provided configurations. In the second file:');
25
+ this.logInfo("Found differences between keys in the provided configurations. In the second file:");
26
26
  for (const [path, change] of Object.entries(changes)) {
27
27
  this.log(` - key "${path}" ${change}`);
28
28
  }
29
29
  if (this.flags.strict) {
30
- throw new Error('Provided configuration contains different keys');
30
+ throw new Error("Provided configuration contains different keys");
31
31
  }
32
32
  }
33
33
  // Returns path who had changed between two objects (inspired by https://gist.github.com/Yimiprod/7ee176597fef230d1451)
@@ -39,18 +39,20 @@ class ConfigKeyDiff extends common_1.Kommand {
39
39
  const ar = [];
40
40
  const ar2 = [];
41
41
  ar.concat(ar2);
42
- changes[[...path, key].join('.')] = 'was removed';
42
+ changes[[...path, key].join(".")] = "was removed";
43
43
  }
44
44
  }
45
45
  for (const key of Object.keys(_object)) {
46
46
  if (_base[key] === undefined) {
47
- changes[[...path, key].join('.')] = 'was added';
47
+ changes[[...path, key].join(".")] = "was added";
48
48
  }
49
- else if (!lodash_1.default.isEqual(_object[key], _base[key]) && lodash_1.default.isObject(_object[key]) && lodash_1.default.isObject(_base[key])) {
49
+ else if (!lodash_1.default.isEqual(_object[key], _base[key]) &&
50
+ lodash_1.default.isObject(_object[key]) &&
51
+ lodash_1.default.isObject(_base[key])) {
50
52
  walkObject(_base[key], _object[key], [...path, key]);
51
53
  }
52
54
  else if (this.flags.values && _base[key] !== _object[key]) {
53
- changes[[...path, key].join('.')] = `value is "${_object[key]}" and was "${_base[key]}"`;
55
+ changes[[...path, key].join(".")] = `value is "${_object[key]}" and was "${_base[key]}"`;
54
56
  }
55
57
  }
56
58
  };
@@ -60,21 +62,25 @@ class ConfigKeyDiff extends common_1.Kommand {
60
62
  }
61
63
  exports.ConfigKeyDiff = ConfigKeyDiff;
62
64
  ConfigKeyDiff.initSdk = false;
63
- ConfigKeyDiff.description = 'Returns differences between two Kuzzle configuration files (kuzzlerc)';
65
+ ConfigKeyDiff.description = "Returns differences between two Kuzzle configuration files (kuzzlerc)";
64
66
  ConfigKeyDiff.examples = [
65
- 'kourou config:diff config/local/kuzzlerc config/production/kuzzlerc'
67
+ "kourou config:diff config/local/kuzzlerc config/production/kuzzlerc",
66
68
  ];
67
69
  ConfigKeyDiff.flags = {
68
70
  strict: command_1.flags.boolean({
69
- description: 'Exit with an error if differences are found',
70
- default: false
71
+ description: "Exit with an error if differences are found",
72
+ default: false,
71
73
  }),
72
74
  values: command_1.flags.boolean({
73
- description: 'Also displays value changes',
74
- default: false
75
- })
75
+ description: "Also displays value changes",
76
+ default: false,
77
+ }),
76
78
  };
77
79
  ConfigKeyDiff.args = [
78
- { name: 'first', description: 'First configuration file', required: true },
79
- { name: 'second', description: 'Second configuration file', required: true },
80
+ { name: "first", description: "First configuration file", required: true },
81
+ {
82
+ name: "second",
83
+ description: "Second configuration file",
84
+ required: true,
85
+ },
80
86
  ];
@@ -1,5 +1,5 @@
1
- import { flags } from '@oclif/command';
2
- import { Kommand } from '../../common';
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../common";
3
3
  export default class DocumentSearch extends Kommand {
4
4
  static description: string;
5
5
  static examples: string[];
@@ -11,7 +11,7 @@ export default class DocumentSearch extends Kommand {
11
11
  password: flags.IOptionFlag<string | undefined>;
12
12
  protocol: flags.IOptionFlag<string>;
13
13
  as: flags.IOptionFlag<string | undefined>;
14
- 'api-key': flags.IOptionFlag<string | undefined>;
14
+ "api-key": flags.IOptionFlag<string | undefined>;
15
15
  sort: flags.IOptionFlag<string>;
16
16
  from: flags.IOptionFlag<string | undefined>;
17
17
  size: flags.IOptionFlag<string | undefined>;
@@ -6,8 +6,8 @@ const kuzzle_1 = require("../../support/kuzzle");
6
6
  class DocumentSearch extends common_1.Kommand {
7
7
  async runSafe() {
8
8
  let request = {
9
- controller: 'document',
10
- action: 'search',
9
+ controller: "document",
10
+ action: "search",
11
11
  index: this.args.index,
12
12
  collection: this.args.collection,
13
13
  from: this.flags.from,
@@ -15,9 +15,9 @@ class DocumentSearch extends common_1.Kommand {
15
15
  scroll: this.flags.scroll,
16
16
  lang: this.flags.lang,
17
17
  body: {
18
- query: this.parseJs(this.args.query || '{}'),
19
- sort: this.parseJs(this.flags.sort)
20
- }
18
+ query: this.parseJs(this.args.query || "{}"),
19
+ sort: this.parseJs(this.flags.sort),
20
+ },
21
21
  };
22
22
  // allow to edit request before send
23
23
  if (this.flags.editor) {
@@ -32,29 +32,29 @@ class DocumentSearch extends common_1.Kommand {
32
32
  }
33
33
  }
34
34
  exports.default = DocumentSearch;
35
- DocumentSearch.description = 'Searches for documents';
35
+ DocumentSearch.description = "Searches for documents";
36
36
  DocumentSearch.examples = [
37
- 'kourou document:search iot sensors \'{ equals: { name: "corona" } }\'',
38
- 'kourou document:search iot sensors \'{ match: { name: "cOrOnna" } }\' -a lang=elasticsearch',
39
- 'kourou document:search iot sensors --editor',
37
+ "kourou document:search iot sensors '{ equals: { name: \"corona\" } }'",
38
+ "kourou document:search iot sensors '{ match: { name: \"cOrOnna\" } }' -a lang=elasticsearch",
39
+ "kourou document:search iot sensors --editor",
40
40
  ];
41
41
  DocumentSearch.flags = Object.assign({ sort: command_1.flags.string({
42
- description: 'Sort in JS or JSON format.',
43
- default: '{}'
42
+ description: "Sort in JS or JSON format.",
43
+ default: "{}",
44
44
  }), from: command_1.flags.string({
45
- description: 'Optional offset'
45
+ description: "Optional offset",
46
46
  }), size: command_1.flags.string({
47
- description: 'Optional page size',
47
+ description: "Optional page size",
48
48
  }), scroll: command_1.flags.string({
49
- description: 'Optional scroll TTL'
49
+ description: "Optional scroll TTL",
50
50
  }), lang: command_1.flags.string({
51
- description: 'Specify the query language to use',
52
- default: 'koncorde'
51
+ description: "Specify the query language to use",
52
+ default: "koncorde",
53
53
  }), editor: command_1.flags.boolean({
54
- description: 'Open an editor (EDITOR env variable) to edit the request before sending'
54
+ description: "Open an editor (EDITOR env variable) to edit the request before sending",
55
55
  }), help: command_1.flags.help() }, kuzzle_1.kuzzleFlags);
56
56
  DocumentSearch.args = [
57
- { name: 'index', description: 'Index name', required: true },
58
- { name: 'collection', description: 'Collection name', required: true },
59
- { name: 'query', description: 'Search query in JS or JSON format.' },
57
+ { name: "index", description: "Index name", required: true },
58
+ { name: "collection", description: "Collection name", required: true },
59
+ { name: "query", description: "Search query in JS or JSON format." },
60
60
  ];
@@ -0,0 +1,12 @@
1
+ import { flags } from '@oclif/command';
2
+ import { Kommand } from '../../../common';
3
+ export default class EsListAliases extends Kommand {
4
+ static initSdk: boolean;
5
+ static description: string;
6
+ static flags: {
7
+ help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
8
+ node: flags.IOptionFlag<string>;
9
+ grep: flags.IOptionFlag<string | undefined>;
10
+ };
11
+ runSafe(): Promise<void>;
12
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const command_1 = require("@oclif/command");
4
+ const elasticsearch_1 = require("@elastic/elasticsearch");
5
+ const common_1 = require("../../../common");
6
+ class EsListAliases extends common_1.Kommand {
7
+ async runSafe() {
8
+ const esClient = new elasticsearch_1.Client({ node: this.flags.node });
9
+ try {
10
+ const { body } = await esClient.cat.aliases({ format: 'json' });
11
+ const elements = body
12
+ .map((e) => ({ index: e.index, alias: e.alias }))
13
+ .filter((e) => (this.flags.grep ? e.alias.match(new RegExp(this.flags.grep)) : true))
14
+ .sort();
15
+ this.log(JSON.stringify(elements, null, 2));
16
+ }
17
+ catch (error) {
18
+ console.log(error);
19
+ }
20
+ }
21
+ }
22
+ exports.default = EsListAliases;
23
+ EsListAliases.initSdk = false;
24
+ EsListAliases.description = 'Lists available ES aliases';
25
+ EsListAliases.flags = {
26
+ help: command_1.flags.help(),
27
+ node: command_1.flags.string({
28
+ char: 'n',
29
+ description: 'Elasticsearch server URL',
30
+ default: 'http://localhost:9200',
31
+ }),
32
+ grep: command_1.flags.string({
33
+ char: 'g',
34
+ description: 'Match output with pattern',
35
+ }),
36
+ };
@@ -1,5 +1,5 @@
1
- import { flags } from '@oclif/command';
2
- import { Kommand } from '../../../common';
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../../common";
3
3
  export default class EsListIndex extends Kommand {
4
4
  static initSdk: boolean;
5
5
  static description: string;
@@ -7,11 +7,11 @@ class EsListIndex extends common_1.Kommand {
7
7
  async runSafe() {
8
8
  const esClient = new elasticsearch_1.Client({ node: this.flags.node });
9
9
  try {
10
- const { body } = await esClient.cat.indices({ format: 'json' });
10
+ const { body } = await esClient.cat.indices({ format: "json" });
11
11
  // nice typescript destructuring syntax (:
12
12
  const indexes = body
13
13
  .map(({ index }) => index)
14
- .filter((index) => (this.flags.grep ? index.match(new RegExp(this.flags.grep)) : true))
14
+ .filter((index) => this.flags.grep ? index.match(new RegExp(this.flags.grep)) : true)
15
15
  .sort();
16
16
  this.log(JSON.stringify(indexes, null, 2));
17
17
  }
@@ -22,16 +22,16 @@ class EsListIndex extends common_1.Kommand {
22
22
  }
23
23
  exports.default = EsListIndex;
24
24
  EsListIndex.initSdk = false;
25
- EsListIndex.description = 'Lists available ES indexes';
25
+ EsListIndex.description = "Lists available ES indexes";
26
26
  EsListIndex.flags = {
27
27
  help: command_1.flags.help(),
28
28
  node: command_1.flags.string({
29
- char: 'n',
30
- description: 'Elasticsearch server URL',
31
- default: 'http://localhost:9200',
29
+ char: "n",
30
+ description: "Elasticsearch server URL",
31
+ default: "http://localhost:9200",
32
32
  }),
33
33
  grep: command_1.flags.string({
34
- char: 'g',
35
- description: 'Match output with pattern',
34
+ char: "g",
35
+ description: "Match output with pattern",
36
36
  }),
37
37
  };
@@ -1,5 +1,5 @@
1
- import { flags } from '@oclif/command';
2
- import { Kommand } from '../../../common';
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../../common";
3
3
  export default class EsGet extends Kommand {
4
4
  static initSdk: boolean;
5
5
  static description: string;
@@ -8,7 +8,7 @@ class EsGet extends common_1.Kommand {
8
8
  const esClient = new elasticsearch_1.Client({ node: this.flags.node });
9
9
  const esRequest = {
10
10
  index: this.args.index,
11
- id: this.args.id
11
+ id: this.args.id,
12
12
  };
13
13
  const { body } = await esClient.get(esRequest);
14
14
  this.log(JSON.stringify(body, null, 2));
@@ -16,16 +16,16 @@ class EsGet extends common_1.Kommand {
16
16
  }
17
17
  exports.default = EsGet;
18
18
  EsGet.initSdk = false;
19
- EsGet.description = 'Gets a document from ES';
19
+ EsGet.description = "Gets a document from ES";
20
20
  EsGet.flags = {
21
21
  help: command_1.flags.help(),
22
22
  node: command_1.flags.string({
23
- char: 'n',
24
- description: 'Elasticsearch server URL',
25
- default: 'http://localhost:9200',
23
+ char: "n",
24
+ description: "Elasticsearch server URL",
25
+ default: "http://localhost:9200",
26
26
  }),
27
27
  };
28
28
  EsGet.args = [
29
- { name: 'index', description: 'ES Index name', required: true },
30
- { name: 'id', description: 'Document ID', required: true }
29
+ { name: "index", description: "ES Index name", required: true },
30
+ { name: "id", description: "Document ID", required: true },
31
31
  ];
@@ -1,5 +1,5 @@
1
- import { flags } from '@oclif/command';
2
- import { Kommand } from '../../../common';
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../../common";
3
3
  export default class EsInsert extends Kommand {
4
4
  static initSdk: boolean;
5
5
  static description: string;
@@ -12,27 +12,27 @@ class EsInsert extends common_1.Kommand {
12
12
  body: this.flags.body,
13
13
  };
14
14
  await esClient.index(esRequest);
15
- this.logOk('Document successfully inserted.');
15
+ this.logOk("Document successfully inserted.");
16
16
  }
17
17
  }
18
18
  exports.default = EsInsert;
19
19
  EsInsert.initSdk = false;
20
- EsInsert.description = 'Inserts a document directly into ES (will replace if exists)';
20
+ EsInsert.description = "Inserts a document directly into ES (will replace if exists)";
21
21
  EsInsert.flags = {
22
22
  body: command_1.flags.string({
23
- description: 'Document body in JSON',
24
- default: '{}'
23
+ description: "Document body in JSON",
24
+ default: "{}",
25
25
  }),
26
26
  id: command_1.flags.string({
27
- description: 'Document ID'
27
+ description: "Document ID",
28
28
  }),
29
29
  node: command_1.flags.string({
30
- char: 'n',
31
- description: 'Elasticsearch server URL',
32
- default: 'http://localhost:9200',
30
+ char: "n",
31
+ description: "Elasticsearch server URL",
32
+ default: "http://localhost:9200",
33
33
  }),
34
34
  help: command_1.flags.help(),
35
35
  };
36
36
  EsInsert.args = [
37
- { name: 'index', description: 'ES Index name', required: true },
37
+ { name: "index", description: "ES Index name", required: true },
38
38
  ];
@@ -1,6 +1,5 @@
1
- import { flags } from '@oclif/command';
2
- import { Client } from '@elastic/elasticsearch';
3
- import { Kommand } from '../../common';
1
+ import { flags } from "@oclif/command";
2
+ import { Kommand } from "../../common";
4
3
  export default class EsMigrate extends Kommand {
5
4
  static initSdk: boolean;
6
5
  static description: string;
@@ -9,15 +8,18 @@ export default class EsMigrate extends Kommand {
9
8
  src: flags.IOptionFlag<string>;
10
9
  dest: flags.IOptionFlag<string>;
11
10
  reset: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
12
- 'batch-size': import("@oclif/parser/lib/flags").IOptionFlag<number>;
13
- 'no-interactive': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
14
- 'dry-run': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11
+ "batch-size": import("@oclif/parser/lib/flags").IOptionFlag<number>;
12
+ "no-interactive": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
13
+ "dry-run": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
15
14
  pattern: flags.IOptionFlag<string | undefined>;
16
15
  scroll: flags.IOptionFlag<string>;
17
16
  };
18
17
  static examples: string[];
19
- private migrateMappings;
18
+ private src;
19
+ private dest;
20
+ private detectProviderType;
21
+ private migrateIndex;
20
22
  private migrateData;
21
- runMigrate(index: string, src: Client, dest: Client): Promise<void>;
23
+ runMigrate(index: string): Promise<void>;
22
24
  runSafe(): Promise<void>;
23
25
  }