bdy 1.16.30-dev → 1.16.31-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.16.30-dev",
4
+ "version": "1.16.31-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -25,7 +25,7 @@ commandSandboxCp.argument('<destination>', texts_1.OPTION_SANDBOX_CP_DEST);
25
25
  commandSandboxCp.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CP);
26
26
  const upload = async (client, workspace, project, source, destination) => {
27
27
  const { sourcePath, sourceStats } = input_1.default.restApiSandboxUploadSourcePath(source);
28
- const { identifier, remotePath } = input_1.default.restApiSandboxUploadDestinationPath(destination);
28
+ const { identifier, remotePath, isRemoteDir } = input_1.default.restApiSandboxUploadDestinationPath(destination);
29
29
  const result = await client.listSandboxes(workspace, project);
30
30
  const sandboxes = result.sandboxes || [];
31
31
  const found = sandboxes.find((s) => s.identifier === identifier);
@@ -36,7 +36,7 @@ const upload = async (client, workspace, project, source, destination) => {
36
36
  // Single file copy
37
37
  const name = (0, path_1.basename)(sourcePath);
38
38
  output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(1, 1, name));
39
- const remoteFile = (0, path_1.join)(remotePath, name);
39
+ const remoteFile = isRemoteDir ? (0, path_1.join)(remotePath, name) : remotePath;
40
40
  await client.sandboxUploadFile(workspace, found.id, remoteFile, sourcePath);
41
41
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(1));
42
42
  }
@@ -49,11 +49,12 @@ const upload = async (client, workspace, project, source, destination) => {
49
49
  if (files.length === 0) {
50
50
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(0));
51
51
  }
52
- output_1.default.normal('\n', false);
52
+ output_1.default.normal('');
53
+ const baseRemoteDir = isRemoteDir ? (0, path_1.join)(remotePath, (0, path_1.basename)(sourcePath)) : remotePath;
53
54
  for (let i = 0; i < files.length; i++) {
54
55
  const localFile = files[i];
55
56
  const relativePath = (0, path_1.relative)(sourcePath, localFile);
56
- const remoteFile = (0, path_1.join)(remotePath, relativePath).replace(/\\/g, '/');
57
+ const remoteFile = (0, path_1.join)(baseRemoteDir, relativePath).replace(/\\/g, '/');
57
58
  output_1.default.clearPreviousLine();
58
59
  output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(i + 1, files.length, relativePath));
59
60
  await client.sandboxUploadFile(workspace, found.id, remoteFile, localFile);
@@ -65,7 +66,7 @@ const upload = async (client, workspace, project, source, destination) => {
65
66
  }
66
67
  };
