@emilgroup/accounting-sdk 1.34.1-beta.76 → 1.34.1-beta.77
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 +2 -0
- package/README.md +2 -2
- package/api/accounting-configs-api.ts +32 -16
- package/api/booking-entries-api.ts +24 -14
- package/api/commission-account-mappings-api.ts +32 -16
- package/api/financial-accounts-api.ts +20 -10
- package/api/financial-transactions-api.ts +8 -4
- package/api/number-ranges-api.ts +16 -8
- package/api/personal-accounts-api.ts +16 -8
- package/api/product-account-mappings-api.ts +265 -20
- package/base.ts +174 -41
- package/common.ts +3 -2
- package/configuration.ts +20 -0
- package/dist/api/accounting-configs-api.d.ts +8 -8
- package/dist/api/accounting-configs-api.js +56 -32
- package/dist/api/booking-entries-api.d.ts +9 -9
- package/dist/api/booking-entries-api.js +33 -22
- package/dist/api/commission-account-mappings-api.d.ts +8 -8
- package/dist/api/commission-account-mappings-api.js +47 -29
- package/dist/api/financial-accounts-api.d.ts +5 -5
- package/dist/api/financial-accounts-api.js +29 -18
- package/dist/api/financial-transactions-api.d.ts +2 -2
- package/dist/api/financial-transactions-api.js +8 -6
- package/dist/api/health-api.d.ts +1 -1
- package/dist/api/number-ranges-api.d.ts +4 -4
- package/dist/api/number-ranges-api.js +22 -14
- package/dist/api/personal-accounts-api.d.ts +4 -4
- package/dist/api/personal-accounts-api.js +22 -14
- package/dist/api/product-account-mappings-api.d.ts +131 -10
- package/dist/api/product-account-mappings-api.js +261 -38
- package/dist/base.d.ts +24 -0
- package/dist/base.js +178 -59
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -0
- package/dist/configuration.d.ts +17 -0
- package/dist/configuration.js +2 -0
- package/dist/models/account-mapping-class.d.ts +2 -0
- package/dist/models/account-mapping-class.js +3 -1
- package/dist/models/accounting-config-data-dto-default-account-mappings.d.ts +2 -0
- package/dist/models/accounting-config-data-dto-default-account-mappings.js +3 -1
- package/dist/models/booking-entry-class.d.ts +16 -2
- package/dist/models/booking-entry-class.js +3 -1
- package/dist/models/create-booking-entry-request-dto.d.ts +3 -2
- package/dist/models/create-booking-entry-request-dto.js +3 -2
- package/dist/models/create-financial-account-request-dto.d.ts +2 -0
- package/dist/models/create-financial-account-request-dto.js +3 -1
- package/dist/models/financial-transaction-class.d.ts +6 -0
- package/dist/models/financial-transaction-data-dto.d.ts +6 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/post-financial-event-request-dto.d.ts +3 -2
- package/dist/models/post-financial-event-request-dto.js +1 -0
- package/dist/models/product-account-mapping-detail-class.d.ts +6 -0
- package/dist/models/product-risk-carrier-class.d.ts +42 -0
- package/dist/models/product-risk-carrier-class.js +15 -0
- package/dist/models/put-product-risk-carrier-body-dto.d.ts +24 -0
- package/dist/models/put-product-risk-carrier-body-dto.js +15 -0
- package/models/account-mapping-class.ts +3 -1
- package/models/accounting-config-data-dto-default-account-mappings.ts +3 -1
- package/models/booking-entry-class.ts +17 -3
- package/models/create-booking-entry-request-dto.ts +4 -3
- package/models/create-financial-account-request-dto.ts +3 -1
- package/models/financial-transaction-class.ts +6 -0
- package/models/financial-transaction-data-dto.ts +6 -0
- package/models/index.ts +2 -0
- package/models/post-financial-event-request-dto.ts +3 -2
- package/models/product-account-mapping-detail-class.ts +6 -0
- package/models/product-risk-carrier-class.ts +48 -0
- package/models/put-product-risk-carrier-body-dto.ts +30 -0
- package/package.json +2 -2
package/dist/base.js
CHANGED
|
@@ -74,6 +74,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
74
74
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
78
|
+
var t = {};
|
|
79
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
80
|
+
t[p] = s[p];
|
|
81
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
82
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
83
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
84
|
+
t[p[i]] = s[p[i]];
|
|
85
|
+
}
|
|
86
|
+
return t;
|
|
87
|
+
};
|
|
77
88
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
78
89
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
79
90
|
};
|
|
@@ -112,6 +123,12 @@ function resetRetry() {
|
|
|
112
123
|
exports.resetRetry = resetRetry;
|
|
113
124
|
var NETWORK_ERROR_MESSAGE = "Network Error";
|
|
114
125
|
var TOKEN_DATA = 'APP_TOKEN';
|
|
126
|
+
// Sent only to authservice, to ask for a server session.
|
|
127
|
+
var AUTH_MODE_HEADER = 'X-Emil-Auth-Mode';
|
|
128
|
+
// Names the account on every call; one browser session can hold several.
|
|
129
|
+
var ACCOUNT_HEADER = 'X-Emil-Account';
|
|
130
|
+
var SESSION_MODES = ['both', 'session'];
|
|
131
|
+
var RESEND_SAFE_METHODS = ['get', 'head', 'options'];
|
|
115
132
|
/**
|
|
116
133
|
*
|
|
117
134
|
* @export
|
|
@@ -128,10 +145,18 @@ var BaseAPI = /** @class */ (function () {
|
|
|
128
145
|
var accessToken = this.tokenData.accessToken;
|
|
129
146
|
this.configuration = configuration;
|
|
130
147
|
this.basePath = configuration.basePath || this.basePath;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.
|
|
148
|
+
if (configuration.cookieAuth) {
|
|
149
|
+
this.configuration.username = this.configuration.username || this.tokenData.username;
|
|
150
|
+
}
|
|
151
|
+
if (this.usesSession()) {
|
|
152
|
+
this.useSessionAuth();
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Use config token if provided, otherwise use tokenData token
|
|
156
|
+
var configToken = this.configuration.accessToken;
|
|
157
|
+
var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
|
|
158
|
+
this.configuration.accessToken = configToken || storedToken;
|
|
159
|
+
}
|
|
135
160
|
}
|
|
136
161
|
else {
|
|
137
162
|
var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
|
|
@@ -143,6 +168,95 @@ var BaseAPI = /** @class */ (function () {
|
|
|
143
168
|
}
|
|
144
169
|
this.attachInterceptor(axios);
|
|
145
170
|
}
|
|
171
|
+
// The app's own account wins over APP_TOKEN, which holds whichever tab wrote last.
|
|
172
|
+
BaseAPI.prototype.sessionAccount = function () {
|
|
173
|
+
return this.configuration.account || this.tokenData.sub;
|
|
174
|
+
};
|
|
175
|
+
// Apps may pass the address as the second argument only; authservice is on the same host.
|
|
176
|
+
BaseAPI.prototype.authBasePath = function () {
|
|
177
|
+
return this.configuration.basePath || this.basePath;
|
|
178
|
+
};
|
|
179
|
+
BaseAPI.prototype.usesSession = function () {
|
|
180
|
+
return !!this.configuration.cookieAuth && SESSION_MODES.indexOf(this.tokenData.authMode) !== -1 && !!this.sessionAccount();
|
|
181
|
+
};
|
|
182
|
+
BaseAPI.prototype.useSessionAuth = function () {
|
|
183
|
+
var _a;
|
|
184
|
+
var _b = this.configuration.baseOptions || {}, headers = _b.headers, baseOptions = __rest(_b, ["headers"]);
|
|
185
|
+
this.configuration.accessToken = '';
|
|
186
|
+
this.configuration.baseOptions = __assign(__assign({}, baseOptions), { withCredentials: true, headers: __assign(__assign({}, headers), (_a = {}, _a[ACCOUNT_HEADER] = this.sessionAccount(), _a)) });
|
|
187
|
+
};
|
|
188
|
+
BaseAPI.prototype.useHeaderAuth = function (accessToken) {
|
|
189
|
+
this.configuration.accessToken = accessToken ? "Bearer ".concat(accessToken) : '';
|
|
190
|
+
this.tokenData.accessToken = accessToken;
|
|
191
|
+
delete this.tokenData.authMode;
|
|
192
|
+
delete this.tokenData.sub;
|
|
193
|
+
if (this.configuration.cookieAuth) {
|
|
194
|
+
var _a = this.configuration.baseOptions || {}, withCredentials = _a.withCredentials, headers = _a.headers, baseOptions = __rest(_a, ["withCredentials", "headers"]);
|
|
195
|
+
var _b = headers || {}, _c = ACCOUNT_HEADER, account = _b[_c], otherHeaders = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);
|
|
196
|
+
this.configuration.baseOptions = __assign(__assign({}, baseOptions), { headers: otherHeaders });
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
BaseAPI.prototype.applyTokenReply = function (_a) {
|
|
200
|
+
var accessToken = _a.accessToken, authMode = _a.authMode, session = _a.session;
|
|
201
|
+
if (this.configuration.cookieAuth && SESSION_MODES.indexOf(authMode) !== -1 && (session === null || session === void 0 ? void 0 : session.sub)) {
|
|
202
|
+
this.tokenData.authMode = authMode;
|
|
203
|
+
this.tokenData.sub = session.sub;
|
|
204
|
+
if (this.configuration.account) {
|
|
205
|
+
// A workspace switch moves the app to another account.
|
|
206
|
+
this.configuration.account = session.sub;
|
|
207
|
+
}
|
|
208
|
+
// Both keeps the token for apps not moved yet; session mode keeps no token at all.
|
|
209
|
+
if (authMode === 'both' && accessToken) {
|
|
210
|
+
this.tokenData.accessToken = accessToken;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
delete this.tokenData.accessToken;
|
|
214
|
+
}
|
|
215
|
+
this.useSessionAuth();
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.useHeaderAuth(accessToken);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
BaseAPI.prototype.sessionHeaders = function () {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
if (!this.configuration.cookieAuth) {
|
|
224
|
+
return {};
|
|
225
|
+
}
|
|
226
|
+
return __assign((_a = {}, _a[AUTH_MODE_HEADER] = 'session', _a), (this.usesSession() && (_b = {}, _b[ACCOUNT_HEADER] = this.sessionAccount(), _b)));
|
|
227
|
+
};
|
|
228
|
+
BaseAPI.prototype.withCurrentAuth = function (config) {
|
|
229
|
+
delete config.headers['Authorization'];
|
|
230
|
+
delete config.headers[ACCOUNT_HEADER];
|
|
231
|
+
if (this.usesSession()) {
|
|
232
|
+
config.headers[ACCOUNT_HEADER] = this.sessionAccount();
|
|
233
|
+
config.withCredentials = true;
|
|
234
|
+
}
|
|
235
|
+
else if (this.configuration.accessToken) {
|
|
236
|
+
config.headers['Authorization'] = this.configuration.accessToken;
|
|
237
|
+
}
|
|
238
|
+
return config;
|
|
239
|
+
};
|
|
240
|
+
// Both keeps the token, so a session call the browser could not complete can be sent again with it.
|
|
241
|
+
BaseAPI.prototype.canRetryWithToken = function (config) {
|
|
242
|
+
var _a;
|
|
243
|
+
return !!config.withCredentials && !!((_a = config.headers) === null || _a === void 0 ? void 0 : _a[ACCOUNT_HEADER])
|
|
244
|
+
&& !!this.tokenData.accessToken && this.tokenData.authMode !== 'session';
|
|
245
|
+
};
|
|
246
|
+
// A network error can come after the server ran the call, so only a call that is safe to repeat is sent again.
|
|
247
|
+
BaseAPI.prototype.canResend = function (config) {
|
|
248
|
+
return RESEND_SAFE_METHODS.indexOf((config.method || 'get').toLowerCase()) !== -1
|
|
249
|
+
|| Object.keys(config.headers || {}).some(function (name) { return name.toLowerCase() === 'idempotency-key'; });
|
|
250
|
+
};
|
|
251
|
+
BaseAPI.prototype.switchToToken = function () {
|
|
252
|
+
this.useHeaderAuth(this.tokenData.accessToken);
|
|
253
|
+
this.storeTokenData(this.tokenData);
|
|
254
|
+
};
|
|
255
|
+
BaseAPI.prototype.retryWithToken = function (axios, config) {
|
|
256
|
+
this.switchToToken();
|
|
257
|
+
config.withCredentials = false;
|
|
258
|
+
return axios(this.withCurrentAuth(config));
|
|
259
|
+
};
|
|
146
260
|
BaseAPI.prototype.selectEnvironment = function (env) {
|
|
147
261
|
this.selectBasePath(env);
|
|
148
262
|
};
|
|
@@ -158,14 +272,15 @@ var BaseAPI = /** @class */ (function () {
|
|
|
158
272
|
};
|
|
159
273
|
BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
|
|
160
274
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
|
-
var options, response
|
|
275
|
+
var options, response;
|
|
276
|
+
var _a;
|
|
162
277
|
return __generator(this, function (_b) {
|
|
163
278
|
switch (_b.label) {
|
|
164
279
|
case 0:
|
|
165
280
|
options = {
|
|
166
281
|
method: 'POST',
|
|
167
|
-
url: "".concat(this.
|
|
168
|
-
headers: { 'Content-Type': 'application/json' },
|
|
282
|
+
url: "".concat(this.authBasePath(), "/authservice/v1/login"),
|
|
283
|
+
headers: __assign({ 'Content-Type': 'application/json' }, (this.configuration.cookieAuth && (_a = {}, _a[AUTH_MODE_HEADER] = 'session', _a))),
|
|
169
284
|
data: {
|
|
170
285
|
username: username,
|
|
171
286
|
password: password,
|
|
@@ -175,12 +290,10 @@ var BaseAPI = /** @class */ (function () {
|
|
|
175
290
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
176
291
|
case 1:
|
|
177
292
|
response = _b.sent();
|
|
178
|
-
_a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
|
|
179
293
|
this.configuration.username = username;
|
|
180
|
-
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
181
294
|
this.tokenData.username = username;
|
|
182
|
-
this.tokenData.
|
|
183
|
-
this.
|
|
295
|
+
this.tokenData.permissions = response.data.permissions;
|
|
296
|
+
this.applyTokenReply(response.data);
|
|
184
297
|
if (!targetWorkspace) return [3 /*break*/, 3];
|
|
185
298
|
return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
|
|
186
299
|
case 2:
|
|
@@ -199,17 +312,14 @@ var BaseAPI = /** @class */ (function () {
|
|
|
199
312
|
};
|
|
200
313
|
BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
|
|
201
314
|
return __awaiter(this, void 0, void 0, function () {
|
|
202
|
-
var options, response
|
|
203
|
-
return __generator(this, function (
|
|
204
|
-
switch (
|
|
315
|
+
var options, response;
|
|
316
|
+
return __generator(this, function (_a) {
|
|
317
|
+
switch (_a.label) {
|
|
205
318
|
case 0:
|
|
206
319
|
options = {
|
|
207
320
|
method: 'POST',
|
|
208
|
-
url: "".concat(this.
|
|
209
|
-
headers: {
|
|
210
|
-
'Content-Type': 'application/json',
|
|
211
|
-
'Authorization': "Bearer ".concat(this.configuration.accessToken),
|
|
212
|
-
},
|
|
321
|
+
url: "".concat(this.authBasePath(), "/authservice/v1/workspaces/switch"),
|
|
322
|
+
headers: __assign(__assign({ 'Content-Type': 'application/json' }, this.sessionHeaders()), (!this.usesSession() && !!this.configuration.accessToken && { 'Authorization': this.configuration.accessToken })),
|
|
213
323
|
data: {
|
|
214
324
|
username: this.configuration.username,
|
|
215
325
|
targetWorkspace: targetWorkspace,
|
|
@@ -218,11 +328,9 @@ var BaseAPI = /** @class */ (function () {
|
|
|
218
328
|
};
|
|
219
329
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
220
330
|
case 1:
|
|
221
|
-
response =
|
|
222
|
-
|
|
223
|
-
this.
|
|
224
|
-
this.tokenData.accessToken = accessToken;
|
|
225
|
-
this.tokenData.permissions = permissions;
|
|
331
|
+
response = _a.sent();
|
|
332
|
+
this.tokenData.permissions = response.data.permissions;
|
|
333
|
+
this.applyTokenReply(response.data);
|
|
226
334
|
this.storeTokenData(__assign({}, this.tokenData));
|
|
227
335
|
return [2 /*return*/];
|
|
228
336
|
}
|
|
@@ -249,10 +357,8 @@ var BaseAPI = /** @class */ (function () {
|
|
|
249
357
|
});
|
|
250
358
|
options = {
|
|
251
359
|
method: 'POST',
|
|
252
|
-
url: "".concat(this.
|
|
253
|
-
headers: {
|
|
254
|
-
'Content-Type': 'application/json',
|
|
255
|
-
},
|
|
360
|
+
url: "".concat(this.authBasePath(), "/authservice/v1/refresh-token"),
|
|
361
|
+
headers: __assign({ 'Content-Type': 'application/json' }, this.sessionHeaders()),
|
|
256
362
|
data: { username: username },
|
|
257
363
|
withCredentials: true,
|
|
258
364
|
};
|
|
@@ -285,62 +391,75 @@ var BaseAPI = /** @class */ (function () {
|
|
|
285
391
|
axios.interceptors.response.use(function (res) {
|
|
286
392
|
return res;
|
|
287
393
|
}, function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
288
|
-
var originalConfig,
|
|
289
|
-
|
|
290
|
-
|
|
394
|
+
var originalConfig, reply, _error_1, reply, _error_2;
|
|
395
|
+
var _this = this;
|
|
396
|
+
return __generator(this, function (_a) {
|
|
397
|
+
switch (_a.label) {
|
|
291
398
|
case 0:
|
|
292
399
|
originalConfig = err.config;
|
|
293
400
|
if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
|
|
294
401
|
if (!((err.response.status === 401 || err.response.status === 403)
|
|
295
402
|
&& !originalConfig._retry)) return [3 /*break*/, 4];
|
|
296
403
|
originalConfig._retry = true;
|
|
297
|
-
|
|
404
|
+
_a.label = 1;
|
|
298
405
|
case 1:
|
|
299
|
-
|
|
406
|
+
_a.trys.push([1, 3, , 4]);
|
|
300
407
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
301
408
|
case 2:
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
this.
|
|
305
|
-
delete originalConfig.headers['Authorization'];
|
|
306
|
-
originalConfig.headers['Authorization'] = accessToken;
|
|
307
|
-
this.configuration.accessToken = accessToken;
|
|
308
|
-
this.tokenData.accessToken = tokenString;
|
|
409
|
+
reply = _a.sent();
|
|
410
|
+
this.tokenData.permissions = reply.permissions;
|
|
411
|
+
this.applyTokenReply(reply);
|
|
309
412
|
this.storeTokenData(this.tokenData);
|
|
310
|
-
|
|
413
|
+
if (!this.usesSession()) {
|
|
414
|
+
return [2 /*return*/, axios(this.withCurrentAuth(originalConfig))];
|
|
415
|
+
}
|
|
416
|
+
// Both mode: if the browser does not send the session cookie (another site), use the token.
|
|
417
|
+
return [2 /*return*/, axios(this.withCurrentAuth(originalConfig)).catch(function (retryError) {
|
|
418
|
+
var _a;
|
|
419
|
+
if (((_a = retryError === null || retryError === void 0 ? void 0 : retryError.response) === null || _a === void 0 ? void 0 : _a.status) !== 401 || !_this.tokenData.accessToken) {
|
|
420
|
+
return Promise.reject(retryError);
|
|
421
|
+
}
|
|
422
|
+
return _this.retryWithToken(axios, originalConfig);
|
|
423
|
+
})];
|
|
311
424
|
case 3:
|
|
312
|
-
_error_1 =
|
|
425
|
+
_error_1 = _a.sent();
|
|
313
426
|
if (_error_1.response && _error_1.response.data) {
|
|
314
427
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
315
428
|
}
|
|
316
429
|
return [2 /*return*/, Promise.reject(_error_1)];
|
|
317
|
-
case 4: return [3 /*break*/,
|
|
430
|
+
case 4: return [3 /*break*/, 10];
|
|
318
431
|
case 5:
|
|
432
|
+
if (!(err.message === NETWORK_ERROR_MESSAGE && this.canRetryWithToken(originalConfig))) return [3 /*break*/, 6];
|
|
433
|
+
// Both mode: the browser blocked the session call or hid its reply; later calls use the token.
|
|
434
|
+
if (!this.canResend(originalConfig)) {
|
|
435
|
+
this.switchToToken();
|
|
436
|
+
return [2 /*return*/, Promise.reject(err)];
|
|
437
|
+
}
|
|
438
|
+
return [2 /*return*/, this.retryWithToken(axios, originalConfig)];
|
|
439
|
+
case 6:
|
|
319
440
|
if (!(err.message === NETWORK_ERROR_MESSAGE
|
|
320
|
-
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
321
|
-
|
|
441
|
+
&& (originalConfig.headers.hasOwnProperty('Authorization')
|
|
442
|
+
|| (this.configuration.cookieAuth && originalConfig.withCredentials && this.canResend(originalConfig)))
|
|
443
|
+
&& _retry_count < 4)) return [3 /*break*/, 10];
|
|
322
444
|
_retry_count++;
|
|
323
|
-
|
|
324
|
-
case 6:
|
|
325
|
-
_c.trys.push([6, 8, , 9]);
|
|
326
|
-
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
445
|
+
_a.label = 7;
|
|
327
446
|
case 7:
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
447
|
+
_a.trys.push([7, 9, , 10]);
|
|
448
|
+
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
449
|
+
case 8:
|
|
450
|
+
reply = _a.sent();
|
|
451
|
+
this.tokenData.permissions = reply.permissions;
|
|
331
452
|
_retry = true;
|
|
332
|
-
|
|
333
|
-
this.configuration.accessToken = accessToken;
|
|
334
|
-
this.tokenData.accessToken = tokenString;
|
|
453
|
+
this.applyTokenReply(reply);
|
|
335
454
|
this.storeTokenData(this.tokenData);
|
|
336
|
-
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
337
|
-
case
|
|
338
|
-
_error_2 =
|
|
455
|
+
return [2 /*return*/, axios.request(__assign({}, this.withCurrentAuth(originalConfig)))];
|
|
456
|
+
case 9:
|
|
457
|
+
_error_2 = _a.sent();
|
|
339
458
|
if (_error_2.response && _error_2.response.data) {
|
|
340
459
|
return [2 /*return*/, Promise.reject(_error_2.response.data)];
|
|
341
460
|
}
|
|
342
461
|
return [2 /*return*/, Promise.reject(_error_2)];
|
|
343
|
-
case
|
|
462
|
+
case 10: return [2 /*return*/, Promise.reject(err)];
|
|
344
463
|
}
|
|
345
464
|
});
|
|
346
465
|
}); });
|
package/dist/common.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare const toPathString: (url: URL) => string;
|
|
|
62
62
|
*
|
|
63
63
|
* @export
|
|
64
64
|
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
66
66
|
/**
|
|
67
67
|
* EMIL AccountingService
|
|
68
68
|
* The EMIL AccountingService API description
|
package/dist/common.js
CHANGED
|
@@ -233,6 +233,7 @@ exports.toPathString = toPathString;
|
|
|
233
233
|
* @export
|
|
234
234
|
*/
|
|
235
235
|
var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
236
|
+
// Typed by hand: since axios 1.20, request() returns an internal axios type that SDK declarations cannot name.
|
|
236
237
|
return function (axios, basePath) {
|
|
237
238
|
if (axios === void 0) { axios = globalAxios; }
|
|
238
239
|
if (basePath === void 0) { basePath = BASE_PATH; }
|
package/dist/configuration.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface ConfigurationParameters {
|
|
|
17
17
|
basePath?: string;
|
|
18
18
|
baseOptions?: any;
|
|
19
19
|
formDataCtor?: new () => any;
|
|
20
|
+
cookieAuth?: boolean;
|
|
21
|
+
account?: string;
|
|
20
22
|
}
|
|
21
23
|
export declare class Configuration {
|
|
22
24
|
/**
|
|
@@ -68,6 +70,21 @@ export declare class Configuration {
|
|
|
68
70
|
* @type {new () => FormData}
|
|
69
71
|
*/
|
|
70
72
|
formDataCtor?: new () => any;
|
|
73
|
+
/**
|
|
74
|
+
* Use a server session when authservice makes one; otherwise the token, as without this option.
|
|
75
|
+
* Set `account` too, so each SDK object keeps its own account.
|
|
76
|
+
*
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
* @memberof Configuration
|
|
79
|
+
*/
|
|
80
|
+
cookieAuth?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The session account (Cognito sub) this app shows, so the SDK never takes another tab's account.
|
|
83
|
+
*
|
|
84
|
+
* @type {string}
|
|
85
|
+
* @memberof Configuration
|
|
86
|
+
*/
|
|
87
|
+
account?: string;
|
|
71
88
|
constructor(param?: ConfigurationParameters);
|
|
72
89
|
/**
|
|
73
90
|
* Check if the given MIME is a JSON MIME.
|
package/dist/configuration.js
CHANGED
|
@@ -24,6 +24,8 @@ var Configuration = /** @class */ (function () {
|
|
|
24
24
|
this.basePath = param.basePath;
|
|
25
25
|
this.baseOptions = param.baseOptions;
|
|
26
26
|
this.formDataCtor = param.formDataCtor;
|
|
27
|
+
this.cookieAuth = param.cookieAuth;
|
|
28
|
+
this.account = param.account;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Check if the given MIME is a JSON MIME.
|
|
@@ -67,5 +67,7 @@ export declare const AccountMappingClassFunctionalCategoryEnum: {
|
|
|
67
67
|
readonly BrokerCtrlAcc: "broker_ctrl_acc";
|
|
68
68
|
readonly CarrierCtrlAcc: "carrier_ctrl_acc";
|
|
69
69
|
readonly MainLedgerBridgeAcc: "main_ledger_bridge_acc";
|
|
70
|
+
readonly ClaimsPayableAcc: "claims_payable_acc";
|
|
71
|
+
readonly CarrierReceivableAcc: "carrier_receivable_acc";
|
|
70
72
|
};
|
|
71
73
|
export type AccountMappingClassFunctionalCategoryEnum = typeof AccountMappingClassFunctionalCategoryEnum[keyof typeof AccountMappingClassFunctionalCategoryEnum];
|
|
@@ -34,5 +34,7 @@ exports.AccountMappingClassFunctionalCategoryEnum = {
|
|
|
34
34
|
ReceivablesCtrlAcc: 'receivables_ctrl_acc',
|
|
35
35
|
BrokerCtrlAcc: 'broker_ctrl_acc',
|
|
36
36
|
CarrierCtrlAcc: 'carrier_ctrl_acc',
|
|
37
|
-
MainLedgerBridgeAcc: 'main_ledger_bridge_acc'
|
|
37
|
+
MainLedgerBridgeAcc: 'main_ledger_bridge_acc',
|
|
38
|
+
ClaimsPayableAcc: 'claims_payable_acc',
|
|
39
|
+
CarrierReceivableAcc: 'carrier_receivable_acc'
|
|
38
40
|
};
|
|
@@ -73,5 +73,7 @@ export declare const AccountingConfigDataDtoDefaultAccountMappingsFunctionalCate
|
|
|
73
73
|
readonly BrokerCtrlAcc: "broker_ctrl_acc";
|
|
74
74
|
readonly CarrierCtrlAcc: "carrier_ctrl_acc";
|
|
75
75
|
readonly MainLedgerBridgeAcc: "main_ledger_bridge_acc";
|
|
76
|
+
readonly ClaimsPayableAcc: "claims_payable_acc";
|
|
77
|
+
readonly CarrierReceivableAcc: "carrier_receivable_acc";
|
|
76
78
|
};
|
|
77
79
|
export type AccountingConfigDataDtoDefaultAccountMappingsFunctionalCategoryEnum = typeof AccountingConfigDataDtoDefaultAccountMappingsFunctionalCategoryEnum[keyof typeof AccountingConfigDataDtoDefaultAccountMappingsFunctionalCategoryEnum];
|
|
@@ -34,5 +34,7 @@ exports.AccountingConfigDataDtoDefaultAccountMappingsFunctionalCategoryEnum = {
|
|
|
34
34
|
ReceivablesCtrlAcc: 'receivables_ctrl_acc',
|
|
35
35
|
BrokerCtrlAcc: 'broker_ctrl_acc',
|
|
36
36
|
CarrierCtrlAcc: 'carrier_ctrl_acc',
|
|
37
|
-
MainLedgerBridgeAcc: 'main_ledger_bridge_acc'
|
|
37
|
+
MainLedgerBridgeAcc: 'main_ledger_bridge_acc',
|
|
38
|
+
ClaimsPayableAcc: 'claims_payable_acc',
|
|
39
|
+
CarrierReceivableAcc: 'carrier_receivable_acc'
|
|
38
40
|
};
|
|
@@ -77,17 +77,29 @@ export interface BookingEntryClass {
|
|
|
77
77
|
*/
|
|
78
78
|
'externalNumber'?: string;
|
|
79
79
|
/**
|
|
80
|
-
* The code of the source entity this entry was posted for, such as an invoice or payment code.
|
|
80
|
+
* The code of the source entity this entry was posted for, such as an invoice or payment code. Absent on an entry posted by hand (sourceEntityType manual) and on a legacy entry.
|
|
81
81
|
* @type {string}
|
|
82
82
|
* @memberof BookingEntryClass
|
|
83
83
|
*/
|
|
84
84
|
'sourceEntityCode'?: string;
|
|
85
85
|
/**
|
|
86
|
-
* The kind of source entity this entry was posted for
|
|
86
|
+
* The kind of source entity this entry was posted for: manual for an entry posted by hand, which carries no sourceEntityCode. Absent only on a legacy entry.
|
|
87
87
|
* @type {string}
|
|
88
88
|
* @memberof BookingEntryClass
|
|
89
89
|
*/
|
|
90
90
|
'sourceEntityType'?: BookingEntryClassSourceEntityTypeEnum;
|
|
91
|
+
/**
|
|
92
|
+
* The code of the entry this entry reverses. Absent on an entry that is not a reversal.
|
|
93
|
+
* @type {string}
|
|
94
|
+
* @memberof BookingEntryClass
|
|
95
|
+
*/
|
|
96
|
+
'reversalOfCode'?: string;
|
|
97
|
+
/**
|
|
98
|
+
* True once the entry has been reversed in full. Its reversal names it in reversalOfCode.
|
|
99
|
+
* @type {boolean}
|
|
100
|
+
* @memberof BookingEntryClass
|
|
101
|
+
*/
|
|
102
|
+
'isReversed'?: boolean;
|
|
91
103
|
/**
|
|
92
104
|
* A list of financial transactions associated with this booking entry. Each entry represents a transaction linked to the current booking.
|
|
93
105
|
* @type {Array<FinancialTransactionClass>}
|
|
@@ -138,6 +150,8 @@ export declare const BookingEntryClassSourceEntityTypeEnum: {
|
|
|
138
150
|
readonly Payment: "payment";
|
|
139
151
|
readonly Credit: "credit";
|
|
140
152
|
readonly CreditAllocation: "credit_allocation";
|
|
153
|
+
readonly ClaimRegulation: "claim_regulation";
|
|
141
154
|
readonly Commission: "commission";
|
|
155
|
+
readonly Manual: "manual";
|
|
142
156
|
};
|
|
143
157
|
export type BookingEntryClassSourceEntityTypeEnum = typeof BookingEntryClassSourceEntityTypeEnum[keyof typeof BookingEntryClassSourceEntityTypeEnum];
|
|
@@ -47,7 +47,7 @@ export interface CreateBookingEntryRequestDto {
|
|
|
47
47
|
*/
|
|
48
48
|
'sourceEntityCode'?: string;
|
|
49
49
|
/**
|
|
50
|
-
* The kind of source entity this entry was posted for. Must be provided together with sourceEntityCode.
|
|
50
|
+
* The kind of source entity this entry was posted for. Must be provided together with sourceEntityCode. Omitted, the entry is typed manual. An entry posted by hand cannot be typed invoice.
|
|
51
51
|
* @type {string}
|
|
52
52
|
* @memberof CreateBookingEntryRequestDto
|
|
53
53
|
*/
|
|
@@ -74,10 +74,11 @@ export interface CreateBookingEntryRequestDto {
|
|
|
74
74
|
'financialTransactions': Array<FinancialTransactionDataDto>;
|
|
75
75
|
}
|
|
76
76
|
export declare const CreateBookingEntryRequestDtoSourceEntityTypeEnum: {
|
|
77
|
-
readonly Invoice: "invoice";
|
|
78
77
|
readonly Payment: "payment";
|
|
79
78
|
readonly Credit: "credit";
|
|
80
79
|
readonly CreditAllocation: "credit_allocation";
|
|
80
|
+
readonly ClaimRegulation: "claim_regulation";
|
|
81
81
|
readonly Commission: "commission";
|
|
82
|
+
readonly Manual: "manual";
|
|
82
83
|
};
|
|
83
84
|
export type CreateBookingEntryRequestDtoSourceEntityTypeEnum = typeof CreateBookingEntryRequestDtoSourceEntityTypeEnum[keyof typeof CreateBookingEntryRequestDtoSourceEntityTypeEnum];
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.CreateBookingEntryRequestDtoSourceEntityTypeEnum = void 0;
|
|
17
17
|
exports.CreateBookingEntryRequestDtoSourceEntityTypeEnum = {
|
|
18
|
-
Invoice: 'invoice',
|
|
19
18
|
Payment: 'payment',
|
|
20
19
|
Credit: 'credit',
|
|
21
20
|
CreditAllocation: 'credit_allocation',
|
|
22
|
-
|
|
21
|
+
ClaimRegulation: 'claim_regulation',
|
|
22
|
+
Commission: 'commission',
|
|
23
|
+
Manual: 'manual'
|
|
23
24
|
};
|
|
@@ -120,5 +120,7 @@ export declare const CreateFinancialAccountRequestDtoFunctionalCategoryEnum: {
|
|
|
120
120
|
readonly BrokerCtrlAcc: "broker_ctrl_acc";
|
|
121
121
|
readonly CarrierCtrlAcc: "carrier_ctrl_acc";
|
|
122
122
|
readonly MainLedgerBridgeAcc: "main_ledger_bridge_acc";
|
|
123
|
+
readonly ClaimsPayableAcc: "claims_payable_acc";
|
|
124
|
+
readonly CarrierReceivableAcc: "carrier_receivable_acc";
|
|
123
125
|
};
|
|
124
126
|
export type CreateFinancialAccountRequestDtoFunctionalCategoryEnum = typeof CreateFinancialAccountRequestDtoFunctionalCategoryEnum[keyof typeof CreateFinancialAccountRequestDtoFunctionalCategoryEnum];
|
|
@@ -42,5 +42,7 @@ exports.CreateFinancialAccountRequestDtoFunctionalCategoryEnum = {
|
|
|
42
42
|
ReceivablesCtrlAcc: 'receivables_ctrl_acc',
|
|
43
43
|
BrokerCtrlAcc: 'broker_ctrl_acc',
|
|
44
44
|
CarrierCtrlAcc: 'carrier_ctrl_acc',
|
|
45
|
-
MainLedgerBridgeAcc: 'main_ledger_bridge_acc'
|
|
45
|
+
MainLedgerBridgeAcc: 'main_ledger_bridge_acc',
|
|
46
|
+
ClaimsPayableAcc: 'claims_payable_acc',
|
|
47
|
+
CarrierReceivableAcc: 'carrier_receivable_acc'
|
|
46
48
|
};
|
|
@@ -45,6 +45,12 @@ export interface FinancialTransactionClass {
|
|
|
45
45
|
* @memberof FinancialTransactionClass
|
|
46
46
|
*/
|
|
47
47
|
'personalAccountNumber'?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The partner this line\'s amount belongs to. Set on a claims payable or carrier receivable line; absent elsewhere.
|
|
50
|
+
* @type {string}
|
|
51
|
+
* @memberof FinancialTransactionClass
|
|
52
|
+
*/
|
|
53
|
+
'partnerCode'?: string;
|
|
48
54
|
/**
|
|
49
55
|
* Internal identifier for the associated booking entry. This links the transaction to a specific entry in the booking system.
|
|
50
56
|
* @type {number}
|
|
@@ -27,6 +27,12 @@ export interface FinancialTransactionDataDto {
|
|
|
27
27
|
* @memberof FinancialTransactionDataDto
|
|
28
28
|
*/
|
|
29
29
|
'personalAccountNumber'?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The partner this line\'s amount belongs to. Required on a claims payable or carrier receivable line; never required elsewhere.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof FinancialTransactionDataDto
|
|
34
|
+
*/
|
|
35
|
+
'partnerCode'?: string;
|
|
30
36
|
/**
|
|
31
37
|
* A brief summary of the transaction, providing context or purpose, such as \"Payment of invoice #1234\" or \"Monthly premium for policy #5678\".
|
|
32
38
|
* @type {string}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -55,11 +55,13 @@ export * from './post-financial-event-response-class';
|
|
|
55
55
|
export * from './premium-item-account-mapping-class';
|
|
56
56
|
export * from './product-account-mapping-class';
|
|
57
57
|
export * from './product-account-mapping-detail-class';
|
|
58
|
+
export * from './product-risk-carrier-class';
|
|
58
59
|
export * from './product-version-account-mapping-detail-class';
|
|
59
60
|
export * from './product-version-with-account-mappings-class';
|
|
60
61
|
export * from './product-with-account-mappings-class';
|
|
61
62
|
export * from './put-premium-item-account-body-dto';
|
|
62
63
|
export * from './put-product-category-account-body-dto';
|
|
64
|
+
export * from './put-product-risk-carrier-body-dto';
|
|
63
65
|
export * from './put-product-version-category-account-body-dto';
|
|
64
66
|
export * from './resolved-account-mapping-class';
|
|
65
67
|
export * from './resolved-commission-account-mapping-class';
|
package/dist/models/index.js
CHANGED
|
@@ -71,11 +71,13 @@ __exportStar(require("./post-financial-event-response-class"), exports);
|
|
|
71
71
|
__exportStar(require("./premium-item-account-mapping-class"), exports);
|
|
72
72
|
__exportStar(require("./product-account-mapping-class"), exports);
|
|
73
73
|
__exportStar(require("./product-account-mapping-detail-class"), exports);
|
|
74
|
+
__exportStar(require("./product-risk-carrier-class"), exports);
|
|
74
75
|
__exportStar(require("./product-version-account-mapping-detail-class"), exports);
|
|
75
76
|
__exportStar(require("./product-version-with-account-mappings-class"), exports);
|
|
76
77
|
__exportStar(require("./product-with-account-mappings-class"), exports);
|
|
77
78
|
__exportStar(require("./put-premium-item-account-body-dto"), exports);
|
|
78
79
|
__exportStar(require("./put-product-category-account-body-dto"), exports);
|
|
80
|
+
__exportStar(require("./put-product-risk-carrier-body-dto"), exports);
|
|
79
81
|
__exportStar(require("./put-product-version-category-account-body-dto"), exports);
|
|
80
82
|
__exportStar(require("./resolved-account-mapping-class"), exports);
|
|
81
83
|
__exportStar(require("./resolved-commission-account-mapping-class"), exports);
|
|
@@ -22,13 +22,13 @@ export interface PostFinancialEventRequestDto {
|
|
|
22
22
|
*/
|
|
23
23
|
'sourceEntityType': PostFinancialEventRequestDtoSourceEntityTypeEnum;
|
|
24
24
|
/**
|
|
25
|
-
* The code of the source entity in the service that owns it, such as an invoice, payment, exceeding credit, credit allocation or
|
|
25
|
+
* The code of the source entity in the service that owns it, such as an invoice, payment, exceeding credit, credit allocation, commission or claim regulation code.
|
|
26
26
|
* @type {string}
|
|
27
27
|
* @memberof PostFinancialEventRequestDto
|
|
28
28
|
*/
|
|
29
29
|
'sourceEntityCode': string;
|
|
30
30
|
/**
|
|
31
|
-
* The partner whose personal account the entry posts to. Required for an exceeding credit, which does not name its partner itself. Optional for a payment
|
|
31
|
+
* The partner whose personal account the entry posts to. Required for an exceeding credit, which does not name its partner itself. Optional for a payment, credit allocation or claim regulation, where it must match the entity\'s own partner. Not accepted for an invoice, whose partner is derived from the policy, and not accepted for a commission, which names its own recipient.
|
|
32
32
|
* @type {string}
|
|
33
33
|
* @memberof PostFinancialEventRequestDto
|
|
34
34
|
*/
|
|
@@ -39,6 +39,7 @@ export declare const PostFinancialEventRequestDtoSourceEntityTypeEnum: {
|
|
|
39
39
|
readonly Payment: "payment";
|
|
40
40
|
readonly Credit: "credit";
|
|
41
41
|
readonly CreditAllocation: "credit_allocation";
|
|
42
|
+
readonly ClaimRegulation: "claim_regulation";
|
|
42
43
|
readonly Commission: "commission";
|
|
43
44
|
};
|
|
44
45
|
export type PostFinancialEventRequestDtoSourceEntityTypeEnum = typeof PostFinancialEventRequestDtoSourceEntityTypeEnum[keyof typeof PostFinancialEventRequestDtoSourceEntityTypeEnum];
|