orangeslice 1.7.13 → 1.7.14
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/api.js +11 -14
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.post = post;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
url.search = "";
|
|
15
|
-
return url.toString();
|
|
16
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* Runtime routing (hardcoded on purpose):
|
|
6
|
+
* - Non-direct calls -> Railway batch-service /function
|
|
7
|
+
* - Direct calls -> orangeslice.ai /api/function
|
|
8
|
+
* - Inngest polling -> batch-service (configured there)
|
|
9
|
+
*/
|
|
10
|
+
const BASE_URL = "https://enrichly-production.up.railway.app/function";
|
|
11
|
+
const DIRECT_BASE_URL = "https://orangeslice.ai/api/function";
|
|
12
|
+
const POLL_TIMEOUT_MS = 120000;
|
|
13
|
+
const DEFAULT_POLL_INTERVAL_MS = 1000;
|
|
17
14
|
function sleep(ms) {
|
|
18
15
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
19
16
|
}
|
|
@@ -85,7 +82,7 @@ async function post(functionId, payload, options = {}) {
|
|
|
85
82
|
const res = await fetchWithRedirect(url, {
|
|
86
83
|
method: "POST",
|
|
87
84
|
headers: { "Content-Type": "application/json" },
|
|
88
|
-
body
|
|
85
|
+
body,
|
|
89
86
|
});
|
|
90
87
|
if (!res.ok) {
|
|
91
88
|
let message = `${res.status}`;
|