@osovitny/anatoly 1.2.9 → 1.2.10

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 (44) hide show
  1. package/bundles/osovitny-anatoly.umd.js +92 -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/services/appcontext.service.js +3 -4
  9. package/esm2015/lib/data/base/base-api.service.js +73 -0
  10. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +75 -0
  11. package/esm2015/lib/data/base/grid/base-grid-read.service.js +60 -0
  12. package/esm2015/lib/data/index.js +5 -6
  13. package/esm2015/lib/data/services/{base-billing-api.service.js → billing-api.service.js} +8 -7
  14. package/esm5/lib/billing/billing.module.js +3 -3
  15. package/esm5/lib/billing/components/buyaccess/buyaccess-button.component.js +3 -3
  16. package/esm5/lib/billing/components/subscriptions/upgrade-plan-button.component.js +3 -3
  17. package/esm5/lib/core/services/appcontext.service.js +3 -4
  18. package/esm5/lib/data/base/base-api.service.js +74 -0
  19. package/esm5/lib/data/base/grid/base-grid-edit.service.js +80 -0
  20. package/esm5/lib/data/base/grid/base-grid-read.service.js +64 -0
  21. package/esm5/lib/data/index.js +5 -6
  22. package/esm5/lib/data/services/billing-api.service.js +56 -0
  23. package/fesm2015/osovitny-anatoly.js +78 -69
  24. package/fesm2015/osovitny-anatoly.js.map +1 -1
  25. package/fesm5/osovitny-anatoly.js +92 -83
  26. package/fesm5/osovitny-anatoly.js.map +1 -1
  27. package/lib/billing/components/buyaccess/buyaccess-button.component.d.ts +2 -2
  28. package/lib/billing/components/subscriptions/upgrade-plan-button.component.d.ts +2 -2
  29. package/lib/core/services/appcontext.service.d.ts +1 -1
  30. package/lib/data/{services → base}/base-api.service.d.ts +6 -6
  31. package/lib/data/{services/base-gridedit.service.d.ts → base/grid/base-grid-edit.service.d.ts} +2 -7
  32. package/lib/data/base/grid/base-grid-read.service.d.ts +11 -0
  33. package/lib/data/index.d.ts +4 -4
  34. package/lib/data/services/{base-billing-api.service.d.ts → billing-api.service.d.ts} +2 -2
  35. package/osovitny-anatoly.metadata.json +1 -1
  36. package/package.json +1 -1
  37. package/esm2015/lib/data/consts.js +0 -21
  38. package/esm2015/lib/data/services/base-api.service.js +0 -71
  39. package/esm2015/lib/data/services/base-gridedit.service.js +0 -98
  40. package/esm5/lib/data/consts.js +0 -25
  41. package/esm5/lib/data/services/base-api.service.js +0 -72
  42. package/esm5/lib/data/services/base-billing-api.service.js +0 -55
  43. package/esm5/lib/data/services/base-gridedit.service.js +0 -104
  44. package/lib/data/consts.d.ts +0 -6
@@ -217,30 +217,6 @@ var BaseGoService = /** @class */ (function () {
217
217
  return BaseGoService;
218
218
  }());
219
219
 
