@ardimedia/angular-portal-azure 0.2.299 → 0.2.301

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 (3) hide show
  1. package/apn.d.ts +37 -14
  2. package/apn.js +81 -89
  3. package/package.json +2 -2
package/apn.d.ts CHANGED
@@ -424,27 +424,50 @@ declare namespace angularportalazure {
424
424
  }
425
425
  }
426
426
  declare namespace angularportalazure {
427
- class ExceptionDotNet {
428
- ExceptionMessage: string;
429
- ExceptionType: string;
430
- InnerException: ExceptionDotNet;
431
- Message: string;
432
- StackTrace: string;
433
- }
434
427
  class ValidationResultDotNet {
435
428
  ErrorMessage: string;
436
429
  MemberNames: string[];
437
430
  }
438
- class ValidationsExceptionDotNet extends ExceptionDotNet {
439
- ClassName: string;
431
+ class ExceptionDotNet {
432
+ ClassName: string | void;
433
+ Data: {
434
+ key: number;
435
+ value: string;
436
+ }[] | null;
437
+ ExceptionMethod: string | void;
438
+ HelpURL: string | null | void;
439
+ HelpLink: string | null | void;
440
+ HResult: number;
441
+ InnerException: ExceptionDotNet | null;
442
+ Message: string | null;
443
+ RemoteStackIndex: number | void;
444
+ RemoteStackTraceString: string | null | void;
445
+ Source: string;
446
+ StackTrace: string;
447
+ WatsonBuckets: string | null | void;
448
+ /**
449
+ * @deprecated ExceptionMessage is obsolete
450
+ */
451
+ ExceptionMessage: string | void;
452
+ /**
453
+ * @deprecated ExceptionType is obsolete
454
+ */
455
+ ExceptionType: string | void;
456
+ }
457
+ class ArgumentNullException extends ExceptionDotNet {
458
+ ParamName: string;
459
+ }
460
+ class EntityValidationException extends ExceptionDotNet {
440
461
  Data: {
441
462
  key: number;
442
463
  value: string;
443
464
  }[];
444
465
  ValidationResults: ValidationResultDotNet[];
445
- convertResponse(response: any): void;
446
- private static convertResponse;
447
- private static convertExceptionType;
466
+ }
467
+ /**
468
+ * @deprecated ValidationsExceptionDotNet should be replaced by EntityValidationException
469
+ */
470
+ class ValidationsExceptionDotNet extends EntityValidationException {
448
471
  }
449
472
  }
450
473
  declare namespace angularportalazure {
@@ -457,7 +480,7 @@ declare namespace angularportalazure {
457
480
  Url: string;
458
481
  static getOneLineMessage(exception: angularportalazure.Exception): string;
459
482
  static prepareException(response: angular.IHttpPromiseCallbackArg<angularportalazure.Exception> | any): angularportalazure.Exception;
460
- private static processExceptionData;
461
- private static processDotNetException2;
483
+ private static createException;
484
+ private static processResponseData;
462
485
  }
463
486
  }
package/apn.js CHANGED
@@ -1499,67 +1499,44 @@ var angularportalazure;
1499
1499
  })(angularportalazure || (angularportalazure = {}));
1500
1500
  var angularportalazure;
