@billkit-eu/sdk 0.6.0 → 0.7.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": "@billkit-eu/sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Official Node.js SDK for BillKit: a Stripe-Billing-shape multi-tenant SaaS API on Mollie.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
package/src/client.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  import {
11
+ ApiKeys,
11
12
  AuditLogs,
12
13
  BillingPortalSessions,
13
14
  CheckoutSessions,
@@ -45,6 +46,7 @@ function resolveApiKey(supplied: string | undefined): string {
45
46
  }
46
47
 
47
48
  export class BillKit {
49
+ readonly apiKeys: ApiKeys;
48
50
  readonly customers: Customers;
49
51
  readonly products: Products;
50
52
  readonly prices: Prices;
@@ -69,6 +71,7 @@ export class BillKit {
69
71
  ...options,
70
72
  apiKey: resolveApiKey(options.apiKey),
71
73
  });
74
+ this.apiKeys = new ApiKeys(transport);
72
75
  this.customers = new Customers(transport);
73
76
  this.products = new Products(transport);
74
77
  this.prices = new Prices(transport);
package/src/errors.ts CHANGED
@@ -26,6 +26,12 @@ export interface BillKitErrorOptions {
26
26
  statusCode?: number | undefined;
27
27
  requestId?: string | undefined;
28
28
  rawBody?: unknown;
29
+ /**
30
+ * The underlying error, forwarded to `Error`'s own `cause`. Set on
31
+ * `APIConnectionError` so the runtime's reason for a failed fetch
32
+ * (`ECONNREFUSED`, a TLS failure, an abort) survives the mapping.
33
+ */
34
+ cause?: unknown;
29
35
  }
30
36
 
31
37
  // TS treats `name = "Foo"` as a literal-type property, which then conflicts
@@ -41,7 +47,10 @@ export class BillKitError extends Error {
41
47
  readonly rawBody: unknown;
42
48
 
43
49
  constructor(message: string, options: BillKitErrorOptions = {}) {
44
- super(message);
50
+ // Only pass the options bag when there is a cause: `{ cause: undefined }`
51
+ // still installs an own `cause` property, which would show up on every
52
+ // error that never had one.
53
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
45
54
  this.type = options.type;
46
55
  this.code = options.code;
47
56
  this.param = options.param;
package/src/index.ts CHANGED
@@ -70,6 +70,7 @@ export { paginate, type ListResponseEnvelope, type PaginateOptions } from "./pag
70
70
  export type {
71
71
  AuditLogsListParams,
72
72
  BaseListParams,
73
+ CreateApiKeyParams,
73
74
  CreateBillingPortalSessionParams,
74
75
  CreateCheckoutSessionParams,
75
76
  CreateCouponParams,
@@ -83,16 +84,24 @@ export type {
83
84
  CreateWebhookEndpointParams,
84
85
  CreditNotesListParams,
85
86
  CustomerListParams,
87
+ DisputesListParams,
86
88
  EventsListParams,
89
+ ExpandOptions,
87
90
  IdempotencyOptions,
91
+ InvoicesListParams,
88
92
  ListParams,
93
+ PaymentsListParams,
89
94
  PriceTier,
90
95
  PricesListParams,
96
+ ProductsListParams,
91
97
  RotateProviderCredentialParams,
98
+ SetCustomerVatNumberParams,
92
99
  SetPortalBrandingParams,
100
+ SetTenantBillingProfileParams,
93
101
  SubscriptionsListParams,
94
102
  UpdateCouponParams,
95
103
  UpdateCustomerParams,
104
+ UpdatePriceParams,
96
105
  UpdateProductParams,
97
106
  UpdateTaxRateParams,
98
107
  UpdateWebhookEndpointParams,