@izak0s/spacebring-api 1.8.0 → 1.9.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 +31 -20
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -1
package/dist/index.d.cts
CHANGED
|
@@ -6807,7 +6807,7 @@ interface components {
|
|
|
6807
6807
|
/** @description Images extracted from the guide description. */
|
|
6808
6808
|
media: {
|
|
6809
6809
|
/** @description Image height in pixels. */
|
|
6810
|
-
height
|
|
6810
|
+
height?: number;
|
|
6811
6811
|
/** @description Storage key of the image. */
|
|
6812
6812
|
key: string;
|
|
6813
6813
|
/** @description MIME type of the image. */
|
|
@@ -6815,7 +6815,7 @@ interface components {
|
|
|
6815
6815
|
/** @description Public URL of the image. */
|
|
6816
6816
|
url: string;
|
|
6817
6817
|
/** @description Image width in pixels. */
|
|
6818
|
-
width
|
|
6818
|
+
width?: number;
|
|
6819
6819
|
}[];
|
|
6820
6820
|
/** @description Display name of the guide. */
|
|
6821
6821
|
title: string;
|
|
@@ -6853,7 +6853,7 @@ interface components {
|
|
|
6853
6853
|
/** @description Images extracted from the guide description. */
|
|
6854
6854
|
media: {
|
|
6855
6855
|
/** @description Image height in pixels. */
|
|
6856
|
-
height
|
|
6856
|
+
height?: number;
|
|
6857
6857
|
/** @description Storage key of the image. */
|
|
6858
6858
|
key: string;
|
|
6859
6859
|
/** @description MIME type of the image. */
|
|
@@ -6861,7 +6861,7 @@ interface components {
|
|
|
6861
6861
|
/** @description Public URL of the image. */
|
|
6862
6862
|
url: string;
|
|
6863
6863
|
/** @description Image width in pixels. */
|
|
6864
|
-
width
|
|
6864
|
+
width?: number;
|
|
6865
6865
|
}[];
|
|
6866
6866
|
/** @description Display name of the guide. */
|
|
6867
6867
|
title: string;
|
|
@@ -6896,7 +6896,7 @@ interface components {
|
|
|
6896
6896
|
/** @description Images extracted from the guide description. */
|
|
6897
6897
|
media: {
|
|
6898
6898
|
/** @description Image height in pixels. */
|
|
6899
|
-
height
|
|
6899
|
+
height?: number;
|
|
6900
6900
|
/** @description Storage key of the image. */
|
|
6901
6901
|
key: string;
|
|
6902
6902
|
/** @description MIME type of the image. */
|
|
@@ -6904,7 +6904,7 @@ interface components {
|
|
|
6904
6904
|
/** @description Public URL of the image. */
|
|
6905
6905
|
url: string;
|
|
6906
6906
|
/** @description Image width in pixels. */
|
|
6907
|
-
width
|
|
6907
|
+
width?: number;
|
|
6908
6908
|
}[];
|
|
6909
6909
|
/** @description Display name of the guide. */
|
|
6910
6910
|
title: string;
|
|
@@ -9040,9 +9040,9 @@ interface components {
|
|
|
9040
9040
|
*/
|
|
9041
9041
|
id: string;
|
|
9042
9042
|
/** @description First name of the user who deleted the order. */
|
|
9043
|
-
name
|
|
9043
|
+
name?: string | null;
|
|
9044
9044
|
/** @description Last name of the user who deleted the order. */
|
|
9045
|
-
surname
|
|
9045
|
+
surname?: string | null;
|
|
9046
9046
|
};
|
|
9047
9047
|
}[];
|
|
9048
9048
|
/** @description Search query parameters for the next page of results. Includes all filters used to fetch the current page. */
|
|
@@ -9508,9 +9508,9 @@ interface components {
|
|
|
9508
9508
|
*/
|
|
9509
9509
|
id: string;
|
|
9510
9510
|
/** @description First name of the user who deleted the order. */
|
|
9511
|
-
name
|
|
9511
|
+
name?: string | null;
|
|
9512
9512
|
/** @description Last name of the user who deleted the order. */
|
|
9513
|
-
surname
|
|
9513
|
+
surname?: string | null;
|
|
9514
9514
|
};
|
|
9515
9515
|
};
|
|
9516
9516
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6807,7 +6807,7 @@ interface components {
|
|
|
6807
6807
|
/** @description Images extracted from the guide description. */
|
|
6808
6808
|
media: {
|
|
6809
6809
|
/** @description Image height in pixels. */
|
|
6810
|
-
height
|
|
6810
|
+
height?: number;
|
|
6811
6811
|
/** @description Storage key of the image. */
|
|
6812
6812
|
key: string;
|
|
6813
6813
|
/** @description MIME type of the image. */
|
|
@@ -6815,7 +6815,7 @@ interface components {
|
|
|
6815
6815
|
/** @description Public URL of the image. */
|
|
6816
6816
|
url: string;
|
|
6817
6817
|
/** @description Image width in pixels. */
|
|
6818
|
-
width
|
|
6818
|
+
width?: number;
|
|
6819
6819
|
}[];
|
|
6820
6820
|
/** @description Display name of the guide. */
|
|
6821
6821
|
title: string;
|
|
@@ -6853,7 +6853,7 @@ interface components {
|
|
|
6853
6853
|
/** @description Images extracted from the guide description. */
|
|
6854
6854
|
media: {
|
|
6855
6855
|
/** @description Image height in pixels. */
|
|
6856
|
-
height
|
|
6856
|
+
height?: number;
|
|
6857
6857
|
/** @description Storage key of the image. */
|
|
6858
6858
|
key: string;
|
|
6859
6859
|
/** @description MIME type of the image. */
|
|
@@ -6861,7 +6861,7 @@ interface components {
|
|
|
6861
6861
|
/** @description Public URL of the image. */
|
|
6862
6862
|
url: string;
|
|
6863
6863
|
/** @description Image width in pixels. */
|
|
6864
|
-
width
|
|
6864
|
+
width?: number;
|
|
6865
6865
|
}[];
|
|
6866
6866
|
/** @description Display name of the guide. */
|
|
6867
6867
|
title: string;
|
|
@@ -6896,7 +6896,7 @@ interface components {
|
|
|
6896
6896
|
/** @description Images extracted from the guide description. */
|
|
6897
6897
|
media: {
|
|
6898
6898
|
/** @description Image height in pixels. */
|
|
6899
|
-
height
|
|
6899
|
+
height?: number;
|
|
6900
6900
|
/** @description Storage key of the image. */
|
|
6901
6901
|
key: string;
|
|
6902
6902
|
/** @description MIME type of the image. */
|
|
@@ -6904,7 +6904,7 @@ interface components {
|
|
|
6904
6904
|
/** @description Public URL of the image. */
|
|
6905
6905
|
url: string;
|
|
6906
6906
|
/** @description Image width in pixels. */
|
|
6907
|
-
width
|
|
6907
|
+
width?: number;
|
|
6908
6908
|
}[];
|
|
6909
6909
|
/** @description Display name of the guide. */
|
|
6910
6910
|
title: string;
|
|
@@ -9040,9 +9040,9 @@ interface components {
|
|
|
9040
9040
|
*/
|
|
9041
9041
|
id: string;
|
|
9042
9042
|
/** @description First name of the user who deleted the order. */
|
|
9043
|
-
name
|
|
9043
|
+
name?: string | null;
|
|
9044
9044
|
/** @description Last name of the user who deleted the order. */
|
|
9045
|
-
surname
|
|
9045
|
+
surname?: string | null;
|
|
9046
9046
|
};
|
|
9047
9047
|
}[];
|
|
9048
9048
|
/** @description Search query parameters for the next page of results. Includes all filters used to fetch the current page. */
|
|
@@ -9508,9 +9508,9 @@ interface components {
|
|
|
9508
9508
|
*/
|
|
9509
9509
|
id: string;
|
|
9510
9510
|
/** @description First name of the user who deleted the order. */
|
|
9511
|
-
name
|
|
9511
|
+
name?: string | null;
|
|
9512
9512
|
/** @description Last name of the user who deleted the order. */
|
|
9513
|
-
surname
|
|
9513
|
+
surname?: string | null;
|
|
9514
9514
|
};
|
|
9515
9515
|
};
|
|
9516
9516
|
};
|
package/dist/index.js
CHANGED
|
@@ -2080,6 +2080,8 @@ var Spacebring = class {
|
|
|
2080
2080
|
/** Typed openapi-fetch client — escape hatch for endpoints or options the facade does not cover. */
|
|
2081
2081
|
raw;
|
|
2082
2082
|
constructor(config) {
|
|
2083
|
+
const baseUrl = config.baseUrl ?? "https://api.spacebring.com";
|
|
2084
|
+
assertSecureBaseUrl(baseUrl);
|
|
2083
2085
|
const headers = {
|
|
2084
2086
|
Authorization: `Basic ${toBase64(`${config.clientId}:${config.clientSecret}`)}`
|
|
2085
2087
|
};
|
|
@@ -2087,7 +2089,7 @@ var Spacebring = class {
|
|
|
2087
2089
|
headers["spacebring-network-id"] = config.networkId;
|
|
2088
2090
|
}
|
|
2089
2091
|
this.raw = createClient({
|
|
2090
|
-
baseUrl
|
|
2092
|
+
baseUrl,
|
|
2091
2093
|
headers,
|
|
2092
2094
|
fetch: withRetry(config.fetch ?? globalThis.fetch, config.maxRetries ?? 3, config.timeoutMs)
|
|
2093
2095
|
});
|
|
@@ -2156,6 +2158,20 @@ function sleep(ms, signal) {
|
|
|
2156
2158
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
2157
2159
|
});
|
|
2158
2160
|
}
|
|
2161
|
+
function assertSecureBaseUrl(baseUrl) {
|
|
2162
|
+
let url;
|
|
2163
|
+
try {
|
|
2164
|
+
url = new URL(baseUrl);
|
|
2165
|
+
} catch {
|
|
2166
|
+
throw new Error(`Spacebring baseUrl is not a valid URL: ${baseUrl}`);
|
|
2167
|
+
}
|
|
2168
|
+
if (url.protocol === "https:") return;
|
|
2169
|
+
const isLoopback = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]" || url.hostname === "::1";
|
|
2170
|
+
if (url.protocol === "http:" && isLoopback) return;
|
|
2171
|
+
throw new Error(
|
|
2172
|
+
`Spacebring baseUrl must use https (got "${url.protocol}//"): Basic-auth credentials would otherwise be sent in cleartext. Use https, or http only for a loopback host.`
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2159
2175
|
function toBase64(value) {
|
|
2160
2176
|
if (typeof Buffer !== "undefined") {
|
|
2161
2177
|
return Buffer.from(value, "utf8").toString("base64");
|