67
68
  const download = async (client, workspace, project, source, destination, merge, replace) => {
68
- const destPath = input_1.default.restApiSandboxDownloadDestinationPath(destination, merge, replace);
69
+ const { destPath, isDestPathDir } = input_1.default.restApiSandboxDownloadDestinationPath(destination, merge, replace);
69
70
  const { sourcePath, identifier } = input_1.default.restApiSandboxDownloadSourcePath(source);
70
71
  const result = await client.listSandboxes(workspace, project);
71
72
  const sandboxes = result.sandboxes || [];
@@ -76,14 +77,16 @@ const download = async (client, workspace, project, source, destination, merge,
76
77
  output_1.default.normal(texts_1.TXT_SANDBOX_CP_DOWNLOAD, false);
77
78
  const { body, headers } = await client.sandboxDownloadFile(workspace, found.id, sourcePath);
78
79
  const isFile = headers['content-type'] === 'application/octet-stream';
80
+ const name = (0, path_1.basename)(sourcePath);
79
81
  if (isFile) {
80
- const name = (0, path_1.basename)(sourcePath);
81
- await node_fs_1.default.promises.writeFile((0, path_1.join)(destPath, name), body);
82
+ const destFilePath = isDestPathDir ? (0, path_1.join)(destPath, name) : destPath;
83
+ await node_fs_1.default.promises.writeFile(destFilePath, body);
82
84
  output_1.default.clearPreviousLine();
83
85
  output_1.default.normal(texts_1.TXT_SANDBOX_CP_DOWNLOAD_DONE);
84
86
  output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(1));
85
87
  }
86
88
  else {
89
+ const destDirPath = isDestPathDir ? (0, path_1.join)(destPath, name) : destPath;
87
90
  const zipPath = (0, path_1.join)((0, utils_1.getHomeDirectory)(), `${(0, uuid_1.v4)()}.tar.gz`);
88
91
  const clearZip = () => {
89
92
  try {
@@ -99,7 +102,7 @@ const download = async (client, workspace, project, source, destination, merge,
99
102
  output_1.default.normal(texts_1.TXT_SANDBOX_CP_DOWNLOAD_DONE);
100
103
  output_1.default.normal(texts_1.TXT_SANDBOX_UNZIP);
101
104
  let count = 0;
102
- await (0, utils_1.untarGz)(destPath, zipPath, () => {
105
+ await (0, utils_1.untarGz)(destDirPath, zipPath, () => {
103
106
  count += 1;
104
107
  output_1.default.clearPreviousLine();
105
108
  output_1.default.normal((0, texts_1.TXT_SANDBOX_UNZIPPING_COUNT)(count));
@@ -527,59 +527,89 @@ class Input {
527
527
  if (!remotePath.startsWith('/')) {
528
528
  remotePath = `/${remotePath}`;
529
529
  }
530
+ const isRemoteDir = remotePath.endsWith('/');
530
531
  return {
531
532
  identifier,
532
533
  remotePath,
534
+ isRemoteDir,
533
535
  };
534
536
  }
535
- static restApiSandboxDownloadDestinationPath(destPath, merge, replace) {
536
- const dirPath = node_path_1.default.resolve(destPath);
537
- const exists = node_fs_1.default.existsSync(dirPath);
538
- if (!exists) {
537
+ static restApiSandboxDownloadDestinationPath(destination, merge, replace) {
538
+ const isDestPathDir = destination.endsWith('/');
539
+ const destPath = node_path_1.default.resolve(destination);
540
+ const exists = node_fs_1.default.existsSync(destPath);
541
+ if (isDestPathDir) {
542
+ if (!exists) {
543
+ try {
544
+ node_fs_1.default.mkdirSync(destPath, {
545
+ recursive: true,
546
+ });
547
+ }
548
+ catch {
549
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_MKDIR)(destPath));
550
+ }
551
+ }
552
+ else if (replace) {
553
+ try {
554
+ node_fs_1.default.rmSync(destPath, {
555
+ recursive: true,
556
+ force: true,
557
+ });
558
+ node_fs_1.default.mkdirSync(destPath, {
559
+ recursive: true,
560
+ });
561
+ }
562
+ catch {
563
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_REPLACE)(destPath));
564
+ }
565
+ }
539
566
  try {
540
- node_fs_1.default.mkdirSync(dirPath, {
541
- recursive: true,
542
- });
567
+ const stats = node_fs_1.default.statSync(destPath);
568
+ if (!stats.isDirectory()) {
569
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_DEST_NOT_FOLDER)(destination));
570
+ }
543
571
  }
544
572
  catch {
545
- output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_MKDIR)(dirPath));
573
+ output_1.default.exitError(texts_1.ERR_SWW);
574
+ }
575
+ let empty = true;
576
+ try {
577
+ const entries = node_fs_1.default.readdirSync(destPath);
578
+ empty = !entries.length;
579
+ }
580
+ catch {
581
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_READDIR)(destPath));
582
+ }
583
+ if (!empty && !merge) {
584
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_NOT_EMPTY_DIR)(destPath));
546
585
  }
547
586
  }
548
- else if (replace) {
587
+ else {
588
+ if (exists) {
589
+ if (!replace) {
590
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_PATH_EXISTS)(destPath));
591
+ }
592
+ try {
593
+ node_fs_1.default.rmSync(destPath, {
594
+ recursive: true,
595
+ force: true,
596
+ });
597
+ }
598
+ catch {
599
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_REPLACE)(destPath));
600
+ }
601
+ }
602
+ const basePath = (0, node_path_1.resolve)(destPath, '..');
549
603
  try {
550
- node_fs_1.default.rmSync(dirPath, {
551
- recursive: true,
552
- force: true,
553
- });
554
- node_fs_1.default.mkdirSync(dirPath, {
604
+ node_fs_1.default.mkdirSync(basePath, {
555
605
  recursive: true,
556
606
  });
557
607
  }
558
608
  catch {
559
- output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_REPLACE)(dirPath));
609
+ output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_MKDIR)(basePath));
560
610
  }
