@hunt-labs/bytekit-sdk 0.9.0 → 0.9.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.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,32 @@ today, see [README.md](./README.md), which remains the authoritative usage guide
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.9.1] - 2026-08-25
14
+
15
+ ### Fixed
16
+
17
+ - The generated `paths` type for the `200` of `GET /v1/scrape/bulk/{id}` now declares `items`
18
+ (#3632). The route builds one body and varies only the status code, so the terminal `200`
19
+ has always carried the per-URL scrape envelopes — but only the `202` documented them, so
20
+ `scrape.bulk.get()` typed the results away at exactly the poll that has them. Types only:
21
+ the field was already on the wire, and server behavior is unchanged.
22
+
23
+ - The generated `paths` types now describe the `202` that `GET /v1/scrape/bulk/{id}`,
24
+ `GET /v1/fetch/bulk/{id}` and `GET /v1/bulk/{id}` already serve while a bulk job is
25
+ non-terminal (#3533). Each of the three returns 202 with the job envelope until the job is
26
+ terminal and 200 afterwards, but only the 200 was declared, so anything typed off the spec
27
+ had no shape for the response the very first poll receives. Types only: `scrape.bulk.get()`,
28
+ `fetch.bulk.get()` and `bulk.get()` already resolved the body on any 2xx, and server behavior
29
+ is unchanged.
30
+
31
+ ### Changed
32
+
33
+ - The generated `topup_balance_bytes` description on `GET /v1/usage` now states that the value is
34
+ the remaining purchased top-up bytes, already net of any overage consumed against them (#3459).
35
+ Types only: the field's name, type and wire format are unchanged. The server previously
36
+ subtracted the consumed overage a second time when computing this value, so the number a client
37
+ reads is larger than before for accounts that ran past their included allowance.
38
+
13
39
  ## [0.9.0] - 2026-08-20
14
40
 
15
41
  ### Removed
@@ -2147,6 +2147,7 @@ export interface components {
2147
2147
  * @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)
2148
2148
  */
2149
2149
  webhook_url: string;
2150
+ /** @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code. */
2150
2151
  webhook_secret?: string;
2151
2152
  /** @description Max 20 headers. Keys must match /^[A-Za-z0-9-]+$/ and not be reserved. */
2152
2153
  webhook_headers?: {
@@ -2176,6 +2177,7 @@ export interface components {
2176
2177
  * @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)
2177
2178
  */
2178
2179
  webhook_url?: string;
2180
+ /** @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code. */
2179
2181
  webhook_secret?: string;
2180
2182
  webhook_headers?: {
2181
2183
  [key: string]: string;
@@ -2236,7 +2238,7 @@ export interface components {
2236
2238
  };
2237
2239
  MonitorCreateResponse: components["schemas"]["MonitorResponse"] & {
2238
2240
  /**
2239
- * @description The webhook signing secret — returned **once** at creation time only. Subsequent GET requests omit this field. Always present on a create response (`webhook_url` is required on create). Format: 64 lowercase hex characters (32 bytes of entropy).
2241
+ * @description The webhook signing secret — returned **once** at creation time only. Subsequent GET requests omit this field. Always present on a create response (`webhook_url` is required on create). Format: 64 lowercase hex characters (32 bytes of entropy). Use it to verify the `X-Webhook-Signature` header on each delivery — see https://bytekit.com/docs/guides/webhooks.
2240
2242
  * @example a3f1b2c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2
2241
2243
  */
2242
2244
  webhook_secret?: string;
@@ -2285,7 +2287,10 @@ export interface components {
2285
2287
  * @description Optional webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported). When omitted, no `sitemap.completed`/`sitemap.failed` webhook is delivered and the job is poll-only via `GET /v1/sitemap/{id}`. When present, delivery is unchanged. `webhook_secret` is ignored when `webhook_url` is absent.
2286
2288
  */
2287
2289
  webhook_url?: string;
2288
- /** @default null */
2290
+ /**
2291
+ * @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code.
2292
+ * @default null
2293
+ */
2289
2294
  webhook_secret: string | null;
2290
2295
  /**
2291
2296
  * @description Max 90 days.
@@ -2522,7 +2527,10 @@ export interface components {
2522
2527
  };
2523
2528
  /** Format: date-time */
2524
2529
  cancelled_at: string | null;
2525
- /** Format: date-time */
2530
+ /**
2531
+ * Format: date-time
2532
+ * @description Reserved, and always `null` today: it reflects the account's cancellation grace deadline, which no current code path sets. It is not the payment-failure grace period — that deadline is tracked per invoice (7 days from the failed payment) in `billing_dunning_graces` and is not exposed on this response.
2533
+ */
2526
2534
  grace_period_expires_at: string | null;
2527
2535
  /** Format: date-time */
2528
2536
  created_at: string;
@@ -2607,6 +2615,7 @@ export interface components {
2607
2615
  purchased_topup_bytes: number;
2608
2616
  /** @description Bytes remaining in starter-grant lots, after active refund reservations. Purchased top-up bytes are excluded. */
2609
2617
  granted_topup_bytes: number;
2618
+ /** @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. */
2610
2619
  rollover_bytes: number;
2611
2620
  };
2612
2621
  CreditBalance: {
@@ -2619,6 +2628,7 @@ export interface components {
2619
2628
  purchased_topup_credits: number;
2620
2629
  /** @description Credits remaining in starter-grant lots, after active refund reservations. Purchased top-up credits are excluded. */
2621
2630
  granted_topup_credits: number;
2631
+ /** @description Always `0`. Search credits do not carry over between billing periods; the field is retained for contract stability and will not become non-zero without an announced plan change. */
2622
2632
  rollover_credits: number;
2623
2633
  };
2624
2634
  };
@@ -3619,6 +3629,7 @@ export interface operations {
3619
3629
  * @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)
3620
3630
  */
3621
3631
  webhook_url: string;
3632
+ /** @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code. */
3622
3633
  webhook_secret?: string;
3623
3634
  metadata?: components["schemas"]["Metadata"];
3624
3635
  /**
@@ -3739,6 +3750,43 @@ export interface operations {
3739
3750
  estimated_credits: number | null;
3740
3751
  /** @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported) */
3741
3752
  webhook_url: string;
3753
+ /** @description Rehydrated per-URL scrape envelopes — the terminal page of results (default 100 rows, `?limit=` up to 500). `routes/scrape-bulk.ts` spreads this key into the SAME body on both status branches, so it is present here exactly as it is on the 202; on the 200 the entries carry their final success or error envelopes (issue #3632). */
3754
+ items: components["schemas"]["ScrapeEnvelope"][];
3755
+ };
3756
+ };
3757
+ };
3758
+ /**
3759
+ * @description Bulk job still processing. `routes/scrape-bulk.ts` ends the poll handler
3760
+ * with `status: isTerminal ? 200 : 202` over an identical body, so this is
3761
+ * the SAME envelope the 200 documents — only the status code and the
3762
+ * reachable `status` values differ. Keep polling until you get a 200
3763
+ * (issue #3533).
3764
+ */
3765
+ 202: {
3766
+ headers: {
3767
+ [name: string]: unknown;
3768
+ };
3769
+ content: {
3770
+ "application/json": {
3771
+ /** @example bulk_01j9abc123 */
3772
+ id: string;
3773
+ /** @enum {string} */
3774
+ status: "processing";
3775
+ total: number;
3776
+ completed: number;
3777
+ failed: number;
3778
+ /** Format: date-time */
3779
+ created_at: string;
3780
+ /** Format: date-time */
3781
+ completed_at: string | null;
3782
+ /** @description Total credits billed for the job. Null until the job is billed. Fractional — credits are NUMERIC(10,2). */
3783
+ total_credits_charged: number | null;
3784
+ /** @description Null in GET responses (computed at submission time only). */
3785
+ estimated_credits: number | null;
3786
+ /** @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported) */
3787
+ webhook_url: string;
3788
+ /** @description Rehydrated per-URL scrape envelopes — the same page the 200 returns (default 100 rows, `?limit=` up to 500). While the job is non-terminal most entries carry the `queued` envelope. */
3789
+ items: components["schemas"]["ScrapeEnvelope"][];
3742
3790
  };
3743
3791
  };
3744
3792
  };
@@ -4019,6 +4067,7 @@ export interface operations {
4019
4067
  * @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)
4020
4068
  */
4021
4069
  webhook_url: string;
4070
+ /** @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code. */
4022
4071
  webhook_secret?: string;
4023
4072
  metadata?: components["schemas"]["Metadata"];
4024
4073
  };
@@ -4154,6 +4203,72 @@ export interface operations {
4154
4203
  };
4155
4204
  };
4156
4205
  };
