@osovitny/anatoly 1.2.9 → 1.2.11

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 (48) hide show
  1. package/bundles/osovitny-anatoly.umd.js +95 -83
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -2
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/billing/billing.module.js +3 -3
  6. package/esm2015/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  7. package/esm2015/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  8. package/esm2015/lib/core/components/html-editor/base-html-editor.component.js +1 -2
  9. package/esm2015/lib/core/services/appcontext.service.js +3 -4
  10. package/esm2015/lib/data/base/base-api.service.js +74 -0
  11. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +76 -0
  12. package/esm2015/lib/data/base/grid/base-grid-read.service.js +61 -0
  13. package/esm2015/lib/data/data.module.js +1 -1
  14. package/esm2015/lib/data/index.js +5 -6
  15. package/esm2015/lib/data/services/{base-billing-api.service.js → billing-api.service.js} +8 -7
  16. package/esm5/lib/billing/billing.module.js +3 -3
  17. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  18. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  19. package/esm5/lib/core/components/html-editor/base-html-editor.component.js +1 -2
  20. package/esm5/lib/core/services/appcontext.service.js +3 -4
  21. package/esm5/lib/data/base/base-api.service.js +75 -0
  22. package/esm5/lib/data/base/grid/base-grid-edit.service.js +81 -0
  23. package/esm5/lib/data/base/grid/base-grid-read.service.js +65 -0
  24. package/esm5/lib/data/data.module.js +1 -1
  25. package/esm5/lib/data/index.js +5 -6
  26. package/esm5/lib/data/services/billing-api.service.js +56 -0
  27. package/fesm2015/osovitny-anatoly.js +81 -69
  28. package/fesm2015/osovitny-anatoly.js.map +1 -1
  29. package/fesm5/osovitny-anatoly.js +95 -83
  30. package/fesm5/osovitny-anatoly.js.map +1 -1
  31. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +2 -2
  32. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +2 -2
  33. package/lib/core/services/appcontext.service.d.ts +1 -1
  34. package/lib/data/{services → base}/base-api.service.d.ts +6 -7
  35. package/lib/data/{services/base-gridedit.service.d.ts → base/grid/base-grid-edit.service.d.ts} +2 -7
  36. package/lib/data/base/grid/base-grid-read.service.d.ts +11 -0
  37. package/lib/data/index.d.ts +4 -4
  38. package/lib/data/services/{base-billing-api.service.d.ts → billing-api.service.d.ts} +2 -2
  39. package/osovitny-anatoly.metadata.json +1 -1
  40. package/package.json +1 -1
  41. package/esm2015/lib/data/consts.js +0 -21
  42. package/esm2015/lib/data/services/base-api.service.js +0 -71
  43. package/esm2015/lib/data/services/base-gridedit.service.js +0 -98
  44. package/esm5/lib/data/consts.js +0 -25
  45. package/esm5/lib/data/services/base-api.service.js +0 -72
  46. package/esm5/lib/data/services/base-billing-api.service.js +0 -55
  47. package/esm5/lib/data/services/base-gridedit.service.js +0 -104
  48. package/lib/data/consts.d.ts +0 -6
@@ -407,30 +407,6 @@
407
407
  return BaseGoService;
408
408
  }());
409
409
 
