@super-protocol/sp-cli 0.0.2-beta.13 → 0.0.2-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @super-protocol/sp-cli
21
21
  $ sp COMMAND
22
22
  running command...
23
23
  $ sp (--version)
24
- @super-protocol/sp-cli/0.0.2-beta.13 linux-x64 node-v22.21.1
24
+ @super-protocol/sp-cli/0.0.2-beta.15 linux-x64 node-v22.21.1
25
25
  $ sp --help [COMMAND]
26
26
  USAGE
27
27
  $ sp COMMAND
@@ -65,11 +65,11 @@ DESCRIPTION
65
65
  Information about current authorized user
66
66
  ```
67
67
 
68
- _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/account/info.ts)_
68
+ _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/account/info.ts)_
69
69
 
70
70
  ## `sp auth login`
71
71
 
72
- Login to remote server
72
+ Login. SignUp and SignIn into SuperProtocol
73
73
 
74
74
  ```
75
75
  USAGE
@@ -80,7 +80,7 @@ GLOBAL FLAGS
80
80
  --json Format output as json.
81
81
 
82
82
  DESCRIPTION
83
- Login to remote server
83
+ Login. SignUp and SignIn into SuperProtocol
84
84
 
85
85
  ALIASES
86
86
  $ sp login
@@ -89,7 +89,7 @@ EXAMPLES
89
89
  $ sp auth login
90
90
  ```
91
91
 
92
- _See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/auth/login.ts)_
92
+ _See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/auth/login.ts)_
93
93
 
94
94
  ## `sp auth me`
95
95
 
@@ -102,7 +102,7 @@ GLOBAL FLAGS
102
102
  --json Format output as json.
103
103
  ```
104
104
 
105
- _See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/auth/me.ts)_
105
+ _See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/auth/me.ts)_
106
106
 
107
107
  ## `sp autocomplete [SHELL]`
108
108
 
@@ -163,7 +163,7 @@ EXAMPLES
163
163
  $ sp config delete - Delete a configuration
164
164
  ```
165
165
 
166
- _See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/index.ts)_
166
+ _See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/index.ts)_
167
167
 
168
168
  ## `sp config add [FILE]`
169
169
 
@@ -202,7 +202,7 @@ EXAMPLES
202
202
  }
203
203
  ```
204
204
 
205
- _See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/add.ts)_
205
+ _See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/add.ts)_
206
206
 
207
207
  ## `sp config create`
208
208
 
@@ -229,7 +229,7 @@ EXAMPLES
229
229
  $ sp config create --name "Production" --url "https://api.dp.superprotocol.com"
230
230
  ```
231
231
 
232
- _See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/create.ts)_
232
+ _See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/create.ts)_
233
233
 
234
234
  ## `sp config delete`
235
235
 
@@ -257,7 +257,7 @@ EXAMPLES
257
257
  $ sp config delete --name "My Config" --force
258
258
  ```
259
259
 
260
- _See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/delete.ts)_
260
+ _See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/delete.ts)_
261
261
 
262
262
  ## `sp config list`
263
263
 
@@ -277,7 +277,7 @@ EXAMPLES
277
277
  $ sp config list
278
278
  ```
279
279
 
280
- _See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/list.ts)_
280
+ _See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/list.ts)_
281
281
 
282
282
  ## `sp config show`
283
283
 
@@ -297,7 +297,7 @@ EXAMPLES
297
297
  $ sp config show
298
298
  ```
299
299
 
300
- _See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/show.ts)_
300
+ _See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/show.ts)_
301
301
 
302
302
  ## `sp config use`
303
303
 
@@ -317,7 +317,7 @@ EXAMPLES
317
317
  $ sp config use
318
318
  ```
319
319
 
320
- _See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/config/use.ts)_
320
+ _See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/config/use.ts)_
321
321
 
322
322
  ## `sp files download RESOURCEFILE LOCALDIRECTORY`
323
323
 
@@ -345,7 +345,7 @@ EXAMPLES
345
345
  $ sp files download ./resource.json ./pathToDownload
346
346
  ```
347
347
 
