@hunt-labs/bytekit-sdk 0.9.2 → 0.9.3

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,23 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.9.3] - 2026-09-04
14
+
15
+ ### Changed
16
+
17
+ - Regenerated `src/generated/api.d.ts` against the corrected queued-scrape `status_url`
18
+ documentation (#3925). `status_url` is a root-relative path, never an absolute URI: join it
19
+ onto the API base URL you called (`https://api.bytekit.com`, no trailing slash) to get the URL
20
+ to poll. The spec had declared it `format: uri` with an absolute example, which no server has
21
+ ever emitted; the emitted value is unchanged, so no client behaviour moves.
22
+ - Regenerated `src/generated/api.d.ts` against the documented proxy-tier response headers
23
+ (#3926). `X-Scrape-Proxy-Tier-Label` now documents that it reports the tier that ACTUALLY
24
+ served a scrape — after any escalation, never the tier first attempted — that it is
25
+ diagnostic only, and that it is omitted on a cache hit, which replayed stored bytes and ran
26
+ no tier. The deprecated numeric `X-Scrape-Proxy-Tier` documents the legacy `1` datacenter /
27
+ `2` residential / `3` mobile vocabulary and its omission for the lean-browser tier. Types are
28
+ unchanged; only the documentation on them moved.
29
+
13
30
  ## [0.9.2] - 2026-09-03
14
31
 
15
32
  ### Changed
@@ -816,11 +816,19 @@ export interface paths {
816
816
  path?: never;
817
817
  cookie?: never;
818
818
  };
819
- get?: never;
819
+ /**
820
+ * Read a scheduled plan change
821
+ * @description The plan change booked for the end of the current period, if any, reconstructed from the Stripe subscription schedule on each call. Both fields are null when nothing is booked, including while the schedule stays attached for one further interval after a change has already landed.
822
+ */
823
+ get: operations["getPlanChange"];
820
824
  put?: never;
821
825
  /** Change subscription plan */
822
826
  post: operations["changePlan"];
823
- delete?: never;
827
+ /**
828
+ * Revoke a scheduled plan change
829
+ * @description Cancels a plan change booked for the end of the current period. The subscription simply renews on the plan it is already on.
830
+ */
831
+ delete: operations["revokePlanChange"];
824
832
  options?: never;
825
833
  head?: never;
826
834
  patch?: never;
@@ -1343,13 +1351,13 @@ export interface components {
1343
1351
  name: string;
1344
1352
  /**
1345
1353
  * @description Monthly subscription price in cents.
1346
- * @example 49900
1354
+ * @example 34900
1347
1355
  */
1348
1356
  price_cents: number;
1349
1357
  /**
1350
1358
  * Format: int64
1351
- * @description Included bandwidth per period, in bytes (binary GiB).
1352
- * @example 100000000000
1359
+ * @description Included bandwidth per period, in bytes (decimal GB = 1,000,000,000 bytes).
1360
+ * @example 125000000000
1353
1361
  */
1354
1362
  included_bytes: number;
1355
1363
  /**
@@ -1359,7 +1367,7 @@ export interface components {
1359
1367
  included_credits: number;
1360
1368
  /**
1361
1369
  * @description Bandwidth top-up price per MB, in cents.
1362
- * @example 0.25
1370
+ * @example 0.2
1363
1371
  */
1364
1372
  topup_price_per_mb_cents: number;
1365
1373
  /**
@@ -1872,7 +1880,7 @@ export interface components {
1872
1880
  * "status": "queued",
1873
1881
  * "id": "sc_01j9abc123",
1874
1882
  * "url": "https://example.com",
1875
- * "status_url": "https://api.bytekit.com/v1/scrape/sc_01j9abc123",
1883
+ * "status_url": "/v1/scrape/sc_01j9abc123",
1876
1884
  * "queued_at": "2025-01-15T12:00:00Z",
1877
1885
  * "events": []
1878
1886
  * }
@@ -1892,7 +1900,7 @@ export interface components {
1892
1900
  id: string;
1893
1901
  /** Format: uri */
1894
1902
  url: string;
1895
- /** Format: uri */
1903
+ /** @description Root-relative path to poll for this job's terminal envelope — not an absolute URI. Join it onto the base URL of the server you called (see `servers`; they carry no trailing slash) to get the pollable URL, e.g. `https://api.bytekit.com` + `/v1/scrape/sc_01j9abc123`. */
1896
1904
  status_url: string;
1897
1905
  /** Format: date-time */
1898
1906
  queued_at: string;
@@ -2227,7 +2235,7 @@ export interface components {
2227
2235
  consecutive_failures: number;
2228
2236
  /** @description Error code from the most recent failed capture, if any. */
2229
2237
  last_error_code: string | null;
2230
- /** @description Reason the monitor was auto-suspended (e.g. "auto_suspended_consecutive_failures"), if applicable. */
2238
+ /** @description Reason the monitor was auto-suspended, if applicable. `insufficient_balance` means the account ran out of spendable balance; `auto_suspended_consecutive_failures` means the monitor failed too many times in a row. Either way the monitor stops capturing until it is reactivated by sending `status: "active"` to `PATCH /v1/monitors/{id}`. */
2231
2239
  suspension_reason: string | null;
2232
2240
  metadata: Record<string, never> | null;
2233
2241
  /** Format: date-time */
@@ -2616,7 +2624,7 @@ export interface components {
2616
2624
  purchased_topup_bytes: number;
2617
2625
  /** @description Bytes remaining in starter-grant lots, after active refund reservations. Purchased top-up bytes are excluded. */
2618
2626
  granted_topup_bytes: number;
2619
- /** @description Unspent subscription allowance carried over from earlier billing periods: bytes remaining in allowance lots granted before the current period started, after active refund reservations. Carried value is spent before the current period's allowance, so this falls to `0` before `limit_bytes` reaches the current allowance alone. */
2627
+ /** @description Unspent subscription allowance carried over from earlier billing periods: bytes remaining in allowance lots granted before the current period started, after active refund reservations. While your plan tier is unchanged, earlier lots are drawn first, so carried-over allowance is spent before the current period's; after an upgrade, allowance acquired at the higher tier is drawn first. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then purchased top-ups, then the one-time starter grant. */
2620
2628
  rollover_bytes: number;
2621
2629
  };
2622
2630
  CreditBalance: {
@@ -3198,7 +3206,7 @@ export interface operations {
3198
3206
  "X-Screenshot-Status"?: string;
3199
3207
  /** @description The originally requested URL. */
3200
3208
  "X-Screenshot-URL"?: string;
3201
- /** @description Credits charged for this screenshot. */
3209
+ /** @description Legacy credit weight for this capture (1, 2 or 4, doubling for `full_page` and again for retina/mobile). It is recorded for reporting only — screenshots are billed on bandwidth, not credits: the charge is the Phase 1 wire bytes x 1.5, and zero when Phase 1 is skipped or fails. */
3202
3210
  "X-Screenshot-Credits-Charged"?: number;
3203
3211
  /** @description Handler elapsed time in milliseconds. */
3204
3212
  "X-Screenshot-Duration-Ms"?: number;
@@ -3239,7 +3247,7 @@ export interface operations {
3239
3247
  "X-Screenshot-Status"?: string;
3240
3248
  /** @description The originally requested URL. */
3241
3249
  "X-Screenshot-URL"?: string;
3242
- /** @description Credits charged for this screenshot. */
3250
+ /** @description Legacy credit weight for this capture (1, 2 or 4, doubling for `full_page` and again for retina/mobile). It is recorded for reporting only — screenshots are billed on bandwidth, not credits: the charge is the Phase 1 wire bytes x 1.5, and zero when Phase 1 is skipped or fails. */
3243
3251
  "X-Screenshot-Credits-Charged"?: number;
3244
3252
  /** @description Handler elapsed time in milliseconds. */
3245
3253
  "X-Screenshot-Duration-Ms"?: number;
@@ -3466,9 +3474,9 @@ export interface operations {
3466
3474
  "X-Scrape-Markdown-URL"?: string;
3467
3475
  /** @description Byte length of the markdown artifact. Present only on fast-path responses when formats includes markdown. */
3468
3476
  "X-Scrape-Markdown-Length"?: number;
3469
- /** @description Numeric proxy tier used (diagnostic). Deprecated — use X-Scrape-Proxy-Tier-Label. */
3477
+ /** @description Legacy numeric form of the tier that served: 1 datacenter, 2 residential, 3 mobile. Omitted for the lean-browser tier, which has no numeric form. Deprecated — use X-Scrape-Proxy-Tier-Label. */
3470
3478
  "X-Scrape-Proxy-Tier"?: number;
3471
- /** @description Human-readable proxy tier label (e.g. residential, datacenter). Present on fast-path responses. */
3479
+ /** @description The proxy tier that actually served this request's fetch, after any escalation — never the tier first attempted. One of datacenter, residential, mobile, lean. Diagnostic only: it is never an input to routing, billing, caching or escalation. Present on sync fast-path responses. Omitted on a cache hit, which replayed stored bytes and ran no tier, and on responses the fast path did not serve. */
3472
3480
  "X-Scrape-Proxy-Tier-Label"?: string;
3473
3481
  /** @description WAF vendor detected on the target, if any (diagnostic). May be "suspected" when a low-confidence fail-open block marker was served. Omitted when no WAF is detected. */
3474
3482
  "X-Scrape-Waf"?: string;
@@ -5621,11 +5629,11 @@ export interface operations {
5621
5629
  bytes_bulk: number;
5622
5630
  bytes_scrape: number;
5623
5631
  bytes_monitor: number;
5624
- /** @description The spendable byte budget for this period, summed over the account's value lots: the allowance granted for the current period, plus unspent allowance carried over from earlier periods, plus purchased top-up and starter-grant bytes. Carried-over value is spent first, so this figure falls as it is consumed. */
5632
+ /** @description The spendable byte budget for this period, summed over the account's value lots: the allowance granted for the current period, plus unspent allowance carried over from earlier periods, plus purchased top-up and starter-grant bytes. The figure falls as those lots are consumed. */
5625
5633
  bytes_limit: number;
5626
5634
  /** @description Bytes still available across every active lot, after active refund reservations. */
5627
5635
  bytes_remaining: number;
5628
- /** @description Unspent allowance carried over from earlier billing periods. */
5636
+ /** @description Unspent allowance carried over from earlier billing periods. Value is spent in one order: your plan's included allowance, including any rollover from earlier periods, then purchased top-ups, then the one-time starter grant. */
5629
5637
  rollover_bytes: number;
5630
5638
  /** @description Bytes remaining in purchased top-up and starter-grant lots. Subscription allowance is excluded. */
5631
5639
  topup_bytes: number;
@@ -5978,10 +5986,10 @@ export interface operations {
5978
5986
  content: {
5979
5987
  "application/json": {
5980
5988
  /**
5981
- * @description Bytes to purchase. Allowed tiers — 5, 25, 50, 75, 100 GB.
5989
+ * @description Bytes to purchase. Allowed tiers — 5, 25, 50, 75, 100 GB (1 GB = 1,000,000,000 bytes).
5982
5990
  * @enum {integer}
5983
5991
  */
5984
- bytes: 5368709120 | 26843545600 | 53687091200 | 80530636800 | 107374182400;
5992
+ bytes: 5000000000 | 25000000000 | 50000000000 | 75000000000 | 100000000000;
5985
5993
  /**
5986
5994
  * Format: uri
5987
5995
  * @description Redirect target after a completed Checkout.
@@ -6135,6 +6143,52 @@ export interface operations {
6135
6143
  };
6136
6144
  };
6137
6145
  };
6146
+ getPlanChange: {
6147
+ parameters: {
6148
+ query?: never;
6149
+ header?: never;
6150
+ path?: never;
6151
+ cookie?: never;
6152
+ };
6153
+ requestBody?: never;
6154
+ responses: {
6155
+ /** @description Successful response. */
6156
+ 200: {
6157
+ headers: {
6158
+ [name: string]: unknown;
6159
+ };
6160
+ content: {
6161
+ "application/json": {
6162
+ /** @description The plan the subscription switches to, or null. */
6163
+ pending_plan_slug: string | null;
6164
+ /**
6165
+ * Format: date-time
6166
+ * @description When the booked change lands, or null.
6167
+ */
6168
+ pending_effective_at: string | null;
6169
+ };
6170
+ };
6171
+ };
6172
+ /** @description No subscription. */
6173
+ 400: {
6174
+ headers: {
6175
+ [name: string]: unknown;
6176
+ };
6177
+ content: {
6178
+ "application/json": components["schemas"]["Error"];
6179
+ };
6180
+ };
6181
+ /** @description The Stripe subscription schedule could not be read. */
6182
+ 502: {
6183
+ headers: {
6184
+ [name: string]: unknown;
6185
+ };
6186
+ content: {
6187
+ "application/json": components["schemas"]["Error"];
6188
+ };
6189
+ };
6190
+ };
6191
+ };
6138
6192
  changePlan: {
6139
6193
  parameters: {
6140
6194
  query?: never;
@@ -6151,13 +6205,28 @@ export interface operations {
6151
6205
  };
6152
6206
  };
6153
6207
  responses: {
6154
- /** @description Successful response. */
6208
+ /** @description Upgrades apply immediately (`changed: true`). Downgrades are booked for the end of the paid period (`changed: false`, `pending: true`) so the customer keeps the allowance they already paid for and nothing is prorated. */
6155
6209
  200: {
6156
6210
  headers: {
6157
6211
  [name: string]: unknown;
6158
6212
  };
6159
6213
  content: {
6160
- "application/json": Record<string, never>;
6214
+ "application/json": {
6215
+ /** @description Whether the subscription was re-priced now. */
6216
+ changed: boolean;
6217
+ /** @description Present and true when the change is booked for a later date. */
6218
+ pending?: boolean;
6219
+ previous_plan: string;
6220
+ new_plan: string;
6221
+ subscription_id: string;
6222
+ /**
6223
+ * Format: date-time
6224
+ * @description When a booked change lands. Absent on an immediate change.
6225
+ */
6226
+ effective_at?: string;
6227
+ /** @description Stripe proration behaviour applied. Absent on a booked change. */
6228
+ proration?: string;
6229
+ };
6161
6230
  };
6162
6231
  };
6163
6232
  /** @description No subscription, same plan, or invalid plan. */
@@ -6171,6 +6240,40 @@ export interface operations {
6171
6240
  };
6172
6241
  };
6173
6242
  };
6243
+ revokePlanChange: {
6244
+ parameters: {
6245
+ query?: never;
6246
+ header?: never;
6247
+ path?: never;
6248
+ cookie?: never;
6249
+ };
6250
+ requestBody?: never;
6251
+ responses: {
6252
+ /** @description Successful response. */
6253
+ 200: {
6254
+ headers: {
6255
+ [name: string]: unknown;
6256
+ };
6257
+ content: {
6258
+ "application/json": {
6259
+ revoked: boolean;
6260
+ /** @description The plan the subscription stays on. */
6261
+ plan: string;
6262
+ subscription_id: string;
6263
+ };
6264
+ };
6265
+ };
6266
+ /** @description No subscription, or no scheduled plan change to revoke. */
6267
+ 400: {
6268
+ headers: {
6269
+ [name: string]: unknown;
6270
+ };
6271
+ content: {
6272
+ "application/json": components["schemas"]["Error"];
6273
+ };
6274
+ };
6275
+ };
6276
+ };
6174
6277
  listInvoices: {
6175
6278
  parameters: {
6176
6279
  query?: {
@@ -6272,13 +6375,13 @@ export interface operations {
6272
6375
  content: {
6273
6376
  "application/json": {
6274
6377
  enabled: boolean;
6275
- /** @description Min 1 MB. Required when enabled. */
6378
+ /** @description Min 1 MB (1,000,000 bytes). Required when enabled. */
6276
6379
  threshold_bytes?: number;
6277
6380
  /**
6278
- * @description Allowed tiers — 5, 25, 50, 75, 100 GB. Required when enabled.
6381
+ * @description Allowed tiers — 5, 25, 50, 75, 100 GB (1 GB = 1,000,000,000 bytes). Required when enabled.
6279
6382
  * @enum {integer}
6280
6383
  */
6281
- amount_bytes?: 5368709120 | 26843545600 | 53687091200 | 80530636800 | 107374182400;
6384
+ amount_bytes?: 5000000000 | 25000000000 | 50000000000 | 75000000000 | 100000000000;
6282
6385
  /** @description $1-$1000. Required when enabled. */
6283
6386
  monthly_cap_cents?: number;
6284
6387
  };
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.9.2";
8
+ export declare const SDK_VERSION = "0.9.3";
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.9.2';
12
+ export const SDK_VERSION = '0.9.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-sdk",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Official TypeScript SDK for the ByteKit API",
5
5
  "license": "MIT",
6
6
  "type": "module",