@open-wa/wa-automate 4.45.2 → 4.46.2

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.
@@ -934,6 +934,11 @@ export declare class Client {
934
934
  * @returns
935
935
  */
936
936
  getLicenseType(): Promise<LicenseType | false>;
937
+ /**
938
+ * The EASY API uses this string to secure a subdomain on the openwa public tunnel service.
939
+ * @returns
940
+ */
941
+ getTunnelCode(): Promise<string>;
937
942
  /**
938
943
  * Get an array of chatIds with their respective last message's timestamp.
939
944
  *
@@ -2152,6 +2152,15 @@ class Client {
2152
2152
  return yield this.pup(() => WAPI.getLicenseType());
2153
2153
  });
2154
2154
  }
2155
+ /**
2156
+ * The EASY API uses this string to secure a subdomain on the openwa public tunnel service.
2157
+ * @returns
2158
+ */
2159
+ getTunnelCode() {
2160
+ return __awaiter(this, void 0, void 0, function* () {
2161
+ return yield this.pup(() => WAPI.getTunnelCode());
2162
+ });
2163
+ }
2155
2164
  /**
2156
2165
  * Get an array of chatIds with their respective last message's timestamp.
2157
2166
  *
package/dist/cli/index.js CHANGED
@@ -103,7 +103,7 @@ function start() {
103
103
  }
104
104
  try {
105
105
  const client = yield (0, index_1.create)(Object.assign({}, createConfig));
106
- (0, server_1.setupHttpServer)(cliConfig);
106
+ yield (0, server_1.setupHttpServer)(cliConfig);
107
107
  if (cliConfig.autoReject) {
108
108
  yield client.autoReject(cliConfig.onCall);
109
109
  }
@@ -199,7 +199,11 @@ function start() {
199
199
  });
200
200
  if (cliConfig.tunnel) {
201
201
  spinner.info(`\n• Setting up external tunnel`);
202
- const tunnel = yield (0, localtunnel_1.default)({ port: PORT });
202
+ const tunnel = yield (0, localtunnel_1.default)({
203
+ port: PORT,
204
+ host: "https://public.openwa.cloud",
205
+ subdomain: yield client.getTunnelCode()
206
+ });
203
207
  cliConfig.apiHost = cliConfig.tunnel = tunnel.url;
204
208
  spinner.succeed(`\n\t${(0, terminal_link_1.default)('External address', tunnel.url)}`);
205
209
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import http from 'node:http';
2
+ import http from 'http';
3
3
  import { Client } from '..';
4
4
  export declare const app: import("express-serve-static-core").Express;
5
5
  export declare let server: http.Server;
@@ -34,8 +34,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.setupSocketServer = exports.setupBotPressHandler = exports.setupChatwoot = exports.setupTwilioCompatibleWebhook = exports.setupMediaMiddleware = exports.listListeners = exports.getCommands = exports.setupRefocusDisengageMiddleware = exports.setupSwaggerStatsMiddleware = exports.setupApiDocs = exports.setupAuthenticationLayer = exports.enableCORSRequests = exports.setUpExpressApp = exports.setupHttpServer = exports.server = exports.app = void 0;
35
35
  //@ts-ignore
36
36
  const express_1 = __importDefault(require("express"));
37
- const node_https_1 = __importDefault(require("node:https"));
38
- const node_http_1 = __importDefault(require("node:http"));
37
+ const https_1 = __importDefault(require("https"));
38
+ const http_1 = __importDefault(require("http"));
39
39
  const collections_1 = require("./collections");
40
40
  const express_robots_txt_1 = __importDefault(require("express-robots-txt"));
41
41
  const swagger_ui_express_1 = __importDefault(require("swagger-ui-express"));
@@ -49,7 +49,7 @@ const chatwoot_1 = require("./integrations/chatwoot");
49
49
  const express_ipfilter_1 = require("express-ipfilter");
50
50
  const helmet_1 = __importDefault(require("helmet"));
51
51
  exports.app = (0, express_1.default)();
52
- exports.server = node_http_1.default.createServer(exports.app);
52
+ exports.server = http_1.default.createServer(exports.app);
53
53
  const trimChatId = (chatId) => chatId.replace("@c.us", "").replace("@g.us", "");
54
54
  const socketListenerCallbacks = {};
55
55
  // const existingListeners = () => Object.keys(Object.keys(socketListenerCallbacks).flatMap(id=>Object.keys(socketListenerCallbacks[id])).reduce((acc,curr)=>{acc[curr]=true;return acc},{}))
@@ -99,11 +99,11 @@ const setupHttpServer = (cliConfig) => {
99
99
  });
100
100
  if (privContents && certContents) {
101
101
  const options = { key: privContents, cert: certContents };
102
- exports.server = node_https_1.default.createServer(options, exports.app);
102
+ exports.server = https_1.default.createServer(options, exports.app);
103
103
  return;
104
104
  }
105
105
  }
106
- exports.server = node_http_1.default.createServer(exports.app);
106
+ exports.server = http_1.default.createServer(exports.app);
107
107
  };
108
108
  exports.setupHttpServer = setupHttpServer;
109
109
  const setUpExpressApp = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.45.2",
3
+ "version": "4.46.2",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",