@mountainpass/addressr-core 0.5.0 → 0.6.1

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/README.md +13 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -52,6 +52,7 @@ const segments = parseHighlight('<em>1</em> <em>GEORGE</em> ST');
52
52
  | `apiKey` | `string` | -- | RapidAPI key. Omit for direct API access. |
53
53
  | `apiUrl` | `string` | `"https://addressr.p.rapidapi.com/"` | API root URL |
54
54
  | `apiHost` | `string` | `"addressr.p.rapidapi.com"` | RapidAPI host header |
55
+ | `retry` | `RetryOptions \| false` | `{ maxRetries: 2, baseDelayMs: 500, maxDelayMs: 5000 }` | Retry config, or `false` to disable |
55
56
  | `fetchImpl` | `typeof fetch` | `globalThis.fetch` | Custom fetch (for testing) |
56
57
 
57
58
  Returns an `AddressrClient` with:
@@ -71,6 +72,18 @@ Returns an `AddressrClient` with:
71
72
  }
72
73
  ```
73
74
 
75
+ ### `RetryOptions`
76
+
77
+ ```ts
78
+ {
79
+ maxRetries?: number; // Default: 2
80
+ baseDelayMs?: number; // Default: 500 — exponential backoff base
81
+ maxDelayMs?: number; // Default: 5000 — backoff cap
82
+ }
83
+ ```
84
+
85
+ Failed requests are retried with exponential backoff and jitter. Only network errors and 5xx responses are retried -- 4xx errors fail immediately. Pass `retry: false` to disable.
86
+
74
87
  ### `parseHighlight(html)`
75
88
 
76
89
  Safely parses Elasticsearch `<em>` highlight tags into segments. No innerHTML, no XSS.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mountainpass/addressr-core",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Framework-agnostic HATEOAS client and types for Australian address search via Addressr",
5
5
  "author": {
6
6
  "name": "Mountain Pass",