@eway-crm/connector 1.0.120 → 1.0.121
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/lib/ApiConnection.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApiConnection = void 0;
|
|
4
|
-
var axios_1 = require("axios");
|
|
5
4
|
var ReturnCodes_1 = require("./ReturnCodes");
|
|
6
5
|
var HttpMethod_1 = require("./HttpMethod");
|
|
7
6
|
var CredentialsSessionHandler_1 = require("./CredentialsSessionHandler");
|
|
@@ -11,6 +10,7 @@ var OAuthSessionHandler_1 = require("./OAuthSessionHandler");
|
|
|
11
10
|
var HttpRequestError_1 = require("./exceptions/HttpRequestError");
|
|
12
11
|
var base64url = require("universal-base64url");
|
|
13
12
|
var ErrorHelper_1 = require("./helpers/ErrorHelper");
|
|
13
|
+
var AxiosInstance_1 = require("./axios/AxiosInstance");
|
|
14
14
|
var ApiConnection = /** @class */ (function () {
|
|
15
15
|
function ApiConnection(apiServiceUri, sessionHandler, errorCallback, supportGetItemPreviewMethod) {
|
|
16
16
|
var _this = this;
|
|
@@ -103,7 +103,7 @@ var ApiConnection = /** @class */ (function () {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
var methodUrl = "".concat(_this.svcUri, "/SaveBinaryAttachment?sessionId=").concat(_this.sessionId, "&itemGuid=").concat(itemGuid, "&fileName=").concat(encodeURIComponent(fileName));
|
|
106
|
-
var promise =
|
|
106
|
+
var promise = AxiosInstance_1.default.post(methodUrl, data, config);
|
|
107
107
|
ApiConnection.handleCallPromise(promise, successCallback, unsuccessClb, errorClb);
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
@@ -197,10 +197,10 @@ var ApiConnection = /** @class */ (function () {
|
|
|
197
197
|
if (data) {
|
|
198
198
|
throw new Error('Calling api get method with data specified does not make any sense.');
|
|
199
199
|
}
|
|
200
|
-
promise =
|
|
200
|
+
promise = AxiosInstance_1.default.get(methodUrl, config);
|
|
201
201
|
break;
|
|
202
202
|
case HttpMethod_1.HttpMethod.post:
|
|
203
|
-
promise =
|
|
203
|
+
promise = AxiosInstance_1.default.post(methodUrl, data, config);
|
|
204
204
|
break;
|
|
205
205
|
default:
|
|
206
206
|
throw new Error("Unknown http method '".concat(httpMethod, "'."));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OAuthHelper = void 0;
|
|
4
|
-
var axios_1 = require("axios");
|
|
5
4
|
var base64url = require("universal-base64url");
|
|
6
5
|
var jwt_decode_1 = require("jwt-decode");
|
|
6
|
+
var AxiosInstance_1 = require("../axios/AxiosInstance");
|
|
7
7
|
var OAuthHelper = exports.OAuthHelper = /** @class */ (function () {
|
|
8
8
|
function OAuthHelper() {
|
|
9
9
|
}
|
|
@@ -37,15 +37,13 @@ var OAuthHelper = exports.OAuthHelper = /** @class */ (function () {
|
|
|
37
37
|
return parts.username;
|
|
38
38
|
};
|
|
39
39
|
OAuthHelper.callTokenEndpoint = function (wsUrl, params, callback) {
|
|
40
|
-
|
|
40
|
+
AxiosInstance_1.default.post(wsUrl + '/auth/connect/token', params, {
|
|
41
41
|
headers: {
|
|
42
42
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
43
43
|
}
|
|
44
|
-
})
|
|
45
|
-
.then(function (response) {
|
|
44
|
+
}).then(function (response) {
|
|
46
45
|
callback(response.data);
|
|
47
|
-
})
|
|
48
|
-
.catch(function (error) {
|
|
46
|
+
}).catch(function (error) {
|
|
49
47
|
if (error.response) {
|
|
50
48
|
if (error.response.status == 400) {
|
|
51
49
|
callback(error.response.data);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TokenizedServiceConnection = void 0;
|
|
4
|
-
var axios_1 = require("axios");
|
|
5
4
|
var __1 = require("..");
|
|
5
|
+
var AxiosInstance_1 = require("../axios/AxiosInstance");
|
|
6
6
|
var TokenizedServiceConnection = /** @class */ (function () {
|
|
7
7
|
function TokenizedServiceConnection(obtainTokenMethodName, obtainTokenMethodType, needsSession, invalidTokenReturnCode, urlAndTokenObtainer, connection, errorCallback) {
|
|
8
8
|
var _this = this;
|
|
@@ -103,7 +103,7 @@ var TokenizedServiceConnection = /** @class */ (function () {
|
|
|
103
103
|
TokenizedServiceConnection.call = function (serviceUrl, methodName, data, successCallback, unsuccessCallback, errorCallback) {
|
|
104
104
|
// We count on that we are in Admin/Subdirectory.
|
|
105
105
|
var address = serviceUrl + '/' + methodName;
|
|
106
|
-
|
|
106
|
+
AxiosInstance_1.default.post(address, data)
|
|
107
107
|
.then(function (response) {
|
|
108
108
|
if (response.status === 200) {
|
|
109
109
|
if (response.data.ReturnCodeString === 'Success') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eway-crm/connector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.121",
|
|
4
4
|
"description": "eWay-CRM API JavaScript connector library.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"jwt-decode": "^3.1.2",
|
|
54
54
|
"universal-base64url": "^1.1.0"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|