@squidcloud/cli 1.0.367 → 1.0.369

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 (2) hide show
  1. package/dist/index.js +72 -56
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -447,8 +447,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
447
447
  Object.defineProperty(exports, "__esModule", ({ value: true }));
448
448
  exports.requirePath = void 0;
449
449
  exports.findModulePath = findModulePath;
450
- const path_1 = __importDefault(__webpack_require__(6928));
451
450
  const enhanced_resolve_1 = __importDefault(__webpack_require__(4506));
451
+ const path_1 = __importDefault(__webpack_require__(6928));
452
452
  async function findModulePath(moduleName, startDir = process.cwd()) {
453
453
  const directoriesToSearch = new Set([startDir, process.cwd(), __dirname]);
454
454
  // Try each directory in order
@@ -982,12 +982,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
982
982
  Object.defineProperty(exports, "__esModule", ({ value: true }));
983
983
  exports["default"] = default_1;
984
984
  const fs = __importStar(__webpack_require__(1943));
985
- const process_utils_1 = __webpack_require__(8251);
986
- const resolve_1 = __webpack_require__(412);
987
985
  const path_1 = __importDefault(__webpack_require__(6928));
988
- const validate_1 = __webpack_require__(2246);
989
- const logging_1 = __webpack_require__(443);
986
+ const resolve_1 = __webpack_require__(412);
990
987
  const shell_runner_1 = __webpack_require__(3089);
988
+ const logging_1 = __webpack_require__(443);
989
+ const process_utils_1 = __webpack_require__(8251);
990
+ const validate_1 = __webpack_require__(2246);
991
991
  async function default_1() {
992
992
  const packageJson = await (0, validate_1.validateSquidProject)();
993
993
  console.log((0, logging_1.primary)('Please note:'), 'to debug your application, you need to run the "start" npm script in your IDE in debug mode');
@@ -1704,6 +1704,7 @@ module.exports = require("os");
1704
1704
 
1705
1705
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1706
1706
  exports.KOTLIN_CONTROLLERS = void 0;
1707
+ exports.getEnvironmentPrefix = getEnvironmentPrefix;
1707
1708
  exports.getApplicationUrl = getApplicationUrl;
1708
1709
  exports.KOTLIN_CONTROLLERS = [
1709
1710
  'aiData',
@@ -1732,25 +1733,40 @@ exports.KOTLIN_CONTROLLERS = [
1732
1733
  'personalStorage',
1733
1734
  'internal-extraction',
1734
1735
  ];
1735
- function getApplicationUrl(regionPrefix, appId, path) {
1736
- const baseUrl = 'https://squid.cloud';
1737
- const parsedBaseUrl = new URL(baseUrl);
1738
- parsedBaseUrl.host = `${appId}.${regionPrefix}.${parsedBaseUrl.host}`;
1739
- const controller = path.replace(/^\//g, '').split('/')[0] || '';
1740
- if (isLocal(regionPrefix)) {
1741
- parsedBaseUrl.protocol = 'http';
1742
- parsedBaseUrl.port = exports.KOTLIN_CONTROLLERS.includes(controller) ? '8001' : '8000';
1743
- if (isAndroid(regionPrefix)) {
1744
- parsedBaseUrl.host = '10.0.2.2';
1736
+ function getEnvironmentPrefix(shard, region, cloudId, stage) {
1737
+ if (region === 'local') {
1738
+ return 'local';
1739
+ }
1740
+ const components = [];
1741
+ if (shard && shard !== 'default') {
1742
+ components.push(shard);
1743
+ }
1744
+ components.push(region);
1745
+ components.push(cloudId);
1746
+ if (stage !== 'prod') {
1747
+ components.push(stage);
1748
+ }
1749
+ return components.join('.');
1750
+ }
1751
+ function getApplicationUrl(environmentPrefix, appId, path, appIdPlaceholder, environmentPrefixPlaceholder) {
1752
+ const baseDomain = new URL('https://squid.cloud').host;
1753
+ const customHost = `${appIdPlaceholder || appId}.${environmentPrefixPlaceholder || environmentPrefix}.${baseDomain}`;
1754
+ let protocol = 'https';
1755
+ let host = customHost;
1756
+ let port = '';
1757
+ if (isLocal(environmentPrefix)) {
1758
+ protocol = 'http';
1759
+ port = exports.KOTLIN_CONTROLLERS.includes(path.replace(/^\//, '').split('/')[0] || '') ? '8001' : '8000';
1760
+ if (isAndroid(environmentPrefix)) {
1761
+ host = '10.0.2.2';
1745
1762
  }
1746
- else if (isIOS(regionPrefix)) {
1747
- parsedBaseUrl.host = 'localhost';
1763
+ else if (isIOS(environmentPrefix)) {
1764
+ host = 'localhost';
1748
1765
  }
1749
1766
  }
1750
- const url = parsedBaseUrl.toString();
1751
- path = path.startsWith('/') ? path.slice(1) : path;
1752
- const urlWithoutTrailingSlash = url.replace(/\/$/g, '');
1753
- return path.length ? `${urlWithoutTrailingSlash}/${path}` : urlWithoutTrailingSlash;
1767
+ const origin = protocol + '://' + host + (port ? `:${port}` : '');
1768
+ const cleanPath = path.replace(/^\/+/, '');
1769
+ return cleanPath ? `${origin}/${cleanPath}` : origin;
1754
1770
  }
1755
1771
  function isLocal(regionPrefix) {
1756
1772
  return /^local/.test(regionPrefix);
@@ -1812,8 +1828,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
1812
1828
  };
1813
1829
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1814
1830
  exports.downloadRepo = downloadRepo;
1815
- const fs_1 = __importDefault(__webpack_require__(9896));
1816
1831
  const decompress_1 = __importDefault(__webpack_require__(482));
1832
+ const fs_1 = __importDefault(__webpack_require__(9896));
1817
1833
  async function downloadRepo(username, repo, dest) {
1818
1834
  let tempDir;
1819
1835
  try {
@@ -8107,11 +8123,11 @@ module.exports = function bitIterator(nextBuffer) {
8107
8123
 
8108
8124
  Object.defineProperty(exports, "__esModule", ({ value: true }));
8109
8125
  exports.reportLocalBackendInitialized = reportLocalBackendInitialized;
8110
- const environment_1 = __webpack_require__(722);
8111
- const http_1 = __webpack_require__(866);
8112
- const global_utils_1 = __webpack_require__(6334);
8113
- const console_app_utils_1 = __webpack_require__(7580);
8114
8126
  const assertic_1 = __webpack_require__(3205);
8127
+ const console_app_utils_1 = __webpack_require__(7580);
8128
+ const global_utils_1 = __webpack_require__(6334);
8129
+ const http_1 = __webpack_require__(866);
8130
+ const environment_1 = __webpack_require__(722);
8115
8131
  async function reportLocalBackendInitialized(appId, apiKey, appRegion, verbose) {
8116
8132
  const stage = appRegion === 'local' ? 'local' : appRegion.endsWith('.sandbox') ? 'sandbox' : 'prod';
8117
8133
  const consoleRegion = (0, console_app_utils_1.getConsoleAppRegionByStage)(stage);
@@ -10302,8 +10318,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10302
10318
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10303
10319
  exports.BUILT_IN_WEBPACK_CONFIG_PATH = exports.USER_WEBPACK_CONFIG_PATH = exports.requirePath = void 0;
10304
10320
  exports.findModulePath = findModulePath;
10305
- const path_1 = __importDefault(__webpack_require__(6928));
10306
10321
  const enhanced_resolve_1 = __importDefault(__webpack_require__(4506));
10322
+ const path_1 = __importDefault(__webpack_require__(6928));
10307
10323
  async function findModulePath(moduleName, startDir = __dirname) {
10308
10324
  let currentDir = startDir;
10309
10325
  const result = await new Promise((r, rej) => {
@@ -11480,21 +11496,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11480
11496
  return (mod && mod.__esModule) ? mod : { "default": mod };
11481
11497
  };
11482
11498
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11483
- const yargs_1 = __importDefault(__webpack_require__(1771));
11484
- const deploy_1 = __importDefault(__webpack_require__(8705));
11499
+ const dotenv = __importStar(__webpack_require__(9650));
11500
+ const fsSync = __importStar(__webpack_require__(9896));
11485
11501
  const path_1 = __importDefault(__webpack_require__(6928));
11486
- const process_utils_1 = __webpack_require__(8251);
11502
+ const yargs_1 = __importDefault(__webpack_require__(1771));
11503
+ const stage_1 = __webpack_require__(8058);
11487
11504
  const packageJson = __importStar(__webpack_require__(8330));
11488
- const start_1 = __importDefault(__webpack_require__(496));
11489
- const dotenv = __importStar(__webpack_require__(9650));
11505
+ const build_1 = __importDefault(__webpack_require__(8584));
11506
+ const deploy_1 = __importDefault(__webpack_require__(8705));
11490
11507
  const init_env_1 = __importDefault(__webpack_require__(1838));
11491
- const fsSync = __importStar(__webpack_require__(9896));
11508
+ const init_webpack_1 = __importDefault(__webpack_require__(1134));
11492
11509
  const sample_1 = __importDefault(__webpack_require__(4328));
11493
- const build_1 = __importDefault(__webpack_require__(8584));
11494
- const stage_1 = __webpack_require__(8058);
11495
- const validate_1 = __webpack_require__(2246);
11510
+ const start_1 = __importDefault(__webpack_require__(496));
11496
11511
  const undeploy_1 = __importDefault(__webpack_require__(9478));
11497
- const init_webpack_1 = __importDefault(__webpack_require__(1134));
11512
+ const process_utils_1 = __webpack_require__(8251);
11513
+ const validate_1 = __webpack_require__(2246);
11498
11514
  function setupDotEnv(baseDir) {
11499
11515
  dotenv.config({ path: path_1.default.resolve(baseDir || './', '.env') });
11500
11516
  }
@@ -11825,11 +11841,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
11825
11841
  exports["default"] = initSample;
11826
11842
  const promises_1 = __importDefault(__webpack_require__(1943));
11827
11843
  const path_1 = __importDefault(__webpack_require__(6928));
11828
- const report_utils_1 = __webpack_require__(3066);
11829
- const process_utils_1 = __webpack_require__(8251);
11844
+ const shell_runner_1 = __webpack_require__(3089);
11830
11845
  const git_utils_1 = __webpack_require__(954);
11831
11846
  const logging_1 = __webpack_require__(443);
11832
- const shell_runner_1 = __webpack_require__(3089);
11847
+ const process_utils_1 = __webpack_require__(8251);
11848
+ const report_utils_1 = __webpack_require__(3066);
11833
11849
  const ORG = 'squid-cloud-samples';
11834
11850
  async function initSample(dirPath, appId, apiKey, environmentId, squidDeveloperId, region, templateName, verbose = false) {
11835
11851
  try {
@@ -22360,7 +22376,7 @@ function exitWithError(...messages) {
22360
22376
  /***/ ((module) => {
22361
22377
 
22362
22378
  "use strict";
22363
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.367","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","build:prod":"webpack --mode=production","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.367","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.3","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.96.0","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/decompress":"^4.2.7","@types/node":"^20.16.10","terminal-link":"^3.0.0"}}');
22379
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@squidcloud/cli","version":"1.0.369","description":"The Squid CLI","main":"dist/index.js","scripts":{"start":"node dist/index.js","start-ts":"ts-node -r tsconfig-paths/register src/index.ts","prebuild":"rimraf dist","build":"webpack --mode=production","build:dev":"webpack --mode=development","build:prod":"webpack --mode=production","lint":"eslint","link":"npm run build && chmod 755 dist/index.js && npm link","watch":"webpack --watch","deploy":"npm run build && npm pack --silent | xargs -I {} mv {} package.tgz && npm install -g package.tgz && rm -rf package.tgz","publish:public":"npm run build && npm publish --access public"},"files":["dist/**/*"],"bin":{"squid":"dist/index.js"},"keywords":[],"author":"","license":"ISC","engines":{"node":">=18.0.0"},"dependencies":{"@squidcloud/local-backend":"^1.0.369","copy-webpack-plugin":"^12.0.2","decompress":"^4.2.1","nodemon":"^3.1.3","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","tsconfig-paths-webpack-plugin":"^4.1.0","webpack":"^5.96.0","zip-webpack-plugin":"^4.0.1"},"devDependencies":{"@types/decompress":"^4.2.7","@types/node":"^20.16.10","terminal-link":"^3.0.0"}}');
22364
22380
 
22365
22381
  /***/ }),
22366
22382
 
@@ -22481,18 +22497,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22481
22497
  };
22482
22498
  Object.defineProperty(exports, "__esModule", ({ value: true }));
22483
22499
  exports["default"] = default_1;
22484
- const webpack_1 = __importDefault(__webpack_require__(6807));
22485
- const process_utils_1 = __webpack_require__(8251);
22486
- const validate_1 = __webpack_require__(2246);
22487
- const logging_1 = __webpack_require__(443);
22488
- const path_1 = __importDefault(__webpack_require__(6928));
22500
+ const assertic_1 = __webpack_require__(3205);
22489
22501
  const fsSync = __importStar(__webpack_require__(9896));
22490
22502
  const fs_1 = __webpack_require__(9896);
22503
+ const path_1 = __importDefault(__webpack_require__(6928));
22504
+ const webpack_1 = __importDefault(__webpack_require__(6807));
22491
22505
  const resolve_1 = __webpack_require__(412);
22492
- const resolve_2 = __webpack_require__(3878);
22493
22506
  const tsoa_utils_1 = __webpack_require__(1431);
22494
22507
  const packageJson = __importStar(__webpack_require__(8330));
22495
- const assertic_1 = __webpack_require__(3205);
22508
+ const logging_1 = __webpack_require__(443);
22509
+ const process_utils_1 = __webpack_require__(8251);
22510
+ const resolve_2 = __webpack_require__(3878);
22511
+ const validate_1 = __webpack_require__(2246);
22496
22512
  function isEnvVarFalsy(variableName) {
22497
22513
  const value = process.env[variableName];
22498
22514
  return !value || value.toLowerCase() === 'false' || value === '0';
@@ -23087,14 +23103,14 @@ var __importStar = (this && this.__importStar) || (function () {
23087
23103
  })();
23088
23104
  Object.defineProperty(exports, "__esModule", ({ value: true }));
23089
23105
  exports["default"] = default_1;
23090
- const environment_1 = __webpack_require__(722);
23091
- const process_utils_1 = __webpack_require__(8251);
23106
+ const assertic_1 = __webpack_require__(3205);
23092
23107
  const fs = __importStar(__webpack_require__(1943));
23093
- const http_1 = __webpack_require__(866);
23094
23108
  const communication_types_1 = __webpack_require__(3443);
23095
23109
  const console_app_utils_1 = __webpack_require__(7580);
23096
- const assertic_1 = __webpack_require__(3205);
23110
+ const http_1 = __webpack_require__(866);
23097
23111
  const shell_runner_1 = __webpack_require__(3089);
23112
+ const environment_1 = __webpack_require__(722);
23113
+ const process_utils_1 = __webpack_require__(8251);
23098
23114
  async function default_1(stage, appId, bundlePath, apiKey, verbose, direct, isUserSpecifiedPath, skipBuild, internalApiKey, environmentId) {
23099
23115
  if (!direct && !isUserSpecifiedPath && !skipBuild) {
23100
23116
  console.log('Building code bundle...');
@@ -24614,12 +24630,12 @@ module.exports = (__webpack_require__(9896).constants) || __webpack_require__(91
24614
24630
 
24615
24631
  Object.defineProperty(exports, "__esModule", ({ value: true }));
24616
24632
  exports["default"] = default_1;
24617
- const environment_1 = __webpack_require__(722);
24618
- const process_utils_1 = __webpack_require__(8251);
24619
- const http_1 = __webpack_require__(866);
24633
+ const assertic_1 = __webpack_require__(3205);
24620
24634
  const communication_types_1 = __webpack_require__(3443);
24621
24635
  const console_app_utils_1 = __webpack_require__(7580);
24622
- const assertic_1 = __webpack_require__(3205);
24636
+ const http_1 = __webpack_require__(866);
24637
+ const environment_1 = __webpack_require__(722);
24638
+ const process_utils_1 = __webpack_require__(8251);
24623
24639
  async function default_1(stage, appId, apiKey, environmentId) {
24624
24640
  const appIdWithEnvId = (0, communication_types_1.appIdWithEnvironmentId)(appId, environmentId);
24625
24641
  const regionPrefix = (0, console_app_utils_1.getConsoleAppRegionByStage)(stage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/cli",
3
- "version": "1.0.367",
3
+ "version": "1.0.369",
4
4
  "description": "The Squid CLI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "node": ">=18.0.0"
30
30
  },
31
31
  "dependencies": {
32
- "@squidcloud/local-backend": "^1.0.367",
32
+ "@squidcloud/local-backend": "^1.0.369",
33
33
  "copy-webpack-plugin": "^12.0.2",
34
34
  "decompress": "^4.2.1",
35
35
  "nodemon": "^3.1.3",