561
611
  }
562
- try {
563
- const stats = node_fs_1.default.statSync(dirPath);
564
- if (!stats.isDirectory()) {
565
- output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_DEST_NOT_FOLDER)(destPath));
566
- }
567
- }
568
- catch {
569
- output_1.default.exitError(texts_1.ERR_SWW);
570
- }
571
- let empty = true;
572
- try {
573
- const entries = node_fs_1.default.readdirSync(dirPath);
574
- empty = !entries.length;
575
- }
576
- catch {
577
- output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_READDIR)(dirPath));
578
- }
579
- if (!empty && !merge) {
580
- output_1.default.exitError((0, texts_1.ERR_SANDBOX_CP_NOT_EMPTY_DIR)(dirPath));
581
- }
582
- return dirPath;
612
+ return { destPath, isDestPathDir };
583
613
  }
584
614
  static restApiSandboxUploadSourcePath(sourcePath) {
585
615
  const s = node_path_1.default.resolve(sourcePath);
@@ -9,9 +9,9 @@ exports.OPTION_COMPARE_URLS_FILE = exports.OPTION_COMPARE_SITEMAP = exports.OPTI
9
9
  exports.LOG_TUNNEL_REGISTERED = exports.LOG_ERROR_WHILE_REFRESHING_AGENT = exports.LOG_REGISTERING_TUNNEL = exports.LOG_GETTING_AGENT = exports.LOG_UNREGISTERING_AGENT = exports.LOG_REGION_DETECTED = exports.LOG_AGENT_REGISTERED = exports.LOG_SOCKET_DISCONNECTED = exports.LOG_SOCKET_CONNECTED = exports.LOG_AGENT_NSSM_CLEARING = exports.LOG_AGENT_NSSM_EXTRACTING = exports.LOG_AGENT_NSSM_DOWNLOADING = exports.LOG_AGENT_ENABLED = exports.LOG_AGENT_STARTING_SYSTEM = exports.LOG_AGENT_STOPPING_SYSTEM = exports.LOG_AGENT_ENABLING_SYSTEM = exports.LOG_AGENT_SYSTEM_SERVICE_CONFIG = exports.LOG_AGENT_EXTRACTING_ARCHIVE = exports.LOG_AGENT_DOWNLOADING_ARCHIVE = exports.LOG_AGENT_SYSTEM_DIR = exports.LOG_ERROR_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_ERROR_REMOVING_AGENT_STANDALONE_LOCK_FILE = exports.LOG_ERROR_SAVING_AGENT_STANDALONE_CONFIG = exports.LOG_ERROR_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_SAVING_AGENT_LOCAL_CONFIG = exports.LOG_REMOVING_AGENT_PROC_ID = exports.LOG_SAVING_AGENT_PROC_ID = exports.LOG_SAVING_AGENT_SYSTEM_CONFIG = exports.LOG_REGISTERING_AGENT = exports.OPTION_SCRAPE_OUTPUT_DIR = exports.OPTION_SCRAPE_DELAY = exports.OPTION_SCRAPE_DARK_MODE = exports.OPTION_SCRAPE_WAIT_FOR_ELEMENT = exports.OPTION_SCRAPE_DEVICE_PIXEL_RATIO = exports.OPTION_SCRAPE_VIEWPORT = exports.OPTION_SCRAPE_BROWSER = exports.OPTION_SCRAPE_XPATH_SELECTOR = exports.OPTION_SCRAPE_CSS_SELECTOR = exports.OPTION_SCRAPE_FULL_PAGE = exports.OPTION_SCRAPE_QUALITY = exports.OPTION_SCRAPE_OUTPUT_TYPE = exports.OPTION_SCRAPE_FOLLOW = exports.OPTION_SCRAPE_URL = exports.OPTION_COMPARE_WAIT_FOR = exports.OPTION_COMPARE_DELAY = exports.OPTION_COMPARE_HEADER = exports.OPTION_COMPARE_COOKIE = exports.OPTION_COMPARE_IGNORE = exports.OPTION_COMPARE_IGNORE_URLS = exports.OPTION_COMPARE_DRY_RUN = void 0;
10
10
  exports.DESC_COMMAND_SANDBOX_LIST = exports.DESC_COMMAND_SANDBOX_CREATE = exports.DESC_COMMAND_SANDBOX = exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SESSION_LINK = exports.LOG_SENDING_DATA = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREAKER_OPEN = exports.LOG_TUNNEL_HTTP_RATE_LIMIT = exports.LOG_TUNNEL_HTTP_WRON_AUTH = exports.LOG_TUNNEL_IDENTIFIED = exports.LOG_TUNNEL_DISCONNECTED = exports.LOG_TUNNEL_FAILED = exports.LOG_TUNNEL_CONNECTED = exports.LOG_AGENT_STARTED = exports.LOG_AGENT_SERVER_STARTED = exports.LOG_ERROR_STARTING_AGENT_SERVER = exports.LOG_SSH_CONNECTION = exports.LOG_WRONG_STREAM = exports.LOG_DETECTED_STREAM = exports.LOG_HTTP2_REQUEST = exports.LOG_HTTP2_CONNECTION = exports.LOG_HTTP1_REQUEST = exports.LOG_HTTP1_CONNECTION = exports.LOG_ERROR = exports.LOG_STOPPING_TUNNEL = exports.LOG_STARTING_TUNNEL = exports.LOG_ENABLING_AGENT_TARGET = exports.LOG_DISABLING_AGENT_TARGET = exports.LOG_REMOVING_TUNNEL = void 0;
11
11
  exports.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST = exports.DESC_COMMAND_SANDBOX_SNAPSHOT = exports.TXT_SANDBOX_COMMAND_KILLED = exports.OPTION_SANDBOX_COMMAND_KILL_CONFIRM = exports.OPTION_SANDBOX_COMMAND_ID = exports.DESC_COMMAND_SANDBOX_EXEC_KILL = exports.DESC_COMMAND_SANDBOX_EXEC_LOGS = exports.DESC_COMMAND_SANDBOX_EXEC_STATUS = exports.DESC_COMMAND_SANDBOX_EXEC_LIST = exports.TXT_SANDBOX_WAITING_START = exports.TXT_SANDBOX_WAITING_STOP = exports.TXT_SANDBOX_WAITING_SETUP = exports.TXT_SANDBOX_WAITING_RUNNING = exports.TXT_SANDBOX_STOPPED = exports.TXT_SANDBOX_STARTED = exports.TXT_SANDBOX_DESTROYED = exports.TXT_SANDBOX_DESTROY_CONFIRM = exports.TXT_SANDBOX_CREATED = exports.TXT_SANDBOX_CREATING = exports.OPTION_SANDBOX_WAIT = exports.OPTION_SANDBOX_WAIT_CONFIGURED = exports.OPTION_SANDBOX_WAIT_RUNNING = exports.ERR_SANDBOX_STOP_FAILED = exports.ERR_SANDBOX_NO_COMMANDS = exports.ERR_SANDBOX_RUNNING_FAILED = exports.ERR_SANDBOX_STOP_TIMEOUT = exports.ERR_SANDBOX_SNAPSHOT_TIMEOUT = exports.ERR_SANDBOX_RUNNING_TIMEOUT = exports.ERR_SANDBOX_SETUP_TIMEOUT = exports.ERR_SANDBOX_SETUP_FAILED = exports.ERR_SANDBOX_INVALID_RESOURCES = exports.ERR_SANDBOX_NOT_FOUND = exports.OPTION_SANDBOX_RUNTIME = exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTION_SANDBOX_RUN_COMMAND = exports.OPTION_SANDBOX_TAGS = exports.OPTION_SANDBOX_INSTALL_COMMANDS = exports.OPTION_SANDBOX_RESOURCES = exports.OPTION_SANDBOX_OS = exports.OPTION_SANDBOX_NAME = exports.OPTION_SANDBOX_IDENTIFIER = exports.DESC_COMMAND_SANDBOX_EXEC = exports.DESC_COMMAND_SANDBOX_STATUS = exports.DESC_COMMAND_SANDBOX_RESTART = exports.DESC_COMMAND_SANDBOX_STOP = exports.DESC_COMMAND_SANDBOX_START = exports.DESC_COMMAND_SANDBOX_DESTROY = exports.DESC_COMMAND_SANDBOX_GET = void 0;
12
- exports.TXT_SANDBOX_EXEC_SUCCESS = exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_SOURCE = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_REPLACE = exports.ERR_SANDBOX_CP_MKDIR = exports.ERR_SANDBOX_CP_NOT_EMPTY_DIR = exports.ERR_SANDBOX_CP_READDIR = exports.ERR_SANDBOX_CP_DEST_NOT_FOLDER = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.TXT_SANDBOX_UNZIPPING_COUNT = exports.TXT_SANDBOX_UNZIP_DONE = exports.TXT_SANDBOX_UNZIP = exports.TXT_SANDBOX_CP_DOWNLOAD_DONE = exports.TXT_SANDBOX_CP_DOWNLOAD = exports.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE = exports.OPTION_SANDBOX_CP_DOWNLOAD_MERGE = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = exports.OPTION_SANDBOX_FROM_SNAPSHOT = exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = void 0;
13
- exports.TXT_PACKAGE_DELETED = exports.ERR_COMMAND_PACKAGE_TYPE = exports.OPT_COMMAND_PACKAGE_VERSION = exports.OPT_COMMAND_PACKAGE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_NAME = exports.OPT_COMMAND_PACKAGE_TYPE = exports.DESC_COMMAND_PACKAGE_CREATE = exports.DESC_COMMAND_PACKAGE_GET = exports.TXT_PACKAGE_DOCKER_LOGIN_FAILED = exports.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS = exports.TXT_PACKAGE_VERSION_DELETE_CONFIRM = exports.TXT_PACKAGE_DELETE_CONFIRM = exports.DESC_COMMAND_PACKAGE_DELETE = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_VERSION_GET = exports.DESC_COMMAND_PACKAGE_VERSION_LIST = exports.DESC_COMMAND_PACKAGE_VERSION_DELETE = exports.DESC_COMMAND_PACKAGE_DOCKER_LOGIN = exports.DESC_COMMAND_PACKAGE_LIST = exports.DESC_COMMAND_PACKAGE_VERSION = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_PROJECT_FOUND = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_PROJECT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = void 0;
14
- exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = exports.EXAMPLE_SANDBOX_ENDPOINT_LIST = exports.EXAMPLE_SANDBOX_ENDPOINT_GET = exports.EXAMPLE_SANDBOX_ENDPOINT_DELETE = exports.EXAMPLE_SANDBOX_ENDPOINT_CREATE = exports.EXAMPLE_SANDBOX_SNAPSHOT_LIST = exports.EXAMPLE_SANDBOX_SNAPSHOT_GET = exports.EXAMPLE_SANDBOX_SNAPSHOT_DELETE = exports.EXAMPLE_SANDBOX_SNAPSHOT_CREATE = exports.EXAMPLE_SANDBOX_EXEC_STATUS = exports.EXAMPLE_SANDBOX_EXEC_LOGS = exports.EXAMPLE_SANDBOX_EXEC_LIST = exports.EXAMPLE_SANDBOX_EXEC_KILL = exports.EXAMPLE_SANDBOX_EXEC_COMMAND = exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.TXT_PROJECT_NONE = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_PROJECT_SET_CLEARED = exports.TXT_PROJECT_SET_SUCCESS = exports.DESC_COMMAND_PROJECT_GET = exports.ARG_COMMAND_PROJECT_NAME = exports.DESC_COMMAND_PROJECT_SET = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT = exports.TXT_PACKAGE_VERSION_DOWNLOAD = exports.TXT_PACKAGE_PUBLISH = exports.TXT_PACKAGE_CREATED = exports.TXT_PACKAGE_VERSION_DELETED = void 0;
12
+ exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_SOURCE = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_REPLACE = exports.ERR_SANDBOX_CP_MKDIR = exports.ERR_SANDBOX_CP_PATH_EXISTS = exports.ERR_SANDBOX_CP_NOT_EMPTY_DIR = exports.ERR_SANDBOX_CP_READDIR = exports.ERR_SANDBOX_CP_DEST_NOT_FOLDER = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.TXT_SANDBOX_UNZIPPING_COUNT = exports.TXT_SANDBOX_UNZIP_DONE = exports.TXT_SANDBOX_UNZIP = exports.TXT_SANDBOX_CP_DOWNLOAD_DONE = exports.TXT_SANDBOX_CP_DOWNLOAD = exports.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE = exports.OPTION_SANDBOX_CP_DOWNLOAD_MERGE = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = exports.OPTION_SANDBOX_FROM_SNAPSHOT = exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = void 0;
13
+ exports.ERR_COMMAND_PACKAGE_TYPE = exports.OPT_COMMAND_PACKAGE_VERSION = exports.OPT_COMMAND_PACKAGE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_NAME = exports.OPT_COMMAND_PACKAGE_TYPE = exports.DESC_COMMAND_PACKAGE_CREATE = exports.DESC_COMMAND_PACKAGE_GET = exports.TXT_PACKAGE_DOCKER_LOGIN_FAILED = exports.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS = exports.TXT_PACKAGE_VERSION_DELETE_CONFIRM = exports.TXT_PACKAGE_DELETE_CONFIRM = exports.DESC_COMMAND_PACKAGE_DELETE = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_VERSION_GET = exports.DESC_COMMAND_PACKAGE_VERSION_LIST = exports.DESC_COMMAND_PACKAGE_VERSION_DELETE = exports.DESC_COMMAND_PACKAGE_DOCKER_LOGIN = exports.DESC_COMMAND_PACKAGE_LIST = exports.DESC_COMMAND_PACKAGE_VERSION = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_PROJECT_FOUND = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_PROJECT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = void 0;
14
+ exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = exports.EXAMPLE_SANDBOX_ENDPOINT_LIST = exports.EXAMPLE_SANDBOX_ENDPOINT_GET = exports.EXAMPLE_SANDBOX_ENDPOINT_DELETE = exports.EXAMPLE_SANDBOX_ENDPOINT_CREATE = exports.EXAMPLE_SANDBOX_SNAPSHOT_LIST = exports.EXAMPLE_SANDBOX_SNAPSHOT_GET = exports.EXAMPLE_SANDBOX_SNAPSHOT_DELETE = exports.EXAMPLE_SANDBOX_SNAPSHOT_CREATE = exports.EXAMPLE_SANDBOX_EXEC_STATUS = exports.EXAMPLE_SANDBOX_EXEC_LOGS = exports.EXAMPLE_SANDBOX_EXEC_LIST = exports.EXAMPLE_SANDBOX_EXEC_KILL = exports.EXAMPLE_SANDBOX_EXEC_COMMAND = exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.TXT_PROJECT_NONE = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_PROJECT_SET_CLEARED = exports.TXT_PROJECT_SET_SUCCESS = exports.DESC_COMMAND_PROJECT_GET = exports.ARG_COMMAND_PROJECT_NAME = exports.DESC_COMMAND_PROJECT_SET = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT = exports.TXT_PACKAGE_VERSION_DOWNLOAD = exports.TXT_PACKAGE_PUBLISH = exports.TXT_PACKAGE_CREATED = exports.TXT_PACKAGE_VERSION_DELETED = exports.TXT_PACKAGE_DELETED = void 0;
15
15
  const utils_1 = require("./utils");
16
16
  exports.ERR_REST_API_GENERAL_ERROR = 'Something went wrong';
17
17
  exports.ERR_REST_API_NOT_RESPONDING = 'Api endpoint not responding. Try again later...';
@@ -604,8 +604,8 @@ exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = 'Endpoint not found';
604
604
  exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = 'No endpoints found';
605
605
  // Sandbox cp command
606
606
  exports.DESC_COMMAND_SANDBOX_CP = 'Copy files/directories to sandbox';
607
- exports.OPTION_SANDBOX_CP_SOURCE = 'Upload: local file (directory) path to upload. Download: sandbox remote file (directory): sandbox-id:/path to download';
608
- exports.OPTION_SANDBOX_CP_DEST = 'Upload: Sandbox remote directory: sandbox-id:/path to upload to. Download: local directory path to download to';
607
+ exports.OPTION_SANDBOX_CP_SOURCE = 'Local path or sandbox path (sandbox-id:/path)';
608
+ exports.OPTION_SANDBOX_CP_DEST = 'Local path or sandbox path (sandbox-id:/path)';
609
609
  exports.OPTION_SANDBOX_CP_DOWNLOAD_MERGE = 'Merge contents of the destination directory with sandbox content';
610
610
  exports.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE = 'Replace contents of the destination directory with sandbox content';
611
611
  exports.TXT_SANDBOX_CP_DOWNLOAD = 'Downloading...';
@@ -626,9 +626,11 @@ const ERR_SANDBOX_CP_READDIR = (dirPath) => `Error while reading directory ${dir
626
626
  exports.ERR_SANDBOX_CP_READDIR = ERR_SANDBOX_CP_READDIR;
627
627
  const ERR_SANDBOX_CP_NOT_EMPTY_DIR = (dirPath) => `Directory ${dirPath} is not empty. Use --merge or --replace flags`;
628
628
  exports.ERR_SANDBOX_CP_NOT_EMPTY_DIR = ERR_SANDBOX_CP_NOT_EMPTY_DIR;
629
+ const ERR_SANDBOX_CP_PATH_EXISTS = (path) => `Path ${path} exists. Use --replace flags`;
630
+ exports.ERR_SANDBOX_CP_PATH_EXISTS = ERR_SANDBOX_CP_PATH_EXISTS;
629
631
  const ERR_SANDBOX_CP_MKDIR = (dirPath) => `Error while creating directory ${dirPath}`;
630
632
  exports.ERR_SANDBOX_CP_MKDIR = ERR_SANDBOX_CP_MKDIR;
631
- const ERR_SANDBOX_CP_REPLACE = (dirPath) => `Error while replacing directory ${dirPath}`;
633
+ const ERR_SANDBOX_CP_REPLACE = (dirPath) => `Error while replacing path ${dirPath}`;
632
634
  exports.ERR_SANDBOX_CP_REPLACE = ERR_SANDBOX_CP_REPLACE;
633
635
  exports.ERR_SANDBOX_CP_INVALID_DEST = 'Invalid destination format. Use: sandbox-identifier:/path';
634
636
  exports.ERR_SANDBOX_CP_INVALID_SOURCE = 'Invalid source format. Use: sandbox-identifier:/path';
@@ -769,20 +771,43 @@ exports.TXT_PROJECT_NONE = 'No project configured. Run "bdy login" or "bdy proje
769
771
  // Examples
770
772
  exports.EXAMPLE_SANDBOX_CP = `
771
773
  EXAMPLES:
772
- # copy file from sandbox to new local directory:
773
- bdy sb cp sandbox-identifier:/path/to/file /path/to/dir
774
+ # copy file from sandbox to local directory with a new name:
775
+ bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/name
774
776
 
775
- # copy contents of directory from sandbox to existing local directory merging it contents:
776
- bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir --merge
777
+ # if local path file already exists you must replace it:
778
+ bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/name --replace
777
779
 
778
- # copy contents of directory from sandbox to existing local directory replacing it contents:
779
- bdy sb co sandbox-identifier:/path/to/dir /path/to/dir --replace
780
+ # copy file from sandbox INTO local directory:
781
+ bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/
780
782
 
781
- # copy local file to sandbox directory:
782
- bdy sb cp /path/to/file sandbox-identifier:/path/to/dir
783
+ # if local directory already exists you must merge it or replace it:
784
+ bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/ --merge
785
+ bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/ --replace
786
+
787
+ # copy directory from sandbox to local directory with a new name
788
+ bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir
789
+
790
+ # if local directory already exists you must replace it:
791
+ bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir --replace
792
+
793
+ # copy directory from sandbox INTO local directory
794
+ bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/
795
+
796
+ # if local directory already exists you must merge it or replace it:
797
+ bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/ --merge
798
+ bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/ --replace
799
+
800
+ # copy local file to sandbox with a new name:
801
+ bdy sb cp /path/to/file sandbox-identifier:/path/to/dir/name
802
+
803
+ # copy local file into sandbox directory
804
+ bdy sb cp /path/to/file sandbox-identifier:/path/to/dir/
783
805
 
784
806
  # copy contents of local directory to sandbox directory:
785
- bdy sb cp /path/to/dir sandbox-identifier:/path/to/dir`;
807
+ bdy sb cp /path/to/dir sandbox-identifier:/path/to/dir
808
+
809
+ # copy local directory into sandbox directory:
810
+ bdy sb cp /path/to/dir sandbox-identifier:/path/to/dir/`;
786
811
  exports.EXAMPLE_SANDBOX_CREATE = `
787
812
  EXAMPLES:
788
813
  # create ubuntu 22.04 sandbox with name and wait for start:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.16.30-dev",
4
+ "version": "1.16.31-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {