@betterstore/sdk 0.3.81 → 0.3.82
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/CHANGELOG.md +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
|
|
3
|
-
declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
|
|
3
|
+
declare const createApiClient: (apiKey: string, proxy?: string, returnError?: boolean) => axios.AxiosInstance;
|
|
4
4
|
|
|
5
5
|
type ShippingRate = ZasilkovnaRate;
|
|
6
6
|
interface BaseRate {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as axios from 'axios';
|
|
2
2
|
|
|
3
|
-
declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
|
|
3
|
+
declare const createApiClient: (apiKey: string, proxy?: string, returnError?: boolean) => axios.AxiosInstance;
|
|
4
4
|
|
|
5
5
|
type ShippingRate = ZasilkovnaRate;
|
|
6
6
|
interface BaseRate {
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
59
59
|
// src/utils/axios.ts
|
|
60
60
|
var import_axios = __toESM(require("axios"));
|
|
61
61
|
var API_BASE_URL = "https://api.betterstore.io/v1";
|
|
62
|
-
var createApiClient = (apiKey, proxy) => {
|
|
62
|
+
var createApiClient = (apiKey, proxy, returnError) => {
|
|
63
63
|
const client = import_axios.default.create({
|
|
64
64
|
baseURL: proxy != null ? proxy : API_BASE_URL,
|
|
65
65
|
headers: {
|
|
@@ -94,6 +94,9 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
94
94
|
apiError.code = "REQUEST_SETUP_ERROR";
|
|
95
95
|
apiError.details = error;
|
|
96
96
|
}
|
|
97
|
+
if (returnError) {
|
|
98
|
+
return apiError;
|
|
99
|
+
}
|
|
97
100
|
throw apiError;
|
|
98
101
|
}
|
|
99
102
|
);
|
|
@@ -139,7 +142,7 @@ var OTP = class {
|
|
|
139
142
|
// src/auth/index.ts
|
|
140
143
|
var Auth = class {
|
|
141
144
|
constructor(apiKey, proxy) {
|
|
142
|
-
this.apiClient = createApiClient(apiKey, proxy);
|
|
145
|
+
this.apiClient = createApiClient(apiKey, proxy, true);
|
|
143
146
|
this.otp = new OTP(this.apiClient);
|
|
144
147
|
}
|
|
145
148
|
retrieveSession(id) {
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
22
22
|
// src/utils/axios.ts
|
|
23
23
|
import axios from "axios";
|
|
24
24
|
var API_BASE_URL = "https://api.betterstore.io/v1";
|
|
25
|
-
var createApiClient = (apiKey, proxy) => {
|
|
25
|
+
var createApiClient = (apiKey, proxy, returnError) => {
|
|
26
26
|
const client = axios.create({
|
|
27
27
|
baseURL: proxy != null ? proxy : API_BASE_URL,
|
|
28
28
|
headers: {
|
|
@@ -57,6 +57,9 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
57
57
|
apiError.code = "REQUEST_SETUP_ERROR";
|
|
58
58
|
apiError.details = error;
|
|
59
59
|
}
|
|
60
|
+
if (returnError) {
|
|
61
|
+
return apiError;
|
|
62
|
+
}
|
|
60
63
|
throw apiError;
|
|
61
64
|
}
|
|
62
65
|
);
|
|
@@ -102,7 +105,7 @@ var OTP = class {
|
|
|
102
105
|
// src/auth/index.ts
|
|
103
106
|
var Auth = class {
|
|
104
107
|
constructor(apiKey, proxy) {
|
|
105
|
-
this.apiClient = createApiClient(apiKey, proxy);
|
|
108
|
+
this.apiClient = createApiClient(apiKey, proxy, true);
|
|
106
109
|
this.otp = new OTP(this.apiClient);
|
|
107
110
|
}
|
|
108
111
|
retrieveSession(id) {
|