@internxt/cli 1.5.7 → 1.6.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 (70) hide show
  1. package/README.md +136 -100
  2. package/dist/commands/add-cert.js +0 -1
  3. package/dist/commands/config.js +0 -1
  4. package/dist/commands/create-folder.js +0 -1
  5. package/dist/commands/delete-permanently-file.js +0 -1
  6. package/dist/commands/delete-permanently-folder.js +0 -1
  7. package/dist/commands/download-file.js +0 -1
  8. package/dist/commands/list.js +0 -1
  9. package/dist/commands/login-legacy.d.ts +24 -0
  10. package/dist/commands/login-legacy.js +175 -0
  11. package/dist/commands/login.d.ts +3 -9
  12. package/dist/commands/login.js +18 -133
  13. package/dist/commands/logout.js +0 -1
  14. package/dist/commands/logs.js +0 -1
  15. package/dist/commands/move-file.js +0 -1
  16. package/dist/commands/move-folder.js +0 -1
  17. package/dist/commands/rename-file.js +0 -1
  18. package/dist/commands/rename-folder.js +0 -1
  19. package/dist/commands/trash-clear.js +0 -1
  20. package/dist/commands/trash-file.js +1 -2
  21. package/dist/commands/trash-folder.js +1 -2
  22. package/dist/commands/trash-list.js +0 -1
  23. package/dist/commands/trash-restore-file.js +0 -1
  24. package/dist/commands/trash-restore-folder.js +0 -1
  25. package/dist/commands/upload-file.d.ts +2 -1
  26. package/dist/commands/upload-file.js +1 -2
  27. package/dist/commands/webdav-config.d.ts +1 -0
  28. package/dist/commands/webdav-config.js +10 -7
  29. package/dist/commands/webdav.js +0 -1
  30. package/dist/commands/whoami.js +1 -2
  31. package/dist/hooks/prerun/auth_check.js +2 -2
  32. package/dist/services/auth.service.d.ts +1 -2
  33. package/dist/services/auth.service.js +11 -26
  34. package/dist/services/config.service.d.ts +1 -0
  35. package/dist/services/config.service.js +3 -0
  36. package/dist/services/crypto.service.js +1 -1
  37. package/dist/services/database/drive-file/drive-file.domain.js +1 -0
  38. package/dist/services/database/drive-folder/drive-folder.domain.js +1 -0
  39. package/dist/services/drive/drive-file.service.js +1 -0
  40. package/dist/services/universal-link.service.d.ts +10 -0
  41. package/dist/services/universal-link.service.js +85 -0
  42. package/dist/types/command.types.d.ts +1 -2
  43. package/dist/types/drive.types.d.ts +3 -0
  44. package/dist/types/webdav.types.d.ts +0 -1
  45. package/dist/utils/cli.utils.d.ts +1 -2
  46. package/dist/utils/cli.utils.js +2 -2
  47. package/dist/utils/drive.utils.d.ts +2 -1
  48. package/dist/utils/drive.utils.js +17 -0
  49. package/dist/utils/errors.utils.d.ts +2 -1
  50. package/dist/utils/errors.utils.js +10 -4
  51. package/dist/utils/webdav.utils.d.ts +20 -6
  52. package/dist/utils/webdav.utils.js +52 -33
  53. package/dist/webdav/handlers/DELETE.handler.js +5 -5
  54. package/dist/webdav/handlers/GET.handler.js +6 -9
  55. package/dist/webdav/handlers/HEAD.handler.js +5 -10
  56. package/dist/webdav/handlers/MKCOL.handler.d.ts +2 -0
  57. package/dist/webdav/handlers/MKCOL.handler.js +10 -20
  58. package/dist/webdav/handlers/MOVE.handler.d.ts +2 -0
  59. package/dist/webdav/handlers/MOVE.handler.js +22 -27
  60. package/dist/webdav/handlers/OPTIONS.handler.js +3 -3
  61. package/dist/webdav/handlers/PROPFIND.handler.js +7 -31
  62. package/dist/webdav/handlers/PUT.handler.d.ts +3 -1
  63. package/dist/webdav/handlers/PUT.handler.js +20 -23
  64. package/dist/webdav/middewares/auth.middleware.js +8 -2
  65. package/dist/webdav/middewares/errors.middleware.js +9 -2
  66. package/dist/webdav/services/webdav-folder.service.d.ts +17 -0
  67. package/dist/webdav/services/webdav-folder.service.js +52 -0
  68. package/dist/webdav/webdav-server.js +8 -0
  69. package/oclif.manifest.json +68 -3
  70. package/package.json +23 -22
