@eway-crm/connector 1.0.121 → 1.0.122

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.
Files changed (98) hide show
  1. package/lib/AnonymousSessionHandler.js +5 -10
  2. package/lib/ApiConnection.js +115 -129
  3. package/lib/ApiMethods.js +35 -40
  4. package/lib/CredentialsSessionHandler.js +22 -28
  5. package/lib/HttpMethod.js +2 -5
  6. package/lib/ISessionHandler.js +1 -2
  7. package/lib/OAuthSessionHandler.js +16 -39
  8. package/lib/OAuthSessionHandlerBase.js +30 -36
  9. package/lib/ReturnCodes.js +10 -15
  10. package/lib/axios/AxiosInstance.js +3 -5
  11. package/lib/constants/ActionEventTypes.js +9 -14
  12. package/lib/constants/ColumnPermissionRules.js +15 -22
  13. package/lib/constants/CompletionLevels.js +6 -11
  14. package/lib/constants/CustomizationStatsItemKeys.js +12 -17
  15. package/lib/constants/Edition.js +2 -5
  16. package/lib/constants/EnumTypes.js +33 -38
  17. package/lib/constants/ExpirationReason.js +1 -3
  18. package/lib/constants/Feature.js +2 -5
  19. package/lib/constants/FieldNames.js +421 -426
  20. package/lib/constants/FieldTypes.js +15 -20
  21. package/lib/constants/FolderNames.js +82 -87
  22. package/lib/constants/Functionality.js +55 -60
  23. package/lib/constants/GlobalSettingsNames.js +71 -76
  24. package/lib/constants/LicenseKeyInvoiceSeverity.js +1 -3
  25. package/lib/constants/LicenseRestrictionKeys.js +63 -68
  26. package/lib/constants/RelationTypes.js +11 -16
  27. package/lib/data/EWItem.js +29 -34
  28. package/lib/data/IApiAdditionalField.js +1 -2
  29. package/lib/data/IApiAvailableBundle.js +1 -2
  30. package/lib/data/IApiAvailableVersionResponse.js +1 -2
  31. package/lib/data/IApiBooleanResponse.js +1 -2
  32. package/lib/data/IApiCapacityAvailableBundle.js +1 -2
  33. package/lib/data/IApiCart.js +1 -2
  34. package/lib/data/IApiColumn.js +1 -2
  35. package/lib/data/IApiColumnPermission.js +1 -2
  36. package/lib/data/IApiCompany.js +1 -2
  37. package/lib/data/IApiContact.js +1 -2
  38. package/lib/data/IApiCurrencyExchangeRate.js +1 -2
  39. package/lib/data/IApiCustomizationStatsItem.js +1 -2
  40. package/lib/data/IApiDataResponse.js +1 -2
  41. package/lib/data/IApiDatumResponse.js +1 -2
  42. package/lib/data/IApiDocument.js +1 -2
  43. package/lib/data/IApiEmail.js +1 -2
  44. package/lib/data/IApiEnumType.js +2 -5
  45. package/lib/data/IApiEnumValue.js +1 -2
  46. package/lib/data/IApiEnumValuesRelation.js +1 -2
  47. package/lib/data/IApiFeature.js +1 -2
  48. package/lib/data/IApiFeaturesLicenseBundle.js +1 -2
  49. package/lib/data/IApiFlow.js +1 -2
  50. package/lib/data/IApiGlobalSetting.js +1 -2
  51. package/lib/data/IApiGoal.js +1 -2
  52. package/lib/data/IApiGood.js +1 -2
  53. package/lib/data/IApiGoodInCart.js +1 -2
  54. package/lib/data/IApiGroup.js +1 -2
  55. package/lib/data/IApiItemBase.js +1 -2
  56. package/lib/data/IApiItemIdentifier.js +1 -2
  57. package/lib/data/IApiItemUsageStatus.js +1 -2
  58. package/lib/data/IApiJournal.js +1 -2
  59. package/lib/data/IApiLead.js +1 -2
  60. package/lib/data/IApiLicense.js +1 -2
  61. package/lib/data/IApiLicenseBundleBase.js +1 -2
  62. package/lib/data/IApiLocalizedLicenseBundle.js +1 -2
  63. package/lib/data/IApiLoginResponse.js +1 -2
  64. package/lib/data/IApiMarketingCampaign.js +1 -2
  65. package/lib/data/IApiMarketingList.js +1 -2
  66. package/lib/data/IApiModulePermission.js +1 -2
  67. package/lib/data/IApiObjectType.js +1 -2
  68. package/lib/data/IApiPasswordStrength.js +1 -2
  69. package/lib/data/IApiPayment.js +1 -2
  70. package/lib/data/IApiProject.js +1 -2
  71. package/lib/data/IApiRecurrencePattern.js +1 -2
  72. package/lib/data/IApiResult.js +1 -2
  73. package/lib/data/IApiSaveResponse.js +1 -2
  74. package/lib/data/IApiTask.js +1 -2
  75. package/lib/data/IApiUser.js +1 -2
  76. package/lib/data/IApiUserSetting.js +1 -2
  77. package/lib/data/IApiWebServiceTaskStatus.js +1 -2
  78. package/lib/data/IApiWorkReport.js +1 -2
  79. package/lib/data/IApiWorkflowActionDerivedItem.js +1 -2
  80. package/lib/data/IApiWorkflowModel.js +1 -2
  81. package/lib/data/query/IApiQuery.js +1 -2
  82. package/lib/data/query/IApiQueryFilters.js +1 -2
  83. package/lib/data/workflowActions/IApiAction.js +1 -2
  84. package/lib/exceptions/HttpRequestError.js +6 -28
  85. package/lib/exceptions/WebServiceError.js +6 -28
  86. package/lib/helpers/ErrorHelper.js +15 -20
  87. package/lib/helpers/OAuthHelper.js +49 -54
  88. package/lib/helpers/VersionHelperBase.js +15 -20
  89. package/lib/index.js +83 -123
  90. package/lib/interfaces/IEWJwtPayload.js +1 -2
  91. package/lib/interfaces/IItemPreview.js +1 -2
  92. package/lib/interfaces/ITokenData.js +1 -2
  93. package/lib/interfaces/ITranslatableString.js +1 -2
  94. package/lib/interfaces/TNumericValidatorType.js +1 -2
  95. package/lib/tokenizedServices/CommonDataConnection.js +11 -17
  96. package/lib/tokenizedServices/ITokenizedApiResult.js +1 -2
  97. package/lib/tokenizedServices/TokenizedServiceConnection.js +53 -59
  98. package/package.json +1 -1
