ofsc-utility 1.0.41 → 1.0.43
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/utilities/index.js +1 -1
- package/package.json +1 -1
- package/readme.md +20 -1
package/dist/utilities/index.js
CHANGED
|
@@ -78,7 +78,7 @@ const fetchWithRetry = async (url, clientId, clientSecret, instanceUrl, token, r
|
|
|
78
78
|
res = await doFetch(token);
|
|
79
79
|
}
|
|
80
80
|
/* ---------- 429: retry with backoff ---------- */
|
|
81
|
-
if ((res.status === 429 || res.status ===
|
|
81
|
+
if ((res.status === 429 || res.status === 502 || res.status === 503 || res.status === 504) && retries > 0) {
|
|
82
82
|
const retryAfter = res.headers.get("Retry-After");
|
|
83
83
|
console.log("⚠️ 429 received. Retrying...", retryAfter);
|
|
84
84
|
const delay = retryAfter ? Number(retryAfter) * 1000 : baseDelay;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofsc-utility",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"description": "TypeScript helpers for Oracle Field Service Cloud (OFSC): events, resources, inventories, metadata and CSV/Excel utilities.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/readme.md
CHANGED
|
@@ -9,10 +9,29 @@ This package exposes grouped API helpers for common OFSC operations, including:
|
|
|
9
9
|
- inventory and activity records
|
|
10
10
|
- metadata file generation
|
|
11
11
|
|
|
12
|
+
### Built-in resilience for OFSC's server errors
|
|
13
|
+
|
|
14
|
+
OFSC's REST API sits behind Oracle's gateway infrastructure, which means calls can occasionally fail with transient errors that have nothing to do with your request — the gateway losing its connection to the backend, a brief service restart, or normal rate limiting under load. This package handles those cases automatically so your integration doesn't fail on a blip that would have succeeded a second later.
|
|
15
|
+
|
|
16
|
+
### Exponential backoff
|
|
17
|
+
|
|
18
|
+
Retries don't hammer the API at a fixed interval — each attempt waits longer than the last (starting at a small base delay and doubling each time), unless OFSC explicitly tells us how long to wait via Retry-After. This gives Oracle's backend room to recover instead of adding to the load that likely caused the error in the first place.
|
|
19
|
+
|
|
20
|
+
### Why this matters for OFSC specifically
|
|
21
|
+
|
|
22
|
+
OFSC's gateway is known to return 503s and connection resets during normal operation — not just outages — especially under sustained polling or bulk export workloads (events, activities, inventory).Handling these
|
|
23
|
+
transparently means:
|
|
24
|
+
|
|
25
|
+
- Scheduled jobs don't die on a single flaky response and require manual re-runs
|
|
26
|
+
- Token expiry mid-session is handled without the caller needing to track token lifetimes
|
|
27
|
+
- You get clear, real error messages (with the response body attached) for
|
|
28
|
+
genuine failures, instead of noisy retries on errors that were never going
|
|
29
|
+
to succeed
|
|
30
|
+
|
|
12
31
|
## Installation
|
|
13
32
|
|
|
14
33
|
```bash
|
|
15
|
-
npm install ofsc-utility
|
|
34
|
+
npm install ofsc-utility@latest
|
|
16
35
|
```
|
|
17
36
|
|
|
18
37
|
## Getting Started
|