@@ -60,7 +60,6 @@ class CreateFolder extends core_1.Command {
60
60
  error,
61
61
  command: this.id,
62
62
  logReporter: this.log.bind(this),
63
- errorReporter: this.error.bind(this),
64
63
  jsonFlag: flags['json'],
65
64
  });
66
65
  this.exit(1);
@@ -43,7 +43,6 @@ class DeletePermanentlyFile extends core_1.Command {
43
43
  error,
44
44
  command: this.id,
45
45
  logReporter: this.log.bind(this),
46
- errorReporter: this.error.bind(this),
47
46
  jsonFlag: flags['json'],
48
47
  });
49
48
  this.exit(1);
@@ -43,7 +43,6 @@ class DeletePermanentlyFolder extends core_1.Command {
43
43
  error,
44
44
  command: this.id,
45
45
  logReporter: this.log.bind(this),
46
- errorReporter: this.error.bind(this),
47
46
  jsonFlag: flags['json'],
48
47
  });
49
48
  this.exit(1);
@@ -92,7 +92,6 @@ class DownloadFile extends core_1.Command {
92
92
  error,
93
93
  command: this.id,
94
94
  logReporter: this.log.bind(this),
95
- errorReporter: this.error.bind(this),
96
95
  jsonFlag: flags['json'],
97
96
  });
98
97
  this.exit(1);
@@ -75,7 +75,6 @@ class List extends core_1.Command {
75
75
  error,
76
76
  command: this.id,
77
77
  logReporter: this.log.bind(this),
78
- errorReporter: this.error.bind(this),
79
78
  jsonFlag: flags['json'],
80
79
  });
81
80
  this.exit(1);
