@clocknext/sdk 0.12.0 → 0.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clocknext/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Official ClockNext SDK — record usage signals and manage plans, purchases, invoices, customers, and billing from your backend.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -14,9 +14,13 @@ const DEFAULT_BASE_URL = "https://payments.clocknext.com";
14
14
  *
15
15
  * In the default `async` mode a signal is sent by the background flusher, long
16
16
  * after `signals.credit()` resolved `{ status: "buffered" }`. There is no
17
- * promise left to reject into, so a rejected signal — an unknown `agentKey`, a
18
- * model the org has not enabled, a customer with no active plan — has nowhere
19
- * to surface except these hooks.
17
+ * promise left to reject into, so a failed REQUEST — a bad API key, an
18
+ * unreachable host, a timeout — has nowhere to surface except these hooks.
19
+ *
20
+ * They do not cover a signal the server accepted (`202`) and then refused while
21
+ * pricing it: that request succeeded as far as this SDK can tell. Those
22
+ * rejections are recorded on the workspace's signal log in the ClockNext
23
+ * dashboard, which is owner-only by design.
20
24
  *
21
25
  * They used to default to nothing at all, which meant a misconfigured
22
26
  * integration compiled, ran, returned success-shaped results, and metered
@@ -136,8 +136,15 @@ function handles(res: SignalResponse) {
136
136
  *
137
137
  * Because of that, a signal the server later REJECTS (unknown `agentKey`, a
138
138
  * model the org has not enabled, no active plan) cannot come back through this
139
- * promise. It surfaces on the `onError` hook, and `list()` is how you confirm
140
- * one actually landed — ingestion being asynchronous, the only way to.
139
+ * promise — and does not reach `onError` either, since from here that request
140
+ * succeeded. Such a rejection has no programmatic channel at all: it is
141
+ * recorded on the workspace's signal log in the ClockNext dashboard, which is
142
+ * owner-only by design.
143
+ *
144
+ * `list()` is the partial check available from code. It returns priced usage
145
+ * logs with a `status`, so it confirms a signal landed and whether pricing
146
+ * succeeded — but a signal refused BEFORE pricing never becomes a usage log
147
+ * and does not appear there.
141
148
  */
142
149
  export class Signals {
143
150
  constructor(
package/src/types.ts CHANGED
@@ -278,8 +278,10 @@ export interface TrackResult {
278
278
  * `"accepted"` — the server has written it to its durable inbox (`202`)
279
279
  * and will price it shortly. It can no longer be lost, but
280
280
  * it is not billed yet and `usageLog` is null. A rejection
281
- * discovered during pricing will NOT come back to you here —
282
- * read it back with `signals.list()`.
281
+ * discovered during pricing will NOT come back to you here,
282
+ * nor on `onError`. `signals.list()` shows what got priced;
283
+ * the dashboard's signal log — owner-only, by design — is
284
+ * where an individual rejection says why.
283
285
  * `"recorded"` — the server priced it inline and `usageLog` is populated.
284
286
  * `"dropped"` — the SDK threw it away without sending: the client is
285
287
  * closed, or the local queue is full. `onDrop` fired with