4206
+ /**
4207
+ * @description Bulk job still processing. `routes/fetch-bulk.ts` ends the poll handler
4208
+ * with `status: isTerminal ? 200 : 202` over an identical body, so this is
4209
+ * the SAME envelope the 200 documents — only the status code and the
4210
+ * reachable `status` values differ. Keep polling until you get a 200; a
4211
+ * **cancelled** job stays on this branch forever (issue #3533).
4212
+ *
4213
+ * Item `content_url` values are pre-signed exactly as on the 200 — a fresh
4214
+ * 600-second signature on every poll.
4215
+ */
4216
+ 202: {
4217
+ headers: {
4218
+ [name: string]: unknown;
4219
+ };
4220
+ content: {
4221
+ "application/json": {
4222
+ /** @example bulk_01j9abc123 */
4223
+ id: string;
4224
+ /** @enum {string} */
4225
+ status: "processing" | "cancelled";
4226
+ total: number;
4227
+ completed: number;
4228
+ failed: number;
4229
+ /** Format: date-time */
4230
+ created_at: string;
4231
+ /** Format: date-time */
4232
+ completed_at: string | null;
4233
+ /** @description Total credits billed for the job. Null until the job is billed. Fractional — credits are NUMERIC(10,2). */
4234
+ total_credits_charged: number | null;
4235
+ /** @description Null in GET responses (computed at submission time only). */
4236
+ estimated_credits: number | null;
4237
+ /** @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported) */
4238
+ webhook_url: string;
4239
+ /** @description Per-URL fetch items, oldest first, capped at 500 (listBulkFetchItemsWithLatestAttempt). */
4240
+ items: {
4241
+ /**
4242
+ * @description Scrape-row id, `sc_`-prefixed. Fetch-bulk items are rows of the same resource sync `/v1/scrape` returns, so they share its prefix. Not to be confused with the `ft_`-prefixed `X-Fetch-ID` correlation header on sync `/v1/fetch`, which identifies a request rather than a stored item.
4243
+ * @example sc_01j9abc123
4244
+ */
4245
+ id: string;
4246
+ /** Format: uri */
4247
+ url: string;
4248
+ /** @enum {string} */
4249
+ status: "pending" | "processing" | "completed" | "failed" | "cancelled";
4250
+ content_type: string | null;
4251
+ content_length: number | null;
4252
+ /** @description Pre-signed download URL for the fetched body, valid for 600 seconds (10 minutes) from the moment this response was generated — matching the signing TTL of `image_url` on `GET /v1/bulk/{id}/screenshots`. A new signature is minted on every poll. Null for items with no stored body; a completed item whose object cannot be signed falls back to the unsigned stored URL, which returns 401 on download. */
4253
+ content_url: string | null;
4254
+ waf_vendor: string | null;
4255
+ cache_hit: boolean;
4256
+ /**
4257
+ * @description Itemised account of this item's charge — the basis, the named factors
4258
+ * that composed the multiplier, and the resulting billed bytes. Omitted
4259
+ * for rows that completed before the billing node was persisted.
4260
+ */
4261
+ billing?: components["schemas"]["BillingNode"];
4262
+ error_code: string | null;
4263
+ error_message: string | null;
4264
+ /** Format: date-time */
4265
+ created_at: string;
4266
+ /** Format: date-time */
4267
+ completed_at: string | null;
4268
+ }[];
4269
+ };
4270
+ };
4271
+ };
4157
4272
  /** @description Resource not found. */
