@eway-crm/connector 1.0.102 → 1.0.103

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.
@@ -10,6 +10,7 @@ var ApiMethods_1 = require("./ApiMethods");
10
10
  var OAuthSessionHandler_1 = require("./OAuthSessionHandler");
11
11
  var HttpRequestError_1 = require("./exceptions/HttpRequestError");
12
12
  var base64url_1 = require("base64url");
13
+ var ErrorHelper_1 = require("./helpers/ErrorHelper");
13
14
  var ApiConnection = /** @class */ (function () {
14
15
  function ApiConnection(apiServiceUri, sessionHandler, errorCallback, supportGetItemPreviewMethod) {
15
16
  var _this = this;
@@ -87,7 +88,7 @@ var ApiConnection = /** @class */ (function () {
87
88
  }
88
89
  };
89
90
  var errorClb = function (error) {
90
- var err = new Error('Unhandled connection error when calling ' + methodUrl + ': ' + JSON.stringify(error));
91
+ var err = new Error('Unhandled connection error when calling ' + methodUrl + ': ' + ErrorHelper_1.default.stringifyError(error));
91
92
  if ('statusCode' in error && error.statusCode === 413) {
92
93
  err = new Error('The file has exceeded the maximum allowed file size for uploading. You can contact your IT administrator or eWay-CRM support if you would like to increase the limit.');
93
94
  }
@@ -219,7 +220,7 @@ var ApiConnection = /** @class */ (function () {
219
220
  }
220
221
  }
221
222
  else {
222
- var err = new Error('Unhandled connection error when calling ' + methodUrl + ': ' + JSON.stringify(error));
223
+ var err = new Error('Unhandled connection error when calling ' + methodUrl + ': ' + ErrorHelper_1.default.stringifyError(error));
223
224
  if (_this.errorCallback) {
224
225
  _this.errorCallback(err, data);
225
226
  }
@@ -27,7 +27,6 @@ export interface IApiGlobalSetting extends IApiItemBase {
27
27
  DependsOnValue: string | null;
28
28
  DependsOnValueInverted: boolean;
29
29
  KbUrlShortCode: string | null;
30
- IsPremium: boolean;
31
30
  DisabledValue: string | null;
32
31
  UnlimitedValue: string | null;
33
32
  }
@@ -0,0 +1,4 @@
1
+ export default class ErrorHelper {
2
+ static readonly stringifyError: (error: Error) => string;
3
+ private static readonly replaceErrors;
4
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ErrorHelper = /** @class */ (function () {
4
+ function ErrorHelper() {
5
+ }
6
+ ErrorHelper.stringifyError = function (error) {
7
+ return JSON.stringify(error, ErrorHelper.replaceErrors);
8
+ };
9
+ ErrorHelper.replaceErrors = function (_key, value) {
10
+ if (value instanceof Error) {
11
+ var error_1 = {};
12
+ Object.getOwnPropertyNames(value).forEach(function (propName) {
13
+ error_1[propName] = value[propName];
14
+ });
15
+ return error_1;
16
+ }
17
+ return value;
18
+ };
19
+ return ErrorHelper;
20
+ }());
21
+ exports.default = ErrorHelper;
package/lib/index.d.ts CHANGED
@@ -22,6 +22,7 @@ import CustomizationStatsItemKeys from './constants/CustomizationStatsItemKeys';
22
22
  import LicenseRestrictionKeys from './constants/LicenseRestrictionKeys';
23
23
  import ExpirationReason from './constants/ExpirationReason';
24
24
  import LicenseKeyInvoiceSeverity from './constants/LicenseKeyInvoiceSeverity';
25
+ import ErrorHelper from './helpers/ErrorHelper';
25
26
  export default ApiConnection;
26
27
  export * from './data/EWItem';
27
28
  export * from './data/IApiAdditionalField';
@@ -77,4 +78,4 @@ export * from './data/IApiWorkReport';
77
78
  export * from './data/query/IApiQuery';
78
79
  export * from './data/query/IApiQueryFilters';
79
80
  export * from './interfaces/ITranslatableString';
80
- export { HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity };
81
+ export { HttpMethod, ISessionHandler, ReturnCodes, ITokenizedApiResult, TokenizedServiceConnection, CommonDataConnection, ApiMethods, GlobalSettingsNames, FolderNames, TFolderName, OAuthHelper, HttpRequestError, TUnionError, TInputData, FieldNames, EnumTypes, RelationTypes, ColumnPermissionPermissionRules, ColumnPermissionMandatoryRules, Edition, Feature, Functionality, CustomizationStatsItemKeys, LicenseRestrictionKeys, ExpirationReason, LicenseKeyInvoiceSeverity, ErrorHelper };
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.LicenseKeyInvoiceSeverity = exports.ExpirationReason = 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;
17
+ exports.ErrorHelper = exports.LicenseKeyInvoiceSeverity = exports.ExpirationReason = 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;
18
18
  var Promise = require("es6-promise");
19
19
  var ApiConnection_1 = require("./ApiConnection");
20
20
  var HttpMethod_1 = require("./HttpMethod");
@@ -58,6 +58,8 @@ var ExpirationReason_1 = require("./constants/ExpirationReason");
58
58
  exports.ExpirationReason = ExpirationReason_1.default;
59
59
  var LicenseKeyInvoiceSeverity_1 = require("./constants/LicenseKeyInvoiceSeverity");
60
60
  exports.LicenseKeyInvoiceSeverity = LicenseKeyInvoiceSeverity_1.default;
61
+ var ErrorHelper_1 = require("./helpers/ErrorHelper");
62
+ exports.ErrorHelper = ErrorHelper_1.default;
61
63
  Promise.polyfill();
62
64
  exports.default = ApiConnection_1.ApiConnection;
63
65
  __exportStar(require("./data/EWItem"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eway-crm/connector",
3
- "version": "1.0.102",
3
+ "version": "1.0.103",
4
4
  "description": "eWay-CRM API JavaScript connector library.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",