1501
1501
  (function (angularportalazure) {
1502
+ var ValidationResultDotNet = /** @class */ (function () {
1503
+ function ValidationResultDotNet() {
1504
+ }
1505
+ return ValidationResultDotNet;
1506
+ }());
1507
+ angularportalazure.ValidationResultDotNet = ValidationResultDotNet;
1502
1508
  var ExceptionDotNet = /** @class */ (function () {
1503
1509
  function ExceptionDotNet() {
1504
1510
  }
1505
1511
  return ExceptionDotNet;
1506
1512
  }());
1507
1513
  angularportalazure.ExceptionDotNet = ExceptionDotNet;
1508
- var ValidationResultDotNet = /** @class */ (function () {
1509
- function ValidationResultDotNet() {
1514
+ var ArgumentNullException = /** @class */ (function (_super) {
1515
+ __extends(ArgumentNullException, _super);
1516
+ function ArgumentNullException() {
1517
+ return _super !== null && _super.apply(this, arguments) || this;
1510
1518
  }
1511
- return ValidationResultDotNet;
1512
- }());
1513
- angularportalazure.ValidationResultDotNet = ValidationResultDotNet;
1519
+ return ArgumentNullException;
1520
+ }(ExceptionDotNet));
1521
+ angularportalazure.ArgumentNullException = ArgumentNullException;
1522
+ var EntityValidationException = /** @class */ (function (_super) {
1523
+ __extends(EntityValidationException, _super);
1524
+ function EntityValidationException() {
1525
+ return _super !== null && _super.apply(this, arguments) || this;
1526
+ }
1527
+ return EntityValidationException;
1528
+ }(ExceptionDotNet));
1529
+ angularportalazure.EntityValidationException = EntityValidationException;
1530
+ /**
1531
+ * @deprecated ValidationsExceptionDotNet should be replaced by EntityValidationException
1532
+ */
1514
1533
  var ValidationsExceptionDotNet = /** @class */ (function (_super) {
1515
1534
  __extends(ValidationsExceptionDotNet, _super);
1516
1535
  function ValidationsExceptionDotNet() {
1517
1536
  return _super !== null && _super.apply(this, arguments) || this;
1518
1537
  }
1519
- ValidationsExceptionDotNet.prototype.convertResponse = function (response) {
1520
- if (response.headers === undefined) {
1521
- ValidationsExceptionDotNet.convertResponse(this, response.data);
1522
- ValidationsExceptionDotNet.convertExceptionType(this, response.data);
1523
- }
1524
- else {
1525
- ValidationsExceptionDotNet.convertResponse(this, response.json());
1526
- ValidationsExceptionDotNet.convertExceptionType(this, response.json());
1527
- }
1528
- };
1529
- ValidationsExceptionDotNet.convertResponse = function (exception, responseData) {
1530
- // ExceptionDotNet
1531
- exception.ExceptionMessage = responseData.ExceptionMessage;
1532
- exception.Message = responseData.Message;
1533
- exception.StackTrace = responseData.StackTrace;
1534
- exception.InnerException = responseData.InnerException;
1535
- // ValidationsExceptionDotNet
1536
- // exception.ClassName = 'Not yet implemented';
1537
- // exception.Data = [{ key: 0, value: 'Not yet implemented' }];
1538
- // ValidationResultDotNet
1539
- // exception.ValidationResults = [{ ErrorMessage: 'Not yet implemented', MemberNames: [] }];
1540
- };
1541
- ValidationsExceptionDotNet.convertExceptionType = function (exception, responseData) {
1542
- if (responseData.ExceptionType === undefined) {
1543
- return;
1544
- }
1545
- if (responseData.ExceptionType === 'System.Data.Entity.Validation.DbEntityValidationException') {
1546
- exception.ExceptionType = 'DbEntityValidationException';
1547
- return;
1548
- }
1549
- else if (responseData.ExceptionType === 'System.Data.Entity.Infrastructure.DbUpdateConcurrencyException') {
1550
- exception.ExceptionType = 'DbUpdateConcurrencyException';
1551
- return;
1552
- }
1553
- // ClassName should by ExceptionType
1554
- if (responseData.ClassName !== undefined && responseData.ClassName.indexOf('ValidationsException') > 0) {
1555
- console.log('[angularportalazure.Exception.setExceptionType2] Why is this in ClassName? Can this be changed?');
1556
- exception.ExceptionType = 'ValidationsException';
1557
- return;
1558
- }
1559
- exception.ExceptionType = responseData.ExceptionType;
1560
- };
1561
1538
  return ValidationsExceptionDotNet;
1562
- }(ExceptionDotNet));
1539
+ }(EntityValidationException));
1563
1540
  angularportalazure.ValidationsExceptionDotNet = ValidationsExceptionDotNet;
1564
1541
  })(angularportalazure || (angularportalazure = {}));
1565
1542
  // #region Declarations
@@ -1575,14 +1552,26 @@ var angularportalazure;
1575
1552
  // #endregion
1576
1553
  // #region Static Methods
1577
1554
  Exception.getOneLineMessage = function (exception) {
1578
- var message = 'FEHLER ';
1555
+ var message = '';
1556
+ // Add Messages, if available
1557
+ if (exception.Messages !== undefined) {
1558
+ exception.Messages.forEach(function (item, index) {
1559
+ if (index > 0) {
1560
+ message = message + ' - ';
1561
+ }
1562
+ message = message + item;
1563
+ });
1564
+ }
1565
+ else {
1566
+ message = 'FEHLER ';
1567
+ }
1579
1568
  if (exception.Message !== undefined) {
1580
1569
  message = message + ': ' + exception.Message + ' ';
1581
1570
  }
1582
- if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') === -1) {
1571
+ if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') < 0) {
1583
1572
  message = message + ': ' + exception.ExceptionMessage + ' ';
1584
1573
  }
1585
- if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') > 0) {
1574
+ if (exception.ExceptionMessage !== undefined && exception.ExceptionMessage.toLowerCase().indexOf('see the inner exception for details') >= 0) {
1586
1575
  if (exception.InnerException !== undefined) {
1587
1576
  if (exception.InnerException.InnerException !== undefined) {
1588
1577
  message = message + ': ' + exception.InnerException.InnerException.ExceptionMessage + ' ';
@@ -1592,60 +1581,63 @@ var angularportalazure;
1592
1581
  }
1593
1582
  }
1594
1583
  }
1595
- if (exception.Messages !== undefined) {
1596
- exception.Messages.forEach(function (item) {
1597
- message = message + '- ' + item + ' ';
1598
- });
1599
- }
1600
1584
  if (message === 'FEHLER ') {
1601
- message = message + ' : JavaScript-Fehler oder Probleme mit der Internetverbindung. Ggf. weitere Informationen im Log. ' + exception;
1602
- console.log(exception);
1585
+ console.debug(exception);
1586
+ message = message + ': JavaScript-Fehler oder Probleme mit der Internetverbindung. Weitere Informationen im Log. ' + exception;
1603
1587
  }
