@deckasoft/waify 0.4.3 → 0.4.4
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/dist/cli/index.js +26 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -887,8 +887,12 @@ var init_start = __esm({
|
|
|
887
887
|
}
|
|
888
888
|
});
|
|
889
889
|
|
|
890
|
+
// src/cli/env.ts
|
|
891
|
+
init_paths();
|
|
892
|
+
import { config as dotenvConfig } from "dotenv";
|
|
893
|
+
dotenvConfig({ path: envPath() });
|
|
894
|
+
|
|
890
895
|
// src/cli/index.ts
|
|
891
|
-
import "dotenv/config";
|
|
892
896
|
import { Command } from "commander";
|
|
893
897
|
|
|
894
898
|
// src/cli/commands/init.ts
|
|
@@ -1300,18 +1304,28 @@ var registerSetup = (program2) => {
|
|
|
1300
1304
|
{ encoding: "utf-8" }
|
|
1301
1305
|
);
|
|
1302
1306
|
console.warn("Starting WhatsApp engine...");
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
if (!startRes.ok && startRes.status !== 400) {
|
|
1312
|
-
throw new Error(
|
|
1313
|
-
`Failed to start session: ${startRes.status} ${startRes.statusText}`
|
|
1307
|
+
try {
|
|
1308
|
+
const startRes = await fetchWithTimeout(
|
|
1309
|
+
`${baseUrl}/api/sessions/${sessionId}/start`,
|
|
1310
|
+
{
|
|
1311
|
+
method: "POST",
|
|
1312
|
+
headers: { "X-API-Key": openwaApiKey }
|
|
1313
|
+
},
|
|
1314
|
+
6e4
|
|
1314
1315
|
);
|
|
1316
|
+
if (!startRes.ok && startRes.status !== 400) {
|
|
1317
|
+
throw new Error(
|
|
1318
|
+
`Failed to start session: ${startRes.status} ${startRes.statusText}`
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
} catch (err) {
|
|
1322
|
+
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
1323
|
+
console.warn(
|
|
1324
|
+
" (Engine start is taking longer than expected \u2014 Chromium may still be loading, continuing\u2026)"
|
|
1325
|
+
);
|
|
1326
|
+
} else {
|
|
1327
|
+
throw err;
|
|
1328
|
+
}
|
|
1315
1329
|
}
|
|
1316
1330
|
try {
|
|
1317
1331
|
const preStatusRes = await fetchWithTimeout(
|