@@ -0,0 +1,24 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class LoginLegacy extends Command {
3
+ static readonly args: {};
4
+ static readonly description: string;
5
+ static readonly aliases: never[];
6
+ static readonly examples: string[];
7
+ static readonly flags: {
8
+ email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ twofactor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
+ twofactortoken: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ static readonly enableJsonFlag = true;
15
+ run: () => Promise<{
16
+ success: boolean;
17
+ message: string;
18
+ login: import("../types/command.types").LoginCredentials;
19
+ }>;
20
+ catch: (error: Error) => Promise<never>;
21
+ private getEmail;
22
+ private getPassword;
23
+ private getTwoFactorCode;
24
+ }
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const core_1 = require("@oclif/core");
37
+ const command_types_1 = require("../types/command.types");
38
+ const auth_service_1 = require("../services/auth.service");
39
+ const config_service_1 = require("../services/config.service");
40
+ const validation_service_1 = require("../services/validation.service");
41
+ const cli_utils_1 = require("../utils/cli.utils");
42
+ const sdk_manager_service_1 = require("../services/sdk-manager.service");
43
+ const OTPAuth = __importStar(require("otpauth"));
44
+ class LoginLegacy extends core_1.Command {
45
+ static args = {};
46
+ static description = '[Legacy] Logs into an Internxt account using user and password. ' +
47
+ 'If the account is two-factor protected, then an extra code will be required.';
48
+ static aliases = [];
49
+ static examples = ['<%= config.bin %> <%= command.id %>'];
50
+ static flags = {
51
+ ...cli_utils_1.CLIUtils.CommonFlags,
52
+ email: core_1.Flags.string({
53
+ char: 'e',
54
+ aliases: ['mail'],
55
+ env: 'INXT_USER',
56
+ description: 'The email to log in',
57
+ required: false,
58
+ }),
59
+ password: core_1.Flags.string({
60
+ char: 'p',
61
+ aliases: ['pass'],
62
+ env: 'INXT_PASSWORD',
63
+ description: 'The plain password to log in',
64
+ required: false,
65
+ }),
66
+ twofactor: core_1.Flags.string({
67
+ char: 'w',
68
+ aliases: ['two', 'two-factor'],
69
+ env: 'INXT_TWOFACTORCODE',
70
+ description: 'The two factor auth code (TOTP). ',
71
+ required: false,
72
+ helpValue: '123456',
73
+ }),
74
+ twofactortoken: core_1.Flags.string({
75
+ char: 't',
76
+ aliases: ['otp', 'otp-token'],
77
+ env: 'INXT_OTPTOKEN',
78
+ description: 'The TOTP secret token. It is used to generate a TOTP code if needed.' +
79
+ ' It has prority over the two factor code flag.',
80
+ required: false,
81
+ helpValue: 'token',
82
+ }),
83
+ };
84
+ static enableJsonFlag = true;
85
+ run = async () => {
86
+ const { flags } = await this.parse(LoginLegacy);
87
+ const nonInteractive = flags['non-interactive'];
88
+ const email = await this.getEmail(flags['email'], nonInteractive);
89
+ const password = await this.getPassword(flags['password'], nonInteractive);
90
+ const is2FANeeded = await auth_service_1.AuthService.instance.is2FANeeded(email);
91
+ let twoFactorCode;
92
+ if (is2FANeeded) {
93
+ const twoFactorToken = flags['twofactortoken'];
94
+ if (twoFactorToken && twoFactorToken.trim().length > 0) {
95
+ const totp = new OTPAuth.TOTP({
96
+ secret: twoFactorToken,
97
+ digits: 6,
98
+ });
99
+ twoFactorCode = totp.generate();
100
+ }
101
+ else {
102
+ twoFactorCode = await this.getTwoFactorCode(flags['twofactor'], nonInteractive);
103
+ }
104
+ }
105
+ const loginCredentials = await auth_service_1.AuthService.instance.doLogin(email, password, twoFactorCode);
106
+ sdk_manager_service_1.SdkManager.init({ token: loginCredentials.token });
107
+ await config_service_1.ConfigService.instance.saveUser(loginCredentials);
108
+ const message = `Succesfully logged in to: ${loginCredentials.user.email}`;
109
+ cli_utils_1.CLIUtils.success(this.log.bind(this), message);
110
+ return {
111
+ success: true,
112
+ message,
113
+ login: loginCredentials,
114
+ };
115
+ };
116
+ catch = async (error) => {
117
+ const { flags } = await this.parse(LoginLegacy);
118
+ cli_utils_1.CLIUtils.catchError({
119
+ error,
120
+ command: this.id,
121
+ logReporter: this.log.bind(this),
122
+ jsonFlag: flags['json'],
123
+ });
124
+ this.exit(1);
125
+ };
126
+ getEmail = async (emailFlag, nonInteractive) => {
127
+ const email = await cli_utils_1.CLIUtils.getValueFromFlag({
128
+ value: emailFlag,
129
+ name: LoginLegacy.flags['email'].name,
130
+ }, {
131
+ nonInteractive,
132
+ prompt: {
133
+ message: 'What is your email?',
134
+ options: { type: 'input' },
135
+ },
136
+ }, {
137
+ validate: validation_service_1.ValidationService.instance.validateEmail,
138
+ error: new command_types_1.NotValidEmailError(),
139
+ }, this.log.bind(this));
140
+ return email;
141
+ };
142
+ getPassword = async (passwordFlag, nonInteractive) => {
143
+ const password = await cli_utils_1.CLIUtils.getValueFromFlag({
144
+ value: passwordFlag,
145
+ name: LoginLegacy.flags['password'].name,
146
+ }, {
147
+ nonInteractive,
148
+ prompt: {
149
+ message: 'What is your password?',
150
+ options: { type: 'password' },
151
+ },
152
+ }, {
153
+ validate: validation_service_1.ValidationService.instance.validateStringIsNotEmpty,
154
+ error: new command_types_1.EmptyPasswordError(),
155
+ }, this.log.bind(this));
156
+ return password;
157
+ };
158
+ getTwoFactorCode = async (twoFactorFlag, nonInteractive) => {
159
+ const twoFactor = await cli_utils_1.CLIUtils.getValueFromFlag({
160
+ value: twoFactorFlag,
161
+ name: LoginLegacy.flags['twofactor'].name,
162
+ }, {
163
+ nonInteractive,
164
+ prompt: {
165
+ message: 'What is your two-factor code?',
166
+ options: { type: 'mask' },
167
+ },
168
+ }, {
169
+ validate: validation_service_1.ValidationService.instance.validate2FA,
170
+ error: new command_types_1.NotValidTwoFactorCodeError(),
171
+ }, this.log.bind(this));
172
+ return twoFactor;
173
+ };
174
+ }
175
+ exports.default = LoginLegacy;
@@ -1,15 +1,12 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Login extends Command {
3
3
  static readonly args: {};
4
- static readonly description = "Logs into an Internxt account. If the account is two-factor protected, then an extra code will be required.";
4
+ static readonly description: string;
5
5
  static readonly aliases: never[];
6
6
  static readonly examples: string[];
7
7
  static readonly flags: {
8
- email: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
- password: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
- twofactor: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- twofactortoken: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
- 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ host: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ port: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
10
  };
14
11
  static readonly enableJsonFlag = true;
15
12
  run: () => Promise<{
@@ -18,7 +15,4 @@ export default class Login extends Command {
18
15
  login: import("../types/command.types").LoginCredentials;
19
16
  }>;
20
17
  catch: (error: Error) => Promise<never>;
21
- private getEmail;
22
- private getPassword;
23
- private getTwoFactorCode;
24
18
  }
@@ -1,107 +1,41 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  const core_1 = require("@oclif/core");
37
- const command_types_1 = require("../types/command.types");
38
- const auth_service_1 = require("../services/auth.service");
39
4
  const config_service_1 = require("../services/config.service");
40
- const validation_service_1 = require("../services/validation.service");
41
5
  const cli_utils_1 = require("../utils/cli.utils");
42
6
  const sdk_manager_service_1 = require("../services/sdk-manager.service");
43
- const OTPAuth = __importStar(require("otpauth"));
7
+ const universal_link_service_1 = require("../services/universal-link.service");
44
8
  class Login extends core_1.Command {
45
9
  static args = {};
46
- static description = 'Logs into an Internxt account. If the account is two-factor protected, then an extra code will be required.';
10
+ static description = 'Logs into your Internxt account using the web-based login flow. ' +
11
+ 'A temporary local server is started to securely receive the authentication response.';
47
12
  static aliases = [];
48
13
  static examples = ['<%= config.bin %> <%= command.id %>'];
49
14
  static flags = {
50
- ...cli_utils_1.CLIUtils.CommonFlags,
51
- email: core_1.Flags.string({
52
- char: 'e',
53
- aliases: ['mail'],
54
- env: 'INXT_USER',
55
- description: 'The email to log in',
15
+ host: core_1.Flags.string({
16
+ char: 'h',
17
+ aliases: ['host'],
18
+ env: 'INXT_LOGIN_SERVER_HOST',
19
+ description: 'IP address of the machine where the CLI is running. ' +
20
+ 'If you are opening the login page in a browser on another device, ' +
21
+ 'set this to the IP address of the machine running the CLI. Defaults to 127.0.0.1.',
56
22
  required: false,
57
23
  }),
58
- password: core_1.Flags.string({
24
+ port: core_1.Flags.integer({
59
25
  char: 'p',
60
- aliases: ['pass'],
61
- env: 'INXT_PASSWORD',
62
- description: 'The plain password to log in',
63
- required: false,
64
- }),
65
- twofactor: core_1.Flags.string({
66
- char: 'w',
67
- aliases: ['two', 'two-factor'],
68
- env: 'INXT_TWOFACTORCODE',
69
- description: 'The two factor auth code (TOTP). ',
26
+ aliases: ['port'],
27
+ env: 'INXT_LOGIN_SERVER_PORT',
28
+ description: 'Port used by the temporary local server to handle the login callback. ' +
29
+ 'If not specified, a random available port will be used automatically.',
70
30
  required: false,
71
- helpValue: '123456',
72
- }),
73
- twofactortoken: core_1.Flags.string({
74
- char: 't',
75
- aliases: ['otp', 'otp-token'],
76
- env: 'INXT_OTPTOKEN',
77
- description: 'The TOTP secret token. It is used to generate a TOTP code if needed.' +
78
- ' It has prority over the two factor code flag.',
79
- required: false,
80
- helpValue: 'token',
81
31
  }),
82
32
  };
83
33
  static enableJsonFlag = true;
84
34
  run = async () => {
85
35
  const { flags } = await this.parse(Login);
86
- const nonInteractive = flags['non-interactive'];
87
- const email = await this.getEmail(flags['email'], nonInteractive);
88
- const password = await this.getPassword(flags['password'], nonInteractive);
89
- const is2FANeeded = await auth_service_1.AuthService.instance.is2FANeeded(email);
90
- let twoFactorCode;
91
- if (is2FANeeded) {
92
- const twoFactorToken = flags['twofactortoken'];
93
- if (twoFactorToken && twoFactorToken.trim().length > 0) {
94
- const totp = new OTPAuth.TOTP({
95
- secret: twoFactorToken,
96
- digits: 6,
97
- });
98
- twoFactorCode = totp.generate();
99
- }
100
- else {
101
- twoFactorCode = await this.getTwoFactorCode(flags['twofactor'], nonInteractive);
102
- }
103
- }
104
- const loginCredentials = await auth_service_1.AuthService.instance.doLogin(email, password, twoFactorCode);
36
+ const host = flags['host'];
37
+ const port = flags['port'];
38
+ const loginCredentials = await universal_link_service_1.UniversalLinkService.instance.loginSSO(flags['json'] ?? false, this.log.bind(this), host, port);
105
39
  sdk_manager_service_1.SdkManager.init({ token: loginCredentials.token });
106
40
  await config_service_1.ConfigService.instance.saveUser(loginCredentials);
107
41
  const message = `Succesfully logged in to: ${loginCredentials.user.email}`;
@@ -118,58 +52,9 @@ class Login extends core_1.Command {
118
52
  error,
119
53
  command: this.id,
120
54
  logReporter: this.log.bind(this),
121
- errorReporter: this.error.bind(this),
122
55
  jsonFlag: flags['json'],
123
56
  });
124
57
  this.exit(1);
125
58
  };
126
- getEmail = async (emailFlag, nonInteractive) => {
127
- const email = await cli_utils_1.CLIUtils.getValueFromFlag({
128
- value: emailFlag,
129
- name: Login.flags['email'].name,
130
- }, {
131
- nonInteractive,
132
- prompt: {
133
- message: 'What is your email?',
134
- options: { type: 'input' },
135
- },
136
- }, {
137
- validate: validation_service_1.ValidationService.instance.validateEmail,
138
- error: new command_types_1.NotValidEmailError(),
139
- }, this.log.bind(this));
140
- return email;
141
- };
142
- getPassword = async (passwordFlag, nonInteractive) => {
143
- const password = await cli_utils_1.CLIUtils.getValueFromFlag({
144
- value: passwordFlag,
145
- name: Login.flags['password'].name,
146
- }, {
147
- nonInteractive,
148
- prompt: {
149
- message: 'What is your password?',
150
- options: { type: 'password' },
151
- },
152
- }, {
153
- validate: validation_service_1.ValidationService.instance.validateStringIsNotEmpty,
154
- error: new command_types_1.EmptyPasswordError(),
155
- }, this.log.bind(this));
156
- return password;
157
- };
158
- getTwoFactorCode = async (twoFactorFlag, nonInteractive) => {
159
- const twoFactor = await cli_utils_1.CLIUtils.getValueFromFlag({
160
- value: twoFactorFlag,
161
- name: Login.flags['twofactor'].name,
162
- }, {
163
- nonInteractive,
164
- prompt: {
165
- message: 'What is your two-factor code?',
166
- options: { type: 'mask' },
167
- },
168
- }, {
169
- validate: validation_service_1.ValidationService.instance.validate2FA,
170
- error: new command_types_1.NotValidTwoFactorCodeError(),
171
- }, this.log.bind(this));
172
- return twoFactor;
173
- };
174
59
  }
175
60
  exports.default = Login;
@@ -32,7 +32,6 @@ class Logout extends core_1.Command {
32
32
  error,
33
33
  command: this.id,
34
34
  logReporter: this.log.bind(this),
35
- errorReporter: this.error.bind(this),
36
35
  jsonFlag: flags['json'],
37
36
  });
38
37
  this.exit(1);
@@ -21,7 +21,6 @@ class Logs extends core_1.Command {
21
21
  error,
22
22
  command: this.id,
23
23
  logReporter: this.log.bind(this),
24
- errorReporter: this.error.bind(this),
25
24
  jsonFlag: flags['json'],
26
25
  });
27
26
  this.exit(1);
@@ -48,7 +48,6 @@ class MoveFile extends core_1.Command {
48
48
  error,
49
49
  command: this.id,
50
50
  logReporter: this.log.bind(this),
51
- errorReporter: this.error.bind(this),
52
51
  jsonFlag: flags['json'],
53
52
  });
54
53
  this.exit(1);
@@ -50,7 +50,6 @@ class MoveFolder extends core_1.Command {
50
50
  error,
51
51
  command: this.id,
52
52
  logReporter: this.log.bind(this),
53
- errorReporter: this.error.bind(this),
54
53
  jsonFlag: flags['json'],
55
54
  });
56
55
  this.exit(1);
@@ -51,7 +51,6 @@ class RenameFile extends core_1.Command {
51
51
  error,
52
52
  command: this.id,
53
53
  logReporter: this.log.bind(this),
54
- errorReporter: this.error.bind(this),
55
54
  jsonFlag: flags['json'],
56
55
  });
