@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
@@ -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,49 @@ 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;
237
+ this.baseUrl = "";
262
238
  }
263
239
  BaseApiService.prototype.serializeParams = function (data) {
264
240
  return data ? ('?' + $.param(data)) : '';
265
241
  };
266
- //webApi
242
+ //api
267
243
  BaseApiService.prototype.get = function (action, data) {
268
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
244
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
269
245
  return this.http.get(url).pipe(map(function (res) { return res; }));
270
246
  };
271
247
  BaseApiService.prototype.post = function (action, data) {
272
- var url = this.baseUrl + ("" + action);
273
- return this.http.post(url, data, { responseType: 'text' });
248
+ var url = this.baseUrl + "/" + action;
249
+ return this.http.post(url, data).pipe(map(function (res) { return res; }));
274
250
  };
275
251
  BaseApiService.prototype.postQS = function (action, data) {
276
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
277
- return this.http.post(url, null, { responseType: 'text' });
252
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
253
+ return this.http.post(url, null).pipe(map(function (res) { return res; }));
254
+ };
255
+ BaseApiService.prototype.delete = function (action, data) {
256
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
257
+ return this.http.delete(url).pipe(map(function (res) { return res; }));
278
258
  };
279
259
  //gets
260
+ BaseApiService.prototype.getById = function (id) {
261
+ return this.get('getById', { id: id });
262
+ };
280
263
  BaseApiService.prototype.getAll = function (data) {
281
264
  return this.get('getall', data).pipe(map(function (res) { return res; }));
282
265
  };
283
- BaseApiService.prototype.getJsonFile = function (fileName, jsonVersion) {
266
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
267
+ if (!jsonUrl) {
268
+ jsonUrl = "/dist/jsons";
269
+ }
284
270
  if (!jsonVersion) {
285
271
  jsonVersion = "1.0";
286
272
  }
287
- var url = Consts.JsonUrl + fileName + '?' + jsonVersion;
273
+ var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
288
274
  return this.http.get(url).pipe(map(function (res) { return res; }));
289
275
  };
290
276
  BaseApiService.prototype.getNewGuid = function () {
291
- var url = this.baseUrl + 'getNewGuid';
277
+ var url = this.baseUrl + "/getNewGuid";
292
278
  return this.http.get(url, { responseType: 'text' });
293
279
  };
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
280
  BaseApiService.ctorParameters = function () { return [
302
281
  { type: HttpClient }
303
282
  ]; };
