@clocknext/sdk 0.13.0 → 0.14.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/dist/index.cjs +33 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -1
- package/dist/index.d.ts +106 -1
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +6 -0
- package/src/resources/signals.ts +35 -0
- package/src/types.ts +80 -0
package/dist/index.cjs
CHANGED
|
@@ -328,7 +328,7 @@ function sleep(ms) {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
// src/http.ts
|
|
331
|
-
var SDK_VERSION = "0.
|
|
331
|
+
var SDK_VERSION = "0.14.0" ;
|
|
332
332
|
var Transport = class {
|
|
333
333
|
constructor(cfg) {
|
|
334
334
|
this.cfg = cfg;
|
|
@@ -1031,6 +1031,7 @@ var SIGNAL_PATHS = {
|
|
|
1031
1031
|
var UNIT_PATH = "/api/v1/signal/unit";
|
|
1032
1032
|
var COMPOSITE_COMPLETE_PATH = "/api/v1/signal/composite/complete";
|
|
1033
1033
|
var OUTCOME_COMPLETE_PATH = "/api/v1/signal/outcome/complete";
|
|
1034
|
+
var USAGE_LOG_PATH = "/api/v1/signal/usage-log";
|
|
1034
1035
|
function signalToWire(signal) {
|
|
1035
1036
|
const t = signal.tokens;
|
|
1036
1037
|
const body = {
|
|
@@ -1289,6 +1290,37 @@ var Signals = class {
|
|
|
1289
1290
|
query: { customerId: params.customerId, limit: params.limit }
|
|
1290
1291
|
});
|
|
1291
1292
|
}
|
|
1293
|
+
/**
|
|
1294
|
+
* One customer's usage history, merged from every meter kind — credit,
|
|
1295
|
+
* outcome, unit, wallet, and completed composite occurrences — into one
|
|
1296
|
+
* feed sorted by time. `GET /api/v1/signal/usage-log`. Exactly the same
|
|
1297
|
+
* rows the customer portal's own "Usage logs" table shows, so a caller can
|
|
1298
|
+
* build against this instead of the portal UI.
|
|
1299
|
+
*
|
|
1300
|
+
* Cursor-paginated, NOT page-numbered: `limit` + `cursor` in, `nextCursor`
|
|
1301
|
+
* out. Omit `cursor` for the first page; pass the previous page's
|
|
1302
|
+
* `nextCursor` back to fetch the next one, and stop once it comes back
|
|
1303
|
+
* `null`. Unlike offset pagination, the cost of a page never grows with how
|
|
1304
|
+
* deep you've paged — each page only asks for rows strictly before the
|
|
1305
|
+
* cursor's position.
|
|
1306
|
+
*
|
|
1307
|
+
* Read-only; unlike {@link track}/{@link unit}/etc., there is nothing to
|
|
1308
|
+
* buffer or retry here.
|
|
1309
|
+
*/
|
|
1310
|
+
usageLog(params) {
|
|
1311
|
+
return this.transport.request({
|
|
1312
|
+
method: "GET",
|
|
1313
|
+
path: USAGE_LOG_PATH,
|
|
1314
|
+
query: {
|
|
1315
|
+
customerId: params.customerId,
|
|
1316
|
+
limit: params.limit,
|
|
1317
|
+
cursor: params.cursor,
|
|
1318
|
+
period: params.period,
|
|
1319
|
+
from: params.from,
|
|
1320
|
+
to: params.to
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1292
1324
|
};
|
|
1293
1325
|
|
|
1294
1326
|
// src/resources/units.ts
|