410
- /*
411
- <file>
412
- Authors:
413
- Vadim Osovitny
414
-
415
- Created:
416
- 4 Mar 2020
417
-
418
- Version:
419
- 1.0
420
-
421
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
422
- </file>
423
- */
424
- var Consts = /** @class */ (function () {
425
- function Consts() {
426
- }
427
- Consts.JsonUrl = "/dist/jsons/";
428
- Consts.JsonVersion = "v=1.0.0";
429
- Consts.AppUrl = "/";
430
- Consts.ApiUrl = "/api/";
431
- return Consts;
432
- }());
433
-
434
410
  /*
435
411
  <file>
436
412
  Authors:
@@ -448,46 +424,49 @@
448
424
  var BaseApiService = /** @class */ (function () {
449
425
  function BaseApiService(http) {
450
426
  this.http = http;
451
- this.baseUrl = Consts.ApiUrl;
427
+ this.baseUrl = "";
452
428
  }
453
429
  BaseApiService.prototype.serializeParams = function (data) {
454
430
  return data ? ('?' + $.param(data)) : '';
455
431
  };
456
- //webApi
432
+ //api
457
433
  BaseApiService.prototype.get = function (action, data) {
458
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
434
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
459
435
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
460
436
  };
461
437
  BaseApiService.prototype.post = function (action, data) {
462
- var url = this.baseUrl + ("" + action);
463
- return this.http.post(url, data, { responseType: 'text' });
438
+ var url = this.baseUrl + "/" + action;
439
+ return this.http.post(url, data).pipe(operators.map(function (res) { return res; }));
464
440
  };
465
441
  BaseApiService.prototype.postQS = function (action, data) {
466
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
467
- return this.http.post(url, null, { responseType: 'text' });
442
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
443
+ return this.http.post(url, null).pipe(operators.map(function (res) { return res; }));
444
+ };
445
+ BaseApiService.prototype.delete = function (action, data) {
446
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
447
+ return this.http.delete(url).pipe(operators.map(function (res) { return res; }));
468
448
  };
469
449
  //gets
450
+ BaseApiService.prototype.getById = function (id) {
451
+ return this.get('getById', { id: id });
452
+ };
470
453
  BaseApiService.prototype.getAll = function (data) {
471
454
  return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
472
455
  };
473
- BaseApiService.prototype.getJsonFile = function (fileName, jsonVersion) {
456
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
457
+ if (!jsonUrl) {
458
+ jsonUrl = "/dist/jsons";
459
+ }
474
460
  if (!jsonVersion) {
475
461
  jsonVersion = "1.0";
476
462
  }
477
- var url = Consts.JsonUrl + fileName + '?' + jsonVersion;
463
+ var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
478
464
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
479
465
  };
480
466
  BaseApiService.prototype.getNewGuid = function () {
481
- var url = this.baseUrl + 'getNewGuid';
467
+ var url = this.baseUrl + "/getNewGuid";
482
468
  return this.http.get(url, { responseType: 'text' });
483
469
  };
484
- //CRUD function
485
- BaseApiService.prototype.getById = function (id) {
486
- return this.get('getById', { id: id });
487
- };
488
- BaseApiService.prototype.remove = function (id) {
489
- return this.postQS('remove', { id: id });
490
- };
491
470
  BaseApiService.ctorParameters = function () { return [
492
471
  { type: http.HttpClient }
493
472
  ]; };
@@ -519,7 +498,7 @@
519
498
  _this.current = null;
520
499
  _this.successes = [];
521
500
  _this.subscription = null;
522
- _this.baseUrl = Consts.ApiUrl + 'appcontext/';
501
+ _this.baseUrl = '/api/appcontext/';
523
502
  return _this;
524
503
  }
525
504
  AppContextService.prototype.getCurrent = function (success) {
@@ -1135,39 +1114,39 @@
1135
1114
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1136
1115
  </file>
1137
1116
  */
1138
- var BaseBillingApiService = /** @class */ (function (_super) {
1139
- __extends(BaseBillingApiService, _super);
1140
- function BaseBillingApiService(http) {
1117
+ var BillingApiService = /** @class */ (function (_super) {
1118
+ __extends(BillingApiService, _super);
1119
+ function BillingApiService(http) {
1141
1120
  var _this = _super.call(this, http) || this;
1142
1121
  _this.http = http;
1143
1122
  _this.baseUrl += 'billing/';
1144
1123
  return _this;
1145
1124
  }
1146
- BaseBillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1125
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1147
1126
  this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
1148
1127
  .subscribe(function (data) { }, function (e) { if (error)
1149
1128
  error(); }, function () { if (success)
1150
1129
  success(); });
1151
1130
  };
1152
- BaseBillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1131
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1153
1132
  this.postQS('cancelRequestedSubscription', null)
1154
1133
  .subscribe(function (data) { }, function (e) { if (error)
1155
1134
  error(); }, function () { if (success)
1156
1135
  success(); });
1157
1136
  };
1158
- BaseBillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1137
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1159
1138
  this.postQS('buyAccess', { requestedPlan: requestedPlan })
1160
1139
  .subscribe(function (data) { }, function (e) { if (error)
1161
1140
  error(); }, function () { if (success)
1162
1141
  success(); });
1163
1142
  };
1164
- BaseBillingApiService.ctorParameters = function () { return [
1143
+ BillingApiService.ctorParameters = function () { return [
1165
1144
  { type: http.HttpClient }
1166
1145
  ]; };
1167
- BaseBillingApiService = __decorate([
1146
+ BillingApiService = __decorate([
1168
1147
  core.Injectable()
1169
- ], BaseBillingApiService);
1170
- return BaseBillingApiService;
1148
+ ], BillingApiService);
1149
+ return BillingApiService;
1171
1150
  }(BaseApiService));
1172
1151
 
1173
1152
  /*
@@ -1221,7 +1200,7 @@
1221
1200
  };
1222
1201
  BuyAccessButtonComponent.ctorParameters = function () { return [
1223
1202
  { type: AppContextService },
1224
- { type: BaseBillingApiService }
1203
+ { type: BillingApiService }
1225
1204
  ]; };
1226
1205
  __decorate([
1227
1206
  core.Input()
@@ -1327,7 +1306,7 @@
1327
1306
  });
1328
1307
  };
1329
1308
  UpgradePlanButtonComponent.ctorParameters = function () { return [
1330
- { type: BaseBillingApiService }
1309
+ { type: BillingApiService }
1331
1310
  ]; };
1332
1311
  __decorate([
1333
1312
  core.Input()
@@ -1513,7 +1492,7 @@
1513
1492
  BuyAccessButtonComponent
1514
1493
  ],
1515
1494
  providers: [
1516
- BaseBillingApiService
1495
+ BillingApiService
1517
1496
  ]
1518
1497
  })
1519
1498
  ], AnatolyBillingModule);
@@ -1536,19 +1515,71 @@
1536
1515
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1537
1516
  </file>
1538
1517
  */
1539
- var BaseGridEditService = /** @class */ (function (_super) {
1540
- __extends(BaseGridEditService, _super);
1541
- function BaseGridEditService(http) {
1518
+ var BaseGridReadService = /** @class */ (function (_super) {
1519
+ __extends(BaseGridReadService, _super);
1520
+ function BaseGridReadService(http) {
1542
1521
  var _this = _super.call(this, []) || this;
1543
1522
  _this.http = http;
1523
+ _this.baseReadUrl = "";
1544
1524
  _this.data = [];
1545
- _this.baseUrl = Consts.ApiUrl;
1546
- _this.baseReadUrl = _this.baseUrl + "getAll";
1547
1525
  return _this;
1548
1526
  }
1549
- BaseGridEditService.prototype.serializeParams = function (data) {
1527
+ BaseGridReadService.prototype.serializeParams = function (data) {
1550
1528
  return data ? ('?' + $.param(data)) : '';
1551
1529
  };
1530
+ BaseGridReadService.prototype.read = function (params, success, error) {
1531
+ var _this = this;
1532
+ if (this.data.length) {
1533
+ return _super.prototype.next.call(this, this.data);
1534
+ }
1535
+ var url = this.baseReadUrl;
1536
+ if (typeof params === 'undefined') {
1537
+ params = this.savedReadParams;
1538
+ }
1539
+ if (params) {
1540
+ url = this.baseReadUrl + ("" + this.serializeParams(params));
1541
+ this.savedReadParams = params;
1542
+ }
1543
+ this.http.get(url).pipe(operators.map(function (res) { return res; })).subscribe(function (data) {
1544
+ _super.prototype.next.call(_this, data);
1545
+ if (success)
1546
+ success();
1547
+ }, function (e) {
1548
+ if (error)
1549
+ error(e);
1550
+ });
1551
+ };
1552
+ BaseGridReadService.ctorParameters = function () { return [
1553
+ { type: http.HttpClient }
1554
+ ]; };
1555
+ BaseGridReadService = __decorate([
1556
+ core.Injectable()
1557
+ ], BaseGridReadService);
1558
+ return BaseGridReadService;
1559
+ }(rxjs.BehaviorSubject));
1560
+
1561
+ /*
1562
+ <file>
1563
+ Authors:
1564
+ Vadim Osovitny
1565
+
1566
+ Created:
1567
+ 29 Apr 2018
1568
+
1569
+ Version:
1570
+ 1.0
1571
+
1572
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1573
+ </file>
1574
+ */
1575
+ var BaseGridEditService = /** @class */ (function (_super) {
1576
+ __extends(BaseGridEditService, _super);
1577
+ function BaseGridEditService(http) {
1578
+ var _this = _super.call(this, http) || this;
1579
+ _this.http = http;
1580
+ _this.baseUrl = "";
1581
+ return _this;
1582
+ }
1552
1583
  BaseGridEditService.prototype.reset = function () {
1553
1584
  this.data = [];
1554
1585
  };
@@ -1562,25 +1593,6 @@
1562
1593
  Object.assign(originalDataItem, dataItem);
1563
1594
  _super.prototype.next.call(this, this.data);
1564
1595
  };
1565
- BaseGridEditService.prototype.read = function (params) {
1566
- var _this = this;
1567
- if (this.data.length) {
1568
- return _super.prototype.next.call(this, this.data);
1569
- }
1570
- var url = this.baseReadUrl;
1571
- if (typeof params === 'undefined') {
1572
- params = this.savedReadParams;
1573
- }
1574
- if (typeof params !== 'undefined') {
1575
- url = this.baseReadUrl + ("" + this.serializeParams(params));
1576
- this.savedReadParams = params;
1577
- }
1578
- // this.http.get(url)
1579
- // .map(res => <any[]>res)
1580
- // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
1581
- //}
1582
- this.http.get(url).pipe(operators.map(function (res) { return res; })).subscribe(function (data) { _super.prototype.next.call(_this, data); });
1583
- };
1584
1596
  BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1585
1597
  var _this = this;
1586
1598
  var action = isNew ? 'add' : 'update';
@@ -1617,7 +1629,7 @@
1617
1629
  core.Injectable()
1618
1630
  ], BaseGridEditService);
1619
1631
  return BaseGridEditService;
1620
- }(rxjs.BehaviorSubject));
1632
+ }(BaseGridReadService));
1621
1633
 
1622
1634
  /*
1623
1635
  <file>
@@ -1664,13 +1676,13 @@
1664
1676
  exports.AnatolyIdentityModule = AnatolyIdentityModule;
1665
1677
  exports.AppContextService = AppContextService;
1666
1678
  exports.BaseApiService = BaseApiService;
1667
- exports.BaseBillingApiService = BaseBillingApiService;
1668
1679
  exports.BaseComponent = BaseComponent;
1669
1680
  exports.BaseEditComponent = BaseEditComponent;
1670
1681
  exports.BaseGoService = BaseGoService;
1671
1682
  exports.BaseGridEditService = BaseGridEditService;
1683
+ exports.BaseGridReadService = BaseGridReadService;
1684
+ exports.BillingApiService = BillingApiService;
1672
1685
  exports.BuyAccessButtonComponent = BuyAccessButtonComponent;
1673
- exports.Consts = Consts;
1674
1686
  exports.ContentHeaderComponent = ContentHeaderComponent;
1675
1687
  exports.FormValidationSummaryComponent = FormValidationSummaryComponent;
1676
1688
  exports.FormsHtmlEditorComponent = FormsHtmlEditorComponent;