@chronary/sdk 0.9.0 → 0.10.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 CHANGED
@@ -2,7 +2,12 @@
2
2
 
3
3
  All notable changes to `@chronary/sdk` will be documented in this file starting with the soft-launch release.
4
4
 
5
- ## 0.9.0 — Unreleased
5
+ ## 0.10.0 — Unreleased
6
+
7
+ - `client.usage.get()` types the two fields the API already returned: `webhook_endpoints` (`{ used, limit }`, registered webhook endpoints vs. the plan cap) and `scoped_keys` (`{ count, limit }`, active agent-scoped keys). Add the `ScopedKeysUsage` type and export `HoldsUsage` and `CrossCalendarQueriesUsage`. A new test fails when the API's `Usage` response gains a field the SDK type lacks (#1995).
8
+ - Every single-request resource method now returns an `APIPromise<T>`, so `.withResponse()` works on them as documented: `const { data, response } = await client.agents.get('agt_1').withResponse()` gives the status, headers and parsed `response.quota`. `APIPromise` is now a real `Promise` subclass, so `await`, `Promise.all` and `Promise<T>` annotations work as before. The auto-paginating `list()` helpers still return a `PageIterator` (#2002).
9
+
10
+ ## 0.9.0
6
11
 
7
12
  - A 429 `quota_exceeded` (a monthly plan limit) is no longer retried: the request rejects with `QuotaExceededError` at once instead of sleeping on `Retry-After` and asking again. A rate-limit 429 still retries, waiting at most 60 seconds (#1936).
8
13
  - Add the `developer` plan: `PlanId` includes it, `Plan.annual_price`, `BillingSummary.pending_plan` / `pending_plan_interval` / `pending_plan_at`, `BillingUpgradeOption.plan` (`developer` | `pro`) and `via`, `UpgradeRequest.plan`. Errors expose `upgradePlan` (the plan `upgradeUrl` leads to). Additive; `BillingSummary.plan` stays a plain string (#1911).
package/README.md CHANGED
@@ -74,6 +74,16 @@ Chronary enforces a per-key rate limit and per-org monthly quotas that vary by p
74
74
 
75
75
  Pro-only feature calls return `403` with an upgrade hint on Free. See the full matrix and rate-limit handling guidance at <https://docs.chronary.ai/resources/rate-limits/>.
76
76
 
77
+ ## Response headers and quota
78
+
79
+ Every single-request method returns an `APIPromise`: `await` it for the data, or call `.withResponse()` to also get the status, headers and parsed quota headers. The auto-paginating `list()` helpers return a `PageIterator` instead.
80
+
81
+ ```ts
82
+ const { data: agent, response } = await client.agents.get('agt_1').withResponse();
83
+ console.log(response.headers.get('x-request-id'));
84
+ console.log(response.quota?.remaining, response.quota?.resetAt);
85
+ ```
86
+
77
87
  ## Webhook Verification
78
88
 
79
89
  ```ts