kourou 1.4.0-dev.4 → 1.5.0-dev.1

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 (116) hide show
  1. package/README.md +892 -707
  2. package/bin/run +10 -24
  3. package/lib/commands/api-key/check.d.ts +11 -14
  4. package/lib/commands/api-key/check.js +5 -5
  5. package/lib/commands/api-key/create.d.ts +14 -17
  6. package/lib/commands/api-key/create.js +7 -5
  7. package/lib/commands/api-key/delete.d.ts +12 -14
  8. package/lib/commands/api-key/delete.js +6 -6
  9. package/lib/commands/api-key/search.d.ts +12 -15
  10. package/lib/commands/api-key/search.js +5 -3
  11. package/lib/commands/app/debug-proxy.d.ts +15 -16
  12. package/lib/commands/app/debug-proxy.js +7 -7
  13. package/lib/commands/app/doctor.d.ts +11 -12
  14. package/lib/commands/app/doctor.js +3 -3
  15. package/lib/commands/app/scaffold.d.ts +5 -8
  16. package/lib/commands/app/scaffold.js +8 -9
  17. package/lib/commands/app/start-services.d.ts +2 -2
  18. package/lib/commands/app/start-services.js +3 -3
  19. package/lib/commands/collection/create.d.ts +14 -19
  20. package/lib/commands/collection/create.js +8 -9
  21. package/lib/commands/collection/export.d.ts +20 -22
  22. package/lib/commands/collection/export.js +14 -14
  23. package/lib/commands/collection/import.d.ts +15 -18
  24. package/lib/commands/collection/import.js +9 -9
  25. package/lib/commands/collection/migrate.d.ts +15 -17
  26. package/lib/commands/collection/migrate.js +12 -9
  27. package/lib/commands/config/diff.d.ts +5 -6
  28. package/lib/commands/config/diff.js +11 -9
  29. package/lib/commands/document/search.d.ts +20 -25
  30. package/lib/commands/document/search.js +13 -13
  31. package/lib/commands/es/aliases/cat.d.ts +3 -4
  32. package/lib/commands/es/aliases/cat.js +4 -4
  33. package/lib/commands/es/indices/cat.d.ts +3 -4
  34. package/lib/commands/es/indices/cat.js +4 -4
  35. package/lib/commands/es/indices/get.d.ts +5 -7
  36. package/lib/commands/es/indices/get.js +7 -7
  37. package/lib/commands/es/indices/insert.d.ts +6 -9
  38. package/lib/commands/es/indices/insert.js +8 -8
  39. package/lib/commands/es/migrate.d.ts +11 -12
  40. package/lib/commands/es/migrate.js +26 -15
  41. package/lib/commands/es/snapshot/create-repository.d.ts +6 -8
  42. package/lib/commands/es/snapshot/create-repository.js +12 -10
  43. package/lib/commands/es/snapshot/create.d.ts +6 -8
  44. package/lib/commands/es/snapshot/create.js +11 -8
  45. package/lib/commands/es/snapshot/list.d.ts +4 -7
  46. package/lib/commands/es/snapshot/list.js +7 -8
  47. package/lib/commands/es/snapshot/restore.d.ts +6 -8
  48. package/lib/commands/es/snapshot/restore.js +11 -8
  49. package/lib/commands/file/decrypt.d.ts +5 -8
  50. package/lib/commands/file/decrypt.js +7 -7
  51. package/lib/commands/file/encrypt.d.ts +5 -8
  52. package/lib/commands/file/encrypt.js +7 -5
  53. package/lib/commands/file/test.d.ts +3 -6
  54. package/lib/commands/file/test.js +5 -5
  55. package/lib/commands/import.d.ts +13 -16
  56. package/lib/commands/import.js +8 -9
  57. package/lib/commands/index/export.d.ts +17 -20
  58. package/lib/commands/index/export.js +12 -11
  59. package/lib/commands/index/import.d.ts +14 -17
  60. package/lib/commands/index/import.js +11 -8
  61. package/lib/commands/instance/kill.d.ts +2 -3
  62. package/lib/commands/instance/kill.js +6 -7
  63. package/lib/commands/instance/logs.d.ts +2 -3
  64. package/lib/commands/instance/logs.js +3 -3
  65. package/lib/commands/instance/spawn.d.ts +3 -4
  66. package/lib/commands/instance/spawn.js +7 -8
  67. package/lib/commands/paas/login.d.ts +4 -5
  68. package/lib/commands/paas/login.js +13 -8
  69. package/lib/commands/profile/export.d.ts +10 -11
  70. package/lib/commands/profile/export.js +3 -3
  71. package/lib/commands/profile/import.d.ts +11 -14
  72. package/lib/commands/profile/import.js +5 -3
  73. package/lib/commands/realtime/subscribe.d.ts +19 -24
  74. package/lib/commands/realtime/subscribe.js +12 -12
  75. package/lib/commands/redis/list-keys.d.ts +14 -17
  76. package/lib/commands/redis/list-keys.js +8 -9
  77. package/lib/commands/role/export.d.ts +10 -11
  78. package/lib/commands/role/export.js +3 -3
  79. package/lib/commands/role/import.d.ts +12 -15
  80. package/lib/commands/role/import.js +6 -4
  81. package/lib/commands/sdk/execute.d.ts +15 -18
  82. package/lib/commands/sdk/execute.js +9 -10
  83. package/lib/commands/sdk/query.d.ts +20 -23
  84. package/lib/commands/sdk/query.js +14 -15
  85. package/lib/commands/user/export-mappings.d.ts +10 -11
  86. package/lib/commands/user/export-mappings.js +3 -3
  87. package/lib/commands/user/export.d.ts +14 -15
  88. package/lib/commands/user/export.js +7 -7
  89. package/lib/commands/user/import-mappings.d.ts +11 -14
  90. package/lib/commands/user/import-mappings.js +5 -3
  91. package/lib/commands/user/import.d.ts +11 -14
  92. package/lib/commands/user/import.js +5 -3
  93. package/lib/commands/vault/add.d.ts +5 -6
  94. package/lib/commands/vault/add.js +9 -11
  95. package/lib/commands/vault/decrypt.d.ts +5 -8
  96. package/lib/commands/vault/decrypt.js +8 -9
  97. package/lib/commands/vault/encrypt.d.ts +5 -8
  98. package/lib/commands/vault/encrypt.js +8 -9
  99. package/lib/commands/vault/show.d.ts +5 -11
  100. package/lib/commands/vault/show.js +7 -8
  101. package/lib/commands/vault/test.d.ts +3 -6
  102. package/lib/commands/vault/test.js +6 -7
  103. package/lib/common.d.ts +1 -1
  104. package/lib/common.js +3 -3
  105. package/lib/help.d.ts +16 -0
  106. package/lib/help.js +31 -0
  107. package/lib/hooks/command_not_found/api-action.d.ts +1 -1
  108. package/lib/hooks/command_not_found/api-action.js +8 -8
  109. package/lib/index.d.ts +1 -1
  110. package/lib/index.js +2 -2
  111. package/lib/support/dump-collection.js +2 -2
  112. package/lib/support/kuzzle.d.ts +8 -9
  113. package/lib/support/kuzzle.js +9 -9
  114. package/lib/support/progressBar.d.ts +10 -0
  115. package/lib/support/progressBar.js +15 -0
  116. package/package.json +13 -12
