@eway-crm/connector 1.0.82 → 1.0.85
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.d.ts +7 -7
- package/lib/ApiConnection.js +2 -2
- package/lib/OAuthSessionHandler.js +1 -2
- package/lib/constants/CustomizationStatsItemKeys.d.ts +1 -1
- package/lib/constants/CustomizationStatsItemKeys.js +1 -1
- package/lib/constants/Functionality.d.ts +4 -3
- package/lib/constants/Functionality.js +4 -2
- package/lib/data/IApiLicense.d.ts +1 -2
- package/lib/exceptions/HttpRequestError.js +3 -1
- package/lib/exceptions/WebServiceError.js +3 -1
- package/lib/helpers/OAuthHelper.js +1 -1
- package/lib/index.js +6 -2
- package/package.json +10 -12
package/lib/ApiConnection.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare class ApiConnection {
|
|
|
18
18
|
static createAnonymous(apiServiceUri: string, errorCallback?: (error: TUnionError) => void): ApiConnection;
|
|
19
19
|
static createUsingOAuth(apiServiceUri: string, username: string, clientId: string, clientSecret: string, refreshToken: string, accessToken: string, appVersion: string, errorCallback?: (error: TUnionError) => void, refreshTokenCallback?: (tokenData: ITokenData) => void, supportGetItemPreviewMethod?: boolean): ApiConnection;
|
|
20
20
|
get wsUrl(): string;
|
|
21
|
-
readonly createOpenLink: (folderName: TFolderName, guid?: string
|
|
21
|
+
readonly createOpenLink: (folderName: TFolderName, guid?: string, fileAs?: string) => string;
|
|
22
22
|
/**
|
|
23
23
|
* Creates a promise for async file upload using binary stream
|
|
24
24
|
* @param itemGuid Item identificator. Ex. '9ac561be-9b7d-4938-8e55-4cce97142483'.
|
|
@@ -27,7 +27,7 @@ export declare class ApiConnection {
|
|
|
27
27
|
* @param config Optional. Additional config for the request.
|
|
28
28
|
* @param catchGlobally Optional. If true, raises this the global error handler each time the promise is rejected.
|
|
29
29
|
*/
|
|
30
|
-
readonly askUploadMethod: (itemGuid: string, fileName: string, data: File, config?: AxiosRequestConfig
|
|
30
|
+
readonly askUploadMethod: (itemGuid: string, fileName: string, data: File, config?: AxiosRequestConfig, catchGlobally?: boolean) => Promise<IApiResult>;
|
|
31
31
|
/**
|
|
32
32
|
* Asynchronously uploads file using binary stream
|
|
33
33
|
* @param itemGuid Item identificator. Ex. '9ac561be-9b7d-4938-8e55-4cce97142483'.
|
|
@@ -38,7 +38,7 @@ export declare class ApiConnection {
|
|
|
38
38
|
* @param errorCallback Optional. Handler callback for any other failures. If not supplied, the global error handler is used.
|
|
39
39
|
* @param config Optional. Additional config for the request.
|
|
40
40
|
*/
|
|
41
|
-
readonly callUploadMethod: (itemGuid: string, fileName: string, data: File, successCallback: (res: IApiResult) => void, unsuccessCallback?: ((e: IApiResult) => void) | undefined, errorCallback?: ((e: TUnionError) => void) | undefined, config?: AxiosRequestConfig
|
|
41
|
+
readonly callUploadMethod: (itemGuid: string, fileName: string, data: File, successCallback: (res: IApiResult) => void, unsuccessCallback?: ((e: IApiResult) => void) | undefined, errorCallback?: ((e: TUnionError) => void) | undefined, config?: AxiosRequestConfig) => void;
|
|
42
42
|
/**
|
|
43
43
|
* Creates a promise for async API method call.
|
|
44
44
|
* @param methodName API method name. Ex. 'GetUsers'.
|
|
@@ -46,7 +46,7 @@ export declare class ApiConnection {
|
|
|
46
46
|
* @param httpMethod Optional. The used HTTP method. POST or GET. Default is POST.
|
|
47
47
|
* @param catchGlobally Optional. If true, raises this the global error handler each time the promise is rejected.
|
|
48
48
|
*/
|
|
49
|
-
readonly askMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, httpMethod?: HttpMethod
|
|
49
|
+
readonly askMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, httpMethod?: HttpMethod, catchGlobally?: boolean) => Promise<TResult>;
|
|
50
50
|
/**
|
|
51
51
|
* Asynchronously calls API method with automatically added session data.
|
|
52
52
|
* @param methodName API method name. Ex. 'GetUsers'.
|
|
@@ -56,8 +56,8 @@ export declare class ApiConnection {
|
|
|
56
56
|
* @param httpMethod Optional. The used HTTP method. POST or GET. Default is POST.
|
|
57
57
|
* @param errorCallback Optional. Handler callback for any other failures. If not supplied, the global error handler is used.
|
|
58
58
|
*/
|
|
59
|
-
readonly callMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, successCallback: (result: TResult) => void, unsuccessCallback?: ((result: TResult) => void) | undefined, httpMethod?: HttpMethod
|
|
60
|
-
readonly callWithoutSession: <TResult extends IApiResult>(methodName: string, data: TInputData | null, successCallback: (result: TResult) => void, unsuccessCallback: (result: TResult) => void, headers?: Record<string, string> | null
|
|
61
|
-
readonly getItemPreviewGetMethodUrl: (folderName: string, itemGuid: string, itemVersion?: number
|
|
59
|
+
readonly callMethod: <TResult extends IApiResult>(methodName: string, data: TInputData, successCallback: (result: TResult) => void, unsuccessCallback?: ((result: TResult) => void) | undefined, httpMethod?: HttpMethod, errorCallback?: ((error: TUnionError) => void) | undefined) => void;
|
|
60
|
+
readonly callWithoutSession: <TResult extends IApiResult>(methodName: string, data: TInputData | null, successCallback: (result: TResult) => void, unsuccessCallback: (result: TResult) => void, headers?: Record<string, string> | null, httpMethod?: HttpMethod, errorCallback?: ((error: TUnionError) => void) | undefined) => void;
|
|
61
|
+
readonly getItemPreviewGetMethodUrl: (folderName: string, itemGuid: string, itemVersion?: number) => string;
|
|
62
62
|
private static handleCallPromise;
|
|
63
63
|
}
|
package/lib/ApiConnection.js
CHANGED
|
@@ -101,7 +101,7 @@ var ApiConnection = /** @class */ (function () {
|
|
|
101
101
|
throw err;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
var methodUrl = _this.svcUri
|
|
104
|
+
var methodUrl = "".concat(_this.svcUri, "/SaveBinaryAttachment?sessionId=").concat(_this.sessionId, "&itemGuid=").concat(itemGuid, "&fileName=").concat(fileName);
|
|
105
105
|
var promise = axios_1.default.post(methodUrl, data, config);
|
|
106
106
|
ApiConnection.handleCallPromise(promise, successCallback, unsuccessClb, errorClb);
|
|
107
107
|
};
|
|
@@ -202,7 +202,7 @@ var ApiConnection = /** @class */ (function () {
|
|
|
202
202
|
promise = axios_1.default.post(methodUrl, data, config);
|
|
203
203
|
break;
|
|
204
204
|
default:
|
|
205
|
-
throw new Error("Unknown http method '"
|
|
205
|
+
throw new Error("Unknown http method '".concat(httpMethod, "'."));
|
|
206
206
|
}
|
|
207
207
|
var errorClb = function (error) {
|
|
208
208
|
if (errorCallback) {
|
|
@@ -43,8 +43,7 @@ var OAuthSessionHandler = /** @class */ (function () {
|
|
|
43
43
|
}, {
|
|
44
44
|
'Authorization': 'Bearer ' + _this.accessToken
|
|
45
45
|
}, undefined, function (error) {
|
|
46
|
-
|
|
47
|
-
if (((_a = error) === null || _a === void 0 ? void 0 : _a.statusCode) === 401) {
|
|
46
|
+
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 401) {
|
|
48
47
|
_this.getNewAccessToken(connection, function (tokenData) {
|
|
49
48
|
_this.accessToken = tokenData.access_token;
|
|
50
49
|
if (!tokenData.error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default class CustomizationStatsItemKeys {
|
|
2
|
-
static
|
|
2
|
+
static customAdditionalFieldsCount: string;
|
|
3
3
|
static customEnabledAdvancedWorkflowsCount: string;
|
|
4
4
|
static customEnabledBasicWorkflowsCount: string;
|
|
5
5
|
static customMandatoryFieldsCount: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var CustomizationStatsItemKeys = /** @class */ (function () {
|
|
4
4
|
function CustomizationStatsItemKeys() {
|
|
5
5
|
}
|
|
6
|
-
CustomizationStatsItemKeys.
|
|
6
|
+
CustomizationStatsItemKeys.customAdditionalFieldsCount = 'CustomAdditionalFieldsCount';
|
|
7
7
|
CustomizationStatsItemKeys.customEnabledAdvancedWorkflowsCount = 'CustomEnabledAdvancedWorkflowsCount';
|
|
8
8
|
CustomizationStatsItemKeys.customEnabledBasicWorkflowsCount = 'CustomEnabledBasicWorkflowsCount';
|
|
9
9
|
CustomizationStatsItemKeys.customMandatoryFieldsCount = 'CustomMandatoryFieldsCount';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare type TFunctionality = 'ContactsSynchronizationWithOutlook' | 'WordAddin' | 'ExcelAddin' | 'TasksRecurrentTasks' | 'TasksSubtasks' | 'TasksSynchronizationWithOutlook' | 'CalendarSynchronizationWithOutlook' | 'EmailsAutomaticTracking' | 'ConvertEmailToProject' | 'DuplicityChecker' | 'NextStepAndLastActivityCustomization' | 'SubProjects' | 'ResourceAndPlanning' | 'ProfessionalEmailCampaigns' | 'ProfessionalEmailCampaignsAdvancedStatistics' | 'WordEmailMerge' | 'PrintLabels' | 'PrintEnvelopes' | 'UserViews' | 'SharedUserViews' | 'GridConditionalFormating' | 'MultipleCurrencies' | 'HistoryTracking' | 'PrivateItems' | 'ItemTypes' | 'FormLayoutCustomization' | 'WorkflowBasicDefinitions' | 'WorkflowAdvancedDefinitions' | 'WorkflowAdvancedDefinitionsRules' | 'WorkflowAdvancedDefinitionsActions' | 'WorkflowGroupLevelActions' | 'CustomFields' | 'ImportantFields' | 'MandatoryFields' | 'UniqueFields' | 'ReadOnlyFields' | 'TransformationCustomTemplates' | 'UserRoles' | 'ModulePermissions' | 'ColumnPermissions' | 'eWayCrmAPI' | 'CommonDataAPI' | 'ThreeCXIntegration' | 'TapiIntegration' | 'PohodaIntegration' | 'PohodaSynchronizationIntervalCustomization' | 'PohodaSynchronizationFieldMappingCustomization' | 'QuickBooksIntegration';
|
|
2
1
|
export default class Functionality {
|
|
3
2
|
static readonly contactsSynchronizationWithOutlook = "ContactsSynchronizationWithOutlook";
|
|
4
3
|
static readonly wordAddin = "WordAddin";
|
|
@@ -40,12 +39,14 @@ export default class Functionality {
|
|
|
40
39
|
static readonly userRoles = "UserRoles";
|
|
41
40
|
static readonly modulePermissions = "ModulePermissions";
|
|
42
41
|
static readonly columnPermissions = "ColumnPermissions";
|
|
43
|
-
static readonly
|
|
44
|
-
static readonly
|
|
42
|
+
static readonly api = "API";
|
|
43
|
+
static readonly gate = "Gate";
|
|
45
44
|
static readonly threeCXIntegration = "ThreeCXIntegration";
|
|
46
45
|
static readonly tapiIntegration = "TapiIntegration";
|
|
47
46
|
static readonly pohodaIntegration = "PohodaIntegration";
|
|
48
47
|
static readonly pohodaSynchronizationIntervalCustomization = "PohodaSynchronizationIntervalCustomization";
|
|
49
48
|
static readonly pohodaSynchronizationFieldMappingCustomization = "PohodaSynchronizationFieldMappingCustomization";
|
|
50
49
|
static readonly quickBooksIntegration = "QuickBooksIntegration";
|
|
50
|
+
static readonly saveBinaryDataOnDisk = "SaveBinaryDataOnDisk";
|
|
51
|
+
static readonly activeDirectoryLogin = "ActiveDirectoryLogin";
|
|
51
52
|
}
|
|
@@ -43,14 +43,16 @@ var Functionality = /** @class */ (function () {
|
|
|
43
43
|
Functionality.userRoles = 'UserRoles';
|
|
44
44
|
Functionality.modulePermissions = 'ModulePermissions';
|
|
45
45
|
Functionality.columnPermissions = 'ColumnPermissions';
|
|
46
|
-
Functionality.
|
|
47
|
-
Functionality.
|
|
46
|
+
Functionality.api = 'API';
|
|
47
|
+
Functionality.gate = 'Gate';
|
|
48
48
|
Functionality.threeCXIntegration = 'ThreeCXIntegration';
|
|
49
49
|
Functionality.tapiIntegration = 'TapiIntegration';
|
|
50
50
|
Functionality.pohodaIntegration = 'PohodaIntegration';
|
|
51
51
|
Functionality.pohodaSynchronizationIntervalCustomization = 'PohodaSynchronizationIntervalCustomization';
|
|
52
52
|
Functionality.pohodaSynchronizationFieldMappingCustomization = 'PohodaSynchronizationFieldMappingCustomization';
|
|
53
53
|
Functionality.quickBooksIntegration = 'QuickBooksIntegration';
|
|
54
|
+
Functionality.saveBinaryDataOnDisk = 'SaveBinaryDataOnDisk';
|
|
55
|
+
Functionality.activeDirectoryLogin = 'ActiveDirectoryLogin';
|
|
54
56
|
return Functionality;
|
|
55
57
|
}());
|
|
56
58
|
exports.default = Functionality;
|
|
@@ -3,7 +3,6 @@ import { ITranslatableString } from '../interfaces/ITranslatableString';
|
|
|
3
3
|
import { TFeatureWithEdition } from './IApiFeaturesLicenseBundle';
|
|
4
4
|
import { Edition } from '../constants/Edition';
|
|
5
5
|
import { Feature } from '../constants/Feature';
|
|
6
|
-
import { TFunctionality } from '../constants/Functionality';
|
|
7
6
|
import { TFolderName } from '../constants/FolderNames';
|
|
8
7
|
declare type LicenceBusinessType = 'Premium' | 'Trial' | 'Free';
|
|
9
8
|
interface IApiRestrictionBase {
|
|
@@ -12,7 +11,7 @@ interface IApiRestrictionBase {
|
|
|
12
11
|
}
|
|
13
12
|
interface IApiRestrictionsClass {
|
|
14
13
|
Functionalities: (IApiRestrictionBase & {
|
|
15
|
-
Functionality:
|
|
14
|
+
Functionality: string;
|
|
16
15
|
CurrentLimit: number | null;
|
|
17
16
|
})[];
|
|
18
17
|
GlobalSettings: (IApiRestrictionBase & {
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -33,7 +33,7 @@ var OAuthHelper = /** @class */ (function () {
|
|
|
33
33
|
return base64url_1.default.decode(parts[1]);
|
|
34
34
|
};
|
|
35
35
|
OAuthHelper.getUserName = function (accessToken) {
|
|
36
|
-
var parts = jwt_decode_1.default(accessToken);
|
|
36
|
+
var parts = (0, jwt_decode_1.default)(accessToken);
|
|
37
37
|
return parts.username;
|
|
38
38
|
};
|
|
39
39
|
OAuthHelper.callTokenEndpoint = function (wsUrl, params, callback) {
|
package/lib/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
exports.LicenseRestrictionKeys = exports.CustomizationStatsItemKeys = exports.Functionality = exports.Feature = exports.Edition = exports.ColumnPermissionMandatoryRules = exports.ColumnPermissionPermissionRules = exports.RelationTypes = exports.EnumTypes = exports.FieldNames = exports.HttpRequestError = exports.OAuthHelper = exports.FolderNames = exports.GlobalSettingsNames = exports.ApiMethods = exports.CommonDataConnection = exports.TokenizedServiceConnection = exports.ReturnCodes = exports.HttpMethod = void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eway-crm/connector",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.85",
|
|
4
4
|
"description": "eWay-CRM API JavaScript connector library.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -34,22 +34,20 @@
|
|
|
34
34
|
"homepage": "https://github.com/eway-crm/js-lib#readme",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eway-crm/eslint-config": "^1.0.6",
|
|
37
|
-
"@types/jest": "^
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
39
|
-
"@typescript-eslint/parser": "^
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"jest": "^
|
|
42
|
-
"prettier": "^2.
|
|
43
|
-
"ts-jest": "^
|
|
44
|
-
"
|
|
45
|
-
"tslint-config-prettier": "^1.18.0",
|
|
46
|
-
"typescript": "^3.9.10"
|
|
37
|
+
"@types/jest": "^28.1.1",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
39
|
+
"@typescript-eslint/parser": "^5.27.1",
|
|
40
|
+
"eslint": "^8.17.0",
|
|
41
|
+
"jest": "^28.1.1",
|
|
42
|
+
"prettier": "^2.6.2",
|
|
43
|
+
"ts-jest": "^28.0.4",
|
|
44
|
+
"typescript": "^4.7.3"
|
|
47
45
|
},
|
|
48
46
|
"files": [
|
|
49
47
|
"lib/**/*"
|
|
50
48
|
],
|
|
51
49
|
"dependencies": {
|
|
52
|
-
"axios": "^0.
|
|
50
|
+
"axios": "^0.27.2",
|
|
53
51
|
"base64url": "^3.0.1",
|
|
54
52
|
"es6-promise": "^4.2.8",
|
|
55
53
|
"jwt-decode": "^3.1.2"
|