@juhuu/sdk-ts 1.2.149 → 1.2.151
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -17
- package/dist/index.mjs +20 -17
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -567,7 +567,7 @@ declare class Service {
|
|
567
567
|
url: string;
|
568
568
|
body: undefined;
|
569
569
|
authenticationNotOptional: boolean;
|
570
|
-
},
|
570
|
+
}, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
|
571
571
|
private sendGetRequest;
|
572
572
|
private sendPostRequest;
|
573
573
|
private sendPatchRequest;
|
@@ -2598,6 +2598,7 @@ declare namespace JUHUU {
|
|
2598
2598
|
surveyEnabled: boolean;
|
2599
2599
|
accountingAreaId: string;
|
2600
2600
|
deviceIdArray: string[];
|
2601
|
+
locationAssignmentStrategy: "kochUndPartnerBikeTower" | "none";
|
2601
2602
|
}
|
2602
2603
|
export interface RentableDevice extends Base {
|
2603
2604
|
type: "rentableDevice";
|
package/dist/index.d.ts
CHANGED
@@ -567,7 +567,7 @@ declare class Service {
|
|
567
567
|
url: string;
|
568
568
|
body: undefined;
|
569
569
|
authenticationNotOptional: boolean;
|
570
|
-
},
|
570
|
+
}, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
|
571
571
|
private sendGetRequest;
|
572
572
|
private sendPostRequest;
|
573
573
|
private sendPatchRequest;
|
@@ -2598,6 +2598,7 @@ declare namespace JUHUU {
|
|
2598
2598
|
surveyEnabled: boolean;
|
2599
2599
|
accountingAreaId: string;
|
2600
2600
|
deviceIdArray: string[];
|
2601
|
+
locationAssignmentStrategy: "kochUndPartnerBikeTower" | "none";
|
2601
2602
|
}
|
2602
2603
|
export interface RentableDevice extends Base {
|
2603
2604
|
type: "rentableDevice";
|
package/dist/index.js
CHANGED
@@ -85,45 +85,45 @@ var Service = class {
|
|
85
85
|
method,
|
86
86
|
body = void 0,
|
87
87
|
authenticationNotOptional
|
88
|
-
},
|
89
|
-
const
|
88
|
+
}, requestOptions = {}) {
|
89
|
+
const currentRequestOptions = {
|
90
90
|
...this.defaultRequestOptions,
|
91
|
-
...
|
91
|
+
...requestOptions
|
92
92
|
};
|
93
|
-
if (
|
93
|
+
if (currentRequestOptions.triggerOnException === void 0) {
|
94
94
|
switch (this.authenticationMode) {
|
95
95
|
case "jwt": {
|
96
|
-
|
96
|
+
currentRequestOptions.triggerOnException = true;
|
97
97
|
break;
|
98
98
|
}
|
99
99
|
case "apiKey": {
|
100
|
-
|
100
|
+
currentRequestOptions.triggerOnException = false;
|
101
101
|
break;
|
102
102
|
}
|
103
103
|
}
|
104
104
|
}
|
105
105
|
console.log("authenticationMode", this.authenticationMode);
|
106
|
-
if (
|
106
|
+
if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
|
107
107
|
switch (this.authenticationMode) {
|
108
108
|
case "jwt": {
|
109
|
-
|
109
|
+
currentRequestOptions.refreshTokensIfNecessary = true;
|
110
110
|
break;
|
111
111
|
}
|
112
112
|
case "apiKey": {
|
113
|
-
|
113
|
+
currentRequestOptions.refreshTokensIfNecessary = false;
|
114
114
|
break;
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
118
|
-
console.log("currentOptions",
|
118
|
+
console.log("currentOptions", currentRequestOptions);
|
119
119
|
let token = null;
|
120
120
|
let apiKey = null;
|
121
121
|
switch (this.authenticationMode) {
|
122
122
|
case "jwt": {
|
123
|
-
if (
|
123
|
+
if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
|
124
124
|
token = await this.getAccessToken();
|
125
125
|
} else {
|
126
|
-
token =
|
126
|
+
token = currentRequestOptions.accessToken;
|
127
127
|
}
|
128
128
|
console.log("accessToken:", token);
|
129
129
|
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
@@ -140,10 +140,10 @@ var Service = class {
|
|
140
140
|
break;
|
141
141
|
}
|
142
142
|
case "apiKey": {
|
143
|
-
if (
|
143
|
+
if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
|
144
144
|
apiKey = this.apiKey;
|
145
145
|
} else {
|
146
|
-
apiKey =
|
146
|
+
apiKey = currentRequestOptions.apiKey;
|
147
147
|
}
|
148
148
|
if (apiKey === null) {
|
149
149
|
console.error(
|
@@ -206,9 +206,12 @@ var Service = class {
|
|
206
206
|
statusText: response?.statusText ?? "",
|
207
207
|
status: response?.status ?? 0
|
208
208
|
};
|
209
|
-
console.log(
|
209
|
+
console.log(
|
210
|
+
"refreshTokensIfNecessary",
|
211
|
+
currentRequestOptions.refreshTokensIfNecessary
|
212
|
+
);
|
210
213
|
console.log("responseObject.status", responseObject.status);
|
211
|
-
if (responseObject.status === 403 &&
|
214
|
+
if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
|
212
215
|
console.log("refreshing tokens...");
|
213
216
|
const oldRefreshToken = await this.getRefreshToken();
|
214
217
|
console.log("old refresh token", oldRefreshToken);
|
@@ -265,7 +268,7 @@ var Service = class {
|
|
265
268
|
return responseObject;
|
266
269
|
}
|
267
270
|
}
|
268
|
-
if (
|
271
|
+
if (currentRequestOptions.triggerOnException === true) {
|
269
272
|
await this.onException(responseObject);
|
270
273
|
}
|
271
274
|
} finally {
|
package/dist/index.mjs
CHANGED
@@ -41,45 +41,45 @@ var Service = class {
|
|
41
41
|
method,
|
42
42
|
body = void 0,
|
43
43
|
authenticationNotOptional
|
44
|
-
},
|
45
|
-
const
|
44
|
+
}, requestOptions = {}) {
|
45
|
+
const currentRequestOptions = {
|
46
46
|
...this.defaultRequestOptions,
|
47
|
-
...
|
47
|
+
...requestOptions
|
48
48
|
};
|
49
|
-
if (
|
49
|
+
if (currentRequestOptions.triggerOnException === void 0) {
|
50
50
|
switch (this.authenticationMode) {
|
51
51
|
case "jwt": {
|
52
|
-
|
52
|
+
currentRequestOptions.triggerOnException = true;
|
53
53
|
break;
|
54
54
|
}
|
55
55
|
case "apiKey": {
|
56
|
-
|
56
|
+
currentRequestOptions.triggerOnException = false;
|
57
57
|
break;
|
58
58
|
}
|
59
59
|
}
|
60
60
|
}
|
61
61
|
console.log("authenticationMode", this.authenticationMode);
|
62
|
-
if (
|
62
|
+
if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
|
63
63
|
switch (this.authenticationMode) {
|
64
64
|
case "jwt": {
|
65
|
-
|
65
|
+
currentRequestOptions.refreshTokensIfNecessary = true;
|
66
66
|
break;
|
67
67
|
}
|
68
68
|
case "apiKey": {
|
69
|
-
|
69
|
+
currentRequestOptions.refreshTokensIfNecessary = false;
|
70
70
|
break;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
}
|
74
|
-
console.log("currentOptions",
|
74
|
+
console.log("currentOptions", currentRequestOptions);
|
75
75
|
let token = null;
|
76
76
|
let apiKey = null;
|
77
77
|
switch (this.authenticationMode) {
|
78
78
|
case "jwt": {
|
79
|
-
if (
|
79
|
+
if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
|
80
80
|
token = await this.getAccessToken();
|
81
81
|
} else {
|
82
|
-
token =
|
82
|
+
token = currentRequestOptions.accessToken;
|
83
83
|
}
|
84
84
|
console.log("accessToken:", token);
|
85
85
|
if ((token === null || token === void 0) && authenticationNotOptional === true) {
|
@@ -96,10 +96,10 @@ var Service = class {
|
|
96
96
|
break;
|
97
97
|
}
|
98
98
|
case "apiKey": {
|
99
|
-
if (
|
99
|
+
if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
|
100
100
|
apiKey = this.apiKey;
|
101
101
|
} else {
|
102
|
-
apiKey =
|
102
|
+
apiKey = currentRequestOptions.apiKey;
|
103
103
|
}
|
104
104
|
if (apiKey === null) {
|
105
105
|
console.error(
|
@@ -162,9 +162,12 @@ var Service = class {
|
|
162
162
|
statusText: response?.statusText ?? "",
|
163
163
|
status: response?.status ?? 0
|
164
164
|
};
|
165
|
-
console.log(
|
165
|
+
console.log(
|
166
|
+
"refreshTokensIfNecessary",
|
167
|
+
currentRequestOptions.refreshTokensIfNecessary
|
168
|
+
);
|
166
169
|
console.log("responseObject.status", responseObject.status);
|
167
|
-
if (responseObject.status === 403 &&
|
170
|
+
if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
|
168
171
|
console.log("refreshing tokens...");
|
169
172
|
const oldRefreshToken = await this.getRefreshToken();
|
170
173
|
console.log("old refresh token", oldRefreshToken);
|
@@ -221,7 +224,7 @@ var Service = class {
|
|
221
224
|
return responseObject;
|
222
225
|
}
|
223
226
|
}
|
224
|
-
if (
|
227
|
+
if (currentRequestOptions.triggerOnException === true) {
|
225
228
|
await this.onException(responseObject);
|
226
229
|
}
|
227
230
|
} finally {
|