@@ -329,7 +308,7 @@ var AppContextService = /** @class */ (function (_super) {
329
308
  _this.current = null;
330
309
  _this.successes = [];
331
310
  _this.subscription = null;
332
- _this.baseUrl = Consts.ApiUrl + 'appcontext/';
311
+ _this.baseUrl = '/api/appcontext/';
333
312
  return _this;
334
313
  }
335
314
  AppContextService.prototype.getCurrent = function (success) {
@@ -945,39 +924,39 @@ var AnatolyCoreModule = /** @class */ (function () {
945
924
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
946
925
  </file>
947
926
  */
948
- var BaseBillingApiService = /** @class */ (function (_super) {
949
- __extends(BaseBillingApiService, _super);
950
- function BaseBillingApiService(http) {
927
+ var BillingApiService = /** @class */ (function (_super) {
928
+ __extends(BillingApiService, _super);
929
+ function BillingApiService(http) {
951
930
  var _this = _super.call(this, http) || this;
952
931
  _this.http = http;
953
932
  _this.baseUrl += 'billing/';
954
933
  return _this;
955
934
  }
956
- BaseBillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
935
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
957
936
  this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
958
937
  .subscribe(function (data) { }, function (e) { if (error)
959
938
  error(); }, function () { if (success)
960
939
  success(); });
961
940
  };
962
- BaseBillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
941
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
963
942
  this.postQS('cancelRequestedSubscription', null)
964
943
  .subscribe(function (data) { }, function (e) { if (error)
965
944
  error(); }, function () { if (success)
966
945
  success(); });
967
946
  };
968
- BaseBillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
947
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
969
948
  this.postQS('buyAccess', { requestedPlan: requestedPlan })
970
949
  .subscribe(function (data) { }, function (e) { if (error)
971
950
  error(); }, function () { if (success)
972
951
  success(); });
973
952
  };
974
- BaseBillingApiService.ctorParameters = function () { return [
953
+ BillingApiService.ctorParameters = function () { return [
975
954
  { type: HttpClient }
976
955
  ]; };
977
- BaseBillingApiService = __decorate([
956
+ BillingApiService = __decorate([
978
957
  Injectable()
979
- ], BaseBillingApiService);
980
- return BaseBillingApiService;
958
+ ], BillingApiService);
959
+ return BillingApiService;
981
960
  }(BaseApiService));
982
961
 
983
962
  /*
@@ -1031,7 +1010,7 @@ var BuyAccessButtonComponent = /** @class */ (function () {
1031
1010
  };
1032
1011
  BuyAccessButtonComponent.ctorParameters = function () { return [
1033
1012
  { type: AppContextService },
1034
- { type: BaseBillingApiService }
1013
+ { type: BillingApiService }
1035
1014
  ]; };
1036
1015
  __decorate([
1037
1016
  Input()
@@ -1137,7 +1116,7 @@ var UpgradePlanButtonComponent = /** @class */ (function () {
1137
1116
  });
1138
1117
  };
1139
1118
  UpgradePlanButtonComponent.ctorParameters = function () { return [
1140
- { type: BaseBillingApiService }
1119
+ { type: BillingApiService }
1141
1120
  ]; };
1142
1121
  __decorate([
1143
1122
  Input()
@@ -1323,7 +1302,7 @@ var AnatolyBillingModule = /** @class */ (function () {
1323
1302
  BuyAccessButtonComponent
1324
1303
  ],
1325
1304
  providers: [
1326
- BaseBillingApiService
1305
+ BillingApiService
1327
1306
  ]
1328
1307
  })
1329
1308
  ], AnatolyBillingModule);
@@ -1346,19 +1325,71 @@ var AnatolyBillingModule = /** @class */ (function () {
1346
1325
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1347
1326
  </file>
1348
1327
  */
1349
- var BaseGridEditService = /** @class */ (function (_super) {
1350
- __extends(BaseGridEditService, _super);
1351
- function BaseGridEditService(http) {
1328
+ var BaseGridReadService = /** @class */ (function (_super) {
1329
+ __extends(BaseGridReadService, _super);
1330
+ function BaseGridReadService(http) {
1352
1331
  var _this = _super.call(this, []) || this;
1353
1332
  _this.http = http;
1333
+ _this.baseReadUrl = "";
1354
1334
  _this.data = [];
1355
- _this.baseUrl = Consts.ApiUrl;
1356
- _this.baseReadUrl = _this.baseUrl + "getAll";
1357
1335
  return _this;
1358
1336
  }
1359
- BaseGridEditService.prototype.serializeParams = function (data) {
1337
+ BaseGridReadService.prototype.serializeParams = function (data) {
1360
1338
  return data ? ('?' + $.param(data)) : '';
1361
1339
  };
1340
+ BaseGridReadService.prototype.read = function (params, success, error) {
1341
+ var _this = this;
1342
+ if (this.data.length) {
1343
+ return _super.prototype.next.call(this, this.data);
1344
+ }
1345
+ var url = this.baseReadUrl;
1346
+ if (typeof params === 'undefined') {
1347
+ params = this.savedReadParams;
1348
+ }
1349
+ if (params) {
1350
+ url = this.baseReadUrl + ("" + this.serializeParams(params));
1351
+ this.savedReadParams = params;
1352
+ }
1353
+ this.http.get(url).pipe(map(function (res) { return res; })).subscribe(function (data) {
1354
+ _super.prototype.next.call(_this, data);
1355
+ if (success)
1356
+ success();
1357
+ }, function (e) {
1358
+ if (error)
1359
+ error(e);
1360
+ });
1361
+ };
1362
+ BaseGridReadService.ctorParameters = function () { return [
1363
+ { type: HttpClient }
1364
+ ]; };
1365
+ BaseGridReadService = __decorate([
1366
+ Injectable()
1367
+ ], BaseGridReadService);
1368
+ return BaseGridReadService;
1369
+ }(BehaviorSubject));
1370
+
1371
+ /*
1372
+ <file>
1373
+ Authors:
1374
+ Vadim Osovitny
1375
+
1376
+ Created:
1377
+ 29 Apr 2018
1378
+
1379
+ Version:
1380
+ 1.0
1381
+
1382
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1383
+ </file>
1384
+ */
1385
+ var BaseGridEditService = /** @class */ (function (_super) {
1386
+ __extends(BaseGridEditService, _super);
1387
+ function BaseGridEditService(http) {
1388
+ var _this = _super.call(this, http) || this;
1389
+ _this.http = http;
1390
+ _this.baseUrl = "";
1391
+ return _this;
1392
+ }
1362
1393
  BaseGridEditService.prototype.reset = function () {
1363
1394
  this.data = [];
1364
1395
  };
@@ -1372,25 +1403,6 @@ var BaseGridEditService = /** @class */ (function (_super) {
1372
1403
  Object.assign(originalDataItem, dataItem);
1373
1404
  _super.prototype.next.call(this, this.data);
1374
1405
  };
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
1406
  BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1395
1407
  var _this = this;
1396
1408
  var action = isNew ? 'add' : 'update';
@@ -1427,7 +1439,7 @@ var BaseGridEditService = /** @class */ (function (_super) {
1427
1439
  Injectable()
1428
1440
  ], BaseGridEditService);
1429
1441
  return BaseGridEditService;
1430
- }(BehaviorSubject));
1442
+ }(BaseGridReadService));
1431
1443
 
1432
1444
  /*
1433
1445
  <file>
@@ -1467,11 +1479,11 @@ var AnatolyDataModule = /** @class */ (function () {
1467
1479
  return AnatolyDataModule;
1468
1480
  }());
1469
1481
 
1470
- // Consts
1482
+ // Services
1471
1483
 
1472
1484
  /**
1473
1485
  * Generated bundle index. Do not edit.
1474
1486
  */
1475
1487
 
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 };
1488
+ 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
1489
  //# sourceMappingURL=osovitny-anatoly.js.map