@@ -1,22 +1,21 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export default class UserExport extends Kommand {
4
3
  static description: string;
5
4
  static flags: {
6
- protocol: flags.IOptionFlag<string>;
7
- host: flags.IOptionFlag<string>;
8
- port: flags.IOptionFlag<string>;
9
- ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- username: flags.IOptionFlag<string>;
11
- password: flags.IOptionFlag<string | undefined>;
12
- as: flags.IOptionFlag<string | undefined>;
13
- "api-key": flags.IOptionFlag<string | undefined>;
14
- help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
15
- path: flags.IOptionFlag<string>;
16
- exclude: flags.IOptionFlag<string[]>;
17
- "generate-credentials": import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
18
- "generated-username": flags.IOptionFlag<string>;
19
- "batch-size": flags.IOptionFlag<string>;
5
+ protocol: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ host: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ port: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ ssl: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ username: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ password: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ as: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ "api-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
14
+ path: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ exclude: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ "generate-credentials": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
+ "generated-username": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ "batch-size": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
19
  };
21
20
  private excludes;
22
21
  beforeConnect(): Promise<void>;
@@ -5,7 +5,7 @@ const fs_1 = tslib_1.__importDefault(require("fs"));
5
5
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
6
  const crypto_1 = tslib_1.__importDefault(require("crypto"));
7
7
  const path_1 = tslib_1.__importDefault(require("path"));
8
- const command_1 = require("@oclif/command");
8
+ const core_1 = require("@oclif/core");
9
9
  const common_1 = require("../../common");
10
10
  const kuzzle_1 = require("../../support/kuzzle");
11
11
  function randomPassword() {
@@ -91,21 +91,21 @@ Examples:
91
91
  - kourou user:export --generate-credentials
92
92
  - kourou user:export --generate-credentials --generated-username content.email
93
93
  `;
94
- UserExport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}), path: command_1.flags.string({
94
+ UserExport.flags = Object.assign(Object.assign({ help: core_1.Flags.help({}), path: core_1.Flags.string({
95
95
  description: "Dump directory",
96
96
  default: "users",
97
- }), exclude: command_1.flags.string({
97
+ }), exclude: core_1.Flags.string({
98
98
  description: "Exclude users by matching their IDs with a regexp",
99
99
  multiple: true,
100
- }), "generate-credentials": command_1.flags.boolean({
100
+ }), "generate-credentials": core_1.Flags.boolean({
101
101
  description: "Generate credentials with a random password for users",
102
- }), "generated-username": command_1.flags.string({
102
+ }), "generated-username": core_1.Flags.string({
103
103
  description: "User content property used as a username for local credentials",
104
104
  default: "_id",
105
- }), "batch-size": command_1.flags.string({
105
+ }), "batch-size": core_1.Flags.string({
106
106
  description: "Maximum batch size (see limits.documentsFetchCount config)",
107
107
  default: "2000",
108
- }) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
108
+ }) }, kuzzle_1.kuzzleFlags), { protocol: core_1.Flags.string({
109
109
  description: "Kuzzle protocol (http or websocket)",
110
110
  default: "ws",
111
111
  }) });
@@ -1,22 +1,19 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export default class UserImportMappings extends Kommand {
4
3
  static description: string;
5
4
  static flags: {
6
- protocol: flags.IOptionFlag<string>;
7
- host: flags.IOptionFlag<string>;
8
- port: flags.IOptionFlag<string>;
9
- ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- username: flags.IOptionFlag<string>;
11
- password: flags.IOptionFlag<string | undefined>;
12
- as: flags.IOptionFlag<string | undefined>;
13
- "api-key": flags.IOptionFlag<string | undefined>;
14
- help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
5
+ protocol: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ host: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ port: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ ssl: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ username: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ password: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ as: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ "api-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
15
14
  };
16
15
  static args: {
17
- name: string;
18
- description: string;
19
- required: boolean;
20
- }[];
16
+ path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
17
+ };
21
18
  runSafe(): Promise<void>;
22
19
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const command_1 = require("@oclif/command");
4
+ const core_1 = require("@oclif/core");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const common_1 = require("../../common");
7
7
  const kuzzle_1 = require("../../support/kuzzle");
@@ -15,9 +15,11 @@ class UserImportMappings extends common_1.Kommand {
15
15
  }
16
16
  }
17
17
  UserImportMappings.description = "Imports users collection mappings";
18
- UserImportMappings.flags = Object.assign(Object.assign({ help: command_1.flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
18
+ UserImportMappings.flags = Object.assign(Object.assign({ help: core_1.Flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: core_1.Flags.string({
19
19
  description: "Kuzzle protocol (http or websocket)",
20
20
  default: "ws",
21
21
  }) });
22
- UserImportMappings.args = [{ name: "path", description: "Dump file", required: true }];
22
+ UserImportMappings.args = {
23
+ path: core_1.Args.string({ description: "Dump file", required: true }),
24
+ };
23
25
  exports.default = UserImportMappings;
@@ -1,22 +1,19 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export default class UserImport extends Kommand {
4
3
  static description: string;
5
4
  static flags: {
6
- protocol: flags.IOptionFlag<string>;
7
- host: flags.IOptionFlag<string>;
8
- port: flags.IOptionFlag<string>;
9
- ssl: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- username: flags.IOptionFlag<string>;
11
- password: flags.IOptionFlag<string | undefined>;
12
- as: flags.IOptionFlag<string | undefined>;
13
- "api-key": flags.IOptionFlag<string | undefined>;
14
- help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
5
+ protocol: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ host: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ port: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ ssl: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ username: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ password: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ as: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ "api-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
15
14
  };
16
15
  static args: {
17
- name: string;
18
- description: string;
19
- required: boolean;
20
- }[];
16
+ path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
17
+ };
21
18
  runSafe(): Promise<void>;
22
19
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const command_1 = require("@oclif/command");
4
+ const core_1 = require("@oclif/core");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const common_1 = require("../../common");
7
7
  const kuzzle_1 = require("../../support/kuzzle");
@@ -15,9 +15,11 @@ class UserImport extends common_1.Kommand {
15
15
  }
16
16
  }
17
17
  UserImport.description = "Imports users";
18
- UserImport.flags = Object.assign(Object.assign({ help: command_1.flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: command_1.flags.string({
18
+ UserImport.flags = Object.assign(Object.assign({ help: core_1.Flags.help({}) }, kuzzle_1.kuzzleFlags), { protocol: core_1.Flags.string({
19
19
  description: "Kuzzle protocol (http or websocket)",
20
20
  default: "ws",
21
21
  }) });
22
- UserImport.args = [{ name: "path", description: "Dump file", required: true }];
22
+ UserImport.args = {
23
+ path: core_1.Args.string({ description: "Dump file", required: true }),
24
+ };
23
25
  exports.default = UserImport;
@@ -1,16 +1,15 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export declare class VaultAdd extends Kommand {
4
3
  static initSdk: boolean;
5
4
  static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- "vault-key": flags.IOptionFlag<string | undefined>;
7
+ "vault-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
8
  };
10
9
  static args: {
11
- name: string;
12
- description: string;
13
- required: boolean;
14
- }[];
10
+ "secrets-file": import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
11
+ key: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
12
+ value: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
15
14
  runSafe(): Promise<void>;
16
15
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VaultAdd = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const command_1 = require("@oclif/command");
6
+ const core_1 = require("@oclif/core");
7
7
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
8
  const kuzzle_vault_1 = require("kuzzle-vault");
9
9
  const common_1 = require("../../common");
@@ -47,21 +47,19 @@ VaultAdd.examples = [
47
47
  "kourou vault:add config/secrets.enc.json aws.s3.keyId b61e267676660c314b006b06 --vault-key <vault-key>",
48
48
  ];
49
49
  VaultAdd.flags = {
50
- "vault-key": command_1.flags.string({
50
+ "vault-key": core_1.Flags.string({
51
51
  description: "Kuzzle Vault Key (or KUZZLE_VAULT_KEY)",
52
52
  default: process.env.KUZZLE_VAULT_KEY,
53
53
  }),
54
54
  };
55
- VaultAdd.args = [
56
- {
57
- name: "secrets-file",
55
+ VaultAdd.args = {
56
+ "secrets-file": core_1.Args.string({
58
57
  description: "Encrypted secrets file",
59
58
  required: true,
60
- },
61
- {
62
- name: "key",
59
+ }),
60
+ key: core_1.Args.string({
63
61
  description: "Path to the key (lodash style)",
64
62
  required: true,
65
- },
66
- { name: "value", description: "Value to encrypt", required: true },
67
- ];
63
+ }),
64
+ value: core_1.Args.string({ description: "Value to encrypt", required: true }),
65
+ };
@@ -1,18 +1,15 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export declare class VaultDecrypt extends Kommand {
4
3
  static initSdk: boolean;
5
4
  static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
- "output-file": flags.IOptionFlag<string | undefined>;
10
- "vault-key": flags.IOptionFlag<string | undefined>;
7
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ "output-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ "vault-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
10
  };
12
11
  static args: {
13
- name: string;
14
- description: string;
15
- required: boolean;
16
- }[];
12
+ file: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
17
14
  runSafe(): Promise<void>;
18
15
  }
@@ -4,7 +4,7 @@ exports.VaultDecrypt = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
- const command_1 = require("@oclif/command");
7
+ const core_1 = require("@oclif/core");
8
8
  const kuzzle_vault_1 = require("kuzzle-vault");
9
9
  const common_1 = require("../../common");
10
10
  class VaultDecrypt extends common_1.Kommand {
@@ -53,23 +53,22 @@ VaultDecrypt.examples = [
53
53
  "kourou vault:decrypt config/secrets.enc.json -o config/secrets.json --vault-key <vault-key>",
54
54
  ];
55
55
  VaultDecrypt.flags = {
56
- force: command_1.flags.boolean({
56
+ force: core_1.Flags.boolean({
57
57
  char: "f",
58
58
  description: "Overwrite the output file if it already exists",
59
59
  }),
60
- "output-file": command_1.flags.string({
60
+ "output-file": core_1.Flags.string({
61
61
  char: "o",
62
62
  description: 'Output file (default: remove ".enc")',
63
63
  }),
64
- "vault-key": command_1.flags.string({
64
+ "vault-key": core_1.Flags.string({
65
65
  description: "Kuzzle Vault Key (or KUZZLE_VAULT_KEY)",
66
66
  default: process.env.KUZZLE_VAULT_KEY,
67
67
  }),
68
68
  };
69
- VaultDecrypt.args = [
70
- {
71
- name: "file",
69
+ VaultDecrypt.args = {
70
+ file: core_1.Args.string({
72
71
  description: "File containing encrypted secrets",
73
72
  required: true,
74
- },
75
- ];
73
+ }),
74
+ };
@@ -1,18 +1,15 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export declare class VaultEncrypt extends Kommand {
4
3
  static initSdk: boolean;
5
4
  static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
- "output-file": flags.IOptionFlag<string | undefined>;
10
- "vault-key": flags.IOptionFlag<string | undefined>;
7
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ "output-file": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ "vault-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
10
  };
12
11
  static args: {
13
- name: string;
14
- description: string;
15
- required: boolean;
16
- }[];
12
+ file: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
17
14
  runSafe(): Promise<void>;
18
15
  }
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const path_1 = tslib_1.__importDefault(require("path"));
7
7
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
8
- const command_1 = require("@oclif/command");
8
+ const core_1 = require("@oclif/core");
9
9
  const kuzzle_vault_1 = require("kuzzle-vault");
10
10
  const common_1 = require("../../common");
11
11
  class VaultEncrypt extends common_1.Kommand {
@@ -66,23 +66,22 @@ VaultEncrypt.examples = [
66
66
  "kourou vault:encrypt config/secrets.json -o config/secrets_prod.enc.json --vault-key <vault-key>",
67
67
  ];
68
68
  VaultEncrypt.flags = {
69
- force: command_1.flags.boolean({
69
+ force: core_1.Flags.boolean({
70
70
  char: "f",
71
71
  description: "Overwrite the output file if it already exists",
72
72
  }),
73
- "output-file": command_1.flags.string({
73
+ "output-file": core_1.Flags.string({
74
74
  char: "o",
75
75
  description: "Output file (default: <file>.enc.json)",
76
76
  }),
77
- "vault-key": command_1.flags.string({
77
+ "vault-key": core_1.Flags.string({
78
78
  description: "Kuzzle Vault Key (or KUZZLE_VAULT_KEY)",
79
79
  default: process.env.KUZZLE_VAULT_KEY,
80
80
  }),
81
81
  };
82
- VaultEncrypt.args = [
83
- {
84
- name: "file",
82
+ VaultEncrypt.args = {
83
+ file: core_1.Args.string({
85
84
  description: "File containing unencrypted secrets",
86
85
  required: true,
87
- },
88
- ];
86
+ }),
87
+ };
@@ -1,20 +1,14 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export declare class VaultShow extends Kommand {
4
3
  static initSdk: boolean;
5
4
  static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- "vault-key": flags.IOptionFlag<string | undefined>;
7
+ "vault-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ };
9
+ static args: {
10
+ "secrets-file": import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
11
+ key: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
9
12
  };
10
- static args: ({
11
- name: string;
12
- description: string;
13
- required: boolean;
14
- } | {
15
- name: string;
16
- description: string;
17
- required?: undefined;
18
- })[];
19
13
  runSafe(): Promise<void>;
20
14
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VaultShow = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
7
  const fs_1 = tslib_1.__importDefault(require("fs"));
8
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
@@ -60,16 +60,15 @@ VaultShow.examples = [
60
60
  "kourou vault:show config/secrets.enc.json aws.s3.secretKey --vault-key <vault-key>",
61
61
  ];
62
62
  VaultShow.flags = {
63
- "vault-key": command_1.flags.string({
63
+ "vault-key": core_1.Flags.string({
64
64
  description: "Kuzzle Vault Key (or KUZZLE_VAULT_KEY)",
65
65
  default: process.env.KUZZLE_VAULT_KEY,
66
66
  }),
67
67
  };
68
- VaultShow.args = [
69
- {
70
- name: "secrets-file",
68
+ VaultShow.args = {
69
+ "secrets-file": core_1.Args.string({
71
70
  description: "Encrypted secrets file",
72
71
  required: true,
73
- },
74
- { name: "key", description: "Path to a key (lodash style)" },
75
- ];
72
+ }),
73
+ key: core_1.Args.string({ description: "Path to a key (lodash style)" }),
74
+ };
@@ -1,16 +1,13 @@
1
- import { flags } from "@oclif/command";
2
1
  import { Kommand } from "../../common";
3
2
  export declare class VaultTest extends Kommand {
4
3
  static initSdk: boolean;
5
4
  static description: string;
6
5
  static examples: string[];
7
6
  static flags: {
8
- "vault-key": flags.IOptionFlag<string | undefined>;
7
+ "vault-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
8
  };
10
9
  static args: {
11
- name: string;
12
- description: string;
13
- required: boolean;
14
- }[];
10
+ "secrets-file": import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
11
+ };
15
12
  runSafe(): Promise<void>;
16
13
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VaultTest = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const command_1 = require("@oclif/command");
5
+ const core_1 = require("@oclif/core");
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
7
  const kuzzle_vault_1 = require("kuzzle-vault");
8
8
  const common_1 = require("../../common");
@@ -35,15 +35,14 @@ VaultTest.examples = [
35
35
  "kourou vault:test config/secrets.enc.json --vault-key <vault-key>",
36
36
  ];
37
37
  VaultTest.flags = {
38
- "vault-key": command_1.flags.string({
38
+ "vault-key": core_1.Flags.string({
39
39
  description: "Kuzzle Vault Key (or KUZZLE_VAULT_KEY)",
40
40
  default: process.env.KUZZLE_VAULT_KEY,
41
41
  }),
42
42
  };
43
- VaultTest.args = [
44
- {
45
- name: "secrets-file",
43
+ VaultTest.args = {
44
+ "secrets-file": core_1.Args.string({
46
45
  description: "Encrypted secrets file",
47
46
  required: true,
48
- },
49
- ];
47
+ }),
48
+ };
package/lib/common.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command } from "@oclif/command";
1
+ import { Command } from "@oclif/core";
2
2
  import { KuzzleSDK } from "./support/kuzzle";
3
3
  import { EditorParams } from "./support/editor";
4
4
  export declare abstract class Kommand extends Command {
package/lib/common.js CHANGED
@@ -7,7 +7,7 @@ const tslib_1 = require("tslib");
7
7
  const os_1 = tslib_1.__importDefault(require("os"));
8
8
  const fs_1 = tslib_1.__importDefault(require("fs"));
9
9
  const path_1 = tslib_1.__importDefault(require("path"));
10
- const command_1 = require("@oclif/command");
10
+ const core_1 = require("@oclif/core");
11
11
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
12
12
  const emoji_1 = require("./support/emoji");
13
13
  const get_1 = tslib_1.__importDefault(require("lodash/get"));
@@ -15,7 +15,7 @@ const isObject_1 = tslib_1.__importDefault(require("lodash/isObject"));
15
15
  const kepler_companion_1 = tslib_1.__importDefault(require("kepler-companion"));
16
16
  const kuzzle_1 = require("./support/kuzzle");
17
17
  const editor_1 = require("./support/editor");
18
- class Kommand extends command_1.Command {
18
+ class Kommand extends core_1.Command {
19
19
  constructor(argv, config) {
20
20
  super(argv, config);
21
21
  // Instantiate a dummy SDK to avoid the this.sdk notation everywhere -_-
@@ -74,7 +74,7 @@ class Kommand extends command_1.Command {
74
74
  async run() {
75
75
  var _a, _b, _c, _d, _e;
76
76
  const kommand = this.constructor;
77
- const result = this.parse(kommand);
77
+ const result = await this.parse(kommand);
78
78
  this.args = result.args;
79
79
  this.flags = result.flags;
80
80
  this.printCommand();
package/lib/help.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Help } from "@oclif/core";
2
+ /**
3
+ * Adds a pointer to sdk:query when help cannot be shown.
4
+ *
5
+ * A command name that is not found here is often an API action, which the
6
+ * command_not_found hook forwards to sdk:query. Help has no way to know that,
7
+ * so it fails on a name that is in fact usable, and the message says so.
8
+ *
9
+ * This used to be a monkey patch of Help.prototype.showHelp in bin/run.
10
+ * @oclif/plugin-help is ESM-only since its 7.0, so it can no longer be
11
+ * required from a CommonJS entry point, and a help class declared through
12
+ * `oclif.helpClass` is the supported way to do this anyway.
13
+ */
14
+ export default class KourouHelp extends Help {
15
+ showHelp(argv: string[]): Promise<void>;
16
+ }
package/lib/help.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ /**
5
+ * Adds a pointer to sdk:query when help cannot be shown.
6
+ *
7
+ * A command name that is not found here is often an API action, which the
8
+ * command_not_found hook forwards to sdk:query. Help has no way to know that,
9
+ * so it fails on a name that is in fact usable, and the message says so.
10
+ *
11
+ * This used to be a monkey patch of Help.prototype.showHelp in bin/run.
12
+ * @oclif/plugin-help is ESM-only since its 7.0, so it can no longer be
13
+ * required from a CommonJS entry point, and a help class declared through
14
+ * `oclif.helpClass` is the supported way to do this anyway.
15
+ */
16
+ class KourouHelp extends core_1.Help {
17
+ async showHelp(argv) {
18
+ try {
19
+ return await super.showHelp(argv);
20
+ }
21
+ catch (error) {
22
+ error.message += `
23
+
24
+ If you tried to execute and API action you can see
25
+ available options by displaying the "sdk:query" command help:
26
+ - kourou sdk:query --help`;
27
+ throw error;
28
+ }
29
+ }
30
+ }
31
+ exports.default = KourouHelp;
@@ -1,4 +1,4 @@
1
- import { Hook } from "@oclif/config";
1
+ import { Hook } from "@oclif/core";
2
2
  /**
3
3
  * Hooks that run the corresponding API action with sdk:query.
4
4
  *
@@ -52,8 +52,8 @@ const hook = async function apiActionHook(opts) {
52
52
  }
53
53
  }
54
54
  else {
55
- const exitCode = await query_1.default.run([...commandArgs, ...args]);
56
- process.exit(exitCode);
55
+ await query_1.default.run([...commandArgs, ...args]);
56
+ process.exit();
57
57
  }
58
58
  // 2th positional argument (collection)
59
59
  if (args[0] &&
@@ -65,8 +65,8 @@ const hook = async function apiActionHook(opts) {
65
65
  args.splice(0, 1);
66
66
  }
67
67
  else {
68
- const exitCode = await query_1.default.run([...commandArgs, ...args]);
69
- process.exit(exitCode);
68
+ await query_1.default.run([...commandArgs, ...args]);
69
+ process.exit();
70
70
  }
71
71
  // 3th positional argument (_id or body)
72
72
  if (args[0] && args[0].charAt(0) !== "-") {
@@ -82,8 +82,8 @@ const hook = async function apiActionHook(opts) {
82
82
  }
83
83
  }
84
84
  else {
85
- const exitCode = await query_1.default.run([...commandArgs, ...args]);
86
- process.exit(exitCode);
85
+ await query_1.default.run([...commandArgs, ...args]);
86
+ process.exit();
87
87
  }
88
88
  // 4th positional argument (body)
89
89
  if (args[0] && args[0].charAt(0) !== "-" && !commandArgs.includes("--body")) {
@@ -91,7 +91,7 @@ const hook = async function apiActionHook(opts) {
91
91
  commandArgs.push(args[0]);
92
92
  args.splice(0, 1);
93
93
  }
94
- const exitCode = await query_1.default.run([...commandArgs, ...args]);
95
- process.exit(exitCode);
94
+ await query_1.default.run([...commandArgs, ...args]);
95
+ process.exit();
96
96
  };
97
97
  exports.default = hook;