57
56
  this.exit(1);
@@ -44,7 +44,6 @@ class RenameFolder extends core_1.Command {
44
44
  error,
45
45
  command: this.id,
46
46
  logReporter: this.log.bind(this),
47
- errorReporter: this.error.bind(this),
48
47
  jsonFlag: flags['json'],
49
48
  });
50
49
  this.exit(1);
@@ -49,7 +49,6 @@ class TrashClear extends core_1.Command {
49
49
  error,
50
50
  command: this.id,
51
51
  logReporter: this.log.bind(this),
52
- errorReporter: this.error.bind(this),
53
52
  jsonFlag: flags['json'],
54
53
  });
55
54
  this.exit(1);
@@ -27,7 +27,7 @@ class TrashFile extends core_1.Command {
27
27
  if (!userCredentials)
28
28
  throw new command_types_1.MissingCredentialsError();
29
29
  const uuid = await this.getFileUuid(flags['id'], nonInteractive);
30
- await trash_service_1.TrashService.instance.trashItems({ items: [{ uuid, type: 'file', id: null }] });
30
+ await trash_service_1.TrashService.instance.trashItems({ items: [{ uuid, type: 'file' }] });
31
31
  const message = 'File trashed successfully.';
32
32
  cli_utils_1.CLIUtils.success(this.log.bind(this), message);
33
33
  return { success: true, message, file: { uuid } };
@@ -38,7 +38,6 @@ class TrashFile extends core_1.Command {
38
38
  error,
39
39
  command: this.id,
40
40
  logReporter: this.log.bind(this),
41
- errorReporter: this.error.bind(this),
42
41
  jsonFlag: flags['json'],
43
42
  });
