@izak0s/spacebring-api 1.3.0 → 1.4.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 +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2266,7 +2266,7 @@ interface components {
|
|
|
2266
2266
|
* @description Exchange rate provider when auto-update is enabled.
|
|
2267
2267
|
* @enum {string}
|
|
2268
2268
|
*/
|
|
2269
|
-
provider?: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
2269
|
+
provider?: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
2270
2270
|
};
|
|
2271
2271
|
/** @description Pre-built query string for the next page of results. Contains all active filter parameters combined with the next page token, ready to append to the endpoint URL. */
|
|
2272
2272
|
searchQueryNext: string;
|
|
@@ -7511,7 +7511,13 @@ interface components {
|
|
|
7511
7511
|
memo?: string;
|
|
7512
7512
|
/** Format: uuid */
|
|
7513
7513
|
membershipRefOwner?: string;
|
|
7514
|
+
/**
|
|
7515
|
+
* @deprecated
|
|
7516
|
+
* @description Deprecated. Use `payments` instead.
|
|
7517
|
+
*/
|
|
7514
7518
|
payment?: components["schemas"]["payment"];
|
|
7519
|
+
/** @description Booking payments. Multiple entries when the booking has several ledger transactions. */
|
|
7520
|
+
payments?: components["schemas"]["payment"][];
|
|
7515
7521
|
/** Format: uuid */
|
|
7516
7522
|
resourceRef?: string;
|
|
7517
7523
|
seats?: number;
|
|
@@ -11283,7 +11289,7 @@ interface components {
|
|
|
11283
11289
|
* @description Exchange rate provider when auto-update is enabled.
|
|
11284
11290
|
* @enum {string}
|
|
11285
11291
|
*/
|
|
11286
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
11292
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
11287
11293
|
} | {
|
|
11288
11294
|
/** @description Exchange rate relative to the location main currency. */
|
|
11289
11295
|
exchangeRate: number;
|
|
@@ -11300,7 +11306,7 @@ interface components {
|
|
|
11300
11306
|
* @description Exchange rate provider when auto-update is enabled.
|
|
11301
11307
|
* @enum {string}
|
|
11302
11308
|
*/
|
|
11303
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
11309
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
11304
11310
|
} | {
|
|
11305
11311
|
/** @description Exchange rate relative to the location main currency. */
|
|
11306
11312
|
exchangeRate: number;
|
|
@@ -19385,6 +19391,8 @@ interface operations {
|
|
|
19385
19391
|
locationRef?: string;
|
|
19386
19392
|
/** @description Pagination token from nextPageToken in a previous response. Keep the same filters when fetching the next page. */
|
|
19387
19393
|
nextPageToken?: string;
|
|
19394
|
+
/** @description Comma-separated product UUIDs used to filter orders, e.g. `uuid1,uuid2`. */
|
|
19395
|
+
productRef?: string;
|
|
19388
19396
|
/**
|
|
19389
19397
|
* @description Filter by order status. Comma-separated values, e.g. `new,inProgress`. Defaults to `new`, `inProgress`, and `completed` when omitted.
|
|
19390
19398
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -2266,7 +2266,7 @@ interface components {
|
|
|
2266
2266
|
* @description Exchange rate provider when auto-update is enabled.
|
|
2267
2267
|
* @enum {string}
|
|
2268
2268
|
*/
|
|
2269
|
-
provider?: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
2269
|
+
provider?: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
2270
2270
|
};
|
|
2271
2271
|
/** @description Pre-built query string for the next page of results. Contains all active filter parameters combined with the next page token, ready to append to the endpoint URL. */
|
|
2272
2272
|
searchQueryNext: string;
|
|
@@ -7511,7 +7511,13 @@ interface components {
|
|
|
7511
7511
|
memo?: string;
|
|
7512
7512
|
/** Format: uuid */
|
|
7513
7513
|
membershipRefOwner?: string;
|
|
7514
|
+
/**
|
|
7515
|
+
* @deprecated
|
|
7516
|
+
* @description Deprecated. Use `payments` instead.
|
|
7517
|
+
*/
|
|
7514
7518
|
payment?: components["schemas"]["payment"];
|
|
7519
|
+
/** @description Booking payments. Multiple entries when the booking has several ledger transactions. */
|
|
7520
|
+
payments?: components["schemas"]["payment"][];
|
|
7515
7521
|
/** Format: uuid */
|
|
7516
7522
|
resourceRef?: string;
|
|
7517
7523
|
seats?: number;
|
|
@@ -11283,7 +11289,7 @@ interface components {
|
|
|
11283
11289
|
* @description Exchange rate provider when auto-update is enabled.
|
|
11284
11290
|
* @enum {string}
|
|
11285
11291
|
*/
|
|
11286
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
11292
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
11287
11293
|
} | {
|
|
11288
11294
|
/** @description Exchange rate relative to the location main currency. */
|
|
11289
11295
|
exchangeRate: number;
|
|
@@ -11300,7 +11306,7 @@ interface components {
|
|
|
11300
11306
|
* @description Exchange rate provider when auto-update is enabled.
|
|
11301
11307
|
* @enum {string}
|
|
11302
11308
|
*/
|
|
11303
|
-
provider: "fastForex" | "nbu" | "bcra" | "nbg";
|
|
11309
|
+
provider: "fastForex" | "nbu" | "bcra" | "nbg" | "bcch";
|
|
11304
11310
|
} | {
|
|
11305
11311
|
/** @description Exchange rate relative to the location main currency. */
|
|
11306
11312
|
exchangeRate: number;
|
|
@@ -19385,6 +19391,8 @@ interface operations {
|
|
|
19385
19391
|
locationRef?: string;
|
|
19386
19392
|
/** @description Pagination token from nextPageToken in a previous response. Keep the same filters when fetching the next page. */
|
|
19387
19393
|
nextPageToken?: string;
|
|
19394
|
+
/** @description Comma-separated product UUIDs used to filter orders, e.g. `uuid1,uuid2`. */
|
|
19395
|
+
productRef?: string;
|
|
19388
19396
|
/**
|
|
19389
19397
|
* @description Filter by order status. Comma-separated values, e.g. `new,inProgress`. Defaults to `new`, `inProgress`, and `completed` when omitted.
|
|
19390
19398
|
*
|
package/dist/index.js
CHANGED
|
@@ -486,7 +486,9 @@ var SpacebringError = class extends Error {
|
|
|
486
486
|
url;
|
|
487
487
|
constructor(status, body, request) {
|
|
488
488
|
const parsed = isErrorBody(body) ? body : void 0;
|
|
489
|
-
|
|
489
|
+
let base = parsed?.message ?? `Spacebring API request failed with status ${status}`;
|
|
490
|
+
const issues = parsed ? issueSummary(parsed) : void 0;
|
|
491
|
+
if (issues) base += ` \u2014 ${issues}`;
|
|
490
492
|
super(request?.operation ? `${base} (${request.operation})` : base);
|
|
491
493
|
this.name = "SpacebringError";
|
|
492
494
|
this.status = status;
|
|
@@ -498,6 +500,19 @@ var SpacebringError = class extends Error {
|
|
|
498
500
|
function isErrorBody(body) {
|
|
499
501
|
return typeof body === "object" && body !== null;
|
|
500
502
|
}
|
|
503
|
+
function issueSummary(body) {
|
|
504
|
+
const issues = body.issues;
|
|
505
|
+
if (!Array.isArray(issues) || issues.length === 0) return void 0;
|
|
506
|
+
const parts = issues.slice(0, 3).map((issue) => {
|
|
507
|
+
if (typeof issue !== "object" || issue === null) return String(issue);
|
|
508
|
+
const { path, message } = issue;
|
|
509
|
+
const where = Array.isArray(path) && path.length > 0 ? path.join(".") : void 0;
|
|
510
|
+
const what = typeof message === "string" ? message : JSON.stringify(issue);
|
|
511
|
+
return where ? `${where}: ${what}` : what;
|
|
512
|
+
});
|
|
513
|
+
const more = issues.length > 3 ? `; +${issues.length - 3} more` : "";
|
|
514
|
+
return parts.join("; ") + more;
|
|
515
|
+
}
|
|
501
516
|
|
|
502
517
|
// src/core.ts
|
|
503
518
|
function unwrap(result, operation) {
|