1604
1588
  return message;
1605
1589
  };
1606
- // TODO:2017-01-09/hp: [any] will be [Response] in angular2
1590
+ // TODO:2018-10-10/hp: [angular.IHttpPromiseCallbackArg<angularportalazure.Exception>] should be Response
1607
1591
  Exception.prepareException = function (response) {
1608
- console.log('angularportalazure.Exception.prepareException');
1609
- console.log(response.data);
1610
- console.log(response.data.Data);
1611
- var exception = new angularportalazure.Exception();
1612
- if (response.headers === undefined) {
1613
- exception = angularportalazure.Exception.processExceptionData(response);
1592
+ console.debug('angularportalazure.Exception.prepareException');
1593
+ console.debug(response);
1594
+ var exception = angularportalazure.Exception.createException();
1595
+ // #region Process (Angular 1) response.data.Data
1596
+ if (response.data !== undefined && response.data.Data !== undefined) {
1597
+ exception = angularportalazure.Exception.processResponseData(exception, response.data.Data);
1614
1598
  }
1615
- else {
1616
- exception = angularportalazure.Exception.processDotNetException2(response);
1599
+ // #endregion
1600
+ // #region Process (Angular 2) response.json().Data (EntityValidationException, etc.)
1601
+ else if (response.json !== undefined && response.json().Data != undefined) {
1602
+ exception = angularportalazure.Exception.processResponseData(exception, response.json().Data);
1617
1603
  }
1618
- exception.convertResponse(response);
1604
+ // #endregion
1605
+ //exception.convertResponse(response);
1619
1606
  exception.Url = response.url;
1620
1607
  exception.Status = response.status;
1621
1608
  exception.StatusText = response.statusText;
1622
- //// Find a better way to log information, maybe to the database or to Google Analytics.
1623
- console.log(response);
1624
- console.log(exception);
1609
+ console.debug(exception);
1625
1610
  return exception;
1626
1611
  };
1627
- Exception.processExceptionData = function (response) {
1612
+ Exception.createException = function () {
1628
1613
  var exception = new angularportalazure.Exception();
1629
- // #region Convert data to Messages
1630
1614
  exception.Messages = [];
1631
- if (response.data.Data === undefined) {
1632
- exception.Messages.push('No further information found in [response.data.Data].');
1633
- }
1634
- else {
1635
- var i = 1;
1636
- while (response.data.Data[i + ''] !== undefined) {
1637
- exception.Messages.push(response.data.Data[i + '']);
1638
- i++;
1639
- }
1640
- }
1641
- // #endregion
1642
1615
  return exception;
1643
1616
  };
1644
- // TODO:2017-01-09/hp: Implement this function for angular2
1645
- Exception.processDotNetException2 = function (response) {
1646
- var exception = new angularportalazure.Exception();
1647
- if (response.json().data !== undefined) {
1648
- console.log('[angularportalazure.Exception.processDotNetException2] not implemented. Implement it to get proper exception data.');
1617
+ //private static processResponseWithData(exception: angularportalazure.Exception, response: angular.IHttpPromiseCallbackArg<angularportalazure.Exception>): angularportalazure.Exception {
1618
+ // console.debug('angularportalazure.Exception.processResponseWithData');
1619
+ // // #region Convert data to Messages
1620
+ // if (response.data.Data === undefined) {
1621
+ // exception.Messages.push('No further information found in [response.data.Data].');
1622
+ // exception.Messages.push('No further information found in [response.data.Data].');
1623
+ // } else {
1624
+ // let i = 1;
1625
+ // while (response.data.Data[i + ''] !== undefined) {
1626
+ // console.debug('Add to exception.Messages : ' + response.data.Data[i + '']);
1627
+ // exception.Messages.push(response.data.Data[i + '']);
1628
+ // i++;
1629
+ // }
1630
+ // }
1631
+ // // #endregion
1632
+ // return exception;
1633
+ //}
1634
+ Exception.processResponseData = function (exception, data) {
1635
+ console.debug('angularportalazure.Exception.processResponseData');
1636
+ var i = 1;
1637
+ while (data[i + ''] !== undefined) {
1638
+ console.debug('Add to exception.Messages : ' + data[i + '']);
1639
+ exception.Messages.push(data[i + '']);
1640
+ i++;
1649
1641
  }
1650
1642
  return exception;
1651
1643
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
- {
1
+ {
2
2
  "name": "@ardimedia/angular-portal-azure",
3
3
  "description": "Angular Portal Azure - GUI Framework.",
4
4
  "author": "Ardimedia Anstalt <info@ardimedia.com> (http://www.ardimedia.com)",
5
- "version": "0.2.299",
5
+ "version": "0.2.301",
6
6
  "main": "index.js",
7
7
  "typings": "apn.d.ts",
8
8
  "dependencies": {