@clocknext/sdk 0.10.0 → 0.11.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/README.md +3 -3
- package/dist/index.cjs +1 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -15
- package/dist/index.d.ts +4 -15
- package/dist/index.js +1 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -176,7 +176,7 @@ interface SerializedOutcomeAttribution {
|
|
|
176
176
|
/** The customer's remaining balance for the dimension a signal metered, AFTER
|
|
177
177
|
* the signal was applied — update an on-screen meter straight from the record
|
|
178
178
|
* response. Populated on recorded (inline / `{ wait: true }`) signals; `null`
|
|
179
|
-
* on
|
|
179
|
+
* on read-back. */
|
|
180
180
|
interface UsageBalance {
|
|
181
181
|
dimension: "credit" | "outcome" | "wallet";
|
|
182
182
|
/** Post-signal remaining. `null` when the meter is uncapped — an ARREAR
|
|
@@ -203,7 +203,7 @@ interface SerializedUsageLog {
|
|
|
203
203
|
status: SignalStatus;
|
|
204
204
|
appliedRules: SerializedRuleApplication[];
|
|
205
205
|
outcome: SerializedOutcomeAttribution | null;
|
|
206
|
-
/** Post-signal balance for the metered dimension. Null on
|
|
206
|
+
/** Post-signal balance for the metered dimension. Null on
|
|
207
207
|
* read-back. */
|
|
208
208
|
balance: UsageBalance | null;
|
|
209
209
|
createdAt: string;
|
|
@@ -1775,8 +1775,8 @@ declare function signalToWire(signal: Signal): Record<string, unknown>;
|
|
|
1775
1775
|
* server prices inline do you get `{ queued: false, usageLog }`. Branch on
|
|
1776
1776
|
* `queued`; never assume `usageLog`.
|
|
1777
1777
|
*
|
|
1778
|
-
* `
|
|
1779
|
-
*
|
|
1778
|
+
* `list()` is how you confirm one actually landed — and, ingestion being
|
|
1779
|
+
* asynchronous, the only way to.
|
|
1780
1780
|
*/
|
|
1781
1781
|
declare class Signals {
|
|
1782
1782
|
private readonly transport;
|
|
@@ -1794,17 +1794,6 @@ declare class Signals {
|
|
|
1794
1794
|
track(signal: Signal, opts?: {
|
|
1795
1795
|
wait?: boolean;
|
|
1796
1796
|
}): Promise<TrackResult>;
|
|
1797
|
-
/**
|
|
1798
|
-
* Validate + price a signal WITHOUT recording it (server `dryRun`). Returns
|
|
1799
|
-
* the projected usage log so an integration can preflight before sending real
|
|
1800
|
-
* traffic — no inbox row, wallet / outcome writes, or webhooks fire.
|
|
1801
|
-
*
|
|
1802
|
-
* Only the model-priced kinds support this. A dry run is not offered for unit
|
|
1803
|
-
* reports or composite completions, and the server REJECTS the flag on those
|
|
1804
|
-
* routes rather than accepting and ignoring it — which is why there is no
|
|
1805
|
-
* dry-run path through `unit()` or `completeComposite()`.
|
|
1806
|
-
*/
|
|
1807
|
-
verify(signal: Signal): Promise<SerializedUsageLog | null>;
|
|
1808
1797
|
/** Meter a named credit. `POST /api/v1/signal/credit`. */
|
|
1809
1798
|
credit(input: CreditInput, opts?: {
|
|
1810
1799
|
wait?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -176,7 +176,7 @@ interface SerializedOutcomeAttribution {
|
|
|
176
176
|
/** The customer's remaining balance for the dimension a signal metered, AFTER
|
|
177
177
|
* the signal was applied — update an on-screen meter straight from the record
|
|
178
178
|
* response. Populated on recorded (inline / `{ wait: true }`) signals; `null`
|
|
179
|
-
* on
|
|
179
|
+
* on read-back. */
|
|
180
180
|
interface UsageBalance {
|
|
181
181
|
dimension: "credit" | "outcome" | "wallet";
|
|
182
182
|
/** Post-signal remaining. `null` when the meter is uncapped — an ARREAR
|
|
@@ -203,7 +203,7 @@ interface SerializedUsageLog {
|
|
|
203
203
|
status: SignalStatus;
|
|
204
204
|
appliedRules: SerializedRuleApplication[];
|
|
205
205
|
outcome: SerializedOutcomeAttribution | null;
|
|
206
|
-
/** Post-signal balance for the metered dimension. Null on
|
|
206
|
+
/** Post-signal balance for the metered dimension. Null on
|
|
207
207
|
* read-back. */
|
|
208
208
|
balance: UsageBalance | null;
|
|
209
209
|
createdAt: string;
|
|
@@ -1775,8 +1775,8 @@ declare function signalToWire(signal: Signal): Record<string, unknown>;
|
|
|
1775
1775
|
* server prices inline do you get `{ queued: false, usageLog }`. Branch on
|
|
1776
1776
|
* `queued`; never assume `usageLog`.
|
|
1777
1777
|
*
|
|
1778
|
-
* `
|
|
1779
|
-
*
|
|
1778
|
+
* `list()` is how you confirm one actually landed — and, ingestion being
|
|
1779
|
+
* asynchronous, the only way to.
|
|
1780
1780
|
*/
|
|
1781
1781
|
declare class Signals {
|
|
1782
1782
|
private readonly transport;
|
|
@@ -1794,17 +1794,6 @@ declare class Signals {
|
|
|
1794
1794
|
track(signal: Signal, opts?: {
|
|
1795
1795
|
wait?: boolean;
|
|
1796
1796
|
}): Promise<TrackResult>;
|
|
1797
|
-
/**
|
|
1798
|
-
* Validate + price a signal WITHOUT recording it (server `dryRun`). Returns
|
|
1799
|
-
* the projected usage log so an integration can preflight before sending real
|
|
1800
|
-
* traffic — no inbox row, wallet / outcome writes, or webhooks fire.
|
|
1801
|
-
*
|
|
1802
|
-
* Only the model-priced kinds support this. A dry run is not offered for unit
|
|
1803
|
-
* reports or composite completions, and the server REJECTS the flag on those
|
|
1804
|
-
* routes rather than accepting and ignoring it — which is why there is no
|
|
1805
|
-
* dry-run path through `unit()` or `completeComposite()`.
|
|
1806
|
-
*/
|
|
1807
|
-
verify(signal: Signal): Promise<SerializedUsageLog | null>;
|
|
1808
1797
|
/** Meter a named credit. `POST /api/v1/signal/credit`. */
|
|
1809
1798
|
credit(input: CreditInput, opts?: {
|
|
1810
1799
|
wait?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -228,7 +228,7 @@ function sleep(ms) {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// src/http.ts
|
|
231
|
-
var SDK_VERSION = "0.
|
|
231
|
+
var SDK_VERSION = "0.11.0" ;
|
|
232
232
|
var Transport = class {
|
|
233
233
|
constructor(cfg) {
|
|
234
234
|
this.cfg = cfg;
|
|
@@ -965,28 +965,6 @@ var Signals = class {
|
|
|
965
965
|
...handles(res)
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
|
-
/**
|
|
969
|
-
* Validate + price a signal WITHOUT recording it (server `dryRun`). Returns
|
|
970
|
-
* the projected usage log so an integration can preflight before sending real
|
|
971
|
-
* traffic — no inbox row, wallet / outcome writes, or webhooks fire.
|
|
972
|
-
*
|
|
973
|
-
* Only the model-priced kinds support this. A dry run is not offered for unit
|
|
974
|
-
* reports or composite completions, and the server REJECTS the flag on those
|
|
975
|
-
* routes rather than accepting and ignoring it — which is why there is no
|
|
976
|
-
* dry-run path through `unit()` or `completeComposite()`.
|
|
977
|
-
*/
|
|
978
|
-
async verify(signal) {
|
|
979
|
-
const body = signalToWire(signal);
|
|
980
|
-
body.dryRun = true;
|
|
981
|
-
const res = await this.transport.request({
|
|
982
|
-
method: "POST",
|
|
983
|
-
path: SIGNAL_PATHS[signal.type],
|
|
984
|
-
body,
|
|
985
|
-
// A dry run writes nothing, so it is always safe to retry.
|
|
986
|
-
retry: true
|
|
987
|
-
});
|
|
988
|
-
return res.usageLog ?? null;
|
|
989
|
-
}
|
|
990
968
|
/** Meter a named credit. `POST /api/v1/signal/credit`. */
|
|
991
969
|
credit(input, opts) {
|
|
992
970
|
return this.track({ ...input, type: "credit" }, opts);
|