4158
4273
  404: {
4159
4274
  headers: {
@@ -4376,6 +4491,7 @@ export interface operations {
4376
4491
  * @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported)
4377
4492
  */
4378
4493
  webhook_url: string;
4494
+ /** @description HMAC secret used to sign webhook deliveries. Each delivery carries `X-Webhook-Timestamp` and `X-Webhook-Signature` (`sha256=` + the hex HMAC-SHA256 of `timestamp.body`). See https://bytekit.com/docs/guides/webhooks for verification code. */
4379
4495
  webhook_secret?: string;
4380
4496
  metadata?: components["schemas"]["Metadata"];
4381
4497
  };
@@ -4491,6 +4607,38 @@ export interface operations {
4491
4607
  };
4492
4608
  };
4493
4609
  };
4610
+ /**
4611
+ * @description Bulk job still processing. `routes/bulk.ts` ends the poll handler with
4612
+ * `status: isTerminal ? 200 : 202` over an identical body, so this is the
4613
+ * SAME envelope the 200 documents — only the status code and the reachable
4614
+ * `status` values differ. Keep polling until you get a 200 (issue #3533).
4615
+ */
4616
+ 202: {
4617
+ headers: {
4618
+ [name: string]: unknown;
4619
+ };
4620
+ content: {
4621
+ "application/json": {
4622
+ /** @example bulk_01j9abc123 */
4623
+ id: string;
4624
+ /** @enum {string} */
4625
+ status: "processing";
4626
+ total: number;
4627
+ completed: number;
4628
+ failed: number;
4629
+ /** Format: date-time */
4630
+ created_at: string;
4631
+ /** Format: date-time */
4632
+ completed_at: string | null;
4633
+ /** @description Total credits billed for the job. Null until the job is billed. Fractional — credits are NUMERIC(10,2). */
4634
+ total_credits_charged: number | null;
4635
+ /** @description Null in GET responses (computed at submission time only). */
4636
+ estimated_credits: number | null;
4637
+ /** @description Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason scheme_unsupported) */
4638
+ webhook_url: string;
4639
+ };
4640
+ };
4641
+ };
4494
4642
  /** @description Resource not found. */
