@proxyrequest/sdk 1.0.0 → 2.0.0
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/CHANGELOG.md +24 -0
- package/README.md +42 -8
- package/SECURITY.md +1 -1
- package/dist/index.cjs +631 -257
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +218 -59
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +218 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +632 -256
- package/dist/index.js.map +1 -1
- package/dist/{models-VMmyyuf_.d.cts → models-BDeknFzS.d.cts} +12 -9
- package/dist/models-BDeknFzS.d.cts.map +1 -0
- package/dist/{models-ECy_bhdn.d.ts → models-CNN_LuGV.d.ts} +12 -9
- package/dist/models-CNN_LuGV.d.ts.map +1 -0
- package/dist/models.d.cts +2 -2
- package/dist/models.d.ts +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.ts +1 -1
- package/dist/{schema-CvCxeox5.d.cts → schema-BNl4txEF.d.cts} +757 -402
- package/dist/schema-BNl4txEF.d.cts.map +1 -0
- package/dist/{schema-CvCxeox5.d.ts → schema-BNl4txEF.d.ts} +757 -402
- package/dist/schema-BNl4txEF.d.ts.map +1 -0
- package/docs/SDK-AUDIT.md +273 -0
- package/docs/backend-compatibility.md +66 -0
- package/docs/errors-and-pagination.md +1 -1
- package/docs/getting-started.md +1 -2
- package/docs/releasing.md +13 -3
- package/docs/reseller-workflow.md +1 -1
- package/docs/webhooks.md +4 -7
- package/package.json +3 -2
- package/dist/models-ECy_bhdn.d.ts.map +0 -1
- package/dist/models-VMmyyuf_.d.cts.map +0 -1
- package/dist/schema-CvCxeox5.d.cts.map +0 -1
- package/dist/schema-CvCxeox5.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [2.0.0] - 2026-09-16
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Replace the incorrect webhook verifier with the actual `X-Signature`
|
|
12
|
+
Base64 HMAC-SHA256 format over exact raw bytes.
|
|
13
|
+
|
|
14
|
+
- Regenerated from the public backend contract (81 operations, 130 schemas).
|
|
15
|
+
- Added the optional `pending`/`paid` status to invoice creation requests.
|
|
16
|
+
- Removed the disabled sessions-management resource; 79 supported operations remain.
|
|
17
|
+
- Corrected OTP login unions, MFA request bodies, payment fields, nullable invoices,
|
|
18
|
+
and configuration-dependent user/invoice responses.
|
|
19
|
+
- Replaced fixed contract-size gates with operation-ID and coverage validation.
|
|
20
|
+
- Added backend-serializer fixtures and compatibility regression tests.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Automatic and explicit idempotency keys with bounded ambiguous-outcome retries.
|
|
25
|
+
- Response metadata variants and explicit ETag/`If-Match` optimistic concurrency support.
|
|
26
|
+
|
|
5
27
|
## [1.0.0] - 2026-08-21
|
|
6
28
|
|
|
7
29
|
### Added
|
|
@@ -13,4 +35,6 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
13
35
|
- Normalized errors, lazy pagination, invoice downloads, raw requests, and webhook verification.
|
|
14
36
|
- Reproducible OpenAPI generation, package validation, Node/browser tests, CI, and npm provenance workflow.
|
|
15
37
|
|
|
38
|
+
[Unreleased]: https://github.com/proxyrequest/javascript-sdk/compare/v2.0.0...HEAD
|
|
39
|
+
[2.0.0]: https://github.com/proxyrequest/javascript-sdk/compare/v1.0.0...v2.0.0
|
|
16
40
|
[1.0.0]: https://github.com/proxyrequest/javascript-sdk/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ The official TypeScript SDK for the [ProxyRequest public API](https://proxyreque
|
|
|
14
14
|
- customer and sub-user accounts;
|
|
15
15
|
- packages, traffic allocations, connection limits, and proxy credentials;
|
|
16
16
|
- invoices, payment links, coupons, rewards, and reseller workflows;
|
|
17
|
-
- residential and static ISP proxy inventory, targeting, routing, and
|
|
17
|
+
- residential and static ISP proxy inventory, targeting, routing, and sticky proxy credentials;
|
|
18
18
|
- usage accounting, analytics, operational visibility, and webhooks;
|
|
19
19
|
- dashboard, branding, API automation, and Telegram integration.
|
|
20
20
|
|
|
@@ -80,11 +80,17 @@ Public login, signup, locations, and similar calls can use an anonymous client:
|
|
|
80
80
|
const client = ProxyRequestClient.anonymous();
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
Never embed a Static API key
|
|
83
|
+
Never embed a Static API key or webhook secret in frontend JavaScript. Browser support is intended for anonymous or appropriately scoped end-user token flows. See the service documentation on [authentication and API fundamentals](https://proxyrequest.com/docs/integration/api-fundamentals/).
|
|
84
84
|
|
|
85
85
|
## Resource API
|
|
86
86
|
|
|
87
|
-
The client exposes
|
|
87
|
+
The client exposes 79 supported operations through 17 resource groups. The pinned
|
|
88
|
+
public schema contains 81 operations; the disabled `sessions_list` and
|
|
89
|
+
`sessions_destroy` operations are intentionally excluded from the SDK. Sticky
|
|
90
|
+
session options in proxy generation remain supported.
|
|
91
|
+
|
|
92
|
+
See [backend compatibility and MFA](docs/backend-compatibility.md) for the updated
|
|
93
|
+
login flow, variable response models, and migration notes.
|
|
88
94
|
|
|
89
95
|
```ts
|
|
90
96
|
client.apiKeys;
|
|
@@ -100,10 +106,8 @@ client.packages;
|
|
|
100
106
|
client.profile;
|
|
101
107
|
client.proxies;
|
|
102
108
|
client.rewards;
|
|
103
|
-
client.sessions;
|
|
104
109
|
client.settings;
|
|
105
110
|
client.telegram;
|
|
106
|
-
client.telegramService;
|
|
107
111
|
client.users;
|
|
108
112
|
client.webhooks;
|
|
109
113
|
```
|
|
@@ -173,6 +177,36 @@ console.log(generated.proxies);
|
|
|
173
177
|
|
|
174
178
|
See [catalog and proxies](https://proxyrequest.com/docs/integration/catalog-and-proxies/) and the separate [proxy connection documentation](https://proxyrequest.com/docs/proxy/authentication/).
|
|
175
179
|
|
|
180
|
+
## Automatic retries and optimistic concurrency
|
|
181
|
+
|
|
182
|
+
The SDK automatically protects supported writes during up to three total
|
|
183
|
+
attempts after a network failure, or after `409 Conflict` with a numeric
|
|
184
|
+
`Retry-After` of at most five seconds. Other HTTP errors are returned
|
|
185
|
+
immediately. This protection applies inside one running call. If the process
|
|
186
|
+
stops before saving the result, inspect the affected resource before submitting
|
|
187
|
+
another write:
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
const response = await client.invoices.createWithResponse({
|
|
191
|
+
body: { gateway: "stripe", package_id: packageId },
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
console.log(response.data.id, response.etag);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Every generated method also has a `WithResponse` variant exposing `statusCode`,
|
|
198
|
+
`headers`, and `etag`.
|
|
199
|
+
|
|
200
|
+
Updates and deletes that declare `If-Match` accept the latest strong ETag:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
await client.users.update({ id: userId, ifMatch: response.etag, body: changes });
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
A stale value raises `ApiError` with `kind === "precondition"` and the current
|
|
207
|
+
server ETag in `currentEtag`. The SDK deliberately does not cache ETags: callers
|
|
208
|
+
choose which representation is being updated.
|
|
209
|
+
|
|
176
210
|
## Pagination
|
|
177
211
|
|
|
178
212
|
List methods return the API page model. Use `client.paginate()` when you want a lazy async stream:
|
|
@@ -205,7 +239,7 @@ try {
|
|
|
205
239
|
}
|
|
206
240
|
```
|
|
207
241
|
|
|
208
|
-
Kinds include `validation`, `authentication`, `permission`, `not_found`, `conflict`, `rate_limit`, `server`, `network`, and `unexpected`.
|
|
242
|
+
Kinds include `validation`, `authentication`, `permission`, `not_found`, `conflict`, `precondition`, `rate_limit`, `server`, `network`, and `unexpected`. Supported writes receive bounded automatic retries for transient failures; tokens are never refreshed automatically. See [common integration errors](https://proxyrequest.com/docs/integration/common-errors/).
|
|
209
243
|
|
|
210
244
|
## Per-request controls and custom Fetch
|
|
211
245
|
|
|
@@ -253,12 +287,12 @@ import { WebhookVerifier } from "@proxyrequest/sdk";
|
|
|
253
287
|
|
|
254
288
|
const event = await WebhookVerifier.decodeVerifiedJson(
|
|
255
289
|
rawBody,
|
|
256
|
-
request.headers.get("
|
|
290
|
+
request.headers.get("X-Signature") ?? "",
|
|
257
291
|
process.env.PROXYREQUEST_WEBHOOK_SECRET!,
|
|
258
292
|
);
|
|
259
293
|
```
|
|
260
294
|
|
|
261
|
-
|
|
295
|
+
Deliveries use standard padded Base64 HMAC-SHA256 over the raw body, without a signed timestamp. Verification accepts only this current format. It authenticates the body, but does not prevent replay: deduplicate usage events in your application. These helpers require SDK 2.0.0 or newer; version 1.0.0 does not support the current delivery format. See the [webhook integration guide](https://proxyrequest.com/docs/integration/webhooks/) and [event reference](https://proxyrequest.com/docs/reference/webhook-events/).
|
|
262
296
|
|
|
263
297
|
## Raw requests
|
|
264
298
|
|
package/SECURITY.md
CHANGED
|
@@ -10,4 +10,4 @@ Do not open a public issue for a vulnerability. Email `support@proxyrequest.com`
|
|
|
10
10
|
|
|
11
11
|
## Credential handling
|
|
12
12
|
|
|
13
|
-
Static API keys
|
|
13
|
+
Static API keys and webhook secrets belong only in trusted server environments. Rotate any credential that may have been exposed and remove it from Git history and build artifacts. Bearer tokens used in browsers should be short-lived and scoped according to the ProxyRequest API documentation.
|