@curviate/sdk 0.38.0 → 0.39.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 +28 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +4 -3
- package/package.json +1 -1
- package/src/generated/types.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,34 @@ Versioning: semantic. Minor for additive changes, patch for bug fixes; no stabil
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.39.0] - 2026-09-28
|
|
13
|
+
|
|
14
|
+
Fixture and types regenerated against the deployed production document
|
|
15
|
+
(`https://api.curviate.com`, 130 paths, server
|
|
16
|
+
`006f3739c93ff758085dc0ad13ae423bafab4631`).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **The retry decision now honours an explicit `retry_likely_to_succeed:
|
|
21
|
+
false`.** A GET on a retryable code (`INTERNAL`, `PLATFORM_ERROR`,
|
|
22
|
+
`PLATFORM_RATE_LIMIT`, `RATE_LIMIT_ACCOUNT`, `RATE_LIMIT_TENANT`) whose
|
|
23
|
+
envelope says `retry_likely_to_succeed: false` is no longer retried, with or
|
|
24
|
+
without a `retry_hint`. The server now sends `false` only as a verdict that
|
|
25
|
+
an unchanged retry fails the same way, and `true` for a failure whose cause
|
|
26
|
+
it cannot see, so this closes the half of the 0.37.1 fix that was deferred.
|
|
27
|
+
A response with no JSON envelope, or no such field, still retries on the
|
|
28
|
+
code table alone. Requires a server that includes the change; against an
|
|
29
|
+
older server, unexpected `INTERNAL` and `PLATFORM_ERROR` failures would stop
|
|
30
|
+
being retried.
|
|
31
|
+
- **`accounts.addSeats()` documents its new failure shapes.** A `502` means
|
|
32
|
+
the purchase failed after today's charge was taken; the charge was refunded
|
|
33
|
+
in full and the seat count was confirmed unchanged, so no seats were added
|
|
34
|
+
and it is safe to retry. A `503 STRIPE_DRIFT_DETECTED` means the seat price
|
|
35
|
+
is misconfigured on our side: nothing was charged, this is not something you
|
|
36
|
+
can fix, and retrying fails the same way until the price is corrected.
|
|
37
|
+
Contact support. Both are generated-type/description additions; no
|
|
38
|
+
resource-method shape changed.
|
|
39
|
+
|
|
12
40
|
## [0.38.0] - 2026-09-26
|
|
13
41
|
|
|
14
42
|
Fixture and types regenerated against the deployed production document
|
package/dist/index.d.ts
CHANGED
|
@@ -31778,7 +31778,16 @@ interface operations {
|
|
|
31778
31778
|
"application/json": components["schemas"]["Error"];
|
|
31779
31779
|
};
|
|
31780
31780
|
};
|
|
31781
|
-
/** @description The purchase
|
|
31781
|
+
/** @description The purchase failed after today's charge was taken; the charge was refunded in full and the seat count was confirmed unchanged, so no seats were added. Safe to retry. */
|
|
31782
|
+
502: {
|
|
31783
|
+
headers: {
|
|
31784
|
+
[name: string]: unknown;
|
|
31785
|
+
};
|
|
31786
|
+
content: {
|
|
31787
|
+
"application/json": components["schemas"]["Error"];
|
|
31788
|
+
};
|
|
31789
|
+
};
|
|
31790
|
+
/** @description The purchase could not be confirmed while another change was in progress (check the seat count before retrying), or the seat price is misconfigured on our side (nothing charged; contact support, retrying fails the same way). */
|
|
31782
31791
|
503: {
|
|
31783
31792
|
headers: {
|
|
31784
31793
|
[name: string]: unknown;
|
|
@@ -31956,7 +31965,7 @@ interface operations {
|
|
|
31956
31965
|
"application/json": components["schemas"]["Error"];
|
|
31957
31966
|
};
|
|
31958
31967
|
};
|
|
31959
|
-
/** @description Another change to this subscription is in progress
|
|
31968
|
+
/** @description Another change to this subscription is in progress (retry shortly), or the seat price is misconfigured on our side (nothing charged; contact support, retrying fails the same way). */
|
|
31960
31969
|
503: {
|
|
31961
31970
|
headers: {
|
|
31962
31971
|
[name: string]: unknown;
|
package/dist/index.js
CHANGED
|
@@ -300,7 +300,7 @@ async function errorFromResponse(res) {
|
|
|
300
300
|
}
|
|
301
301
|
const safetyHint = toSafetyHint(env?.hint);
|
|
302
302
|
const safetyReason = toSafetyReason(env?.reason);
|
|
303
|
-
|
|
303
|
+
const err = new CurviateError({
|
|
304
304
|
code: toErrorCode(env?.code),
|
|
305
305
|
message: env?.message ?? `Request failed with status ${res.status}.`,
|
|
306
306
|
httpStatus: res.status,
|
|
@@ -325,6 +325,7 @@ async function errorFromResponse(res) {
|
|
|
325
325
|
...safetyReason !== void 0 ? { safetyReason } : {},
|
|
326
326
|
...typeof env?.blocked === "boolean" ? { blocked: env.blocked } : {}
|
|
327
327
|
});
|
|
328
|
+
return { err, refusesRetry: env?.retry_likely_to_succeed === false };
|
|
328
329
|
}
|
|
329
330
|
function retryDelay(err, attempt, jitter) {
|
|
330
331
|
if (err.retryAfterMs !== void 0) return err.retryAfterMs;
|
|
@@ -405,9 +406,9 @@ async function execute(method, path, opts) {
|
|
|
405
406
|
if (res.ok) {
|
|
406
407
|
return parseSuccess(res);
|
|
407
408
|
}
|
|
408
|
-
const err = await errorFromResponse(res);
|
|
409
|
+
const { err, refusesRetry } = await errorFromResponse(res);
|
|
409
410
|
const namesBudgetRow = err.budgetRow !== void 0;
|
|
410
|
-
const neverRetry = err.retryHint?.kind === "never";
|
|
411
|
+
const neverRetry = err.retryHint?.kind === "never" || refusesRetry;
|
|
411
412
|
const retryable = !isWrite && !namesBudgetRow && !neverRetry && RETRYABLE_CODES.has(err.code) && attempt < opts.maxRetries;
|
|
412
413
|
if (retryable) {
|
|
413
414
|
await sleep(retryDelay(err, attempt + 1, jitterFn()));
|
package/package.json
CHANGED
package/src/generated/types.ts
CHANGED
|
@@ -31682,7 +31682,16 @@ export interface operations {
|
|
|
31682
31682
|
"application/json": components["schemas"]["Error"];
|
|
31683
31683
|
};
|
|
31684
31684
|
};
|
|
31685
|
-
/** @description The purchase
|
|
31685
|
+
/** @description The purchase failed after today's charge was taken; the charge was refunded in full and the seat count was confirmed unchanged, so no seats were added. Safe to retry. */
|
|
31686
|
+
502: {
|
|
31687
|
+
headers: {
|
|
31688
|
+
[name: string]: unknown;
|
|
31689
|
+
};
|
|
31690
|
+
content: {
|
|
31691
|
+
"application/json": components["schemas"]["Error"];
|
|
31692
|
+
};
|
|
31693
|
+
};
|
|
31694
|
+
/** @description The purchase could not be confirmed while another change was in progress (check the seat count before retrying), or the seat price is misconfigured on our side (nothing charged; contact support, retrying fails the same way). */
|
|
31686
31695
|
503: {
|
|
31687
31696
|
headers: {
|
|
31688
31697
|
[name: string]: unknown;
|
|
@@ -31860,7 +31869,7 @@ export interface operations {
|
|
|
31860
31869
|
"application/json": components["schemas"]["Error"];
|
|
31861
31870
|
};
|
|
31862
31871
|
};
|
|
31863
|
-
/** @description Another change to this subscription is in progress
|
|
31872
|
+
/** @description Another change to this subscription is in progress (retry shortly), or the seat price is misconfigured on our side (nothing charged; contact support, retrying fails the same way). */
|
|
31864
31873
|
503: {
|
|
31865
31874
|
headers: {
|
|
31866
31875
|
[name: string]: unknown;
|