348
- _See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/files/download.ts)_
348
+ _See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/files/download.ts)_
349
349
 
350
350
  ## `sp files upload PATH`
351
351
 
@@ -379,7 +379,7 @@ EXAMPLES
379
379
  $ sp files upload ./file.txt
380
380
  ```
381
381
 
382
- _See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/files/upload.ts)_
382
+ _See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/files/upload.ts)_
383
383
 
384
384
  ## `sp help [COMMAND]`
385
385
 
@@ -403,7 +403,7 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.3
403
403
 
404
404
  ## `sp login`
405
405
 
406
- Login to remote server
406
+ Login. SignUp and SignIn into SuperProtocol
407
407
 
408
408
  ```
409
409
  USAGE
@@ -414,7 +414,7 @@ GLOBAL FLAGS
414
414
  --json Format output as json.
415
415
 
416
416
  DESCRIPTION
417
- Login to remote server
417
+ Login. SignUp and SignIn into SuperProtocol
418
418
 
419
419
  ALIASES
420
420
  $ sp login
@@ -450,7 +450,7 @@ EXAMPLES
450
450
  $ sp storage create --not-default
451
451
  ```
452
452
 
453
- _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/storage/create.ts)_
453
+ _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/storage/create.ts)_
454
454
 
455
455
  ## `sp storage select`
456
456
 
@@ -476,7 +476,7 @@ EXAMPLES
476
476
  $ sp storage select --id=2de3e3a4-0000-1111-2222-333344445555
477
477
  ```
478
478
 
479
- _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/storage/select.ts)_
479
+ _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/storage/select.ts)_
480
480
 
481
481
  ## `sp storage update`
482
482
 
@@ -503,5 +503,5 @@ EXAMPLES
503
503
  $ sp storage update --id=2de3e3a4-0000-1111-2222-333344445555
504
504
  ```
505
505
 
506
- _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.13/src/commands/storage/update.ts)_
506
+ _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.15/src/commands/storage/update.ts)_
507
507
  <!-- commandsstop -->
@@ -5,5 +5,8 @@ export default class SpLogin extends BaseCommand<typeof SpLogin> {
5
5
  static examples: string[];
6
6
  checkStorage(): Promise<void>;
7
7
  init(): Promise<void>;
8
- run(): Promise<void>;
8
+ run(): Promise<{
9
+ account: string;
10
+ success: boolean;
11
+ }>;
9
12
  }
@@ -3,7 +3,7 @@ import { StorageService } from '../../services/storage.service.js';
3
3
  import { BaseCommand } from '../base.js';
4
4
  export default class SpLogin extends BaseCommand {
5
5
  static aliases = ['login'];
6
- static description = 'Login to remote server';
6
+ static description = 'Login. SignUp and SignIn into SuperProtocol';
7
7
  static examples = [
8
8
  `<%= config.bin %> <%= command.id %>