@@ -1,22 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommonDataConnection = void 0;
4
- var TokenizedServiceConnection_1 = require("./TokenizedServiceConnection");
5
- var HttpMethod_1 = require("../HttpMethod");
6
- var obtainer = function (result) {
1
+ import { TokenizedServiceConnection } from './TokenizedServiceConnection';
2
+ import { HttpMethod } from '../HttpMethod';
3
+ const obtainer = (result) => {
7
4
  return { url: result.ServiceUrl, token: result.Token };
8
5
  };
9
- var CommonDataConnection = /** @class */ (function () {
10
- function CommonDataConnection(connection, errorCallback) {
11
- var _this = this;
12
- this.isCommonDataApiEnabled = function (enabledCallback, disabledCallback) {
13
- _this.tokenizedConnection.isEnabled(enabledCallback, disabledCallback);
6
+ export class CommonDataConnection {
7
+ constructor(connection, errorCallback) {
8
+ this.isCommonDataApiEnabled = (enabledCallback, disabledCallback) => {
9
+ this.tokenizedConnection.isEnabled(enabledCallback, disabledCallback);
14
10
  };
15
- this.callCommonDataApi = function (methodName, data, successCallback, unsuccessCallback) {
16
- _this.tokenizedConnection.callTokenizedApi(methodName, data, successCallback, unsuccessCallback);
11
+ this.callCommonDataApi = (methodName, data, successCallback, unsuccessCallback) => {
12
+ this.tokenizedConnection.callTokenizedApi(methodName, data, successCallback, unsuccessCallback);
17
13
  };
18
- this.tokenizedConnection = new TokenizedServiceConnection_1.TokenizedServiceConnection('ObtainCommonDataApiAccessToken', HttpMethod_1.HttpMethod.get, false, 'InvalidCommonDataToken', obtainer, connection, errorCallback);
14
+ this.tokenizedConnection = new TokenizedServiceConnection('ObtainCommonDataApiAccessToken', HttpMethod.get, false, 'InvalidCommonDataToken', obtainer, connection, errorCallback);
19
15
  }
20
- return CommonDataConnection;
21
- }());
22
- exports.CommonDataConnection = CommonDataConnection;
16
+ }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,35 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenizedServiceConnection = void 0;
4
- var __1 = require("..");
5
- var AxiosInstance_1 = require("../axios/AxiosInstance");
6
- var TokenizedServiceConnection = /** @class */ (function () {
7
- function TokenizedServiceConnection(obtainTokenMethodName, obtainTokenMethodType, needsSession, invalidTokenReturnCode, urlAndTokenObtainer, connection, errorCallback) {
8
- var _this = this;
9
- this.isEnabled = function (enabledCallback, disabledCallback) {
10
- var check = function () {
11
- if (!_this.url || !_this.token) {
1
+ import { HttpRequestError } from '..';
2
+ import axiosInstance from '../axios/AxiosInstance';
3
+ export class TokenizedServiceConnection {
4
+ constructor(obtainTokenMethodName, obtainTokenMethodType, needsSession, invalidTokenReturnCode, urlAndTokenObtainer, connection, errorCallback) {
5
+ this.isEnabled = (enabledCallback, disabledCallback) => {
6
+ const check = () => {
7
+ if (!this.url || !this.token) {
12
8
  disabledCallback();
13
9
  }
14
10
  else {
15
- enabledCallback(_this.url, _this.token);
11
+ enabledCallback(this.url, this.token);
16
12
  }
17
13
  };
18
- if (!_this.url || !_this.token) {
19
- _this.obtainToken(check);
14
+ if (!this.url || !this.token) {
15
+ this.obtainToken(check);
20
16
  return;
21
17
  }
22
18
  else {
23
- enabledCallback(_this.url, _this.token);
19
+ enabledCallback(this.url, this.token);
24
20
  }
25
21
  };
26
- this.callTokenizedApi = function (methodName, data, successCallback, unsuccessCallback) {
27
- _this.isEnabled(function (url, token) {
22
+ this.callTokenizedApi = (methodName, data, successCallback, unsuccessCallback) => {
23
+ this.isEnabled((url, token) => {
28
24
  data.token = token;
29
- TokenizedServiceConnection.call(url, methodName, data, successCallback, function (result) {
30
- if (result.ReturnCodeString === _this.invalidTokenReturnCode) {
31
- _this.obtainToken(function () {
32
- _this.callTokenizedApi(methodName, data, successCallback, unsuccessCallback);
25
+ TokenizedServiceConnection.call(url, methodName, data, successCallback, (result) => {
26
+ if (result.ReturnCodeString === this.invalidTokenReturnCode) {
27
+ this.obtainToken(() => {
28
+ this.callTokenizedApi(methodName, data, successCallback, unsuccessCallback);
33
29
  });
34
30
  return;
35
31
  }
@@ -37,56 +33,56 @@ var TokenizedServiceConnection = /** @class */ (function () {
37
33
  unsuccessCallback(result);
38
34
  }
39
35
  else {
40
- if (!!_this.generalErrorCallback) {
41
- var error = new Error('Unhandled tokenized service connection return code ' + result.ReturnCodeString + '.\nDescription: ' + result.Description);
42
- _this.generalErrorCallback(error);
36
+ if (!!this.generalErrorCallback) {
37
+ const error = new Error('Unhandled tokenized service connection return code ' + result.ReturnCodeString + '.\nDescription: ' + result.Description);
38
+ this.generalErrorCallback(error);
43
39
  }
44
40
  }
45
- }, function (error) {
46
- if (!!_this.generalErrorCallback) {
47
- var err = new Error('Unhandled tokenized service connection communication error: ' + JSON.stringify(error));
48
- _this.generalErrorCallback(err);
41
+ }, (error) => {
42
+ if (!!this.generalErrorCallback) {
43
+ const err = new Error('Unhandled tokenized service connection communication error: ' + JSON.stringify(error));
44
+ this.generalErrorCallback(err);
49
45
  }
50
46
  });
51
- }, function () {
47
+ }, () => {
52
48
  if (unsuccessCallback) {
53
49
  unsuccessCallback(null);
54
50
  }
55
51
  });
56
52
  };
57
- this.obtainToken = function (callback) {
58
- if (!_this.isActive) {
59
- _this.url = null;
60
- _this.token = null;
53
+ this.obtainToken = (callback) => {
54
+ if (!this.isActive) {
55
+ this.url = null;
56
+ this.token = null;
61
57
  callback();
62
58
  return;
63
59
  }
64
- var successClb = function (result) {
65
- var obtainedResult = _this.urlAndTokenObtainer(result);
60
+ const successClb = (result) => {
61
+ const obtainedResult = this.urlAndTokenObtainer(result);
66
62
  if (!obtainedResult.url || !obtainedResult.token) {
67
- _this.url = null;
68
- _this.token = null;
69
- _this.isActive = false;
63
+ this.url = null;
64
+ this.token = null;
65
+ this.isActive = false;
70
66
  callback();
71
67
  }
72
68
  else {
73
- _this.url = obtainedResult.url;
74
- _this.token = obtainedResult.token;
75
- _this.isActive = true;
69
+ this.url = obtainedResult.url;
70
+ this.token = obtainedResult.token;
71
+ this.isActive = true;
76
72
  callback();
77
73
  }
78
74
  };
79
- var unsuccessClb = function () {
80
- _this.url = null;
81
- _this.token = null;
82
- _this.isActive = false;
75
+ const unsuccessClb = () => {
76
+ this.url = null;
77
+ this.token = null;
78
+ this.isActive = false;
83
79
  callback();
84
80
  };
85
- if (_this.needsSession) {
86
- _this.connection.callMethod(_this.obtainTokenMethodName, {}, successClb, unsuccessClb, _this.obtainTokenMethodType);
81
+ if (this.needsSession) {
82
+ this.connection.callMethod(this.obtainTokenMethodName, {}, successClb, unsuccessClb, this.obtainTokenMethodType);
87
83
  }
88
84
  else {
89
- _this.connection.callWithoutSession(_this.obtainTokenMethodName, null, successClb, unsuccessClb, null, _this.obtainTokenMethodType);
85
+ this.connection.callWithoutSession(this.obtainTokenMethodName, null, successClb, unsuccessClb, null, this.obtainTokenMethodType);
90
86
  }
91
87
  };
92
88
  this.obtainTokenMethodName = obtainTokenMethodName;
@@ -100,11 +96,11 @@ var TokenizedServiceConnection = /** @class */ (function () {
100
96
  this.token = null;
101
97
  this.isActive = true;
102
98
  }
103
- TokenizedServiceConnection.call = function (serviceUrl, methodName, data, successCallback, unsuccessCallback, errorCallback) {
99
+ static call(serviceUrl, methodName, data, successCallback, unsuccessCallback, errorCallback) {
104
100
  // We count on that we are in Admin/Subdirectory.
105
- var address = serviceUrl + '/' + methodName;
106
- AxiosInstance_1.default.post(address, data)
107
- .then(function (response) {
101
+ const address = serviceUrl + '/' + methodName;
102
+ axiosInstance.post(address, data)
103
+ .then((response) => {
108
104
  if (response.status === 200) {
109
105
  if (response.data.ReturnCodeString === 'Success') {
110
106
  successCallback(response.data);
@@ -114,17 +110,15 @@ var TokenizedServiceConnection = /** @class */ (function () {
114
110
  }
115
111
  }
116
112
  else {
117
- errorCallback(new __1.HttpRequestError(response.status, response.statusText));
113
+ errorCallback(new HttpRequestError(response.status, response.statusText));
118
114
  }
119
115
  })
120
- .catch(function (error) {
116
+ .catch((error) => {
121
117
  if (error.response) {
122
- errorCallback(new __1.HttpRequestError(error.response.status, error.response.statusText));
118
+ errorCallback(new HttpRequestError(error.response.status, error.response.statusText));
123
119
  return;
124
120
  }
125
121
  errorCallback(error);
126
122
  });
127
- };
128
- return TokenizedServiceConnection;
129
- }());
130
- exports.TokenizedServiceConnection = TokenizedServiceConnection;
123
+ }
124
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eway-crm/connector",
3
- "version": "1.0.121",
3
+ "version": "1.0.122",
4
4
  "description": "eWay-CRM API JavaScript connector library.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",