@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/README.md +41 -10
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +7 -3
- package/src/resources/signals.ts +9 -2
- package/src/types.ts +4 -2
package/package.json
CHANGED
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
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
package/src/resources/signals.ts
CHANGED
|
@@ -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
|
|
140
|
-
*
|
|
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
|
-
*
|
|
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
|