@juhuu/sdk-ts 1.2.150 → 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 CHANGED
@@ -567,7 +567,7 @@ declare class Service {
567
567
  url: string;
568
568
  body: undefined;
569
569
  authenticationNotOptional: boolean;
570
- }, options?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
570
+ }, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
571
571
  private sendGetRequest;
572
572
  private sendPostRequest;
573
573
  private sendPatchRequest;
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
- }, options?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
570
+ }, requestOptions?: JUHUU.RequestOptions): Promise<JUHUU.HttpResponse<T>>;
571
571
  private sendGetRequest;
572
572
  private sendPostRequest;
573
573
  private sendPatchRequest;
package/dist/index.js CHANGED
@@ -85,45 +85,45 @@ var Service = class {
85
85
  method,
86
86
  body = void 0,
87
87
  authenticationNotOptional
88
- }, options = {}) {
89
- const currentOptions = {
88
+ }, requestOptions = {}) {
89
+ const currentRequestOptions = {
90
90
  ...this.defaultRequestOptions,
91
- ...options
91
+ ...requestOptions
92
92
  };
93
- if (currentOptions.triggerOnException === void 0) {
93
+ if (currentRequestOptions.triggerOnException === void 0) {
94
94
  switch (this.authenticationMode) {
95
95
  case "jwt": {
96
- currentOptions.triggerOnException = true;
96
+ currentRequestOptions.triggerOnException = true;
97
97
  break;
98
98
  }
99
99
  case "apiKey": {
100
- currentOptions.triggerOnException = false;
100
+ currentRequestOptions.triggerOnException = false;
101
101
  break;
102
102
  }
103
103
  }
104
104
  }
105
105
  console.log("authenticationMode", this.authenticationMode);
106
- if (currentOptions.refreshTokensIfNecessary === void 0) {
106
+ if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
107
107
  switch (this.authenticationMode) {
108
108
  case "jwt": {
109
- currentOptions.refreshTokensIfNecessary = true;
109
+ currentRequestOptions.refreshTokensIfNecessary = true;
110
110
  break;
111
111
  }
112
112
  case "apiKey": {
113
- currentOptions.refreshTokensIfNecessary = false;
113
+ currentRequestOptions.refreshTokensIfNecessary = false;
114
114
  break;
115
115
  }
116
116
  }
117
117
  }
118
- console.log("currentOptions", 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 (currentOptions.accessToken === void 0 || currentOptions.accessToken === null) {
123
+ if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
124
124
  token = await this.getAccessToken();
125
125
  } else {
126
- token = currentOptions.accessToken;
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 (currentOptions.apiKey === void 0 || currentOptions.apiKey === null) {
143
+ if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
144
144
  apiKey = this.apiKey;
145
145
  } else {
146
- apiKey = currentOptions.apiKey;
146
+ apiKey = currentRequestOptions.apiKey;
147
147
  }
148
148
  if (apiKey === null) {
149
149
  console.error(
@@ -208,10 +208,10 @@ var Service = class {
208
208
  };
209
209
  console.log(
210
210
  "refreshTokensIfNecessary",
211
- currentOptions.refreshTokensIfNecessary
211
+ currentRequestOptions.refreshTokensIfNecessary
212
212
  );
213
213
  console.log("responseObject.status", responseObject.status);
214
- if (responseObject.status === 403 && currentOptions.refreshTokensIfNecessary === true) {
214
+ if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
215
215
  console.log("refreshing tokens...");
216
216
  const oldRefreshToken = await this.getRefreshToken();
217
217
  console.log("old refresh token", oldRefreshToken);
@@ -268,7 +268,7 @@ var Service = class {
268
268
  return responseObject;
269
269
  }
270
270
  }
271
- if (options.triggerOnException === true) {
271
+ if (currentRequestOptions.triggerOnException === true) {
272
272
  await this.onException(responseObject);
273
273
  }
274
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
- }, options = {}) {
45
- const currentOptions = {
44
+ }, requestOptions = {}) {
45
+ const currentRequestOptions = {
46
46
  ...this.defaultRequestOptions,
47
- ...options
47
+ ...requestOptions
48
48
  };
49
- if (currentOptions.triggerOnException === void 0) {
49
+ if (currentRequestOptions.triggerOnException === void 0) {
50
50
  switch (this.authenticationMode) {
51
51
  case "jwt": {
52
- currentOptions.triggerOnException = true;
52
+ currentRequestOptions.triggerOnException = true;
53
53
  break;
54
54
  }
55
55
  case "apiKey": {
56
- currentOptions.triggerOnException = false;
56
+ currentRequestOptions.triggerOnException = false;
57
57
  break;
58
58
  }
59
59
  }
60
60
  }
61
61
  console.log("authenticationMode", this.authenticationMode);
62
- if (currentOptions.refreshTokensIfNecessary === void 0) {
62
+ if (currentRequestOptions.refreshTokensIfNecessary === void 0) {
63
63
  switch (this.authenticationMode) {
64
64
  case "jwt": {
65
- currentOptions.refreshTokensIfNecessary = true;
65
+ currentRequestOptions.refreshTokensIfNecessary = true;
66
66
  break;
67
67
  }
68
68
  case "apiKey": {
69
- currentOptions.refreshTokensIfNecessary = false;
69
+ currentRequestOptions.refreshTokensIfNecessary = false;
70
70
  break;
71
71
  }
72
72
  }
73
73
  }
74
- console.log("currentOptions", 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 (currentOptions.accessToken === void 0 || currentOptions.accessToken === null) {
79
+ if (currentRequestOptions.accessToken === void 0 || currentRequestOptions.accessToken === null) {
80
80
  token = await this.getAccessToken();
81
81
  } else {
82
- token = currentOptions.accessToken;
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 (currentOptions.apiKey === void 0 || currentOptions.apiKey === null) {
99
+ if (currentRequestOptions.apiKey === void 0 || currentRequestOptions.apiKey === null) {
100
100
  apiKey = this.apiKey;
101
101
  } else {
102
- apiKey = currentOptions.apiKey;
102
+ apiKey = currentRequestOptions.apiKey;
103
103
  }
104
104
  if (apiKey === null) {
105
105
  console.error(
@@ -164,10 +164,10 @@ var Service = class {
164
164
  };
165
165
  console.log(
166
166
  "refreshTokensIfNecessary",
167
- currentOptions.refreshTokensIfNecessary
167
+ currentRequestOptions.refreshTokensIfNecessary
168
168
  );
169
169
  console.log("responseObject.status", responseObject.status);
170
- if (responseObject.status === 403 && currentOptions.refreshTokensIfNecessary === true) {
170
+ if (responseObject.status === 403 && currentRequestOptions.refreshTokensIfNecessary === true) {
171
171
  console.log("refreshing tokens...");
172
172
  const oldRefreshToken = await this.getRefreshToken();
173
173
  console.log("old refresh token", oldRefreshToken);
@@ -224,7 +224,7 @@ var Service = class {
224
224
  return responseObject;
225
225
  }
226
226
  }
227
- if (options.triggerOnException === true) {
227
+ if (currentRequestOptions.triggerOnException === true) {
228
228
  await this.onException(responseObject);
229
229
  }
230
230
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juhuu/sdk-ts",
3
- "version": "1.2.150",
3
+ "version": "1.2.151",
4
4
  "description": "Typescript wrapper for JUHUU services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",