44
43
  this.exit(1);
@@ -27,7 +27,7 @@ class TrashFolder extends core_1.Command {
27
27
  if (!userCredentials)
28
28
  throw new command_types_1.MissingCredentialsError();
29
29
  const uuid = await this.getFolderUuid(flags['id'], nonInteractive);
30
- await trash_service_1.TrashService.instance.trashItems({ items: [{ uuid, type: 'folder', id: null }] });
30
+ await trash_service_1.TrashService.instance.trashItems({ items: [{ uuid, type: 'folder' }] });
31
31
  const message = 'Folder trashed successfully.';
32
32
  cli_utils_1.CLIUtils.success(this.log.bind(this), message);
33
33
  return { success: true, message, folder: { uuid } };
@@ -38,7 +38,6 @@ class TrashFolder extends core_1.Command {
38
38
  error,
39
39
  command: this.id,
40
40
  logReporter: this.log.bind(this),
41
- errorReporter: this.error.bind(this),
42
41
  jsonFlag: flags['json'],
43
42
  });
44
43
  this.exit(1);
@@ -62,7 +62,6 @@ class TrashList extends core_1.Command {
62
62
  error,
63
63
  command: this.id,
64
64
  logReporter: this.log.bind(this),
65
- errorReporter: this.error.bind(this),
66
65
  jsonFlag: flags['json'],
67
66
  });
