@emilgroup/document-sdk 1.38.0 → 1.38.1-beta.1

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 CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/document-sdk@1.38.0 --save
20
+ npm install @emilgroup/document-sdk@1.38.1-beta.1 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/document-sdk@1.38.0
24
+ yarn add @emilgroup/document-sdk@1.38.1-beta.1
25
25
  ```
26
26
 
27
27
  And then you can import `DocumentsApi`.
package/common.ts CHANGED
@@ -65,7 +65,7 @@ export const setBearerAuthToObject = async function (object: any, configuration?
65
65
  const accessToken = typeof configuration.accessToken === 'function'
66
66
  ? await configuration.accessToken()
67
67
  : await configuration.accessToken;
68
- object["Authorization"] = "Bearer " + accessToken;
68
+ object["Authorization"] = configuration.getBearerToken(accessToken);
69
69
  }
70
70
  }
71
71
 
@@ -78,7 +78,7 @@ export const setOAuthToObject = async function (object: any, name: string, scope
78
78
  const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
79
79
  ? await configuration.accessToken(name, scopes)
80
80
  : await configuration.accessToken;
81
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
81
+ object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
82
82
  }
83
83
  }
84
84
 
package/configuration.ts CHANGED
@@ -98,4 +98,13 @@ export class Configuration {
98
98
  const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
99
99
  return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
100
100
  }
101
+
102
+ /**
103
+ * Returns "Bearer" token.
104
+ * @param token - access token.
105
+ * @return Bearer token.
106
+ */
107
+ public getBearerToken(token?: string): string {
108
+ return ('' + token).startsWith("Bearer") ? token : "Bearer " + token;
109
+ }
101
110
  }
package/dist/common.js CHANGED
@@ -140,7 +140,7 @@ var setBearerAuthToObject = function (object, configuration) {
140
140
  _b.label = 4;
141
141
  case 4:
142
142
  accessToken = _a;
143
- object["Authorization"] = "Bearer " + accessToken;
143
+ object["Authorization"] = configuration.getBearerToken(accessToken);
144
144
  _b.label = 5;
145
145
  case 5: return [2 /*return*/];
146
146
  }
@@ -170,7 +170,7 @@ var setOAuthToObject = function (object, name, scopes, configuration) {
170
170
  _b.label = 4;
171
171
  case 4:
172
172
  localVarAccessTokenValue = _a;
173
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
173
+ object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
174
174
  _b.label = 5;
175
175
  case 5: return [2 /*return*/];
176
176
  }
@@ -80,4 +80,10 @@ export declare class Configuration {
80
80
  * @return True if the given MIME is JSON, false otherwise.
81
81
  */
82
82
  isJsonMime(mime: string): boolean;
83
+ /**
84
+ * Returns "Bearer" token.
85
+ * @param token - access token.
86
+ * @return Bearer token.
87
+ */
88
+ getBearerToken(token?: string): string;
83
89
  }
@@ -39,6 +39,14 @@ var Configuration = /** @class */ (function () {
39
39
  var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
40
40
  return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
41
41
  };
42
+ /**
43
+ * Returns "Bearer" token.
44
+ * @param token - access token.
45
+ * @return Bearer token.
46
+ */
47
+ Configuration.prototype.getBearerToken = function (token) {
48
+ return ('' + token).startsWith("Bearer") ? token : "Bearer " + token;
49
+ };
42
50
  return Configuration;
43
51
  }());
44
52
  exports.Configuration = Configuration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/document-sdk",
3
- "version": "1.38.0",
3
+ "version": "1.38.1-beta.1",
4
4
  "description": "OpenAPI client for @emilgroup/document-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [