@emilgroup/tenant-sdk 1.5.0 → 1.7.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/.openapi-generator/FILES +3 -0
- package/README.md +5 -22
- package/api/custom-schema-api.ts +0 -4
- package/api/data-report-api.ts +0 -4
- package/api/data-report-executor-api.ts +0 -4
- package/api/default-api.ts +120 -0
- package/api/invite-organizations-api.ts +0 -4
- package/api/invite-users-api.ts +0 -4
- package/api/list-organization-invitations-api.ts +0 -4
- package/api/organizations-api.ts +0 -4
- package/api/re-invite-an-organization-api.ts +0 -4
- package/api/roles-api.ts +0 -4
- package/api/settings-api.ts +0 -4
- package/api/users-api.ts +0 -4
- package/api.ts +2 -4
- package/base.ts +59 -93
- package/common.ts +0 -1
- package/configuration.ts +0 -8
- package/dist/api/custom-schema-api.js +4 -8
- package/dist/api/data-report-api.js +5 -9
- package/dist/api/data-report-executor-api.js +1 -5
- package/dist/api/default-api.d.ts +66 -0
- package/dist/api/default-api.js +196 -0
- package/dist/api/invite-organizations-api.js +1 -5
- package/dist/api/invite-users-api.js +5 -9
- package/dist/api/list-organization-invitations-api.js +1 -5
- package/dist/api/organizations-api.js +3 -7
- package/dist/api/re-invite-an-organization-api.js +1 -5
- package/dist/api/roles-api.js +1 -5
- package/dist/api/settings-api.js +1 -5
- package/dist/api/users-api.js +9 -13
- package/dist/api.d.ts +1 -0
- package/dist/api.js +1 -0
- package/dist/base.d.ts +5 -9
- package/dist/base.js +40 -136
- package/dist/common.d.ts +0 -1
- package/dist/common.js +1 -2
- package/dist/configuration.d.ts +0 -7
- package/dist/models/custom-field-dto.d.ts +7 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/inline-response200.d.ts +54 -0
- package/dist/models/inline-response200.js +15 -0
- package/dist/models/inline-response503.d.ts +54 -0
- package/dist/models/inline-response503.js +15 -0
- package/models/custom-field-dto.ts +7 -1
- package/models/index.ts +2 -0
- package/models/inline-response200.ts +48 -0
- package/models/inline-response503.ts +48 -0
- package/package.json +3 -5
package/dist/api/users-api.js
CHANGED
|
@@ -85,10 +85,6 @@ var axios_1 = __importDefault(require("axios"));
|
|
|
85
85
|
var common_1 = require("../common");
|
|
86
86
|
// @ts-ignore
|
|
87
87
|
var base_1 = require("../base");
|
|
88
|
-
// URLSearchParams not necessarily used
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
var url_1 = require("url");
|
|
91
|
-
var FormData = require('form-data');
|
|
92
88
|
/**
|
|
93
89
|
* UsersApi - axios parameter creator
|
|
94
90
|
* @export
|
|
@@ -117,7 +113,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
117
113
|
(0, common_1.assertParamExists)('assignUserRoles', 'assignUserRolesRequestDto', assignUserRolesRequestDto);
|
|
118
114
|
localVarPath = "/tenantservice/v1/users/{id}/assign-roles"
|
|
119
115
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
120
|
-
localVarUrlObj = new
|
|
116
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
121
117
|
if (configuration) {
|
|
122
118
|
baseOptions = configuration.baseOptions;
|
|
123
119
|
baseAccessToken = configuration.accessToken;
|
|
@@ -166,7 +162,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
166
162
|
(0, common_1.assertParamExists)('deleteUser', 'id', id);
|
|
167
163
|
localVarPath = "/tenantservice/v1/users/{id}"
|
|
168
164
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
169
|
-
localVarUrlObj = new
|
|
165
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
170
166
|
if (configuration) {
|
|
171
167
|
baseOptions = configuration.baseOptions;
|
|
172
168
|
baseAccessToken = configuration.accessToken;
|
|
@@ -212,7 +208,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
212
208
|
// verify required parameter 'batchDeleteRequestDto' is not null or undefined
|
|
213
209
|
(0, common_1.assertParamExists)('deleteUsers', 'batchDeleteRequestDto', batchDeleteRequestDto);
|
|
214
210
|
localVarPath = "/tenantservice/v1/users/delete-batch";
|
|
215
|
-
localVarUrlObj = new
|
|
211
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
216
212
|
if (configuration) {
|
|
217
213
|
baseOptions = configuration.baseOptions;
|
|
218
214
|
baseAccessToken = configuration.accessToken;
|
|
@@ -261,7 +257,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
261
257
|
(0, common_1.assertParamExists)('disableUser', 'id', id);
|
|
262
258
|
localVarPath = "/tenantservice/v1/users/{id}/disable"
|
|
263
259
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
264
|
-
localVarUrlObj = new
|
|
260
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
265
261
|
if (configuration) {
|
|
266
262
|
baseOptions = configuration.baseOptions;
|
|
267
263
|
baseAccessToken = configuration.accessToken;
|
|
@@ -307,7 +303,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
307
303
|
// verify required parameter 'disableUsersRequestDto' is not null or undefined
|
|
308
304
|
(0, common_1.assertParamExists)('disableUsers', 'disableUsersRequestDto', disableUsersRequestDto);
|
|
309
305
|
localVarPath = "/tenantservice/v1/users/disable-batch";
|
|
310
|
-
localVarUrlObj = new
|
|
306
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
311
307
|
if (configuration) {
|
|
312
308
|
baseOptions = configuration.baseOptions;
|
|
313
309
|
baseAccessToken = configuration.accessToken;
|
|
@@ -356,7 +352,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
356
352
|
(0, common_1.assertParamExists)('enableUser', 'id', id);
|
|
357
353
|
localVarPath = "/tenantservice/v1/users/{id}/enable"
|
|
358
354
|
.replace("{".concat("id", "}"), encodeURIComponent(String(id)));
|
|
359
|
-
localVarUrlObj = new
|
|
355
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
360
356
|
if (configuration) {
|
|
361
357
|
baseOptions = configuration.baseOptions;
|
|
362
358
|
baseAccessToken = configuration.accessToken;
|
|
@@ -402,7 +398,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
402
398
|
// verify required parameter 'enableUsersRequestDto' is not null or undefined
|
|
403
399
|
(0, common_1.assertParamExists)('enableUsers', 'enableUsersRequestDto', enableUsersRequestDto);
|
|
404
400
|
localVarPath = "/tenantservice/v1/users/enable-batch";
|
|
405
|
-
localVarUrlObj = new
|
|
401
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
406
402
|
if (configuration) {
|
|
407
403
|
baseOptions = configuration.baseOptions;
|
|
408
404
|
baseAccessToken = configuration.accessToken;
|
|
@@ -455,7 +451,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
455
451
|
(0, common_1.assertParamExists)('getUser', 'code2', code2);
|
|
456
452
|
localVarPath = "/tenantservice/v1/users/{code}"
|
|
457
453
|
.replace("{".concat("code", "}"), encodeURIComponent(String(code)));
|
|
458
|
-
localVarUrlObj = new
|
|
454
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
459
455
|
if (configuration) {
|
|
460
456
|
baseOptions = configuration.baseOptions;
|
|
461
457
|
baseAccessToken = configuration.accessToken;
|
|
@@ -511,7 +507,7 @@ var UsersApiAxiosParamCreator = function (configuration) {
|
|
|
511
507
|
switch (_a.label) {
|
|
512
508
|
case 0:
|
|
513
509
|
localVarPath = "/tenantservice/v1/users";
|
|
514
|
-
localVarUrlObj = new
|
|
510
|
+
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
515
511
|
if (configuration) {
|
|
516
512
|
baseOptions = configuration.baseOptions;
|
|
517
513
|
baseAccessToken = configuration.accessToken;
|
package/dist/api.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export * from './api/custom-schema-api';
|
|
13
13
|
export * from './api/data-report-api';
|
|
14
14
|
export * from './api/data-report-executor-api';
|
|
15
|
+
export * from './api/default-api';
|
|
15
16
|
export * from './api/invite-organizations-api';
|
|
16
17
|
export * from './api/invite-users-api';
|
|
17
18
|
export * from './api/list-organization-invitations-api';
|
package/dist/api.js
CHANGED
|
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
__exportStar(require("./api/custom-schema-api"), exports);
|
|
31
31
|
__exportStar(require("./api/data-report-api"), exports);
|
|
32
32
|
__exportStar(require("./api/data-report-executor-api"), exports);
|
|
33
|
+
__exportStar(require("./api/default-api"), exports);
|
|
33
34
|
__exportStar(require("./api/invite-organizations-api"), exports);
|
|
34
35
|
__exportStar(require("./api/invite-users-api"), exports);
|
|
35
36
|
__exportStar(require("./api/list-organization-invitations-api"), exports);
|
package/dist/base.d.ts
CHANGED
|
@@ -49,19 +49,15 @@ export interface RequestArgs {
|
|
|
49
49
|
export declare class BaseAPI {
|
|
50
50
|
protected basePath: string;
|
|
51
51
|
protected axios: AxiosInstance;
|
|
52
|
-
protected configuration: Configuration;
|
|
53
|
-
private
|
|
54
|
-
private password?;
|
|
52
|
+
protected configuration: Configuration | undefined;
|
|
53
|
+
private tokenData?;
|
|
55
54
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
56
|
-
initialize(env?: Environment): Promise<void>;
|
|
57
|
-
private loadCredentials;
|
|
58
|
-
private readConfigFile;
|
|
59
|
-
private readEnvVariables;
|
|
60
55
|
selectEnvironment(env: Environment): void;
|
|
61
56
|
authorize(username: string, password: string): Promise<void>;
|
|
62
57
|
refreshTokenInternal(): Promise<string>;
|
|
63
|
-
private
|
|
64
|
-
|
|
58
|
+
private storeTokenData;
|
|
59
|
+
loadTokenData(): void;
|
|
60
|
+
cleanTokenData(): void;
|
|
65
61
|
private attachInterceptor;
|
|
66
62
|
}
|
|
67
63
|
/**
|
package/dist/base.js
CHANGED
|
@@ -38,29 +38,6 @@ 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
|
-
};
|
|
64
41
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
65
42
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
66
43
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -103,18 +80,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
103
80
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
104
81
|
exports.RequiredError = exports.BaseAPI = exports.resetRetry = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
105
82
|
var configuration_1 = require("./configuration");
|
|
83
|
+
var common_1 = require("./common");
|
|
106
84
|
// Some imports not used depending on template conditions
|
|
107
85
|
// @ts-ignore
|
|
108
86
|
var axios_1 = __importDefault(require("axios"));
|
|
109
|
-
var fs = __importStar(require("fs"));
|
|
110
|
-
var path = __importStar(require("path"));
|
|
111
|
-
var os = __importStar(require("os"));
|
|
112
87
|
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;
|
|
118
88
|
/**
|
|
119
89
|
*
|
|
120
90
|
* @export
|
|
@@ -138,6 +108,7 @@ function resetRetry() {
|
|
|
138
108
|
}
|
|
139
109
|
exports.resetRetry = resetRetry;
|
|
140
110
|
var NETWORK_ERROR_MESSAGE = "Network Error";
|
|
111
|
+
var TOKEN_DATA = 'APP_TOKEN';
|
|
141
112
|
/**
|
|
142
113
|
*
|
|
143
114
|
* @export
|
|
@@ -149,101 +120,27 @@ var BaseAPI = /** @class */ (function () {
|
|
|
149
120
|
if (axios === void 0) { axios = axios_1.default; }
|
|
150
121
|
this.basePath = basePath;
|
|
151
122
|
this.axios = axios;
|
|
123
|
+
this.loadTokenData();
|
|
152
124
|
if (configuration) {
|
|
153
125
|
this.configuration = configuration;
|
|
154
126
|
this.basePath = configuration.basePath || this.basePath;
|
|
155
127
|
}
|
|
156
128
|
else {
|
|
129
|
+
var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
|
|
157
130
|
this.configuration = new configuration_1.Configuration({
|
|
158
131
|
basePath: this.basePath,
|
|
132
|
+
accessToken: accessToken ? "Bearer ".concat(accessToken) : '',
|
|
133
|
+
username: username,
|
|
159
134
|
});
|
|
160
135
|
}
|
|
161
136
|
this.attachInterceptor(axios);
|
|
162
137
|
}
|
|
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
|
-
});
|
|
183
|
-
};
|
|
184
|
-
BaseAPI.prototype.loadCredentials = function () {
|
|
185
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
186
|
-
var error_1;
|
|
187
|
-
return __generator(this, function (_a) {
|
|
188
|
-
switch (_a.label) {
|
|
189
|
-
case 0:
|
|
190
|
-
_a.trys.push([0, 2, , 3]);
|
|
191
|
-
return [4 /*yield*/, this.readConfigFile()];
|
|
192
|
-
case 1:
|
|
193
|
-
_a.sent();
|
|
194
|
-
return [3 /*break*/, 3];
|
|
195
|
-
case 2:
|
|
196
|
-
error_1 = _a.sent();
|
|
197
|
-
console.warn("No credentials file found. Check that ".concat(filePath, " exists."));
|
|
198
|
-
return [3 /*break*/, 3];
|
|
199
|
-
case 3:
|
|
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*/];
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
BaseAPI.prototype.readConfigFile = function () {
|
|
210
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
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
138
|
BaseAPI.prototype.selectEnvironment = function (env) {
|
|
242
139
|
this.configuration.basePath = env;
|
|
243
140
|
};
|
|
244
141
|
BaseAPI.prototype.authorize = function (username, password) {
|
|
245
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
-
var options, response, accessToken
|
|
143
|
+
var options, response, accessToken;
|
|
247
144
|
return __generator(this, function (_a) {
|
|
248
145
|
switch (_a.label) {
|
|
249
146
|
case 0:
|
|
@@ -263,8 +160,9 @@ var BaseAPI = /** @class */ (function () {
|
|
|
263
160
|
accessToken = response.data.accessToken;
|
|
264
161
|
this.configuration.username = username;
|
|
265
162
|
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
266
|
-
|
|
267
|
-
this.
|
|
163
|
+
this.tokenData.username = username;
|
|
164
|
+
this.tokenData.accessToken = accessToken;
|
|
165
|
+
this.storeTokenData(__assign({}, this.tokenData));
|
|
268
166
|
return [2 /*return*/];
|
|
269
167
|
}
|
|
270
168
|
});
|
|
@@ -272,12 +170,12 @@ var BaseAPI = /** @class */ (function () {
|
|
|
272
170
|
};
|
|
273
171
|
BaseAPI.prototype.refreshTokenInternal = function () {
|
|
274
172
|
return __awaiter(this, void 0, void 0, function () {
|
|
275
|
-
var
|
|
276
|
-
return __generator(this, function (
|
|
277
|
-
switch (
|
|
173
|
+
var username, options, accessToken;
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
278
176
|
case 0:
|
|
279
|
-
|
|
280
|
-
if (!username
|
|
177
|
+
username = this.configuration.username;
|
|
178
|
+
if (!username) {
|
|
281
179
|
return [2 /*return*/, ''];
|
|
282
180
|
}
|
|
283
181
|
options = {
|
|
@@ -285,28 +183,33 @@ var BaseAPI = /** @class */ (function () {
|
|
|
285
183
|
url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
|
|
286
184
|
headers: {
|
|
287
185
|
'Content-Type': 'application/json',
|
|
288
|
-
Cookie: refreshToken,
|
|
289
186
|
},
|
|
290
187
|
data: { username: username },
|
|
291
188
|
withCredentials: true,
|
|
292
189
|
};
|
|
293
190
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
294
191
|
case 1:
|
|
295
|
-
accessToken = (
|
|
192
|
+
accessToken = (_a.sent()).data.accessToken;
|
|
296
193
|
return [2 /*return*/, accessToken];
|
|
297
194
|
}
|
|
298
195
|
});
|
|
299
196
|
});
|
|
300
197
|
};
|
|
301
|
-
BaseAPI.prototype.
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
return "".concat(response.headers['set-cookie'][0].split(';')[0], ";");
|
|
198
|
+
BaseAPI.prototype.storeTokenData = function (tokenData) {
|
|
199
|
+
if (typeof window !== 'undefined') {
|
|
200
|
+
(0, common_1.defaultStorage)().set(TOKEN_DATA, tokenData);
|
|
305
201
|
}
|
|
306
|
-
return '';
|
|
307
202
|
};
|
|
308
|
-
BaseAPI.prototype.
|
|
309
|
-
|
|
203
|
+
BaseAPI.prototype.loadTokenData = function () {
|
|
204
|
+
if (typeof window !== 'undefined') {
|
|
205
|
+
this.tokenData = (0, common_1.defaultStorage)().get(TOKEN_DATA) || {};
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.tokenData = {};
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
BaseAPI.prototype.cleanTokenData = function () {
|
|
212
|
+
this.storeTokenData(null);
|
|
310
213
|
};
|
|
311
214
|
BaseAPI.prototype.attachInterceptor = function (axios) {
|
|
312
215
|
var _this = this;
|
|
@@ -318,8 +221,9 @@ var BaseAPI = /** @class */ (function () {
|
|
|
318
221
|
switch (_a.label) {
|
|
319
222
|
case 0:
|
|
320
223
|
originalConfig = err.config;
|
|
321
|
-
if (!err.response) return [3 /*break*/, 5];
|
|
322
|
-
if (!(err.response.status === 401
|
|
224
|
+
if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
|
|
225
|
+
if (!((err.response.status === 401 || err.response.status === 403)
|
|
226
|
+
&& !originalConfig._retry)) return [3 /*break*/, 4];
|
|
323
227
|
originalConfig._retry = true;
|
|
324
228
|
_a.label = 1;
|
|
325
229
|
case 1:
|
|
@@ -328,23 +232,21 @@ var BaseAPI = /** @class */ (function () {
|
|
|
328
232
|
case 2:
|
|
329
233
|
tokenString = _a.sent();
|
|
330
234
|
accessToken = "Bearer ".concat(tokenString);
|
|
331
|
-
originalConfig.headers['Authorization']
|
|
235
|
+
delete originalConfig.headers['Authorization'];
|
|
236
|
+
originalConfig.headers['Authorization'] = accessToken;
|
|
332
237
|
this.configuration.accessToken = accessToken;
|
|
333
|
-
|
|
238
|
+
this.tokenData.accessToken = tokenString;
|
|
239
|
+
this.storeTokenData(this.tokenData);
|
|
240
|
+
return [2 /*return*/, axios(originalConfig)];
|
|
334
241
|
case 3:
|
|
335
242
|
_error_1 = _a.sent();
|
|
336
243
|
if (_error_1.response && _error_1.response.data) {
|
|
337
244
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
338
245
|
}
|
|
339
246
|
return [2 /*return*/, Promise.reject(_error_1)];
|
|
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];
|
|
247
|
+
case 4: return [3 /*break*/, 9];
|
|
345
248
|
case 5:
|
|
346
249
|
if (!(err.message === NETWORK_ERROR_MESSAGE
|
|
347
|
-
&& err.isAxiosError
|
|
348
250
|
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
349
251
|
&& _retry_count < 4)) return [3 /*break*/, 9];
|
|
350
252
|
_retry_count++;
|
|
@@ -358,6 +260,8 @@ var BaseAPI = /** @class */ (function () {
|
|
|
358
260
|
_retry = true;
|
|
359
261
|
originalConfig.headers['Authorization'] = accessToken;
|
|
360
262
|
this.configuration.accessToken = accessToken;
|
|
263
|
+
this.tokenData.accessToken = tokenString;
|
|
264
|
+
this.storeTokenData(this.tokenData);
|
|
361
265
|
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
362
266
|
case 8:
|
|
363
267
|
_error_2 = _a.sent();
|
package/dist/common.d.ts
CHANGED
package/dist/common.js
CHANGED
|
@@ -62,7 +62,6 @@ 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");
|
|
66
65
|
/**
|
|
67
66
|
*
|
|
68
67
|
* @export
|
|
@@ -188,7 +187,7 @@ var setSearchParams = function (url) {
|
|
|
188
187
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
189
188
|
objects[_i - 1] = arguments[_i];
|
|
190
189
|
}
|
|
191
|
-
var searchParams = new
|
|
190
|
+
var searchParams = new URLSearchParams(url.search);
|
|
192
191
|
for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
|
|
193
192
|
var object = objects_1[_a];
|
|
194
193
|
for (var key in object) {
|
package/dist/configuration.d.ts
CHANGED
|
@@ -68,13 +68,6 @@ 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;
|
|
78
71
|
constructor(param?: ConfigurationParameters);
|
|
79
72
|
/**
|
|
80
73
|
* Check if the given MIME is a JSON MIME.
|
|
@@ -16,11 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export interface CustomFieldDto {
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The name of the custom field - should be camelCase.
|
|
20
20
|
* @type {string}
|
|
21
21
|
* @memberof CustomFieldDto
|
|
22
22
|
*/
|
|
23
23
|
'name': string;
|
|
24
|
+
/**
|
|
25
|
+
* The label of the custom field as it will be displayed in the UI. If no label is provided, the name will be used in its place.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof CustomFieldDto
|
|
28
|
+
*/
|
|
29
|
+
'label'?: string;
|
|
24
30
|
/**
|
|
25
31
|
*
|
|
26
32
|
* @type {string}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export * from './get-data-report-response-class';
|
|
|
29
29
|
export * from './get-organization-response-class';
|
|
30
30
|
export * from './get-settings-response-class';
|
|
31
31
|
export * from './get-user-response-class';
|
|
32
|
+
export * from './inline-response200';
|
|
33
|
+
export * from './inline-response503';
|
|
32
34
|
export * from './invite-class';
|
|
33
35
|
export * from './invite-org-request-dto';
|
|
34
36
|
export * from './invite-user-request-dto';
|
package/dist/models/index.js
CHANGED
|
@@ -45,6 +45,8 @@ __exportStar(require("./get-data-report-response-class"), exports);
|
|
|
45
45
|
__exportStar(require("./get-organization-response-class"), exports);
|
|
46
46
|
__exportStar(require("./get-settings-response-class"), exports);
|
|
47
47
|
__exportStar(require("./get-user-response-class"), exports);
|
|
48
|
+
__exportStar(require("./inline-response200"), exports);
|
|
49
|
+
__exportStar(require("./inline-response503"), exports);
|
|
48
50
|
__exportStar(require("./invite-class"), exports);
|
|
49
51
|
__exportStar(require("./invite-org-request-dto"), exports);
|
|
50
52
|
__exportStar(require("./invite-user-request-dto"), exports);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EMIL Tenant Service
|
|
3
|
+
* The EMIL TenantService API description
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0
|
|
6
|
+
* Contact: kontakt@emil.de
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface InlineResponse200
|
|
16
|
+
*/
|
|
17
|
+
export interface InlineResponse200 {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof InlineResponse200
|
|
22
|
+
*/
|
|
23
|
+
'status'?: string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
27
|
+
* @memberof InlineResponse200
|
|
28
|
+
*/
|
|
29
|
+
'info'?: {
|
|
30
|
+
[key: string]: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
37
|
+
* @memberof InlineResponse200
|
|
38
|
+
*/
|
|
39
|
+
'error'?: {
|
|
40
|
+
[key: string]: {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
};
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
47
|
+
* @memberof InlineResponse200
|
|
48
|
+
*/
|
|
49
|
+
'details'?: {
|
|
50
|
+
[key: string]: {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* EMIL Tenant Service
|
|
6
|
+
* The EMIL TenantService API description
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0
|
|
9
|
+
* Contact: kontakt@emil.de
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EMIL Tenant Service
|
|
3
|
+
* The EMIL TenantService API description
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0
|
|
6
|
+
* Contact: kontakt@emil.de
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface InlineResponse503
|
|
16
|
+
*/
|
|
17
|
+
export interface InlineResponse503 {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof InlineResponse503
|
|
22
|
+
*/
|
|
23
|
+
'status'?: string;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
27
|
+
* @memberof InlineResponse503
|
|
28
|
+
*/
|
|
29
|
+
'info'?: {
|
|
30
|
+
[key: string]: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
37
|
+
* @memberof InlineResponse503
|
|
38
|
+
*/
|
|
39
|
+
'error'?: {
|
|
40
|
+
[key: string]: {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
};
|
|
43
|
+
} | null;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @type {{ [key: string]: { [key: string]: string; }; }}
|
|
47
|
+
* @memberof InlineResponse503
|
|
48
|
+
*/
|
|
49
|
+
'details'?: {
|
|
50
|
+
[key: string]: {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* EMIL Tenant Service
|
|
6
|
+
* The EMIL TenantService API description
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0
|
|
9
|
+
* Contact: kontakt@emil.de
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -21,11 +21,17 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export interface CustomFieldDto {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The name of the custom field - should be camelCase.
|
|
25
25
|
* @type {string}
|
|
26
26
|
* @memberof CustomFieldDto
|
|
27
27
|
*/
|
|
28
28
|
'name': string;
|
|
29
|
+
/**
|
|
30
|
+
* The label of the custom field as it will be displayed in the UI. If no label is provided, the name will be used in its place.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof CustomFieldDto
|
|
33
|
+
*/
|
|
34
|
+
'label'?: string;
|
|
29
35
|
/**
|
|
30
36
|
*
|
|
31
37
|
* @type {string}
|