68
67
  this.exit(1);
@@ -48,7 +48,6 @@ class TrashRestoreFile extends core_1.Command {
48
48
  error,
49
49
  command: this.id,
50
50
  logReporter: this.log.bind(this),
51
- errorReporter: this.error.bind(this),
52
51
  jsonFlag: flags['json'],
53
52
  });
54
53
  this.exit(1);
@@ -50,7 +50,6 @@ class TrashRestoreFolder extends core_1.Command {
50
50
  error,
51
51
  command: this.id,
52
52
  logReporter: this.log.bind(this),
53
- errorReporter: this.error.bind(this),
54
53
  jsonFlag: flags['json'],
55
54
  });
56
55
  this.exit(1);
@@ -17,12 +17,13 @@ export default class UploadFile extends Command {
17
17
  plainName: string;
18
18
  name: string;
19
19
  id: number;
20
- bucket: string;
21
20
  uuid: string;
21
+ bucket: string;
22
22
  folderUuid: string;
23
23
  folderId: number;
24
24
  status: "EXISTS" | "TRASHED" | "DELETED";
25
25
  fileId: string;
26
+ itemType: "file";
26
27
  size: number;
27
28
  createdAt: Date;
28
29
  updatedAt: Date;
@@ -121,7 +121,7 @@ class UploadFile extends core_1.Command {
121
121
  }
122
122
  }
123
123
  catch (error) {
124
- errors_utils_1.ErrorUtils.report(this.error.bind(this), error, { command: this.id });
124
+ errors_utils_1.ErrorUtils.report(error, { command: this.id });
125
125
  }
126
126
  progressBar?.update(100);
127
127
  progressBar?.stop();
@@ -144,7 +144,6 @@ class UploadFile extends core_1.Command {
144
144
  error,
145
145
  command: this.id,
146
146
  logReporter: this.log.bind(this),
147
- errorReporter: this.error.bind(this),
148
147
  jsonFlag: flags['json'],
149
148
  });
150
149
  this.exit(1);
@@ -10,6 +10,7 @@ export default class WebDAVConfig extends Command {
10
10
  https: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
11
  http: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  timeout: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ createFullPath: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
14
  };
14
15
  static readonly enableJsonFlag = true;
15
16
  run: () => Promise<{