@hunt-labs/bytekit-sdk 0.11.5 → 0.11.6

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 CHANGED
@@ -10,6 +10,15 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.11.6] - 2026-09-24
14
+
15
+ ### Changed
16
+
17
+ - Regenerated `src/generated/api.d.ts` (#4865): a documentation-wording correction to the
18
+ `POST /v1/schema` billing description, which now says the page bandwidth is billed at its
19
+ upstream wire bytes with no endpoint factor instead of "exactly like `/v1/scrape`". No
20
+ behavior change: doc comments only, no SDK signature moves.
21
+
13
22
  ## [0.11.5] - 2026-09-22
14
23
 
15
24
  ### Changed
package/README.md CHANGED
@@ -358,7 +358,7 @@ try {
358
358
 
359
359
  Note that `details` is populated only from the API's canonical
360
360
  `{ error: { … } }` envelope. A few endpoints answer with a flat, vendor-masked
361
- body instead (`/v1/search` returns `502 {"error":"search_provider_error"}`);
361
+ body instead (`/v1/search` returns `503 {"error":"search_provider_error"}`);
362
362
  those carry no structured detail, so `err.details` stays `undefined` there —
363
363
  `err.code` is still the machine-readable reason.
364
364
 
package/dist/client.d.ts CHANGED
@@ -103,7 +103,7 @@ export declare class ByteKitError extends Error {
103
103
  * The envelope's `error.details`, when it carried one — `undefined` otherwise.
104
104
  *
105
105
  * Populated ONLY from the canonical `{ error: { … } }` envelope. A flat
106
- * vendor-masked body (`/v1/search` 502 `{"error":"search_provider_error"}`)
106
+ * vendor-masked body (`/v1/search` 503 `{"error":"search_provider_error"}`)
107
107
  * has no envelope to read a detail from, so it never grows one (#2685 E3).
108
108
  *
109
109
  * A `details` that is not a JSON object — which the untyped spec field
package/dist/client.js CHANGED
@@ -470,9 +470,9 @@ export class ByteKit {
470
470
  }
471
471
  }
472
472
  else if (typeof json.error === 'string' && json.error.length > 0) {
473
- // Flat vendor-masked shape, e.g. /v1/search 502
473
+ // Flat vendor-masked shape, e.g. /v1/search 503
474
474
  // {"error":"search_provider_error"} (docs/api/openapi.yaml §/v1/search
475
- // 502). The string IS the error code. `message` falls back to it only
475
+ // 503). The string IS the error code. `message` falls back to it only
476
476
  // when the response carried no statusText, so the thrown error is
477
477
  // never message-empty.
478
478
  code = json.error;
@@ -640,7 +640,8 @@ export interface paths {
640
640
  * `wait_for_selector`) cause a `400 unsupported_option`.
641
641
  *
642
642
  * Dual-axis billing: a fixed per-request credit charge **plus** the
643
- * underlying page's bandwidth, billed exactly like `/v1/scrape`. The
643
+ * underlying page's bandwidth, billed at its upstream wire bytes with no
644
+ * endpoint factor (a 100 KiB estimate is pre-charged, then reconciled). The
644
645
  * bandwidth is still billed when the scrape succeeds but extraction later
645
646
  * fails; both axes are refunded only when the scrape itself never runs.
646
647
  *
@@ -4175,35 +4176,20 @@ export interface operations {
4175
4176
  "application/json": components["schemas"]["Error"];
4176
4177
  };
4177
4178
  };
4178
- /**
4179
- * @description Content transform failed, or a non-2xx upstream response relayed as the unified
4180
- * Error envelope. On an upstream relay the HTTP status equals the upstream status
4181
- * (code `upstream_error`), so any 4xx/5xx the target returns surfaces here as an
4182
- * Error envelope rather than a raw body (#1462).
4183
- *
4184
- * **One divergence.** An upstream `502` is relayed at HTTP `503`, not `502` — see
4185
- * the `503` response below. A fetch service that cannot be reached also answers
4186
- * `503`, not `502` (#3373); this status no longer covers that condition.
4187
- */
4188
- 502: {
4189
- headers: {
4190
- [name: string]: unknown;
4191
- };
4192
- content: {
4193
- "application/json": components["schemas"]["Error"];
4194
- };
4195
- };
4196
4179
  /**
4197
4180
  * @description Two distinct conditions answer `503`, and they disagree about what the body's
4198
4181
  * `error.http_status` reports. Read `error.code` to tell them apart.
4199
4182
  *
4200
- * - **`upstream_error`** — the target returned HTTP `502`, relayed here as `503`.
4201
- * Cloudflare fronts this API and replaces a clean origin 502 with its own generic
4202
- * `text/plain` error page, discarding the envelope before it reaches you, while a
4203
- * 503 is passed through unchanged. The body's `error.http_status` still reports
4204
- * the **true upstream status**, `502` — not `503` — and is the only surviving
4205
- * record of what the target answered, so the body rather than the HTTP status is
4206
- * authoritative here (#3355).
4183
+ * - **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as
4184
+ * `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its
4185
+ * own generic `text/plain` error page, discarding the envelope before it reaches
4186
+ * you, while a 503 is passed through unchanged. The body's `error.http_status`
4187
+ * still reports the **true upstream status**, `502` or `504` — not `503` — and is
4188
+ * the only surviving record of what the target answered, so the body rather than
4189
+ * the HTTP status is authoritative here (#3355, #4891). Every other non-2xx
4190
+ * upstream response is relayed at its own HTTP status with the same
4191
+ * `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an
4192
+ * Error envelope rather than a raw body (#1462).
4207
4193
  * - **`internal_error`** (message `Fetch service unavailable.`) — no fetch service
4208
4194
  * endpoint could be resolved on this deployment, a fault of this API and not of the
4209
4195
  * target. There is no upstream status to preserve: the `503` is this API's own
@@ -4325,35 +4311,20 @@ export interface operations {
4325
4311
  "application/json": components["schemas"]["Error"];
4326
4312
  };
4327
4313
  };
4328
- /**
4329
- * @description Content transform failed, or a non-2xx upstream response relayed as the unified
4330
- * Error envelope. On an upstream relay the HTTP status equals the upstream status
4331
- * (code `upstream_error`), so any 4xx/5xx the target returns surfaces here as an
4332
- * Error envelope rather than a raw body (#1462).
4333
- *
4334
- * **One divergence.** An upstream `502` is relayed at HTTP `503`, not `502` — see
4335
- * the `503` response below. A fetch service that cannot be reached also answers
4336
- * `503`, not `502` (#3373); this status no longer covers that condition.
4337
- */
4338
- 502: {
4339
- headers: {
4340
- [name: string]: unknown;
4341
- };
4342
- content: {
4343
- "application/json": components["schemas"]["Error"];
4344
- };
4345
- };
4346
4314
  /**
4347
4315
  * @description Two distinct conditions answer `503`, and they disagree about what the body's
4348
4316
  * `error.http_status` reports. Read `error.code` to tell them apart.
4349
4317
  *
4350
- * - **`upstream_error`** — the target returned HTTP `502`, relayed here as `503`.
4351
- * Cloudflare fronts this API and replaces a clean origin 502 with its own generic
4352
- * `text/plain` error page, discarding the envelope before it reaches you, while a
4353
- * 503 is passed through unchanged. The body's `error.http_status` still reports
4354
- * the **true upstream status**, `502` — not `503` — and is the only surviving
4355
- * record of what the target answered, so the body rather than the HTTP status is
4356
- * authoritative here (#3355).
4318
+ * - **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as
4319
+ * `503`. Cloudflare fronts this API and replaces a clean origin 502 or 504 with its
4320
+ * own generic `text/plain` error page, discarding the envelope before it reaches
4321
+ * you, while a 503 is passed through unchanged. The body's `error.http_status`
4322
+ * still reports the **true upstream status**, `502` or `504` — not `503` — and is
4323
+ * the only surviving record of what the target answered, so the body rather than
4324
+ * the HTTP status is authoritative here (#3355, #4891). Every other non-2xx
4325
+ * upstream response is relayed at its own HTTP status with the same
4326
+ * `upstream_error` envelope, so any other 4xx/5xx the target returns surfaces as an
4327
+ * Error envelope rather than a raw body (#1462).
4357
4328
  * - **`internal_error`** (message `Fetch service unavailable.`) — no fetch service
4358
4329
  * endpoint could be resolved on this deployment, a fault of this API and not of the
4359
4330
  * target. There is no upstream status to preserve: the `503` is this API's own
@@ -5737,13 +5708,14 @@ export interface operations {
5737
5708
  };
5738
5709
  };
5739
5710
  /**
5740
- * @description Upstream search provider error. The body is a fixed,
5711
+ * @description Upstream search provider error, answered at `503` rather than `502` because
5712
+ * Cloudflare replaces an origin 502 body with its own page (#4891). The body is a fixed,
5741
5713
  * vendor-masked shape — deliberately NOT the unified `Error`
5742
5714
  * envelope. The upstream provider's identity and message are
5743
5715
  * never surfaced, so the response carries only the constant
5744
5716
  * `error` code `search_provider_error`.
5745
5717
  */
5746
- 502: {
5718
+ 503: {
5747
5719
  headers: {
5748
5720
  [name: string]: unknown;
5749
5721
  };
@@ -5903,16 +5875,15 @@ export interface operations {
5903
5875
  "application/json": components["schemas"]["Error"];
5904
5876
  };
5905
5877
  };
5906
- /** @description Underlying scrape failed (`scrape_failed`) or upstream provider error (`provider_error`). */
5907
- 502: {
5908
- headers: {
5909
- [name: string]: unknown;
5910
- };
5911
- content: {
5912
- "application/json": components["schemas"]["Error"];
5913
- };
5914
- };
5915
- /** @description Extraction provider unconfigured (`provider_unavailable`). */
5878
+ /**
5879
+ * @description Read `error.code` to tell the conditions apart: underlying scrape failed or the
5880
+ * extraction service was unreachable (`scrape_failed`), upstream provider error
5881
+ * (`provider_error`), extraction provider unconfigured (`provider_unavailable`), or
5882
+ * upstream provider timed out (`provider_timeout`). None of these answers `502` or
5883
+ * `504`: Cloudflare fronts this API and replaces an origin 502 or 504 with its own
5884
+ * `text/plain` page, discarding the error envelope, while a 503 passes through
5885
+ * unchanged (#4891).
5886
+ */
5916
5887
  503: {
5917
5888
  headers: {
5918
5889
  [name: string]: unknown;
@@ -5921,15 +5892,6 @@ export interface operations {
5921
5892
  "application/json": components["schemas"]["Error"];
5922
5893
  };
5923
5894
  };
5924
- /** @description Upstream provider timed out (`provider_timeout`). */
5925
- 504: {
5926
- headers: {
5927
- [name: string]: unknown;
5928
- };
5929
- content: {
5930
- "application/json": components["schemas"]["Error"];
5931
- };
5932
- };
5933
5895
  };
5934
5896
  };
5935
5897
  getUsage: {
@@ -6401,8 +6363,8 @@ export interface operations {
6401
6363
  "application/json": components["schemas"]["Error"];
6402
6364
  };
6403
6365
  };
6404
- /** @description Stripe error creating the Checkout session. */
6405
- 502: {
6366
+ /** @description Stripe error creating the Checkout session (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
6367
+ 503: {
6406
6368
  headers: {
6407
6369
  [name: string]: unknown;
6408
6370
  };
@@ -6473,8 +6435,8 @@ export interface operations {
6473
6435
  "application/json": components["schemas"]["Error"];
6474
6436
  };
6475
6437
  };
6476
- /** @description The Stripe subscription schedule could not be read. */
6477
- 502: {
6438
+ /** @description The Stripe subscription schedule could not be read (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
6439
+ 503: {
6478
6440
  headers: {
6479
6441
  [name: string]: unknown;
6480
6442
  };
@@ -6871,8 +6833,8 @@ export interface operations {
6871
6833
  "application/json": components["schemas"]["Error"];
6872
6834
  };
6873
6835
  };
6874
- /** @description Stripe API error. */
6875
- 502: {
6836
+ /** @description Stripe API error (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
6837
+ 503: {
6876
6838
  headers: {
6877
6839
  [name: string]: unknown;
6878
6840
  };
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * outbound request carries — see the emit site in `client.ts`. The header name is spelled
6
6
  * only there, so issue #2905's pre-merge gate 1 counts exactly one occurrence in `src/`.
7
7
  */
8
- export declare const SDK_VERSION = "0.11.5";
8
+ export declare const SDK_VERSION = "0.11.6";
package/dist/version.js CHANGED
@@ -9,4 +9,4 @@
9
9
  * outbound request carries — see the emit site in `client.ts`. The header name is spelled
10
10
  * only there, so issue #2905's pre-merge gate 1 counts exactly one occurrence in `src/`.
11
11
  */
12
- export const SDK_VERSION = '0.11.5';
12
+ export const SDK_VERSION = '0.11.6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-sdk",
3
- "version": "0.11.5",
3
+ "version": "0.11.6",
4
4
  "description": "Official TypeScript SDK for the ByteKit API",
5
5
  "license": "MIT",
6
6
  "type": "module",