4495
4643
  404: {
4496
4644
  headers: {
@@ -5119,7 +5267,7 @@ export interface operations {
5119
5267
  "application/json": components["schemas"]["Error"];
5120
5268
  };
5121
5269
  };
5122
- /** @description Payment required — the account is out of credits. */
5270
+ /** @description Payment required. Either the account is out of credits (`quota_exceeded`), or a custom overage-enabled plan would cross its configured overage spending cap (`spending_cap_reached`). */
5123
5271
  402: {
5124
5272
  headers: {
5125
5273
  [name: string]: unknown;
@@ -5398,7 +5546,7 @@ export interface operations {
5398
5546
  plan_type: "payg" | "subscription";
5399
5547
  /** @description Total top-up spend in cents for this billing period. Present only in dual/bytes billing mode. */
5400
5548
  topup_spent_cents?: number;
5401
- /** @description Remaining top-up bytes: max(0, topup_bytes − max(0, bytes_used − included_bytes − rollover_bytes)). Present only in dual/bytes billing mode. */
5549
+ /** @description Remaining purchased top-up bytes, already net of any overage consumed against them. Equal to topup_bytes. Present only in dual/bytes billing mode. */
5402
5550
  topup_balance_bytes?: number;
5403
5551
  /** @description Days elapsed since period_start. */
5404
5552
  period_days_elapsed: number;
@@ -5408,9 +5556,13 @@ export interface operations {
5408
5556
  bytes_bulk: number;
5409
5557
  bytes_scrape: number;
5410
5558
  bytes_monitor: number;
5559
+ /** @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. */
5411
5560
  bytes_limit: number;
5561
+ /** @description Bytes still available across every active lot, after active refund reservations. */
5412
5562
  bytes_remaining: number;
5563
+ /** @description Unspent allowance carried over from earlier billing periods. */
5413
5564
  rollover_bytes: number;
5565
+ /** @description Bytes remaining in purchased top-up and starter-grant lots. Subscription allowance is excluded. */
5414
5566
  topup_bytes: number;
5415
5567
  /** @description Total API requests in the current billing period. */
5416
5568
  request_count: number;
@@ -6028,7 +6180,7 @@ export interface operations {
6028
6180
  /** @description Whether the authenticated account's plan supports bandwidth top-up purchases. False for free and PAYG plans. The frontend should disable or hide the Buy Bandwidth affordance when this is false. */
6029
6181
  available: boolean;
6030
6182
  };
6031
- /** @description The number of bandwidth bytes included in the account's current plan allotment (before any rollover or top-up bytes). Use this value instead of computing plan allotment client-side from `limit_bytes - rollover_bytes - topup_bytes`. */
6183
+ /** @description The bandwidth allotment configured on the account's current plan (before any rollover or top-up bytes). Use this value instead of computing the plan allotment client-side from `limit_bytes - rollover_bytes - topup_bytes`: the allowance actually granted is the lot written when the period's invoice was paid, so the two can differ before the first paid invoice of a plan. */
6032
6184
  included_bytes?: number;
6033
6185
  /** @description Number of automatic top-up transactions (bandwidth and credit) that have been triggered in the current calendar month. Includes both pending and completed transactions. */
6034
6186
  triggers_this_month?: number;
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.0";
8
+ export declare const SDK_VERSION = "0.9.1";
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.0';
12
+ export const SDK_VERSION = '0.9.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunt-labs/bytekit-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Official TypeScript SDK for the ByteKit API",
5
5
  "license": "MIT",
6
6
  "type": "module",