9
9
  `,
@@ -43,6 +43,8 @@ export default class SpLogin extends BaseCommand {
43
43
  this.logger.error({ err: error }, 'Storage initialization failed');
44
44
  this.warn('Storage initialization failed. You can set up storage later using "sp storage create" or "sp storage select".');
45
45
  }
46
- this.log('Successfully authorized');
46
+ const account = accountManager.getAddress();
47
+ this.log(`Logined in with account ${account}`);
48
+ return { account, success: true };
47
49
  }
48
50
  }
@@ -64,22 +64,7 @@ export default class ConfigAdd extends BaseConfigCommand {
64
64
  const displayName = importedConfig?.name || importedFileName;
65
65
  this.log(`Successfully imported configuration: ${displayName}`);
66
66
  this.log(`Configuration file: ${importedFileName}`);
67
- const shouldSwitch = this.flags.yes || await this.selectPrompt({
68
- message: 'Switch to this configuration now?',
69
- options: [
70
- { label: 'Yes', value: true },
71
- { label: 'No', value: false },
72
- ],
73
- });
74
- if (shouldSwitch) {
75
- await this.configFileManager.setCurrentConfig(importedFileName);
76
- this.log(`Switched to configuration: ${displayName}`);
77
- await this.container
78
- .initConfigFileManager(true)
79
- .initConfigManager(true)
80
- .initAccountManager(true)
81
- .build();
82
- }
67
+ await this.switchToNewConfig(importedFileName, displayName, this.flags.yes);
83
68
  }
84
69
  catch (error) {
85
70
  this.error(`Failed to import configuration: ${error instanceof Error ? error.message : String(error)}`);
@@ -11,5 +11,6 @@ export declare abstract class BaseConfigCommand<T extends typeof Command> extend
11
11
  init(): Promise<void>;
12
12
  protected inputPrompt(options: TextOptions): Promise<string>;
13
13
  protected selectPrompt<Value>(options: SelectOptions<Value>): Promise<Value>;
14
+ protected switchToNewConfig(configFile: string, displayName: string, yes: boolean): Promise<void>;
14
15
  }
15
16
  export {};
@@ -25,16 +25,16 @@ export class BaseConfigCommand extends BaseCommand {
25
25
  this.log(` Provider URL: ${PROVIDER_URL} (using default)`);
26
26
  }
27
27
  if (configData.auth?.accessKey) {
28
- this.log(' Authorization: [OK] Configured');
28
+ this.log(' Authorization: Configured');
29
29
  }
30
30
  else {
31
- this.log(' Authorization: [--] Not configured');
31
+ this.log(' Authorization: Unauthorized');
32
32
  }
33
33
  if (configData.account?.address) {
34
- this.log(` Account: [OK] ${configData.account.address}`);
34
+ this.log(` Account: ${configData.account.address}`);
35
35
  }
36
36
  else {
37
- this.log(' Account: [--] Not configured');
37
+ this.log(' Account: Not configured');
38
38
  }
39
39
  }
40
40
  }
@@ -57,4 +57,22 @@ export class BaseConfigCommand extends BaseCommand {
57
57
  const result = await select(options);
58
58
  return this.ensurePromptValue(result);
59
59
  }
60
+ async switchToNewConfig(configFile, displayName, yes) {
61
+ const shouldSwitch = yes || await this.selectPrompt({
62
+ message: 'Switch to this configuration now?',
63
+ options: [
64
+ { label: 'Yes', value: true },
65
+ { label: 'No', value: false },
66
+ ],
67
+ });
68
+ if (shouldSwitch) {
69
+ await this.configFileManager.setCurrentConfig(configFile);
70
+ this.log(`Switched to configuration: ${displayName}`);
71
+ await this.container
72
+ .initConfigFileManager(true)
73
+ .initConfigManager(true)
74
+ .initAccountManager(true)
75
+ .build();
76
+ }
77
+ }
60
78
  }
@@ -32,17 +32,7 @@ export default class ConfigCreate extends BaseConfigCommand {
32
32
  if (url) {
33
33
  this.log(`Provider URL: ${url}`);
34
34
  }
35
- const shouldSwitch = yes || await this.selectPrompt({
36
- message: 'Switch to this configuration now?',
37
- options: [
38
- { label: 'Yes', value: true },
39
- { label: 'No', value: false },
40
- ],
41
- });
42
- if (shouldSwitch) {
43
- await this.configFileManager.setCurrentConfig(fileName);
44
- this.log(`Switched to configuration: ${name}`);
45
- }
35
+ await this.switchToNewConfig(fileName, name, yes);
46
36
  }
47
37
  catch (error) {
48
38
  this.error(`Failed to create configuration: ${error instanceof Error ? error.message : String(error)}`);
@@ -1,3 +1,5 @@
1
+ import { printTable } from 'console-table-printer';
2
+ import { PROVIDER_URL } from '../../constants.js';
1
3
  import { BaseConfigCommand } from './base.js';
2
4
  export default class ConfigList extends BaseConfigCommand {
3
5
  static description = 'List all configurations';
@@ -12,28 +14,27 @@ export default class ConfigList extends BaseConfigCommand {
12
14
  this.log('Create a new configuration with: sp config create --name "Config Name"');
13
15
  return;
14
16
  }
15
- this.log('Available configurations:\n');
17
+ const rows = [];
16
18
  for (const config of configs) {
17
19
  const marker = config.file === current ? '* ' : ' ';
18
20
  const configData = this.configFileManager.getConfigData(config.file);
19
- let statusInfo = '';
20
- if (configData) {
21
- const parts = [];
22
- if (configData.providerUrl) {
23
- parts.push(`URL: ${configData.providerUrl}`);
24
- }
25
- if (configData.auth) {
26
- parts.push('Auth: [OK]');
27
- }
28
- if (configData.account) {
29
- parts.push(`Account: [OK] ${configData.account.address} `);
30
- }
31
- if (parts.length > 0) {
32
- statusInfo = ` | ${parts.join(', ')}`;
33
- }
34
- }
35
- this.log(`${marker}${config.name}${statusInfo}`);
36
- this.log(` File: ${config.file}`);
21
+ const row = {
22
+ account: configData?.account?.address ?? '[not found in config file]',
23
+ current: marker,
24
+ file: config.file,
25
+ name: config.name,
26
+ url: configData?.providerUrl ?? PROVIDER_URL,
27
+ };
28
+ rows.push(row);
37
29
  }
30
+ printTable(rows, {
31
+ columns: [
32
+ { name: 'current', title: 'Current' },
33
+ { name: 'name', title: 'Config name' },
34
+ { name: 'account', title: 'Account' },
35
+ { name: 'url', title: 'Provider Url' },
36
+ { name: 'file', title: 'Configuration File' },
37
+ ], title: 'Available configurations',
38
+ });
38
39
  }
39
40
  }
@@ -3,3 +3,5 @@ export declare const DIR_ACCESS_PERMS = 448;
3
3
  export declare const PROVIDER_URL = "https://api.dp.superprotocol.com";
4
4
  export declare const REFRESH_TOKEN_URI = "/api/auth/refresh-access";
5
5
  export declare const S3_ENDPOINT = "https://gateway.storjshare.io";
6
+ export declare const DEFAULT_USER_CONFIG_FILE = "default.config.json";
7
+ export declare const DEFAULT_USER_CONFIG_NAME = "Default";
package/dist/constants.js CHANGED
@@ -5,3 +5,5 @@ export const DIR_ACCESS_PERMS = 0o700;
5
5
  export const PROVIDER_URL = 'https://api.dp.superprotocol.com';
6
6
  export const REFRESH_TOKEN_URI = '/api/auth/refresh-access';
7
7
  export const S3_ENDPOINT = 'https://gateway.storjshare.io';
8
+ export const DEFAULT_USER_CONFIG_FILE = 'default.config.json';
9
+ export const DEFAULT_USER_CONFIG_NAME = 'Default';
@@ -94,7 +94,7 @@ export class AppContainer {
94
94
  if (this._configManager) {
95
95
  return;
96
96
  }
97
- const configFilePath = this.configFileManager.getCurrentConfigPath();
97
+ const configFilePath = await this.configFileManager.getCurrentConfigPath();
98
98
  if (!configFilePath) {
99
99
  throw new Error('Config file not found');
100
100
  }
@@ -65,9 +65,9 @@ export class AccountManager {
65
65
  }
66
66
  catch (error) {
67
67
  this.logger.warn({ err: error }, 'Incorrect config file');
68
- ux.warn('Config not found or have errors');
68
+ ux.warn("Account doesn't exists in current configuration");
69
69
  const ask = await confirm({
70
- message: 'Do you want to create new one?',
70
+ message: 'Do you want to create new account?',
71
71
  });
72
72
  if (isCancel(ask)) {
73
73
  ux.error('Operation cancelled.', { exit: 1 });
@@ -82,6 +82,7 @@ export class AccountManager {
82
82
  }
83
83
  async promptAccount() {
84
84
  const askPrivateKey = await confirm({
85
+ initialValue: false,
85
86
  message: 'Do you want to input privateKey?',
86
87
  });
87
88
  if (isCancel(askPrivateKey)) {
@@ -37,7 +37,7 @@ export declare class ConfigFileManager implements IManager {
37
37
  name: string;
38
38
  }>;
39
39
  getCurrentConfigFile(): string | undefined;
40
- getCurrentConfigPath(): string | undefined;
40
+ getCurrentConfigPath(): Promise<string>;
41
41
  importConfig(sourcePath: string, targetName?: string): Promise<string>;
42
42
  init(): Promise<void>;
43
43
  removeConfig(configName: string): Promise<void>;
@@ -4,7 +4,7 @@ import * as fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { Value } from 'typebox/value';
6
6
  import { cliConfigSchema } from '../config/config.schema.js';
7
- import { DIR_ACCESS_PERMS, FILE_ACCESS_PERMS } from '../constants.js';
7
+ import { DEFAULT_USER_CONFIG_FILE, DEFAULT_USER_CONFIG_NAME, DIR_ACCESS_PERMS, FILE_ACCESS_PERMS, } from '../constants.js';
8
8
  import { getConfigName } from '../utils/helper.js';
9
9
  export class ConfigFileManager {
10
10
  logger;
@@ -165,12 +165,13 @@ export class ConfigFileManager {
165
165
  }
166
166
  return this.configs.currentConfig;
167
167
  }
168
- getCurrentConfigPath() {
168
+ async getCurrentConfigPath() {
169
169
  if (this.runtimeConfigFile) {
170
170
  return this.runtimeConfigFile;
171
171
  }
172
172
  if (!this.configs.currentConfig) {
173
- return undefined;
173
+ await this.createConfig(DEFAULT_USER_CONFIG_FILE, DEFAULT_USER_CONFIG_NAME);
174
+ await this.setCurrentConfig(DEFAULT_USER_CONFIG_FILE);
174
175
  }
175
176
  return path.join(this.configsDir, this.configs.currentConfig);
176
177
  }
@@ -64,7 +64,7 @@ export declare class StorageService {
64
64
  id: string;
65
65
  updatedAt: string;
66
66
  userId: string;
67
- }>;
67
+ } | undefined>;
68
68
  updateStorage(id: string, storage: UpdateStorageDto): Promise<StorageResponseDto>;
69
69
  upload(params: IUploadParams, progressCb: ProgressCb): Promise<void>;
70
70
  }
@@ -8,13 +8,13 @@ import { StorageType, } from '@super-protocol/dto-js';
8
8
  import { ResourceType, } from '@super-protocol/provider-client';
9
9
  import { download, upload } from '@super-protocol/sp-files-addon';
10
10
  import * as fs from 'node:fs/promises';
11
- import { basename, dirname, join } from 'node:path';
11
+ import { basename, dirname } from 'node:path';
12
12
  import { Value } from 'typebox/value';
13
13
  import { Retryable } from 'typescript-retry-decorator';
14
14
  import { storageResourceSchema } from '../config/resource.schema.js';
15
15
  import { S3_ENDPOINT } from '../constants.js';
16
16
  import { ProviderClientError } from '../errors.js';
17
- import { preparePath, readJsonFile } from '../utils/helper.js';
17
+ import { joinPaths, preparePath, readJsonFile } from '../utils/helper.js';
18
18
  export class StorageError extends Error {
19
19
  }
20
20
  export class StoragesUndefinedError extends StorageError {
@@ -67,7 +67,7 @@ export class StorageService {
67
67
  }
68
68
  let localPath = preparePath(params.downloadPath);
69
69
  if (resource.filepath) {
70
- localPath = join(localPath, resource.filepath);
70
+ localPath = joinPaths(localPath, resource.filepath);
71
71
  }
72
72
  await download(resource, localPath, {
73
73
  encryption: resourceFile.encryption,
@@ -182,11 +182,20 @@ export class StorageService {
182
182
  async saveStorage(selectedStorage) {
183
183
  this.logger.info({ selectedStorage }, 'Saving selected storage');
184
184
  try {
185
- const { data, error } = await this.providerClient.POST('/api/user-settings', {
185
+ let { data, error } = await this.providerClient.PATCH('/api/user-settings', {
186
186
  body: {
187
187
  activeStorageId: selectedStorage,
188
188
  },
189
189
  });
190
+ if (error && error.statusCode === 404) {
191
+ const result = await this.providerClient.POST('/api/user-settings', {
192
+ body: {
193
+ activeStorageId: selectedStorage,
194
+ },
195
+ });
196
+ error = result.error;
197
+ data = result.data;
198
+ }
190
199
  if (error) {
191
200
  throw new StorageError(`User settings request error ${error.message}`);
192
201
  }
@@ -243,27 +252,27 @@ export class StorageService {
243
252
  const writeCredentials = storage.storageType === StorageType.StorJ
244
253
  ? {
245
254
  bucket: storage.bucket,
246
- prefix: join(storage.prefix, remotePath),
255
+ prefix: joinPaths(storage.prefix, remotePath),
247
256
  token: storage.storjCredentials.writeAccessToken,
248
257
  }
249
258
  : {
250
259
  accessKeyId: storage.s3Credentials.writeAccessKeyId,
251
260
  bucket: storage.bucket,
252
261
  endpoint: S3_ENDPOINT,
253
- prefix: join(storage.prefix, remotePath),
262
+ prefix: joinPaths(storage.prefix, remotePath),
254
263
  secretKey: storage.s3Credentials.writeSecretAccessKey,
255
264
  };
256
265
  const readCredentials = storage.storageType === StorageType.StorJ
257
266
  ? {
258
267
  bucket: storage.bucket,
259
- prefix: join(storage.prefix, remotePath),
268
+ prefix: joinPaths(storage.prefix, remotePath),
260
269
  token: storage.storjCredentials.readAccessToken,
261
270
  }
262
271
  : {
263
272
  accessKeyId: storage.s3Credentials.readAccessKeyId,
264
273
  bucket: storage.bucket,
265
274
  endpoint: S3_ENDPOINT,
266
- prefix: join(storage.prefix, remotePath),
275
+ prefix: joinPaths(storage.prefix, remotePath),
267
276
  secretKey: storage.s3Credentials.readSecretAccessKey,
268
277
  };
269
278
  const info = await fs.stat(params.localPath);
@@ -1,5 +1,6 @@
1
1
  export declare const getConfigName: (name: string) => string;
2
2
  export declare const preparePath: (rawPath: string) => string;
3
+ export declare const joinPaths: (...args: string[]) => string;
3
4
  export type ReadJsonFileParams = {
4
5
  path: string;
5
6
  };
@@ -7,6 +7,7 @@ export const preparePath = (rawPath) => {
7
7
  return rawPath;
8
8
  return path.join(process.cwd(), rawPath);
9
9
  };
10
+ export const joinPaths = (...args) => path.join(...args).replaceAll('\\', '/');
10
11
  export const readJsonFile = async (params) => {
11
12
  if (!existsSync(params.path)) {
12
13
  throw new Error(`File could not be found in ${params.path}`);
@@ -43,7 +43,7 @@
43
43
  "login"
44
44
  ],
45
45
  "args": {},
46
- "description": "Login to remote server",
46
+ "description": "Login. SignUp and SignIn into SuperProtocol",
47
47
  "examples": [
48
48
  "<%= config.bin %> <%= command.id %>\n"
49
49
  ],
@@ -733,5 +733,5 @@
733
733
  ]
734
734
  }
735
735
  },
736
- "version": "0.0.2-beta.13"
736
+ "version": "0.0.2-beta.15"
737
737
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@super-protocol/sp-cli",
3
3
  "description": "SuperProtocol Command line interface",
4
- "version": "0.0.2-beta.13",
4
+ "version": "0.0.2-beta.15",
5
5
  "author": "SuperProtocol",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -22,6 +22,7 @@
22
22
  "@super-protocol/dto-js": "^1.3.0",
23
23
  "@super-protocol/provider-client": "^0.1.8",
24
24
  "@super-protocol/sp-files-addon": "^0.12.7",
25
+ "console-table-printer": "^2.15.0",
25
26
  "cookie": "^1.0.2",
26
27
  "jsonwebtoken": "^9.0.2",
27
28
  "pino": "^9.14.0",