@emilgroup/translation-sdk 1.0.1-beta.4 → 1.1.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/dist/base.d.ts CHANGED
@@ -24,22 +24,12 @@ export declare const COLLECTION_FORMATS: {
24
24
  };
25
25
  export interface LoginClass {
26
26
  accessToken: string;
27
- permissions: string;
28
- }
29
- export interface SwitchWorkspaceRequest {
30
- username: string;
31
- targetWorkspace: string;
32
- }
33
- export interface SwitchWorkspaceResponseClass {
34
- accessToken: string;
35
- permissions: string;
27
+ permissions: Array<string>;
36
28
  }
37
29
  export declare enum Environment {
38
30
  Production = "https://apiv2.emil.de",
39
31
  Test = "https://apiv2-test.emil.de",
40
- Staging = "https://apiv2-staging.emil.de",
41
- Development = "https://apiv2-dev.emil.de",
42
- ProductionZurich = "https://eu-central-2.apiv2.emil.de"
32
+ Development = "https://apiv2-dev.emil.de"
43
33
  }
44
34
  export declare function resetRetry(): void;
45
35
  /**
@@ -59,18 +49,19 @@ export interface RequestArgs {
59
49
  export declare class BaseAPI {
60
50
  protected basePath: string;
61
51
  protected axios: AxiosInstance;
62
- protected configuration: Configuration | undefined;
63
- private tokenData?;
52
+ protected configuration: Configuration;
53
+ private username?;
54
+ private password?;
64
55
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
56
+ initialize(env?: Environment): Promise<void>;
57
+ private loadCredentials;
58
+ private readConfigFile;
59
+ private readEnvVariables;
65
60
  selectEnvironment(env: Environment): void;
66
- selectBasePath(path: string): void;
67
- getPermissions(): Array<string>;
68
- authorize(username: string, password: string, targetWorkspace?: string): Promise<void>;
69
- switchWorkspace(targetWorkspace: string): Promise<void>;
70
- refreshTokenInternal(): Promise<LoginClass>;
71
- private storeTokenData;
72
- loadTokenData(): void;
73
- cleanTokenData(): void;
61
+ authorize(username: string, password: string): Promise<void>;
62
+ refreshTokenInternal(): Promise<string>;
63
+ private extractRefreshToken;
64
+ getConfiguration(): Configuration;
74
65
  private attachInterceptor;
75
66
  }
76
67
  /**
package/dist/base.js CHANGED
@@ -38,6 +38,29 @@ var __assign = (this && this.__assign) || function () {
38
38
  };
39
39
  return __assign.apply(this, arguments);
40
40
  };
41
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ var desc = Object.getOwnPropertyDescriptor(m, k);
44
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
+ desc = { enumerable: true, get: function() { return m[k]; } };
46
+ }
47
+ Object.defineProperty(o, k2, desc);
48
+ }) : (function(o, m, k, k2) {
49
+ if (k2 === undefined) k2 = k;
50
+ o[k2] = m[k];
51
+ }));
52
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
53
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
54
+ }) : function(o, v) {
55
+ o["default"] = v;
56
+ });
57
+ var __importStar = (this && this.__importStar) || function (mod) {
58
+ if (mod && mod.__esModule) return mod;
59
+ var result = {};
60
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
61
+ __setModuleDefault(result, mod);
62
+ return result;
63
+ };
41
64
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
65
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
66
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -80,11 +103,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
80
103
  Object.defineProperty(exports, "__esModule", { value: true });
81
104
  exports.RequiredError = exports.BaseAPI = exports.resetRetry = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
82
105
  var configuration_1 = require("./configuration");
83
- var common_1 = require("./common");
84
106
  // Some imports not used depending on template conditions
85
107
  // @ts-ignore
86
108
  var axios_1 = __importDefault(require("axios"));
109
+ var fs = __importStar(require("fs"));
110
+ var path = __importStar(require("path"));
111
+ var os = __importStar(require("os"));
87
112
  exports.BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
113
+ var CONFIG_DIRECTORY = '.emil';
114
+ var CONFIG_FILENAME = 'credentials';
115
+ var KEY_USERNAME = 'emil_username';
116
+ var KEY_PASSWORD = 'emil_password';
117
+ var filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
88
118
  /**
89
119
  *
90
120
  * @export
@@ -99,9 +129,7 @@ var Environment;
99
129
  (function (Environment) {
100
130
  Environment["Production"] = "https://apiv2.emil.de";
101
131
  Environment["Test"] = "https://apiv2-test.emil.de";
102
- Environment["Staging"] = "https://apiv2-staging.emil.de";
103
132
  Environment["Development"] = "https://apiv2-dev.emil.de";
104
- Environment["ProductionZurich"] = "https://eu-central-2.apiv2.emil.de";
105
133
  })(Environment = exports.Environment || (exports.Environment = {}));
106
134
  var _retry_count = 0;
107
135
  var _retry = null;
@@ -110,7 +138,6 @@ function resetRetry() {
110
138
  }
111
139
  exports.resetRetry = resetRetry;
112
140
  var NETWORK_ERROR_MESSAGE = "Network Error";
113
- var TOKEN_DATA = 'APP_TOKEN';
114
141
  /**
115
142
  *
116
143
  * @export
@@ -122,105 +149,122 @@ var BaseAPI = /** @class */ (function () {
122
149
  if (axios === void 0) { axios = axios_1.default; }
123
150
  this.basePath = basePath;
124
151
  this.axios = axios;
125
- this.loadTokenData();
126
152
  if (configuration) {
127
- var accessToken = this.tokenData.accessToken;
128
153
  this.configuration = configuration;
129
154
  this.basePath = configuration.basePath || this.basePath;
130
- // Use config token if provided, otherwise use tokenData token
131
- var configToken = this.configuration.accessToken;
132
- var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
133
- this.configuration.accessToken = configToken || storedToken;
134
155
  }
135
156
  else {
136
- var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
137
157
  this.configuration = new configuration_1.Configuration({
138
158
  basePath: this.basePath,
139
- accessToken: accessToken ? "Bearer ".concat(accessToken) : '',
140
- username: username,
141
159
  });
142
160
  }
143
161
  this.attachInterceptor(axios);
144
162
  }
145
- BaseAPI.prototype.selectEnvironment = function (env) {
146
- this.selectBasePath(env);
147
- };
148
- BaseAPI.prototype.selectBasePath = function (path) {
149
- this.configuration.basePath = path;
150
- };
151
- BaseAPI.prototype.getPermissions = function () {
152
- var _a;
153
- if (!((_a = this.tokenData) === null || _a === void 0 ? void 0 : _a.permissions)) {
154
- return [];
155
- }
156
- return this.tokenData.permissions.split(',');
163
+ BaseAPI.prototype.initialize = function (env) {
164
+ if (env === void 0) { env = Environment.Production; }
165
+ return __awaiter(this, void 0, void 0, function () {
166
+ return __generator(this, function (_a) {
167
+ switch (_a.label) {
168
+ case 0:
169
+ this.configuration.basePath = env;
170
+ return [4 /*yield*/, this.loadCredentials()];
171
+ case 1:
172
+ _a.sent();
173
+ if (!this.username) return [3 /*break*/, 3];
174
+ return [4 /*yield*/, this.authorize(this.username, this.password)];
175
+ case 2:
176
+ _a.sent();
177
+ this.password = null; // to avoid keeping password loaded in memory.
178
+ _a.label = 3;
179
+ case 3: return [2 /*return*/];
180
+ }
181
+ });
182
+ });
157
183
  };
158
- BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
184
+ BaseAPI.prototype.loadCredentials = function () {
159
185
  return __awaiter(this, void 0, void 0, function () {
160
- var options, response, _a, accessToken, permissions;
161
- return __generator(this, function (_b) {
162
- switch (_b.label) {
186
+ var error_1;
187
+ return __generator(this, function (_a) {
188
+ switch (_a.label) {
163
189
  case 0:
164
- options = {
165
- method: 'POST',
166
- url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
167
- headers: { 'Content-Type': 'application/json' },
168
- data: {
169
- username: username,
170
- password: password,
171
- },
172
- withCredentials: true,
173
- };
174
- return [4 /*yield*/, axios_1.default.request(options)];
190
+ _a.trys.push([0, 2, , 3]);
191
+ return [4 /*yield*/, this.readConfigFile()];
175
192
  case 1:
176
- response = _b.sent();
177
- _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
178
- this.configuration.username = username;
179
- this.configuration.accessToken = "Bearer ".concat(accessToken);
180
- this.tokenData.username = username;
181
- this.tokenData.accessToken = accessToken;
182
- this.tokenData.permissions = permissions;
183
- if (!targetWorkspace) return [3 /*break*/, 3];
184
- return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
193
+ _a.sent();
194
+ return [3 /*break*/, 3];
185
195
  case 2:
186
- _b.sent();
187
- return [3 /*break*/, 4];
196
+ error_1 = _a.sent();
197
+ console.warn("No credentials file found. Check that ".concat(filePath, " exists."));
198
+ return [3 /*break*/, 3];
188
199
  case 3:
189
- // Only store if no workspace switch (since switchWorkspace will store after switching)
190
- this.storeTokenData(__assign({}, this.tokenData));
191
- _b.label = 4;
192
- case 4: return [2 /*return*/];
200
+ this.readEnvVariables();
201
+ if (!this.username) {
202
+ console.info("No credentials found in credentials file or environment variables. Either provide some or use \n authorize() function.");
203
+ }
204
+ return [2 /*return*/];
193
205
  }
194
206
  });
195
207
  });
196
208
  };
197
- BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
209
+ BaseAPI.prototype.readConfigFile = function () {
198
210
  return __awaiter(this, void 0, void 0, function () {
199
- var options, response, _a, accessToken, permissions;
200
- return __generator(this, function (_b) {
201
- switch (_b.label) {
211
+ var file, lines;
212
+ var _this = this;
213
+ return __generator(this, function (_a) {
214
+ switch (_a.label) {
215
+ case 0: return [4 /*yield*/, fs.promises.readFile(filePath, 'utf-8')];
216
+ case 1:
217
+ file = _a.sent();
218
+ lines = file.split(os.EOL)
219
+ .filter(Boolean);
220
+ lines.forEach(function (line) {
221
+ if (line.startsWith(KEY_USERNAME)) {
222
+ _this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
223
+ }
224
+ else if (line.startsWith(KEY_PASSWORD)) {
225
+ _this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
226
+ }
227
+ });
228
+ return [2 /*return*/];
229
+ }
230
+ });
231
+ });
232
+ };
233
+ BaseAPI.prototype.readEnvVariables = function () {
234
+ if (process.env.EMIL_USERNAME) {
235
+ this.username = process.env.EMIL_USERNAME;
236
+ this.password = process.env.EMIL_PASSWORD || '';
237
+ return true;
238
+ }
239
+ return false;
240
+ };
241
+ BaseAPI.prototype.selectEnvironment = function (env) {
242
+ this.configuration.basePath = env;
243
+ };
244
+ BaseAPI.prototype.authorize = function (username, password) {
245
+ return __awaiter(this, void 0, void 0, function () {
246
+ var options, response, accessToken, refreshToken;
247
+ return __generator(this, function (_a) {
248
+ switch (_a.label) {
202
249
  case 0:
203
250
  options = {
204
251
  method: 'POST',
205
- url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
206
- headers: {
207
- 'Content-Type': 'application/json',
208
- 'Authorization': "Bearer ".concat(this.configuration.accessToken),
209
- },
252
+ url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
253
+ headers: { 'Content-Type': 'application/json' },
210
254
  data: {
211
- username: this.configuration.username,
212
- targetWorkspace: targetWorkspace,
255
+ username: username,
256
+ password: password,
213
257
  },
214
258
  withCredentials: true,
215
259
  };
216
260
  return [4 /*yield*/, axios_1.default.request(options)];
217
261
  case 1:
218
- response = _b.sent();
219
- _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
262
+ response = _a.sent();
263
+ accessToken = response.data.accessToken;
264
+ this.configuration.username = username;
220
265
  this.configuration.accessToken = "Bearer ".concat(accessToken);
221
- this.tokenData.accessToken = accessToken;
222
- this.tokenData.permissions = permissions;
223
- this.storeTokenData(__assign({}, this.tokenData));
266
+ refreshToken = this.extractRefreshToken(response);
267
+ this.configuration.refreshToken = refreshToken;
224
268
  return [2 /*return*/];
225
269
  }
226
270
  });
@@ -228,111 +272,95 @@ var BaseAPI = /** @class */ (function () {
228
272
  };
229
273
  BaseAPI.prototype.refreshTokenInternal = function () {
230
274
  return __awaiter(this, void 0, void 0, function () {
231
- var username, refreshTokenAxios, options, response;
232
- var _this = this;
233
- return __generator(this, function (_a) {
234
- switch (_a.label) {
275
+ var _a, username, refreshToken, options, accessToken;
276
+ return __generator(this, function (_b) {
277
+ switch (_b.label) {
235
278
  case 0:
236
- username = this.configuration.username;
237
- if (!username) {
238
- throw new Error('Failed to refresh token.');
279
+ _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
280
+ if (!username || !refreshToken) {
281
+ return [2 /*return*/, ''];
239
282
  }
240
- refreshTokenAxios = axios_1.default.create();
241
- refreshTokenAxios.interceptors.response.use(function (response) {
242
- var permissions = response.data.permissions;
243
- _this.tokenData.permissions = permissions;
244
- _this.storeTokenData(_this.tokenData);
245
- return response;
246
- });
247
283
  options = {
248
284
  method: 'POST',
249
285
  url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
250
286
  headers: {
251
287
  'Content-Type': 'application/json',
288
+ Cookie: refreshToken,
252
289
  },
253
290
  data: { username: username },
254
291
  withCredentials: true,
255
292
  };
256
- return [4 /*yield*/, refreshTokenAxios.request(options)];
293
+ return [4 /*yield*/, axios_1.default.request(options)];
257
294
  case 1:
258
- response = _a.sent();
259
- return [2 /*return*/, response.data];
295
+ accessToken = (_b.sent()).data.accessToken;
296
+ return [2 /*return*/, accessToken];
260
297
  }
261
298
  });
262
299
  });
263
300
  };
264
- BaseAPI.prototype.storeTokenData = function (tokenData) {
265
- if (typeof window !== 'undefined') {
266
- (0, common_1.defaultStorage)().set(TOKEN_DATA, tokenData);
267
- }
268
- };
269
- BaseAPI.prototype.loadTokenData = function () {
270
- if (typeof window !== 'undefined') {
271
- this.tokenData = (0, common_1.defaultStorage)().get(TOKEN_DATA) || {};
272
- }
273
- else {
274
- this.tokenData = {};
301
+ BaseAPI.prototype.extractRefreshToken = function (response) {
302
+ if (response.headers && response.headers['set-cookie']
303
+ && response.headers['set-cookie'].length > 0) {
304
+ return "".concat(response.headers['set-cookie'][0].split(';')[0], ";");
275
305
  }
306
+ return '';
276
307
  };
277
- BaseAPI.prototype.cleanTokenData = function () {
278
- this.storeTokenData(null);
308
+ BaseAPI.prototype.getConfiguration = function () {
309
+ return this.configuration;
279
310
  };
280
311
  BaseAPI.prototype.attachInterceptor = function (axios) {
281
312
  var _this = this;
282
313
  axios.interceptors.response.use(function (res) {
283
314
  return res;
284
315
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
285
- var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
286
- return __generator(this, function (_c) {
287
- switch (_c.label) {
316
+ var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
317
+ return __generator(this, function (_a) {
318
+ switch (_a.label) {
288
319
  case 0:
289
320
  originalConfig = err.config;
290
- if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
291
- if (!((err.response.status === 401 || err.response.status === 403)
292
- && !originalConfig._retry)) return [3 /*break*/, 4];
321
+ if (!err.response) return [3 /*break*/, 5];
322
+ if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
293
323
  originalConfig._retry = true;
294
- _c.label = 1;
324
+ _a.label = 1;
295
325
  case 1:
296
- _c.trys.push([1, 3, , 4]);
326
+ _a.trys.push([1, 3, , 4]);
297
327
  return [4 /*yield*/, this.refreshTokenInternal()];
298
328
  case 2:
299
- _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
329
+ tokenString = _a.sent();
300
330
  accessToken = "Bearer ".concat(tokenString);
301
- this.tokenData.permissions = permissions;
302
- delete originalConfig.headers['Authorization'];
303
- originalConfig.headers['Authorization'] = accessToken;
331
+ originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
304
332
  this.configuration.accessToken = accessToken;
305
- this.tokenData.accessToken = tokenString;
306
- this.storeTokenData(this.tokenData);
307
- return [2 /*return*/, axios(originalConfig)];
333
+ return [2 /*return*/, axios.request(originalConfig)];
308
334
  case 3:
309
- _error_1 = _c.sent();
335
+ _error_1 = _a.sent();
310
336
  if (_error_1.response && _error_1.response.data) {
311
337
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
312
338
  }
313
339
  return [2 /*return*/, Promise.reject(_error_1)];
314
- case 4: return [3 /*break*/, 9];
340
+ case 4:
341
+ if (err.response.status === 403 && err.response.data) {
342
+ return [2 /*return*/, Promise.reject(err.response.data)];
343
+ }
344
+ return [3 /*break*/, 9];
315
345
  case 5:
316
346
  if (!(err.message === NETWORK_ERROR_MESSAGE
347
+ && err.isAxiosError
317
348
  && originalConfig.headers.hasOwnProperty('Authorization')
318
349
  && _retry_count < 4)) return [3 /*break*/, 9];
319
350
  _retry_count++;
320
- _c.label = 6;
351
+ _a.label = 6;
321
352
  case 6:
322
- _c.trys.push([6, 8, , 9]);
353
+ _a.trys.push([6, 8, , 9]);
323
354
  return [4 /*yield*/, this.refreshTokenInternal()];
324
355
  case 7:
325
- _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
356
+ tokenString = _a.sent();
326
357
  accessToken = "Bearer ".concat(tokenString);
327
- this.tokenData.permissions = permissions;
328
358
  _retry = true;
329
359
  originalConfig.headers['Authorization'] = accessToken;
330
360
  this.configuration.accessToken = accessToken;
331
- this.tokenData.accessToken = tokenString;
332
- this.storeTokenData(this.tokenData);
333
361
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
334
362
  case 8:
335
- _error_2 = _c.sent();
363
+ _error_2 = _a.sent();
336
364
  if (_error_2.response && _error_2.response.data) {
337
365
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
338
366
  }
package/dist/common.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  import { Configuration } from "./configuration";
13
13
  import { RequestArgs } from "./base";
14
14
  import { AxiosInstance, AxiosResponse } from 'axios';
15
+ import { URL } from 'url';
15
16
  /**
16
17
  *
17
18
  * @export
package/dist/common.js CHANGED
@@ -62,6 +62,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.defaultStorage = exports.LocalStorage = exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
64
64
  var base_1 = require("./base");
65
+ var url_1 = require("url");
65
66
  /**
66
67
  *
67
68
  * @export
@@ -140,7 +141,7 @@ var setBearerAuthToObject = function (object, configuration) {
140
141
  _b.label = 4;
141
142
  case 4:
142
143
  accessToken = _a;
143
- object["Authorization"] = configuration.getBearerToken(accessToken);
144
+ object["Authorization"] = "Bearer " + accessToken;
144
145
  _b.label = 5;
145
146
  case 5: return [2 /*return*/];
146
147
  }
@@ -170,7 +171,7 @@ var setOAuthToObject = function (object, name, scopes, configuration) {
170
171
  _b.label = 4;
171
172
  case 4:
172
173
  localVarAccessTokenValue = _a;
173
- object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
174
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
174
175
  _b.label = 5;
175
176
  case 5: return [2 /*return*/];
176
177
  }
@@ -187,7 +188,7 @@ var setSearchParams = function (url) {
187
188
  for (var _i = 1; _i < arguments.length; _i++) {
188
189
  objects[_i - 1] = arguments[_i];
189
190
  }
190
- var searchParams = new URLSearchParams(url.search);
191
+ var searchParams = new url_1.URLSearchParams(url.search);
191
192
  for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
192
193
  var object = objects_1[_a];
193
194
  for (var key in object) {
@@ -68,6 +68,13 @@ export declare class Configuration {
68
68
  * @type {new () => FormData}
69
69
  */
70
70
  formDataCtor?: new () => any;
71
+ /**
72
+ * parameter for automatically refreshing access token for oauth2 security
73
+ *
74
+ * @type {string}
75
+ * @memberof Configuration
76
+ */
77
+ refreshToken?: string;
71
78
  constructor(param?: ConfigurationParameters);
72
79
  /**
73
80
  * Check if the given MIME is a JSON MIME.
@@ -80,10 +87,4 @@ export declare class Configuration {
80
87
  * @return True if the given MIME is JSON, false otherwise.
81
88
  */
82
89
  isJsonMime(mime: string): boolean;
83
- /**
84
- * Returns "Bearer" token.
85
- * @param token - access token.
86
- * @return Bearer token.
87
- */
88
- getBearerToken(token?: string): string;
89
90
  }
@@ -39,14 +39,6 @@ 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
- };
50
42
  return Configuration;
51
43
  }());
52
44
  exports.Configuration = Configuration;
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export interface CreateProductLanguageRequestDto {
18
18
  /**
19
- * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
19
+ * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
20
20
  * @type {string}
21
21
  * @memberof CreateProductLanguageRequestDto
22
22
  */
@@ -1,8 +1,6 @@
1
1
  export * from './create-product-language-request-dto';
2
2
  export * from './create-product-language-response-class';
3
3
  export * from './get-product-language-response-class';
4
- export * from './inline-response200';
5
- export * from './inline-response503';
6
4
  export * from './list-product-languages-response-class';
7
5
  export * from './list-translations-response-class';
8
6
  export * from './product-language-class';
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-product-language-request-dto"), exports);
18
18
  __exportStar(require("./create-product-language-response-class"), exports);
19
19
  __exportStar(require("./get-product-language-response-class"), exports);
20
- __exportStar(require("./inline-response200"), exports);
21
- __exportStar(require("./inline-response503"), exports);
22
20
  __exportStar(require("./list-product-languages-response-class"), exports);
23
21
  __exportStar(require("./list-translations-response-class"), exports);
24
22
  __exportStar(require("./product-language-class"), exports);
@@ -22,7 +22,7 @@ export interface ProductLanguageClass {
22
22
  */
23
23
  'id': number;
24
24
  /**
25
- * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
25
+ * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
26
26
  * @type {string}
27
27
  * @memberof ProductLanguageClass
28
28
  */
@@ -40,11 +40,11 @@ export interface ProductLanguageClass {
40
40
  */
41
41
  'isActive': boolean;
42
42
  /**
43
- * The translation status. It tells if the language is ready to be used in the product and how many fields are missing.
44
- * @type {object}
43
+ * The translation status. It tells if the language is ready to be used in the product. Can be null in the default language.
44
+ * @type {string}
45
45
  * @memberof ProductLanguageClass
46
46
  */
47
- 'translationStatus': object | null;
47
+ 'translationStatus': string | null;
48
48
  /**
49
49
  * Time at which the object was created.
50
50
  * @type {string}
@@ -21,7 +21,7 @@
21
21
  */
22
22
  export interface CreateProductLanguageRequestDto {
23
23
  /**
24
- * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
24
+ * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
25
25
  * @type {string}
26
26
  * @memberof CreateProductLanguageRequestDto
27
27
  */
package/models/index.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export * from './create-product-language-request-dto';
2
2
  export * from './create-product-language-response-class';
3
3
  export * from './get-product-language-response-class';
4
- export * from './inline-response200';
5
- export * from './inline-response503';
6
4
  export * from './list-product-languages-response-class';
7
5
  export * from './list-translations-response-class';
8
6
  export * from './product-language-class';
@@ -27,7 +27,7 @@ export interface ProductLanguageClass {
27
27
  */
28
28
  'id': number;
29
29
  /**
30
- * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
30
+ * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
31
31
  * @type {string}
32
32
  * @memberof ProductLanguageClass
33
33
  */
@@ -45,11 +45,11 @@ export interface ProductLanguageClass {
45
45
  */
46
46
  'isActive': boolean;
47
47
  /**
48
- * The translation status. It tells if the language is ready to be used in the product and how many fields are missing.
49
- * @type {object}
48
+ * The translation status. It tells if the language is ready to be used in the product. Can be null in the default language.
49
+ * @type {string}
50
50
  * @memberof ProductLanguageClass
51
51
  */
52
- 'translationStatus': object | null;
52
+ 'translationStatus': string | null;
53
53
  /**
54
54
  * Time at which the object was created.
55
55
  * @type {string}