meterflow 0.5.0 → 0.5.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/dist/index.cjs CHANGED
@@ -35,7 +35,7 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // package.json
38
- var version = "0.5.0";
38
+ var version = "0.5.1";
39
39
 
40
40
  // src/errors.ts
41
41
  var MeterFlowError = class extends Error {
@@ -276,6 +276,15 @@ var UsageResource = class {
276
276
  ...opts?.idempotencyKey !== void 0 && { idempotencyKey: opts.idempotencyKey }
277
277
  });
278
278
  }
279
+ /**
280
+ * Read one recorded event back, including `billing_outcome` — what the worker decided to bill
281
+ * for it, or why it billed nothing (`no_subscription`, `no_meter_limit`, `not_metered`,
282
+ * `within_allowance`, `not_deducted`). It is `null` while `processed` is false: the worker runs
283
+ * after `record` answers, so poll this when you need to know what happened to a charge.
284
+ */
285
+ event(eventId) {
286
+ return this.client.request("GET", `usage/events/${encodeURIComponent(eventId)}`);
287
+ }
279
288
  summary(customerId, query) {
280
289
  return this.client.request("GET", `usage/${encodeURIComponent(customerId)}`, {
281
290
  ...query !== void 0 && { query }
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // package.json
38
- var version = "0.5.0";
38
+ var version = "0.5.1";
39
39
 
40
40
  // src/errors.ts
41
41
  var MeterFlowError = class extends Error {
@@ -276,6 +276,15 @@ var UsageResource = class {
276
276
  ...opts?.idempotencyKey !== void 0 && { idempotencyKey: opts.idempotencyKey }
277
277
  });
278
278
  }
279
+ /**
280
+ * Read one recorded event back, including `billing_outcome` — what the worker decided to bill
281
+ * for it, or why it billed nothing (`no_subscription`, `no_meter_limit`, `not_metered`,
282
+ * `within_allowance`, `not_deducted`). It is `null` while `processed` is false: the worker runs
283
+ * after `record` answers, so poll this when you need to know what happened to a charge.
284
+ */
285
+ event(eventId) {
286
+ return this.client.request("GET", `usage/events/${encodeURIComponent(eventId)}`);
287
+ }
279
288
  summary(customerId, query) {
280
289
  return this.client.request("GET", `usage/${encodeURIComponent(customerId)}`, {
281
290
  ...query !== void 0 && { query }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.5.0";
2
+ var version = "0.5.1";
3
3
 
4
4
  // src/errors.ts
5
5
  var MeterFlowError = class extends Error {
@@ -240,6 +240,15 @@ var UsageResource = class {
240
240
  ...opts?.idempotencyKey !== void 0 && { idempotencyKey: opts.idempotencyKey }
241
241
  });
242
242
  }
243
+ /**
244
+ * Read one recorded event back, including `billing_outcome` — what the worker decided to bill
245
+ * for it, or why it billed nothing (`no_subscription`, `no_meter_limit`, `not_metered`,
246
+ * `within_allowance`, `not_deducted`). It is `null` while `processed` is false: the worker runs
247
+ * after `record` answers, so poll this when you need to know what happened to a charge.
248
+ */
249
+ event(eventId) {
250
+ return this.client.request("GET", `usage/events/${encodeURIComponent(eventId)}`);
251
+ }
243
252
  summary(customerId, query) {
244
253
  return this.client.request("GET", `usage/${encodeURIComponent(customerId)}`, {
245
254
  ...query !== void 0 && { query }
@@ -25,6 +25,13 @@ export declare class UsageResource {
25
25
  record(body: UsageEventRequest, opts?: RecordOptions): Promise<UsageEventResponse>;
26
26
  /** Record up to `MAX_BATCH_EVENTS` events in one request. Larger arrays are rejected locally, never sent. */
27
27
  recordBatch(events: UsageEventRequest[], opts?: RecordOptions): Promise<UsageEventResponse[]>;
28
+ /**
29
+ * Read one recorded event back, including `billing_outcome` — what the worker decided to bill
30
+ * for it, or why it billed nothing (`no_subscription`, `no_meter_limit`, `not_metered`,
31
+ * `within_allowance`, `not_deducted`). It is `null` while `processed` is false: the worker runs
32
+ * after `record` answers, so poll this when you need to know what happened to a charge.
33
+ */
34
+ event(eventId: string): Promise<UsageEventResponse>;
28
35
  summary(customerId: string, query?: SummaryQuery): Promise<UsageSummaryResponse>;
29
36
  }
30
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/resources/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAC;AACpE,KAAK,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACtE,KAAK,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAE9C,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOlF,6GAA6G;IAC7G,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAY7F,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAKjF"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/resources/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,KAAK,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAC;AACpE,KAAK,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACtE,KAAK,oBAAoB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAE9C,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOlF,6GAA6G;IAC7G,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAY7F;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAInD,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAKjF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meterflow",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Official Node.js SDK for MeterFlow — usage-based billing, credit management, and metering.",
5
5
  "license": "MIT",
6
6
  "author": "MeterFlow",