220
- /*
221
- <file>
222
- Authors:
223
- Vadim Osovitny
224
-
225
- Created:
226
- 4 Mar 2020
227
-
228
- Version:
229
- 1.0
230
-
231
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
232
- </file>
233
- */
234
- var Consts = /** @class */ (function () {
235
- function Consts() {
236
- }
237
- Consts.JsonUrl = "/dist/jsons/";
238
- Consts.JsonVersion = "v=1.0.0";
239
- Consts.AppUrl = "/";
240
- Consts.ApiUrl = "/api/";
241
- return Consts;
242
- }());
243
-
244
220
  /*
245
221
  <file>
246
222
  Authors:
@@ -258,46 +234,48 @@ var Consts = /** @class */ (function () {
258
234
  var BaseApiService = /** @class */ (function () {
259
235
  function BaseApiService(http) {
260
236
  this.http = http;
261
- this.baseUrl = Consts.ApiUrl;
262
237
  }
263
238
  BaseApiService.prototype.serializeParams = function (data) {
264
239
  return data ? ('?' + $.param(data)) : '';
265
240
  };
266
- //webApi
241
+ //api
267
242
  BaseApiService.prototype.get = function (action, data) {
268
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
243
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
269
244
  return this.http.get(url).pipe(map(function (res) { return res; }));
270
245
  };
271
246
  BaseApiService.prototype.post = function (action, data) {
272
- var url = this.baseUrl + ("" + action);
273
- return this.http.post(url, data, { responseType: 'text' });
247
+ var url = this.baseUrl + "/" + action;
248
+ return this.http.post(url, data).pipe(map(function (res) { return res; }));
274
249
  };
275
250
  BaseApiService.prototype.postQS = function (action, data) {
276
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
277
- return this.http.post(url, null, { responseType: 'text' });
251
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
252
+ return this.http.post(url, null).pipe(map(function (res) { return res; }));
253
+ };
254
+ BaseApiService.prototype.delete = function (action, data) {
255
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
256
+ return this.http.delete(url).pipe(map(function (res) { return res; }));
278
257
  };
279
258
  //gets
259
+ BaseApiService.prototype.getById = function (id) {
260
+ return this.get('getById', { id: id });
261
+ };
280
262
  BaseApiService.prototype.getAll = function (data) {
281
263
  return this.get('getall', data).pipe(map(function (res) { return res; }));
282
264
  };
283
- BaseApiService.prototype.getJsonFile = function (fileName, jsonVersion) {
265
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
266
+ if (!jsonUrl) {
267
+ jsonUrl = "/dist/jsons";
268
+ }
284
269
  if (!jsonVersion) {
285
270
  jsonVersion = "1.0";
286
271
  }
287
- var url = Consts.JsonUrl + fileName + '?' + jsonVersion;
272
+ var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
288
273
  return this.http.get(url).pipe(map(function (res) { return res; }));
289
274
  };
290
275
  BaseApiService.prototype.getNewGuid = function () {
291
- var url = this.baseUrl + 'getNewGuid';
276
+ var url = this.baseUrl + "/getNewGuid";
292
277
  return this.http.get(url, { responseType: 'text' });
293
278
  };
294
- //CRUD function
295
- BaseApiService.prototype.getById = function (id) {
296
- return this.get('getById', { id: id });
297
- };
298
- BaseApiService.prototype.remove = function (id) {
299
- return this.postQS('remove', { id: id });
300
- };
301
279
  BaseApiService.ctorParameters = function () { return [
302
280
  { type: HttpClient }
303
281
  ]; };
@@ -329,7 +307,7 @@ var AppContextService = /** @class */ (function (_super) {
329
307
  _this.current = null;
330
308
  _this.successes = [];
331
309
  _this.subscription = null;
332
- _this.baseUrl = Consts.ApiUrl + 'appcontext/';
310
+ _this.baseUrl = '/api/appcontext/';
333
311
  return _this;
334
312
  }
335
313
  AppContextService.prototype.getCurrent = function (success) {
@@ -945,39 +923,39 @@ var AnatolyCoreModule = /** @class */ (function () {
945
923
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
946
924
  </file>
947
925
  */
948
- var BaseBillingApiService = /** @class */ (function (_super) {
949
- __extends(BaseBillingApiService, _super);
950
- function BaseBillingApiService(http) {
926
+ var BillingApiService = /** @class */ (function (_super) {
927
+ __extends(BillingApiService, _super);
928
+ function BillingApiService(http) {
951
929
  var _this = _super.call(this, http) || this;
952
930
  _this.http = http;
953
931
  _this.baseUrl += 'billing/';
954
932
  return _this;
955
933
  }
956
- BaseBillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
934
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
957
935
  this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
958
936
  .subscribe(function (data) { }, function (e) { if (error)
959
937
  error(); }, function () { if (success)
960
938
  success(); });
961
939
  };
962
- BaseBillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
940
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
963
941
  this.postQS('cancelRequestedSubscription', null)
964
942
  .subscribe(function (data) { }, function (e) { if (error)
965
943
  error(); }, function () { if (success)
966
944
  success(); });
967
945
  };
968
- BaseBillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
946
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
969
947
  this.postQS('buyAccess', { requestedPlan: requestedPlan })
970
948
  .subscribe(function (data) { }, function (e) { if (error)
971
949
  error(); }, function () { if (success)
972
950
  success(); });
973
951
  };
974
- BaseBillingApiService.ctorParameters = function () { return [
952
+ BillingApiService.ctorParameters = function () { return [
975
953
  { type: HttpClient }
976
954
  ]; };
977
- BaseBillingApiService = __decorate([
955
+ BillingApiService = __decorate([
978
956
  Injectable()
979
- ], BaseBillingApiService);
980
- return BaseBillingApiService;
957
+ ], BillingApiService);
958
+ return BillingApiService;
981
959
  }(BaseApiService));
982
960
 
983
961
  /*
@@ -1031,7 +1009,7 @@ var BuyAccessButtonComponent = /** @class */ (function () {
1031
1009
  };
1032
1010
  BuyAccessButtonComponent.ctorParameters = function () { return [
1033
1011
  { type: AppContextService },
1034
- { type: BaseBillingApiService }
1012
+ { type: BillingApiService }
1035
1013
  ]; };
1036
1014
  __decorate([
1037
1015
  Input()
@@ -1137,7 +1115,7 @@ var UpgradePlanButtonComponent = /** @class */ (function () {
1137
1115
  });
1138
1116
  };
1139
1117
  UpgradePlanButtonComponent.ctorParameters = function () { return [
1140
- { type: BaseBillingApiService }
1118
+ { type: BillingApiService }
1141
1119
  ]; };
1142
1120
  __decorate([
1143
1121
  Input()
@@ -1323,7 +1301,7 @@ var AnatolyBillingModule = /** @class */ (function () {
1323
1301
  BuyAccessButtonComponent
1324
1302
  ],
1325
1303
  providers: [
1326
- BaseBillingApiService
1304
+ BillingApiService
1327
1305
  ]
1328
1306
  })
1329
1307
  ], AnatolyBillingModule);
@@ -1346,19 +1324,69 @@ var AnatolyBillingModule = /** @class */ (function () {
1346
1324
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1347
1325
  </file>
1348
1326
  */
1349
- var BaseGridEditService = /** @class */ (function (_super) {
1350
- __extends(BaseGridEditService, _super);
1351
- function BaseGridEditService(http) {
1327
+ var BaseGridReadService = /** @class */ (function (_super) {
1328
+ __extends(BaseGridReadService, _super);
1329
+ function BaseGridReadService(http) {
1352
1330
  var _this = _super.call(this, []) || this;
1353
1331
  _this.http = http;
1354
1332
  _this.data = [];
1355
- _this.baseUrl = Consts.ApiUrl;
1356
- _this.baseReadUrl = _this.baseUrl + "getAll";
1357
1333
  return _this;
1358
1334
  }
1359
- BaseGridEditService.prototype.serializeParams = function (data) {
1335
+ BaseGridReadService.prototype.serializeParams = function (data) {
1360
1336
  return data ? ('?' + $.param(data)) : '';
1361
1337
  };
1338
+ BaseGridReadService.prototype.read = function (params, success, error) {
1339
+ var _this = this;
1340
+ if (this.data.length) {
1341
+ return _super.prototype.next.call(this, this.data);
1342
+ }
1343
+ var url = this.baseReadUrl;
1344
+ if (typeof params === 'undefined') {
1345
+ params = this.savedReadParams;
1346
+ }
1347
+ if (params) {
1348
+ url = this.baseReadUrl + ("" + this.serializeParams(params));
1349
+ this.savedReadParams = params;
1350
+ }
1351
+ this.http.get(url).pipe(map(function (res) { return res; })).subscribe(function (data) {
1352
+ _super.prototype.next.call(_this, data);
1353
+ if (success)
1354
+ success();
1355
+ }, function (e) {
1356
+ if (error)
1357
+ error(e);
1358
+ });
1359
+ };
1360
+ BaseGridReadService.ctorParameters = function () { return [
1361
+ { type: HttpClient }
1362
+ ]; };
1363
+ BaseGridReadService = __decorate([
1364
+ Injectable()
1365
+ ], BaseGridReadService);
1366
+ return BaseGridReadService;
1367
+ }(BehaviorSubject));
1368
+
1369
+ /*
1370
+ <file>
1371
+ Authors:
1372
+ Vadim Osovitny
1373
+
1374
+ Created:
1375
+ 29 Apr 2018
1376
+
1377
+ Version:
1378
+ 1.0
1379
+
1380
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1381
+ </file>
1382
+ */
1383
+ var BaseGridEditService = /** @class */ (function (_super) {
1384
+ __extends(BaseGridEditService, _super);
1385
+ function BaseGridEditService(http) {
1386
+ var _this = _super.call(this, http) || this;
1387
+ _this.http = http;
1388
+ return _this;
1389
+ }
1362
1390
  BaseGridEditService.prototype.reset = function () {
1363
1391
  this.data = [];
1364
1392
  };
@@ -1372,25 +1400,6 @@ var BaseGridEditService = /** @class */ (function (_super) {
1372
1400
  Object.assign(originalDataItem, dataItem);
1373
1401
  _super.prototype.next.call(this, this.data);
1374
1402
  };
1375
- BaseGridEditService.prototype.read = function (params) {
1376
- var _this = this;
1377
- if (this.data.length) {
1378
- return _super.prototype.next.call(this, this.data);
1379
- }
1380
- var url = this.baseReadUrl;
1381
- if (typeof params === 'undefined') {
1382
- params = this.savedReadParams;
1383
- }
1384
- if (typeof params !== 'undefined') {
1385
- url = this.baseReadUrl + ("" + this.serializeParams(params));
1386
- this.savedReadParams = params;
1387
- }
1388
- // this.http.get(url)
1389
- // .map(res => <any[]>res)
1390
- // .do(data => { this.data = data; }).subscribe(data => { super.next(data); });
1391
- //}
1392
- this.http.get(url).pipe(map(function (res) { return res; })).subscribe(function (data) { _super.prototype.next.call(_this, data); });
1393
- };
1394
1403
  BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1395
1404
  var _this = this;
1396
1405
  var action = isNew ? 'add' : 'update';
@@ -1427,7 +1436,7 @@ var BaseGridEditService = /** @class */ (function (_super) {
1427
1436
  Injectable()
1428
1437
  ], BaseGridEditService);
1429
1438
  return BaseGridEditService;
1430
- }(BehaviorSubject));
1439
+ }(BaseGridReadService));
1431
1440
 
1432
1441
  /*
1433
1442
  <file>
@@ -1467,11 +1476,11 @@ var AnatolyDataModule = /** @class */ (function () {
1467
1476
  return AnatolyDataModule;
1468
1477
  }());
1469
1478
 
1470
- // Consts
1479
+ // Services
1471
1480
 
1472
1481
  /**
1473
1482
  * Generated bundle index. Do not edit.
1474
1483
  */
1475
1484
 
1476
- export { Alerts, AnatolyBillingModule, AnatolyCoreModule, AnatolyDataModule, AnatolyIdentityModule, AppContextService, BaseApiService, BaseBillingApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BuyAccessButtonComponent, Consts, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, HtmlEditorComponent, ItemValidationSummaryComponent, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1485
+ export { Alerts, AnatolyBillingModule, AnatolyCoreModule, AnatolyDataModule, AnatolyIdentityModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, HtmlEditorComponent, ItemValidationSummaryComponent, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1477
1486
  //# sourceMappingURL=osovitny-anatoly.js.map