igniteui-webcomponents-datasources 1.3.3 → 1.4.2

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 (84) hide show
  1. package/bundles/igniteui-webcomponents-datasources.umd.js +2279 -1
  2. package/bundles/igniteui-webcomponents-datasources.umd.min.js +7 -2
  3. package/esm2015/igniteui-webcomponents-datasources.js +0 -1
  4. package/esm2015/lib/Entity.js +0 -1
  5. package/esm2015/lib/EntityProperty.js +0 -1
  6. package/esm2015/lib/EntitySet.js +0 -1
  7. package/esm2015/lib/ODataDataSourcePage.js +0 -1
  8. package/esm2015/lib/ODataSchemaProvider.js +0 -1
  9. package/esm2015/lib/ODataVirtualDataSource.js +0 -1
  10. package/esm2015/lib/ODataVirtualDataSourceDataProvider.js +0 -1
  11. package/esm2015/lib/ODataVirtualDataSourceDataProviderWorker.js +0 -1
  12. package/esm2015/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +0 -1
  13. package/esm2015/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +0 -1
  14. package/esm2015/lib/RestVirtualDataSource.js +272 -0
  15. package/esm2015/lib/RestVirtualDataSourceDataProvider.js +528 -0
  16. package/esm2015/lib/RestVirtualDataSourceDataProviderWorker.js +744 -0
  17. package/esm2015/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +154 -0
  18. package/esm2015/lib/RestVirtualDataSourcePage.js +67 -0
  19. package/esm2015/lib/RestVirtualDataSourceProviderTaskDataHolder.js +8 -0
  20. package/esm2015/lib/Schema.js +0 -1
  21. package/esm2015/lib/util.js +0 -1
  22. package/esm2015/public_api.js +6 -1
  23. package/esm5/igniteui-webcomponents-datasources.js +0 -1
  24. package/esm5/lib/Entity.js +0 -1
  25. package/esm5/lib/EntityProperty.js +0 -1
  26. package/esm5/lib/EntitySet.js +0 -1
  27. package/esm5/lib/ODataDataSourcePage.js +0 -1
  28. package/esm5/lib/ODataSchemaProvider.js +0 -1
  29. package/esm5/lib/ODataVirtualDataSource.js +0 -1
  30. package/esm5/lib/ODataVirtualDataSourceDataProvider.js +0 -1
  31. package/esm5/lib/ODataVirtualDataSourceDataProviderWorker.js +0 -1
  32. package/esm5/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js +0 -1
  33. package/esm5/lib/ODataVirtualDataSourceProviderTaskDataHolder.js +0 -1
  34. package/esm5/lib/RestVirtualDataSource.js +357 -0
  35. package/esm5/lib/RestVirtualDataSourceDataProvider.js +675 -0
  36. package/esm5/lib/RestVirtualDataSourceDataProviderWorker.js +948 -0
  37. package/esm5/lib/RestVirtualDataSourceDataProviderWorkerSettings.js +240 -0
  38. package/esm5/lib/RestVirtualDataSourcePage.js +73 -0
  39. package/esm5/lib/RestVirtualDataSourceProviderTaskDataHolder.js +12 -0
  40. package/esm5/lib/Schema.js +0 -1
  41. package/esm5/lib/util.js +0 -1
  42. package/esm5/public_api.js +6 -1
  43. package/fesm2015/igniteui-webcomponents-datasources.js +1754 -3
  44. package/fesm5/igniteui-webcomponents-datasources.js +2275 -3
  45. package/lib/RestVirtualDataSource.d.ts +60 -0
  46. package/lib/RestVirtualDataSourceDataProvider.d.ts +135 -0
  47. package/lib/RestVirtualDataSourceDataProviderWorker.d.ts +69 -0
  48. package/lib/RestVirtualDataSourceDataProviderWorkerSettings.d.ts +60 -0
  49. package/lib/RestVirtualDataSourcePage.d.ts +19 -0
  50. package/lib/RestVirtualDataSourceProviderTaskDataHolder.d.ts +5 -0
  51. package/package.json +2 -2
  52. package/public_api.d.ts +6 -0
  53. package/bundles/igniteui-webcomponents-datasources.umd.js.map +0 -1
  54. package/bundles/igniteui-webcomponents-datasources.umd.min.js.map +0 -1
  55. package/esm2015/igniteui-webcomponents-datasources.js.map +0 -1
  56. package/esm2015/lib/Entity.js.map +0 -1
  57. package/esm2015/lib/EntityProperty.js.map +0 -1
  58. package/esm2015/lib/EntitySet.js.map +0 -1
  59. package/esm2015/lib/ODataDataSourcePage.js.map +0 -1
  60. package/esm2015/lib/ODataSchemaProvider.js.map +0 -1
  61. package/esm2015/lib/ODataVirtualDataSource.js.map +0 -1
  62. package/esm2015/lib/ODataVirtualDataSourceDataProvider.js.map +0 -1
  63. package/esm2015/lib/ODataVirtualDataSourceDataProviderWorker.js.map +0 -1
  64. package/esm2015/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js.map +0 -1
  65. package/esm2015/lib/ODataVirtualDataSourceProviderTaskDataHolder.js.map +0 -1
  66. package/esm2015/lib/Schema.js.map +0 -1
  67. package/esm2015/lib/util.js.map +0 -1
  68. package/esm2015/public_api.js.map +0 -1
  69. package/esm5/igniteui-webcomponents-datasources.js.map +0 -1
  70. package/esm5/lib/Entity.js.map +0 -1
  71. package/esm5/lib/EntityProperty.js.map +0 -1
  72. package/esm5/lib/EntitySet.js.map +0 -1
  73. package/esm5/lib/ODataDataSourcePage.js.map +0 -1
  74. package/esm5/lib/ODataSchemaProvider.js.map +0 -1
  75. package/esm5/lib/ODataVirtualDataSource.js.map +0 -1
  76. package/esm5/lib/ODataVirtualDataSourceDataProvider.js.map +0 -1
  77. package/esm5/lib/ODataVirtualDataSourceDataProviderWorker.js.map +0 -1
  78. package/esm5/lib/ODataVirtualDataSourceDataProviderWorkerSettings.js.map +0 -1
  79. package/esm5/lib/ODataVirtualDataSourceProviderTaskDataHolder.js.map +0 -1
  80. package/esm5/lib/Schema.js.map +0 -1
  81. package/esm5/lib/util.js.map +0 -1
  82. package/esm5/public_api.js.map +0 -1
  83. package/fesm2015/igniteui-webcomponents-datasources.js.map +0 -1
  84. package/fesm5/igniteui-webcomponents-datasources.js.map +0 -1
@@ -1,4 +1,11 @@
1
- import { fromEnum, XName, DataSourceSchemaPropertyType, XDocument, XmlNodeType, typeCast, XElement, ODataDataSourceSchema, XNamespace, markType, AsyncVirtualDataSourceProviderTaskDataHolder, SortDescriptionCollection, ListSortDirection, DataSourceSummaryScope, stringIsNullOrEmpty, Convert, DefaultSectionInformation, SummaryOperand, DefaultSummaryResult, AsyncVirtualDataTask, AsyncDataSourcePageTaskHolder, ODataDataSourceFilterExpressionVisitor, TransactionType, AsyncVirtualDataSourceProviderWorker, AsyncVirtualDataSourceDataProviderWorkerSettings, FilterExpressionCollection, SummaryDescriptionCollection, DataSourcePageRequestPriority, runOn, DataSourceDataProviderSchemaChangedEventArgs, stringContains, Base, IDataSourceVirtualDataProvider_$type, VirtualDataSource } from 'igniteui-webcomponents-core';
1
+ /*!
2
+ THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
3
+ https://www.infragistics.com/legal/license/igultimate-la
4
+ https://www.infragistics.com/legal/license/igultimate-eula
5
+ GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
6
+ */
7
+
8
+ import { fromEnum, XName, DataSourceSchemaPropertyType, XDocument, XmlNodeType, typeCast, XElement, ODataDataSourceSchema, XNamespace, markType, AsyncVirtualDataSourceProviderTaskDataHolder, SortDescriptionCollection, ListSortDirection, DataSourceSummaryScope, stringIsNullOrEmpty, Convert, DefaultSectionInformation, SummaryOperand, DefaultSummaryResult, AsyncVirtualDataTask, AsyncDataSourcePageTaskHolder, ODataDataSourceFilterExpressionVisitor, TransactionType, AsyncVirtualDataSourceProviderWorker, AsyncVirtualDataSourceDataProviderWorkerSettings, FilterExpressionCollection, SummaryDescriptionCollection, DataSourcePageRequestPriority, runOn, DataSourceDataProviderSchemaChangedEventArgs, stringContains, Base, IDataSourceVirtualDataProvider_$type, VirtualDataSource, LocalDataSource } from 'igniteui-webcomponents-core';
2
9
  import { __values, __extends, __generator } from 'tslib';
3
10
 
4
11
  var EntityProperty = /** @class */ /*@__PURE__*/ (function () {
@@ -2336,5 +2343,2270 @@ var ODataVirtualDataSource = /** @class */ /*@__PURE__*/ (function (_super) {
2336
2343
  return ODataVirtualDataSource;
2337
2344
  }(VirtualDataSource));
2338
2345
 
2339
- export { Entity, EntityProperty, EntitySet, LinkedList, LinkedListNode, ODataDataSourcePage, ODataSchemaProvider, ODataVirtualDataSource, ODataVirtualDataSourceDataProvider, ODataVirtualDataSourceDataProviderWorker, ODataVirtualDataSourceDataProviderWorkerSettings, ODataVirtualDataSourceProviderTaskDataHolder, Schema, first, toArray };
2340
- //# sourceMappingURL=igniteui-webcomponents-datasources.js.map
2346
+ var RestVirtualDataSourceProviderTaskDataHolder = /** @class */ /*@__PURE__*/ (function (_super) {
2347
+ __extends(RestVirtualDataSourceProviderTaskDataHolder, _super);
2348
+ function RestVirtualDataSourceProviderTaskDataHolder() {
2349
+ return _super !== null && _super.apply(this, arguments) || this;
2350
+ }
2351
+ RestVirtualDataSourceProviderTaskDataHolder.$t = markType(RestVirtualDataSourceProviderTaskDataHolder, 'ODataVirtualDataSourceProviderTaskDataHolder', AsyncVirtualDataSourceProviderTaskDataHolder.$type);
2352
+ return RestVirtualDataSourceProviderTaskDataHolder;
2353
+ }(AsyncVirtualDataSourceProviderTaskDataHolder));
2354
+
2355
+ var RestVirtualDataSourcePage = /** @class */ /*@__PURE__*/ (function () {
2356
+ function RestVirtualDataSourcePage(sourceData_, schema, groupInformation, summaryInformation, pageIndex) {
2357
+ this._actualData = null;
2358
+ this._schema = null;
2359
+ this._pageIndex = 0;
2360
+ this._groupInformation = null;
2361
+ this._summaryInformation = null;
2362
+ if (sourceData_ == null) {
2363
+ this._actualData = null;
2364
+ }
2365
+ else {
2366
+ var count = (sourceData_.items.length);
2367
+ this._actualData = [];
2368
+ var dateProps = new Set();
2369
+ for (var i = 0; i < schema.propertyNames.length; i++) {
2370
+ if (schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeValue || schema.propertyTypes[i] == DataSourceSchemaPropertyType.DateTimeOffsetValue) {
2371
+ dateProps.add(schema.propertyNames[i]);
2372
+ }
2373
+ }
2374
+ var value_ = void 0;
2375
+ var _loop_1 = function (i_) {
2376
+ var currItem_ = sourceData_.items[i_];
2377
+ var dict = new Map();
2378
+ var properties = Array.from(Object.keys(currItem_));
2379
+ var values = (properties.map(function (k) { return currItem_[k]; }));
2380
+ for (var i1 = 0; i1 < properties.length; i1++) {
2381
+ value_ = values[i1];
2382
+ if (dateProps.has(properties[i1])) {
2383
+ value_ = new Date(value_);
2384
+ }
2385
+ dict.set(properties[i1], value_);
2386
+ }
2387
+ this_1._actualData[i_] = dict;
2388
+ };
2389
+ var this_1 = this;
2390
+ for (var i_ = 0; i_ < count; i_++) {
2391
+ _loop_1(i_);
2392
+ }
2393
+ }
2394
+ this._schema = schema;
2395
+ this._groupInformation = groupInformation;
2396
+ this._summaryInformation = summaryInformation;
2397
+ this._pageIndex = pageIndex;
2398
+ }
2399
+ RestVirtualDataSourcePage.prototype.count = function () {
2400
+ return this._actualData.length;
2401
+ };
2402
+ RestVirtualDataSourcePage.prototype.getItemAtIndex = function (index) {
2403
+ return this._actualData[index];
2404
+ };
2405
+ RestVirtualDataSourcePage.prototype.getItemValueAtIndex = function (index, valueName) {
2406
+ var item = this._actualData[index];
2407
+ if (!item.has(valueName)) {
2408
+ return null;
2409
+ }
2410
+ return item.get(valueName);
2411
+ };
2412
+ RestVirtualDataSourcePage.prototype.pageIndex = function () {
2413
+ return this._pageIndex;
2414
+ };
2415
+ RestVirtualDataSourcePage.prototype.schema = function () {
2416
+ return this._schema;
2417
+ };
2418
+ RestVirtualDataSourcePage.prototype.getGroupInformation = function () {
2419
+ return this._groupInformation;
2420
+ };
2421
+ RestVirtualDataSourcePage.prototype.getSummaryInformation = function () {
2422
+ return this._summaryInformation;
2423
+ };
2424
+ return RestVirtualDataSourcePage;
2425
+ }());
2426
+
2427
+ var RestVirtualDataSourceDataProviderWorker = /** @class */ /*@__PURE__*/ (function (_super) {
2428
+ __extends(RestVirtualDataSourceDataProviderWorker, _super);
2429
+ function RestVirtualDataSourceDataProviderWorker(settings) {
2430
+ var e_1, _a;
2431
+ var _this = _super.call(this, settings) || this;
2432
+ _this._baseUri = null;
2433
+ _this._entitySet = null;
2434
+ _this._sortDescriptions = null;
2435
+ _this._groupDescriptions = null;
2436
+ _this._filterExpressions = null;
2437
+ _this._summaryDescriptions = null;
2438
+ _this._desiredPropeties = null;
2439
+ _this._enableJsonp = true;
2440
+ _this._isAggregationSupported = false;
2441
+ _this._provideFullCount = null;
2442
+ _this._provideOrderByParameter = null;
2443
+ _this._provideFilterParameter = null;
2444
+ _this._provideAggregationParameter = null;
2445
+ _this._provideAggregatedCount = null;
2446
+ _this._providePagingParameter = null;
2447
+ _this._provideDesiredPropertiesParameter = null;
2448
+ _this._provideUri = null;
2449
+ _this._performFetch = null;
2450
+ _this._fixedFullCount = -1;
2451
+ _this._groupInformation = null;
2452
+ _this._summaryInformation = null;
2453
+ _this._filterString = null;
2454
+ _this._selectedString = null;
2455
+ _this.doWork = _this.doWork.bind(_this);
2456
+ _this._baseUri = settings.baseUri;
2457
+ _this._entitySet = settings.entitySet;
2458
+ _this._sortDescriptions = settings.sortDescriptions;
2459
+ _this._groupDescriptions = settings.groupDescriptions;
2460
+ if (_this._groupDescriptions != null && _this._groupDescriptions.size() > 0) {
2461
+ _this._sortDescriptions = new SortDescriptionCollection();
2462
+ try {
2463
+ for (var _b = __values(_this.iter(settings.sortDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
2464
+ var sd = _c.value;
2465
+ _this._sortDescriptions.add(sd);
2466
+ }
2467
+ }
2468
+ catch (e_1_1) {
2469
+ e_1 = { error: e_1_1 };
2470
+ }
2471
+ finally {
2472
+ try {
2473
+ if (_c && !_c.done && (_a = _b.return))
2474
+ _a.call(_b);
2475
+ }
2476
+ finally {
2477
+ if (e_1)
2478
+ throw e_1.error;
2479
+ }
2480
+ }
2481
+ for (var i = 0; i < _this._groupDescriptions.size(); i++) {
2482
+ _this._sortDescriptions.insert(i, _this._groupDescriptions.get(i));
2483
+ }
2484
+ }
2485
+ _this._filterExpressions = settings.filterExpressions;
2486
+ _this._desiredPropeties = settings.propertiesRequested;
2487
+ _this._summaryDescriptions = settings.summaryDescriptions;
2488
+ _this._fixedFullCount = settings.fixedFullCount;
2489
+ _this._summaryScope = settings.summaryScope;
2490
+ _this._enableJsonp = settings.enableJsonp;
2491
+ _this._provideFullCount = settings.provideFullCount;
2492
+ _this._performFetch = settings.performFetch;
2493
+ _this._provideAggregationParameter = settings.provideAggregationParameter;
2494
+ _this._provideFilterParameter = settings.provideFilterParameter;
2495
+ _this._provideOrderByParameter = settings.provideOrderByParameter;
2496
+ _this._provideUri = settings.provideUri;
2497
+ _this._providePagingParameter = settings.providePagingParameter;
2498
+ _this._provideDesiredPropertiesParameter = settings.provideDesiredPropertiesParameter;
2499
+ _this._provideItems = settings.provideItems;
2500
+ _this._provideAggregatedCount = settings.provideAggregatedCount;
2501
+ if (!_this._provideItems) {
2502
+ _this._provideItems = function (res) {
2503
+ return res ? res.items : null;
2504
+ };
2505
+ }
2506
+ if (!_this._provideFullCount) {
2507
+ _this._provideFullCount = function (p) {
2508
+ if (p.fullCount) {
2509
+ return p.fullCount;
2510
+ }
2511
+ else {
2512
+ return _this._fixedFullCount >= 0 ? _this._fixedFullCount : 0;
2513
+ }
2514
+ };
2515
+ }
2516
+ if (!_this._provideOrderByParameter) {
2517
+ _this._provideOrderByParameter = function (args, orderByString, orderBy) {
2518
+ args.push({ name: "orderBy", value: encodeURIComponent(orderByString) });
2519
+ };
2520
+ }
2521
+ if (!_this._providePagingParameter) {
2522
+ _this._providePagingParameter = function (args, skip, take) {
2523
+ args.push({ name: "skip", value: skip });
2524
+ args.push({ name: "take", value: take });
2525
+ };
2526
+ }
2527
+ if (!_this._provideAggregationParameter) {
2528
+ _this._provideAggregationParameter = function (args, fetchCountOnly, groupByString, groupBy, summaryString, summary) {
2529
+ args.push({ name: "groupBy", value: groupByString });
2530
+ args.push({ name: "aggregate", value: "count" });
2531
+ };
2532
+ }
2533
+ if (!_this._provideUri) {
2534
+ _this._provideUri = function (baseUri, entitySet, args) {
2535
+ var requestUri = baseUri;
2536
+ requestUri += "/" + entitySet;
2537
+ if (args.length > 0) {
2538
+ requestUri += "?";
2539
+ }
2540
+ var argsString = "";
2541
+ for (var i = 0; i < args.length; i++) {
2542
+ if (i > 0) {
2543
+ argsString += "&";
2544
+ }
2545
+ argsString += args[i].name + "=" + args[i].value;
2546
+ }
2547
+ return requestUri + argsString;
2548
+ };
2549
+ }
2550
+ _this._isAggregationSupported = settings.isAggregationSupported;
2551
+ window.setTimeout(_this.doWork, 100);
2552
+ return _this;
2553
+ }
2554
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorker.prototype, "sortDescriptions", {
2555
+ get: function () {
2556
+ return this._sortDescriptions;
2557
+ },
2558
+ enumerable: true,
2559
+ configurable: true
2560
+ });
2561
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorker.prototype, "filterExpressions", {
2562
+ get: function () {
2563
+ return this._filterExpressions;
2564
+ },
2565
+ enumerable: true,
2566
+ configurable: true
2567
+ });
2568
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorker.prototype, "desiredProperties", {
2569
+ get: function () {
2570
+ return this._desiredPropeties;
2571
+ },
2572
+ enumerable: true,
2573
+ configurable: true
2574
+ });
2575
+ RestVirtualDataSourceDataProviderWorker.prototype.initialize = function () {
2576
+ _super.prototype.initialize.call(this);
2577
+ };
2578
+ RestVirtualDataSourceDataProviderWorker.prototype.getTaskDataHolder = function () {
2579
+ var holder = new RestVirtualDataSourceProviderTaskDataHolder();
2580
+ return holder;
2581
+ };
2582
+ RestVirtualDataSourceDataProviderWorker.prototype.getCompletedTaskData = function (holder, completed) {
2583
+ _super.prototype.getCompletedTaskData.call(this, holder, completed);
2584
+ };
2585
+ RestVirtualDataSourceDataProviderWorker.prototype.removeCompletedTaskData = function (holder, completed) {
2586
+ _super.prototype.removeCompletedTaskData.call(this, holder, completed);
2587
+ };
2588
+ RestVirtualDataSourceDataProviderWorker.prototype.getTasksData = function (holder) {
2589
+ _super.prototype.getTasksData.call(this, holder);
2590
+ };
2591
+ RestVirtualDataSourceDataProviderWorker.prototype.iter = function (coll) {
2592
+ var i;
2593
+ return __generator(this, function (_a) {
2594
+ switch (_a.label) {
2595
+ case 0:
2596
+ i = 0;
2597
+ _a.label = 1;
2598
+ case 1:
2599
+ if (!(i < coll.size()))
2600
+ return [3 /*break*/, 4];
2601
+ return [4 /*yield*/, coll.get(i)];
2602
+ case 2:
2603
+ _a.sent();
2604
+ _a.label = 3;
2605
+ case 3:
2606
+ i++;
2607
+ return [3 /*break*/, 1];
2608
+ case 4: return [2 /*return*/];
2609
+ }
2610
+ });
2611
+ };
2612
+ RestVirtualDataSourceDataProviderWorker.prototype.iterFilter = function (coll) {
2613
+ var i;
2614
+ return __generator(this, function (_a) {
2615
+ switch (_a.label) {
2616
+ case 0:
2617
+ i = 0;
2618
+ _a.label = 1;
2619
+ case 1:
2620
+ if (!(i < coll.size()))
2621
+ return [3 /*break*/, 4];
2622
+ return [4 /*yield*/, coll.get(i)];
2623
+ case 2:
2624
+ _a.sent();
2625
+ _a.label = 3;
2626
+ case 3:
2627
+ i++;
2628
+ return [3 /*break*/, 1];
2629
+ case 4: return [2 /*return*/];
2630
+ }
2631
+ });
2632
+ };
2633
+ RestVirtualDataSourceDataProviderWorker.prototype.iterSummaries = function (summaries) {
2634
+ var i;
2635
+ return __generator(this, function (_a) {
2636
+ switch (_a.label) {
2637
+ case 0:
2638
+ i = 0;
2639
+ _a.label = 1;
2640
+ case 1:
2641
+ if (!(i < summaries.size()))
2642
+ return [3 /*break*/, 4];
2643
+ return [4 /*yield*/, summaries.get(i)];
2644
+ case 2:
2645
+ _a.sent();
2646
+ _a.label = 3;
2647
+ case 3:
2648
+ i++;
2649
+ return [3 /*break*/, 1];
2650
+ case 4: return [2 /*return*/];
2651
+ }
2652
+ });
2653
+ };
2654
+ RestVirtualDataSourceDataProviderWorker.prototype.processCompletedTask = function (completedTask, currentDelay, pageIndex, taskDataHolder) {
2655
+ var _this = this;
2656
+ var h = taskDataHolder;
2657
+ var schema = null;
2658
+ var result = null;
2659
+ var schemaFetchCount = -1;
2660
+ var task = completedTask.task;
2661
+ try {
2662
+ if (task.hasErrors) {
2663
+ this.retryIndex(pageIndex, currentDelay);
2664
+ return;
2665
+ }
2666
+ if (pageIndex == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
2667
+ result = task.result;
2668
+ schemaFetchCount = (this._provideFullCount(result));
2669
+ }
2670
+ else {
2671
+ result = task.result;
2672
+ }
2673
+ }
2674
+ catch (e) {
2675
+ this.retryIndex(pageIndex, currentDelay);
2676
+ return;
2677
+ }
2678
+ if (schemaFetchCount >= 0) {
2679
+ this.actualCount = schemaFetchCount;
2680
+ }
2681
+ else {
2682
+ this.actualCount = (this._provideFullCount(result));
2683
+ }
2684
+ schema = this.actualSchema;
2685
+ if (schema == null) {
2686
+ var requests_1 = 0;
2687
+ this.resolveSchema(function (s) {
2688
+ // resolveSchema success callback
2689
+ _this.actualSchema = s;
2690
+ if (_this._isAggregationSupported && (_this._groupDescriptions.size() !== 0 || _this._summaryDescriptions.size() !== 0)) {
2691
+ if (_this._groupDescriptions.size() > 0) {
2692
+ requests_1++;
2693
+ _this.resolveGroupInformation(function (g) {
2694
+ // group info success
2695
+ requests_1--;
2696
+ if (requests_1 === 0) {
2697
+ _this.finishProcessingCompletedTask(task, pageIndex, s, result);
2698
+ }
2699
+ }, function () {
2700
+ // group info failure
2701
+ _this.retryIndex(pageIndex, currentDelay);
2702
+ return;
2703
+ });
2704
+ }
2705
+ if (_this._summaryDescriptions.size() > 0) {
2706
+ requests_1++;
2707
+ _this.resolveSummaryInformation(function (g) {
2708
+ // summary info success
2709
+ requests_1--;
2710
+ if (requests_1 === 0) {
2711
+ _this.finishProcessingCompletedTask(task, pageIndex, s, result);
2712
+ }
2713
+ }, function () {
2714
+ // summary info failure
2715
+ _this.retryIndex(pageIndex, currentDelay);
2716
+ return;
2717
+ });
2718
+ }
2719
+ }
2720
+ else {
2721
+ _this.finishProcessingCompletedTask(task, pageIndex, s, result);
2722
+ }
2723
+ }, function () {
2724
+ // resolveSchema failure callback
2725
+ _this.retryIndex(pageIndex, currentDelay);
2726
+ return;
2727
+ });
2728
+ return;
2729
+ }
2730
+ this.finishProcessingCompletedTask(task, pageIndex, schema, result);
2731
+ };
2732
+ RestVirtualDataSourceDataProviderWorker.prototype.finishProcessingCompletedTask = function (task, pageIndex, schema, result) {
2733
+ var _this = this;
2734
+ var executionContext;
2735
+ var pageLoaded;
2736
+ var groupInformation;
2737
+ var summaryInformation;
2738
+ this.actualSchema = schema;
2739
+ executionContext = this.executionContext;
2740
+ groupInformation = this._groupInformation;
2741
+ summaryInformation = this._summaryInformation;
2742
+ pageLoaded = this.pageLoaded;
2743
+ var page = null;
2744
+ if (result != null) {
2745
+ page = new RestVirtualDataSourcePage(result, schema, groupInformation, summaryInformation, pageIndex);
2746
+ if (!this.isLastPage(pageIndex) && page.count() > 0 && !this.populatedActualPageSize) {
2747
+ this.populatedActualPageSize = true;
2748
+ this.actualPageSize = page.count();
2749
+ }
2750
+ }
2751
+ else {
2752
+ page = new RestVirtualDataSourcePage(null, schema, groupInformation, summaryInformation, pageIndex);
2753
+ }
2754
+ if (this.pageLoaded != null) {
2755
+ if (this.executionContext != null) {
2756
+ if (executionContext == null || pageLoaded == null) {
2757
+ this.shutdown();
2758
+ return;
2759
+ }
2760
+ executionContext.execute(function () { return pageLoaded(page, _this.actualCount, _this.actualPageSize); });
2761
+ }
2762
+ else {
2763
+ if (pageLoaded == null) {
2764
+ this.shutdown();
2765
+ return;
2766
+ }
2767
+ pageLoaded(page, this.actualCount, this.actualPageSize);
2768
+ }
2769
+ }
2770
+ };
2771
+ RestVirtualDataSourceDataProviderWorker.prototype.resolveGroupInformation = function (finishAction, failureAction) {
2772
+ var e_2, _a;
2773
+ var _this = this;
2774
+ if (this._groupInformation != null) {
2775
+ finishAction(this._groupInformation);
2776
+ return;
2777
+ }
2778
+ var orderBy = "";
2779
+ var groupBy = "";
2780
+ var filter = null;
2781
+ var summary = "";
2782
+ if (this._groupDescriptions == null || this._groupDescriptions.size() == 0) {
2783
+ finishAction(null);
2784
+ return;
2785
+ }
2786
+ if (this._provideAggregationParameter == null) {
2787
+ finishAction(null);
2788
+ return;
2789
+ }
2790
+ filter = this._filterString;
2791
+ this.updateFilterString();
2792
+ if (this._groupDescriptions != null) {
2793
+ var first1 = true;
2794
+ try {
2795
+ for (var _b = __values(this.iter(this._groupDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
2796
+ var group = _c.value;
2797
+ if (first1) {
2798
+ first1 = false;
2799
+ }
2800
+ else {
2801
+ orderBy += ", ";
2802
+ groupBy += ", ";
2803
+ }
2804
+ groupBy += group.propertyName;
2805
+ if (group.direction === ListSortDirection.Descending) {
2806
+ orderBy += group.propertyName + " desc";
2807
+ }
2808
+ else {
2809
+ orderBy += group.propertyName + " asc";
2810
+ }
2811
+ }
2812
+ }
2813
+ catch (e_2_1) {
2814
+ e_2 = { error: e_2_1 };
2815
+ }
2816
+ finally {
2817
+ try {
2818
+ if (_c && !_c.done && (_a = _b.return))
2819
+ _a.call(_b);
2820
+ }
2821
+ finally {
2822
+ if (e_2)
2823
+ throw e_2.error;
2824
+ }
2825
+ }
2826
+ }
2827
+ if (this._summaryScope === DataSourceSummaryScope.Both || this._summaryScope === DataSourceSummaryScope.Groups) {
2828
+ var summaryParameters = this.getSummaryQueryParameters(true);
2829
+ if (!stringIsNullOrEmpty(summaryParameters)) {
2830
+ summary = ", " + summaryParameters;
2831
+ }
2832
+ }
2833
+ var args = [];
2834
+ if (this._provideOrderByParameter) {
2835
+ this._provideOrderByParameter(args, orderBy, this._groupDescriptions);
2836
+ }
2837
+ if (this._provideFilterParameter && filter != null) {
2838
+ this._provideFilterParameter(args, filter, this._filterExpressions);
2839
+ }
2840
+ if (this._provideAggregationParameter) {
2841
+ this._provideAggregationParameter(args, true, groupBy, this._groupDescriptions, summary, this._summaryDescriptions);
2842
+ }
2843
+ var uri = this._provideUri(this._baseUri, this._entitySet, args);
2844
+ try {
2845
+ var groupInformation_1 = [];
2846
+ var success_1 = function (data, response) { return _this.groupSuccess(data, response, finishAction, failureAction, groupInformation_1); };
2847
+ var failure_1 = function (err) { return _this.groupError(err, finishAction, failureAction, groupInformation_1); };
2848
+ var run_ = null;
2849
+ var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
2850
+ var request = {
2851
+ requestUri: uri,
2852
+ enableJsonpCallback: this._enableJsonp,
2853
+ method: 'GET',
2854
+ headers: headers,
2855
+ data: null
2856
+ };
2857
+ run_ = function () {
2858
+ _this.fetchUri(request, success_1, failure_1);
2859
+ };
2860
+ run_();
2861
+ }
2862
+ catch (e) {
2863
+ failureAction();
2864
+ }
2865
+ };
2866
+ RestVirtualDataSourceDataProviderWorker.prototype.fetchUri = function (request, success, failure) {
2867
+ if (this._performFetch) {
2868
+ this._performFetch(request, success, failure);
2869
+ }
2870
+ else {
2871
+ fetch(request.requestUri, {
2872
+ method: request.method,
2873
+ headers: request.headers,
2874
+ }).then(function (res) {
2875
+ res.json().then(function (j) {
2876
+ success(j, res);
2877
+ });
2878
+ }).catch(function (e) {
2879
+ failure(e);
2880
+ });
2881
+ }
2882
+ };
2883
+ RestVirtualDataSourceDataProviderWorker.prototype.groupError = function (err, finishAction, failureAction, groupInformation) {
2884
+ this._groupInformation = null;
2885
+ };
2886
+ RestVirtualDataSourceDataProviderWorker.prototype.groupSuccess = function (data, response, finishAction, failureAction, groupInformation) {
2887
+ var e_3, _a;
2888
+ var groupNames = [];
2889
+ try {
2890
+ for (var _b = __values(this.iter(this._groupDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
2891
+ var group = _c.value;
2892
+ groupNames.push(group.propertyName);
2893
+ }
2894
+ }
2895
+ catch (e_3_1) {
2896
+ e_3 = { error: e_3_1 };
2897
+ }
2898
+ finally {
2899
+ try {
2900
+ if (_c && !_c.done && (_a = _b.return))
2901
+ _a.call(_b);
2902
+ }
2903
+ finally {
2904
+ if (e_3)
2905
+ throw e_3.error;
2906
+ }
2907
+ }
2908
+ var groupNamesArray = groupNames;
2909
+ var items = this._provideItems(data);
2910
+ if (items && items.length > 0) {
2911
+ var currentIndex = 0;
2912
+ for (var i = 0; i < items.length; i++) {
2913
+ this.addGroup(groupInformation, groupNames, groupNames, currentIndex, items[i]);
2914
+ }
2915
+ }
2916
+ this._groupInformation = groupInformation;
2917
+ finishAction(this._groupInformation);
2918
+ };
2919
+ RestVirtualDataSourceDataProviderWorker.prototype.addGroup = function (groupInformation, groupNames, groupNamesArray, currentIndex, group) {
2920
+ var e_4, _a;
2921
+ var groupValues = [];
2922
+ try {
2923
+ for (var groupNames_1 = __values(groupNames), groupNames_1_1 = groupNames_1.next(); !groupNames_1_1.done; groupNames_1_1 = groupNames_1.next()) {
2924
+ var name_1 = groupNames_1_1.value;
2925
+ if (group[name_1]) {
2926
+ groupValues.push(group[name_1]);
2927
+ }
2928
+ }
2929
+ }
2930
+ catch (e_4_1) {
2931
+ e_4 = { error: e_4_1 };
2932
+ }
2933
+ finally {
2934
+ try {
2935
+ if (groupNames_1_1 && !groupNames_1_1.done && (_a = groupNames_1.return))
2936
+ _a.call(groupNames_1);
2937
+ }
2938
+ finally {
2939
+ if (e_4)
2940
+ throw e_4.error;
2941
+ }
2942
+ }
2943
+ var groupCount = 0;
2944
+ //todo: make this customizable
2945
+ if (this._provideAggregatedCount) {
2946
+ var ct = this._provideAggregatedCount(group);
2947
+ }
2948
+ else {
2949
+ if (group["aggregatedCount"]) {
2950
+ groupCount = Convert.toInt321(group["aggregatedCount"]);
2951
+ }
2952
+ }
2953
+ var summaryResults = null;
2954
+ if (this._summaryScope == DataSourceSummaryScope.Both || this._summaryScope == DataSourceSummaryScope.Groups) {
2955
+ summaryResults = this.createSummaryResults(group);
2956
+ }
2957
+ var groupInfo = new DefaultSectionInformation(currentIndex, currentIndex + (groupCount - 1), groupNamesArray, groupValues, summaryResults);
2958
+ groupInformation.push(groupInfo);
2959
+ };
2960
+ RestVirtualDataSourceDataProviderWorker.prototype.resolveSummaryInformation = function (finishAction, failureAction) {
2961
+ var _this = this;
2962
+ if (this._summaryInformation != null) {
2963
+ finishAction(this._summaryInformation);
2964
+ return;
2965
+ }
2966
+ var filter = null;
2967
+ var summary = null;
2968
+ if (this._summaryDescriptions == null ||
2969
+ this._summaryDescriptions.size() == 0 ||
2970
+ this._summaryScope == DataSourceSummaryScope.Groups ||
2971
+ this._summaryScope == DataSourceSummaryScope.None) {
2972
+ finishAction(null);
2973
+ return;
2974
+ }
2975
+ filter = this._filterString;
2976
+ this.updateFilterString();
2977
+ summary = this.getSummaryQueryParameters(false);
2978
+ var args = [];
2979
+ // if (this._provideOrderByParameter) {
2980
+ // args.push({ name: "orderBy", value: this._provideOrderByParameter(orderBy, this._sortDescriptions) });
2981
+ // }
2982
+ if (this._provideFilterParameter && filter != null) {
2983
+ this._provideFilterParameter(args, filter, this._filterExpressions);
2984
+ }
2985
+ if (this._provideAggregationParameter) {
2986
+ this._provideAggregationParameter(args, true, null, null, summary, this._summaryDescriptions);
2987
+ }
2988
+ var uri = this._provideUri(this._baseUri, this._entitySet, args);
2989
+ // let commandText = this._entitySet + "?$apply=";
2990
+ // if (!stringIsNullOrEmpty(filter)) {
2991
+ // commandText += "filter(" + filter + ")/";
2992
+ // }
2993
+ // commandText += "aggregate(" + summary + ")";
2994
+ try {
2995
+ var summaryInformation_1 = [];
2996
+ var success_2 = function (data, response) { return _this.summarySuccess(data, response, finishAction, failureAction, summaryInformation_1); };
2997
+ var failure_2 = function (err) { return _this.summaryError(err, finishAction, failureAction, summaryInformation_1); };
2998
+ var run_ = null;
2999
+ var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
3000
+ var request = {
3001
+ requestUri: uri,
3002
+ enableJsonpCallback: this._enableJsonp,
3003
+ method: 'GET',
3004
+ headers: headers,
3005
+ data: null
3006
+ };
3007
+ run_ = function () {
3008
+ _this.fetchUri(request, success_2, failure_2);
3009
+ };
3010
+ run_();
3011
+ }
3012
+ catch (e) {
3013
+ failureAction();
3014
+ }
3015
+ };
3016
+ RestVirtualDataSourceDataProviderWorker.prototype.summarySuccess = function (data, response, finishAction, failureAction, summaryInformation) {
3017
+ if (data && data.value && data.value.length > 0) {
3018
+ summaryInformation = this.createSummaryResults(data.value[0]);
3019
+ }
3020
+ this._summaryInformation = summaryInformation;
3021
+ finishAction(this._summaryInformation);
3022
+ };
3023
+ RestVirtualDataSourceDataProviderWorker.prototype.summaryError = function (err, finishAction, failureAction, summaryInformation) {
3024
+ this._summaryInformation = null;
3025
+ };
3026
+ RestVirtualDataSourceDataProviderWorker.prototype.getSummaryQueryParameters = function (ignoreCount) {
3027
+ var e_5, _a;
3028
+ var result = "";
3029
+ if (this._summaryDescriptions != null) {
3030
+ var first = true;
3031
+ var countExists = false;
3032
+ try {
3033
+ for (var _b = __values(this.iterSummaries(this._summaryDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
3034
+ var summary = _c.value;
3035
+ if (summary.operand == SummaryOperand.Count && (ignoreCount || countExists)) {
3036
+ continue;
3037
+ }
3038
+ if (!first) {
3039
+ result += ", ";
3040
+ }
3041
+ switch (summary.operand) {
3042
+ case SummaryOperand.Average:
3043
+ result += summary.propertyName + " with average as " + summary.propertyName + "Average";
3044
+ break;
3045
+ case SummaryOperand.Min:
3046
+ result += summary.propertyName + " with min as " + summary.propertyName + "Min";
3047
+ break;
3048
+ case SummaryOperand.Max:
3049
+ result += summary.propertyName + " with max as " + summary.propertyName + "Max";
3050
+ break;
3051
+ case SummaryOperand.Sum:
3052
+ result += summary.propertyName + " with sum as " + summary.propertyName + "Sum";
3053
+ break;
3054
+ case SummaryOperand.Count:
3055
+ result += "$count as $__count";
3056
+ countExists = true;
3057
+ break;
3058
+ }
3059
+ first = false;
3060
+ }
3061
+ }
3062
+ catch (e_5_1) {
3063
+ e_5 = { error: e_5_1 };
3064
+ }
3065
+ finally {
3066
+ try {
3067
+ if (_c && !_c.done && (_a = _b.return))
3068
+ _a.call(_b);
3069
+ }
3070
+ finally {
3071
+ if (e_5)
3072
+ throw e_5.error;
3073
+ }
3074
+ }
3075
+ }
3076
+ return result;
3077
+ };
3078
+ RestVirtualDataSourceDataProviderWorker.prototype.createSummaryResults = function (data) {
3079
+ var e_6, _a;
3080
+ var summaryResults = [];
3081
+ try {
3082
+ for (var _b = __values(this.iterSummaries(this._summaryDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
3083
+ var summary = _c.value;
3084
+ var summaryName = summary.propertyName;
3085
+ switch (summary.operand) {
3086
+ case SummaryOperand.Average:
3087
+ summaryName += "Average";
3088
+ break;
3089
+ case SummaryOperand.Min:
3090
+ summaryName += "Min";
3091
+ break;
3092
+ case SummaryOperand.Max:
3093
+ summaryName += "Max";
3094
+ break;
3095
+ case SummaryOperand.Sum:
3096
+ summaryName += "Sum";
3097
+ break;
3098
+ case SummaryOperand.Count:
3099
+ summaryName = "$__count";
3100
+ break;
3101
+ }
3102
+ var summaryValue = null;
3103
+ if (data && data[summaryName]) {
3104
+ summaryValue = data[summaryName];
3105
+ }
3106
+ var summaryResult = new DefaultSummaryResult(summary.propertyName, summary.operand, summaryValue);
3107
+ summaryResults.push(summaryResult);
3108
+ }
3109
+ }
3110
+ catch (e_6_1) {
3111
+ e_6 = { error: e_6_1 };
3112
+ }
3113
+ finally {
3114
+ try {
3115
+ if (_c && !_c.done && (_a = _b.return))
3116
+ _a.call(_b);
3117
+ }
3118
+ finally {
3119
+ if (e_6)
3120
+ throw e_6.error;
3121
+ }
3122
+ }
3123
+ return summaryResults;
3124
+ };
3125
+ RestVirtualDataSourceDataProviderWorker.prototype.resolveSchemaFromItems = function (items) {
3126
+ var lds = new LocalDataSource();
3127
+ lds.dataSource = items;
3128
+ lds.flushAutoRefresh();
3129
+ return lds.actualSchema;
3130
+ };
3131
+ RestVirtualDataSourceDataProviderWorker.prototype.resolveSchema = function (finishAction, failureAction) {
3132
+ var _this = this;
3133
+ if (!this._provideItems || !this._providePagingParameter) {
3134
+ failureAction("required providers for items and paging are not specified");
3135
+ return;
3136
+ }
3137
+ var success_ = function (res) {
3138
+ var items = _this._provideItems(res);
3139
+ if (items && items.length > 0) {
3140
+ var schema = _this.resolveSchemaFromItems(items);
3141
+ finishAction(schema);
3142
+ }
3143
+ else {
3144
+ failureAction("could not find items to resolve schema");
3145
+ }
3146
+ };
3147
+ var failure_ = function (e) { return failureAction(e); };
3148
+ var args = [];
3149
+ if (this._providePagingParameter) {
3150
+ this._providePagingParameter(args, 0, this.actualPageSize);
3151
+ }
3152
+ var uri = this._provideUri(this._baseUri, this._entitySet, args);
3153
+ try {
3154
+ var run_ = null;
3155
+ var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
3156
+ var request = {
3157
+ requestUri: uri,
3158
+ enableJsonpCallback: this._enableJsonp,
3159
+ method: 'GET',
3160
+ headers: headers,
3161
+ data: null
3162
+ };
3163
+ run_ = function () {
3164
+ _this.fetchUri(request, success_, failure_);
3165
+ };
3166
+ run_();
3167
+ }
3168
+ catch (e) {
3169
+ failureAction(e);
3170
+ }
3171
+ };
3172
+ RestVirtualDataSourceDataProviderWorker.prototype.makeTaskForRequest = function (request, retryDelay) {
3173
+ var e_7, _a;
3174
+ var args = [];
3175
+ // if (this._provideAggregationParameter) {
3176
+ // args.push({ name: "apply", value: this._provideAggregationParameter(true, groupBy, this._groupDescriptions, summary, this._summaryDescriptions) });
3177
+ // }
3178
+ var actualPageSize = 0;
3179
+ var sortDescriptions = null;
3180
+ actualPageSize = this.actualPageSize;
3181
+ sortDescriptions = this.sortDescriptions;
3182
+ //let requestUrl: string = this._baseUri;
3183
+ //requestUrl += "/" + this._entitySet;
3184
+ var queryStarted = false;
3185
+ this.updateFilterString();
3186
+ if (this._filterString != null) {
3187
+ if (this._provideFilterParameter) {
3188
+ this._provideFilterParameter(args, this._filterString, this._filterExpressions);
3189
+ }
3190
+ }
3191
+ if (this.sortDescriptions != null) {
3192
+ var sortString = null;
3193
+ try {
3194
+ for (var _b = __values(this.iter(this.sortDescriptions)), _c = _b.next(); !_c.done; _c = _b.next()) {
3195
+ var sort = _c.value;
3196
+ if (sortString == null) {
3197
+ sortString = "";
3198
+ }
3199
+ else {
3200
+ sortString += ", ";
3201
+ }
3202
+ if (sort.direction == ListSortDirection.Descending) {
3203
+ sortString += sort.propertyName + " desc";
3204
+ }
3205
+ else {
3206
+ sortString += sort.propertyName;
3207
+ }
3208
+ }
3209
+ }
3210
+ catch (e_7_1) {
3211
+ e_7 = { error: e_7_1 };
3212
+ }
3213
+ finally {
3214
+ try {
3215
+ if (_c && !_c.done && (_a = _b.return))
3216
+ _a.call(_b);
3217
+ }
3218
+ finally {
3219
+ if (e_7)
3220
+ throw e_7.error;
3221
+ }
3222
+ }
3223
+ if (sortString != null) {
3224
+ if (this._provideOrderByParameter) {
3225
+ this._provideOrderByParameter(args, sortString, this._sortDescriptions);
3226
+ }
3227
+ }
3228
+ }
3229
+ if (this.desiredProperties != null && this.desiredProperties.length > 0) {
3230
+ var selectString = "";
3231
+ var first = true;
3232
+ var $t = this.desiredProperties;
3233
+ for (var i = 0; i < $t.length; i++) {
3234
+ var select = $t[i];
3235
+ if (first) {
3236
+ first = false;
3237
+ }
3238
+ else {
3239
+ selectString += ", ";
3240
+ }
3241
+ selectString += select;
3242
+ }
3243
+ if (this._provideDesiredPropertiesParameter) {
3244
+ this._provideDesiredPropertiesParameter(args, selectString, this._desiredPropeties);
3245
+ }
3246
+ }
3247
+ if (this._providePagingParameter) {
3248
+ if (request.index == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
3249
+ this._providePagingParameter(args, 0, actualPageSize);
3250
+ }
3251
+ else {
3252
+ this._providePagingParameter(args, request.index * actualPageSize, actualPageSize);
3253
+ }
3254
+ }
3255
+ var task = new AsyncVirtualDataTask();
3256
+ var uri = this._provideUri(this._baseUri, this._entitySet, args);
3257
+ if (request.index == RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
3258
+ this.executeRequest(uri, queryStarted, 0, actualPageSize, task);
3259
+ }
3260
+ else {
3261
+ this.executeRequest(uri, queryStarted, request.index * actualPageSize, actualPageSize, task);
3262
+ }
3263
+ request.taskHolder = new AsyncDataSourcePageTaskHolder();
3264
+ request.taskHolder.task = task;
3265
+ this.tasks.add(request);
3266
+ };
3267
+ RestVirtualDataSourceDataProviderWorker.prototype.updateFilterString = function () {
3268
+ var e_8, _a;
3269
+ if (this.filterExpressions != null && this.filterExpressions.size() > 0 && this._filterString == null) {
3270
+ var sb = "";
3271
+ var first = true;
3272
+ try {
3273
+ for (var _b = __values(this.iterFilter(this.filterExpressions)), _c = _b.next(); !_c.done; _c = _b.next()) {
3274
+ var expr = _c.value;
3275
+ if (first) {
3276
+ first = false;
3277
+ }
3278
+ else {
3279
+ sb += " AND ";
3280
+ }
3281
+ var visitor = new ODataDataSourceFilterExpressionVisitor(0);
3282
+ visitor.visit(expr);
3283
+ var txt = visitor.toString();
3284
+ if (this.filterExpressions.size() > 1) {
3285
+ txt = "(" + txt + ")";
3286
+ }
3287
+ sb += (txt);
3288
+ }
3289
+ }
3290
+ catch (e_8_1) {
3291
+ e_8 = { error: e_8_1 };
3292
+ }
3293
+ finally {
3294
+ try {
3295
+ if (_c && !_c.done && (_a = _b.return))
3296
+ _a.call(_b);
3297
+ }
3298
+ finally {
3299
+ if (e_8)
3300
+ throw e_8.error;
3301
+ }
3302
+ }
3303
+ this._filterString = sb;
3304
+ }
3305
+ };
3306
+ RestVirtualDataSourceDataProviderWorker.prototype.executeRequest = function (requestUrl, queryStarted, skip, top, task) {
3307
+ var _this = this;
3308
+ // if (!queryStarted) {
3309
+ // queryStarted = true;
3310
+ // requestUrl += "?";
3311
+ // } else {
3312
+ // requestUrl += "&";
3313
+ // }
3314
+ // requestUrl += "$skip=" + skip + "&$top=" + top + "&$count=true";
3315
+ var requestUrl_ = requestUrl;
3316
+ var self_ = this;
3317
+ var success_ = function (data, response) { return _this.success(task, data, response); };
3318
+ var failure_ = function (err) { return _this.error(task, err); };
3319
+ var run_ = null;
3320
+ var headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
3321
+ var request = {
3322
+ requestUri: requestUrl_,
3323
+ enableJsonpCallback: this._enableJsonp,
3324
+ method: 'GET',
3325
+ headers: headers,
3326
+ data: null
3327
+ };
3328
+ run_ = function () {
3329
+ _this.fetchUri(request, success_, failure_);
3330
+ };
3331
+ task.run = run_;
3332
+ };
3333
+ RestVirtualDataSourceDataProviderWorker.prototype.success = function (t, data, response) {
3334
+ t.result = data;
3335
+ t.isCompleted = true;
3336
+ };
3337
+ RestVirtualDataSourceDataProviderWorker.prototype.error = function (t, result) {
3338
+ t.isCompleted = true;
3339
+ t.hasErrors = true;
3340
+ };
3341
+ RestVirtualDataSourceDataProviderWorker.prototype.createBatchRequest = function (changes) {
3342
+ //TODO: updates
3343
+ };
3344
+ RestVirtualDataSourceDataProviderWorker.prototype.getRequestUriWithKey = function (key) {
3345
+ var result = "";
3346
+ var keys = Object.keys(key);
3347
+ for (var i = 0; i < keys.length; i++) {
3348
+ if (i > 0) {
3349
+ result += ",";
3350
+ }
3351
+ result += keys[i] + "=" + key[keys[i]];
3352
+ }
3353
+ return this._entitySet + "(" + result + ")";
3354
+ };
3355
+ RestVirtualDataSourceDataProviderWorker.schemaRequestIndex = -1;
3356
+ return RestVirtualDataSourceDataProviderWorker;
3357
+ }(AsyncVirtualDataSourceProviderWorker));
3358
+
3359
+ var RestVirtualDataSourceDataProviderWorkerSettings = /** @class */ /*@__PURE__*/ (function (_super) {
3360
+ __extends(RestVirtualDataSourceDataProviderWorkerSettings, _super);
3361
+ function RestVirtualDataSourceDataProviderWorkerSettings() {
3362
+ var _this = _super !== null && _super.apply(this, arguments) || this;
3363
+ _this._baseUri = null;
3364
+ _this._entitySet = null;
3365
+ _this._sortDescriptions = null;
3366
+ _this._filterExpressions = null;
3367
+ _this._propertiesRequested = null;
3368
+ _this._groupDescriptions = null;
3369
+ _this._summaryDescriptions = null;
3370
+ _this._fixedFullCount = -1;
3371
+ _this._provideFullCount = null;
3372
+ _this._provideOrderByParameter = null;
3373
+ _this._provideFilterParameter = null;
3374
+ _this._provideAggregationParameter = null;
3375
+ _this._provideAggregatedCount = null;
3376
+ _this._provideUri = null;
3377
+ _this._providePagingParameter = null;
3378
+ _this._provideDesiredPropertiesParameter = null;
3379
+ _this._performFetch = null;
3380
+ return _this;
3381
+ }
3382
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "baseUri", {
3383
+ get: function () {
3384
+ return this._baseUri;
3385
+ },
3386
+ set: function (value) {
3387
+ this._baseUri = value;
3388
+ },
3389
+ enumerable: true,
3390
+ configurable: true
3391
+ });
3392
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "entitySet", {
3393
+ get: function () {
3394
+ return this._entitySet;
3395
+ },
3396
+ set: function (value) {
3397
+ this._entitySet = value;
3398
+ },
3399
+ enumerable: true,
3400
+ configurable: true
3401
+ });
3402
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "sortDescriptions", {
3403
+ get: function () {
3404
+ return this._sortDescriptions;
3405
+ },
3406
+ set: function (value) {
3407
+ this._sortDescriptions = value;
3408
+ },
3409
+ enumerable: true,
3410
+ configurable: true
3411
+ });
3412
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "filterExpressions", {
3413
+ get: function () {
3414
+ return this._filterExpressions;
3415
+ },
3416
+ set: function (value) {
3417
+ this._filterExpressions = value;
3418
+ },
3419
+ enumerable: true,
3420
+ configurable: true
3421
+ });
3422
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "propertiesRequested", {
3423
+ get: function () {
3424
+ return this._propertiesRequested;
3425
+ },
3426
+ set: function (value) {
3427
+ this._propertiesRequested = value;
3428
+ },
3429
+ enumerable: true,
3430
+ configurable: true
3431
+ });
3432
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "groupDescriptions", {
3433
+ get: function () {
3434
+ return this._groupDescriptions;
3435
+ },
3436
+ set: function (value) {
3437
+ this._groupDescriptions = value;
3438
+ },
3439
+ enumerable: true,
3440
+ configurable: true
3441
+ });
3442
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "summaryDescriptions", {
3443
+ get: function () {
3444
+ return this._summaryDescriptions;
3445
+ },
3446
+ set: function (value) {
3447
+ this._summaryDescriptions = value;
3448
+ },
3449
+ enumerable: true,
3450
+ configurable: true
3451
+ });
3452
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "summaryScope", {
3453
+ get: function () {
3454
+ return this._summaryscope;
3455
+ },
3456
+ set: function (value) {
3457
+ this._summaryscope = value;
3458
+ },
3459
+ enumerable: true,
3460
+ configurable: true
3461
+ });
3462
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "enableJsonp", {
3463
+ get: function () {
3464
+ return this._enableJsonp;
3465
+ },
3466
+ set: function (isEnabled) {
3467
+ this._enableJsonp = isEnabled;
3468
+ },
3469
+ enumerable: true,
3470
+ configurable: true
3471
+ });
3472
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "isAggregationSupported", {
3473
+ get: function () {
3474
+ return this._isAggregationSupported;
3475
+ },
3476
+ set: function (isSupported) {
3477
+ this._isAggregationSupported = isSupported;
3478
+ },
3479
+ enumerable: true,
3480
+ configurable: true
3481
+ });
3482
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "fixedFullCount", {
3483
+ get: function () {
3484
+ return this._fixedFullCount;
3485
+ },
3486
+ set: function (value) {
3487
+ this._fixedFullCount = value;
3488
+ },
3489
+ enumerable: true,
3490
+ configurable: true
3491
+ });
3492
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideFullCount", {
3493
+ get: function () {
3494
+ return this._provideFullCount;
3495
+ },
3496
+ set: function (value) {
3497
+ this._provideFullCount = value;
3498
+ },
3499
+ enumerable: true,
3500
+ configurable: true
3501
+ });
3502
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideOrderByParameter", {
3503
+ get: function () {
3504
+ return this._provideOrderByParameter;
3505
+ },
3506
+ set: function (value) {
3507
+ this._provideOrderByParameter = value;
3508
+ },
3509
+ enumerable: true,
3510
+ configurable: true
3511
+ });
3512
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideFilterParameter", {
3513
+ get: function () {
3514
+ return this._provideFilterParameter;
3515
+ },
3516
+ set: function (value) {
3517
+ this._provideFilterParameter = value;
3518
+ },
3519
+ enumerable: true,
3520
+ configurable: true
3521
+ });
3522
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideAggregationParameter", {
3523
+ get: function () {
3524
+ return this._provideAggregationParameter;
3525
+ },
3526
+ set: function (value) {
3527
+ this._provideAggregationParameter = value;
3528
+ },
3529
+ enumerable: true,
3530
+ configurable: true
3531
+ });
3532
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideAggregatedCount", {
3533
+ get: function () {
3534
+ return this._provideAggregatedCount;
3535
+ },
3536
+ set: function (value) {
3537
+ this._provideAggregatedCount = value;
3538
+ },
3539
+ enumerable: true,
3540
+ configurable: true
3541
+ });
3542
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideUri", {
3543
+ get: function () {
3544
+ return this._provideUri;
3545
+ },
3546
+ set: function (value) {
3547
+ this._provideUri = value;
3548
+ },
3549
+ enumerable: true,
3550
+ configurable: true
3551
+ });
3552
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "providePagingParameter", {
3553
+ get: function () {
3554
+ return this._providePagingParameter;
3555
+ },
3556
+ set: function (value) {
3557
+ this._providePagingParameter = value;
3558
+ },
3559
+ enumerable: true,
3560
+ configurable: true
3561
+ });
3562
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideDesiredPropertiesParameter", {
3563
+ get: function () {
3564
+ return this._provideDesiredPropertiesParameter;
3565
+ },
3566
+ set: function (value) {
3567
+ this._provideDesiredPropertiesParameter = value;
3568
+ },
3569
+ enumerable: true,
3570
+ configurable: true
3571
+ });
3572
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "provideItems", {
3573
+ get: function () {
3574
+ return this._provideItems;
3575
+ },
3576
+ set: function (value) {
3577
+ this._provideItems = value;
3578
+ },
3579
+ enumerable: true,
3580
+ configurable: true
3581
+ });
3582
+ Object.defineProperty(RestVirtualDataSourceDataProviderWorkerSettings.prototype, "performFetch", {
3583
+ get: function () {
3584
+ return this._performFetch;
3585
+ },
3586
+ set: function (value) {
3587
+ this._performFetch = value;
3588
+ },
3589
+ enumerable: true,
3590
+ configurable: true
3591
+ });
3592
+ RestVirtualDataSourceDataProviderWorkerSettings.$t = markType(RestVirtualDataSourceDataProviderWorkerSettings, 'RestVirtualDataSourceDataProviderWorkerSettings', AsyncVirtualDataSourceDataProviderWorkerSettings.$type);
3593
+ return RestVirtualDataSourceDataProviderWorkerSettings;
3594
+ }(AsyncVirtualDataSourceDataProviderWorkerSettings));
3595
+
3596
+ var RestVirtualDataSourceDataProvider = /** @class */ /*@__PURE__*/ (function (_super) {
3597
+ __extends(RestVirtualDataSourceDataProvider, _super);
3598
+ function RestVirtualDataSourceDataProvider() {
3599
+ var _this = _super.call(this) || this;
3600
+ _this._worker = null;
3601
+ _this._requests = new LinkedList();
3602
+ _this._callback = null;
3603
+ _this._pageLoaded = null;
3604
+ _this._pageSizeRequested = 50;
3605
+ _this._baseUri = null;
3606
+ _this._entitySet = null;
3607
+ _this._timeoutMilliseconds = 10000;
3608
+ _this.schemaChanged = null;
3609
+ _this._currentFullCount = 0;
3610
+ _this._currentSchema = null;
3611
+ _this._executionContext = null;
3612
+ _this._updateNotifier = null;
3613
+ _this._deferAutoRefresh = false;
3614
+ _this._sortDescriptions = null;
3615
+ _this._groupDescriptions = null;
3616
+ _this._propertiesRequested = null;
3617
+ _this._filterExpressions = null;
3618
+ _this._summaryDescriptions = null;
3619
+ _this._enableJsonp = true;
3620
+ _this._fixedFullCount = -1;
3621
+ _this._provideFullCount = null;
3622
+ _this._provideOrderByParameter = null;
3623
+ _this._provideFilterParameter = null;
3624
+ _this._provideAggregationParameter = null;
3625
+ _this._provideAggregatedCount = null;
3626
+ _this._provideUri = null;
3627
+ _this._performFetch = null;
3628
+ _this._providePagingParameter = null;
3629
+ _this._provideDesiredPropertiesParameter = null;
3630
+ _this._schemaFetchQueued = false;
3631
+ _this._autoRefreshQueued = false;
3632
+ _this._sortDescriptions = new SortDescriptionCollection();
3633
+ _this._sortDescriptions.onChanged = function () { return _this.sortDescriptions_CollectionChanged(null, null); };
3634
+ _this._groupDescriptions = new SortDescriptionCollection();
3635
+ _this._groupDescriptions.onChanged = function () { return _this.groupDescriptions_CollectionChanged(null, null); };
3636
+ _this._filterExpressions = new FilterExpressionCollection();
3637
+ _this._filterExpressions.onChanged = function () { return _this.filterExpressions_CollectionChanged(null, null); };
3638
+ _this._summaryDescriptions = new SummaryDescriptionCollection();
3639
+ _this._summaryDescriptions.onChanged = function () { return _this.summaryDescriptions_CollectionChanged(null, null); };
3640
+ return _this;
3641
+ }
3642
+ RestVirtualDataSourceDataProvider.prototype.filterExpressions_CollectionChanged = function (sender, e) {
3643
+ this.queueAutoRefresh();
3644
+ };
3645
+ RestVirtualDataSourceDataProvider.prototype.sortDescriptions_CollectionChanged = function (sender, e) {
3646
+ this.queueAutoRefresh();
3647
+ };
3648
+ RestVirtualDataSourceDataProvider.prototype.groupDescriptions_CollectionChanged = function (sender, e) {
3649
+ this.queueAutoRefresh();
3650
+ };
3651
+ RestVirtualDataSourceDataProvider.prototype.summaryDescriptions_CollectionChanged = function (sender, e) {
3652
+ this.queueAutoRefresh();
3653
+ };
3654
+ RestVirtualDataSourceDataProvider.prototype.addPageRequest = function (pageIndex, priority) {
3655
+ if (this.deferAutoRefresh) {
3656
+ return;
3657
+ }
3658
+ if (this._worker != null && this._worker.isShutdown) {
3659
+ this._worker = null;
3660
+ this._callback = null;
3661
+ }
3662
+ if (this._worker == null) {
3663
+ this.createWorker();
3664
+ }
3665
+ if (priority == DataSourcePageRequestPriority.High) {
3666
+ this._requests.addFirst(pageIndex);
3667
+ }
3668
+ else {
3669
+ this._requests.addLast(pageIndex);
3670
+ }
3671
+ if (!this._worker.addPageRequest(pageIndex, priority)) {
3672
+ this._worker = null;
3673
+ this._callback = null;
3674
+ this.addPageRequest(pageIndex, priority);
3675
+ }
3676
+ };
3677
+ RestVirtualDataSourceDataProvider.prototype.createWorker = function () {
3678
+ if (!this.valid()) {
3679
+ return;
3680
+ }
3681
+ this._callback = runOn(this, this.raisePageLoaded);
3682
+ var settings = this.getWorkerSettings();
3683
+ this._worker = new RestVirtualDataSourceDataProviderWorker(settings);
3684
+ };
3685
+ RestVirtualDataSourceDataProvider.prototype.valid = function () {
3686
+ return this.entitySet != null && this.baseUri != null;
3687
+ };
3688
+ RestVirtualDataSourceDataProvider.prototype.getWorkerSettings = function () {
3689
+ var _this = this;
3690
+ return ((function () {
3691
+ var $ret = new RestVirtualDataSourceDataProviderWorkerSettings();
3692
+ $ret.baseUri = _this._baseUri;
3693
+ $ret.entitySet = _this._entitySet;
3694
+ $ret.pageSizeRequested = _this._pageSizeRequested;
3695
+ $ret.timeoutMilliseconds = _this._timeoutMilliseconds;
3696
+ $ret.pageLoaded = _this._callback;
3697
+ $ret.executionContext = _this._executionContext;
3698
+ $ret.sortDescriptions = _this._sortDescriptions;
3699
+ $ret.groupDescriptions = _this._groupDescriptions;
3700
+ $ret.filterExpressions = _this._filterExpressions;
3701
+ $ret.propertiesRequested = _this._propertiesRequested;
3702
+ $ret.summaryDescriptions = _this._summaryDescriptions;
3703
+ $ret.summaryScope = _this._summaryScope;
3704
+ $ret.enableJsonp = _this._enableJsonp;
3705
+ $ret.isAggregationSupported = _this.isAggregationSupported;
3706
+ $ret.performFetch = _this.performFetch;
3707
+ $ret.provideAggregationParameter = _this.provideAggregationParameter;
3708
+ $ret.provideAggregatedCount = _this.provideAggregatedCount;
3709
+ $ret.provideDesiredPropertiesParameter = _this.provideDesiredPropertiesParameter;
3710
+ $ret.provideFilterParameter = _this.provideFilterParameter;
3711
+ $ret.provideFullCount = _this.provideFullCount;
3712
+ $ret.provideItems = _this.provideItems;
3713
+ $ret.provideOrderByParameter = _this.provideOrderByParameter;
3714
+ $ret.providePagingParameter = _this.providePagingParameter;
3715
+ $ret.provideUri = _this.provideUri;
3716
+ $ret.fixedFullCount = _this.fixedFullCount;
3717
+ return $ret;
3718
+ })());
3719
+ };
3720
+ RestVirtualDataSourceDataProvider.prototype.removePageRequest = function (pageIndex) {
3721
+ var current = this._requests.first;
3722
+ while (current != null) {
3723
+ if (current.value == pageIndex) {
3724
+ this._requests.remove(current);
3725
+ }
3726
+ current = current.next;
3727
+ }
3728
+ if (this._worker == null) {
3729
+ return;
3730
+ }
3731
+ this._worker.removePageRequest(pageIndex);
3732
+ };
3733
+ RestVirtualDataSourceDataProvider.prototype.removeAllPageRequests = function () {
3734
+ this._requests.clear();
3735
+ if (this._worker == null) {
3736
+ return;
3737
+ }
3738
+ this._worker.removeAllPageRequests();
3739
+ };
3740
+ RestVirtualDataSourceDataProvider.prototype.close = function () {
3741
+ if (this._worker != null) {
3742
+ this._worker.shutdown();
3743
+ this._worker = null;
3744
+ this._callback = null;
3745
+ }
3746
+ };
3747
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "pageLoaded", {
3748
+ get: function () {
3749
+ return this._pageLoaded;
3750
+ },
3751
+ set: function (value) {
3752
+ this._pageLoaded = value;
3753
+ this.queueAutoRefresh();
3754
+ },
3755
+ enumerable: true,
3756
+ configurable: true
3757
+ });
3758
+ RestVirtualDataSourceDataProvider.prototype.raisePageLoaded = function (page, fullCount, actualPageSize) {
3759
+ if (this._pageLoaded != null) {
3760
+ this._currentFullCount = fullCount;
3761
+ if (this._currentSchema == null) {
3762
+ var currentSchema = null;
3763
+ if (page != null) {
3764
+ currentSchema = page.schema();
3765
+ }
3766
+ this._currentSchema = currentSchema;
3767
+ if (this.schemaChanged != null) {
3768
+ this.schemaChanged(this, new DataSourceDataProviderSchemaChangedEventArgs(this._currentSchema, this._currentFullCount));
3769
+ }
3770
+ }
3771
+ if (page.pageIndex() != RestVirtualDataSourceDataProviderWorker.schemaRequestIndex) {
3772
+ this._pageLoaded(page, fullCount, actualPageSize);
3773
+ }
3774
+ }
3775
+ };
3776
+ RestVirtualDataSourceDataProvider.prototype.killWorker = function () {
3777
+ if (this._worker != null) {
3778
+ this._worker.shutdown();
3779
+ this._worker = null;
3780
+ this._callback = null;
3781
+ }
3782
+ };
3783
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "pageSizeRequested", {
3784
+ get: function () {
3785
+ return this._pageSizeRequested;
3786
+ },
3787
+ set: function (value) {
3788
+ this._pageSizeRequested = value;
3789
+ this.queueAutoRefresh();
3790
+ },
3791
+ enumerable: true,
3792
+ configurable: true
3793
+ });
3794
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "baseUri", {
3795
+ get: function () {
3796
+ return this._baseUri;
3797
+ },
3798
+ set: function (value) {
3799
+ var oldValue = this._baseUri;
3800
+ this._baseUri = value;
3801
+ if (oldValue != this._baseUri) {
3802
+ this.queueAutoRefresh();
3803
+ if (this.valid() && this.deferAutoRefresh) {
3804
+ this.queueSchemaFetch();
3805
+ }
3806
+ }
3807
+ },
3808
+ enumerable: true,
3809
+ configurable: true
3810
+ });
3811
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "entitySet", {
3812
+ get: function () {
3813
+ return this._entitySet;
3814
+ },
3815
+ set: function (value) {
3816
+ var oldValue = this._entitySet;
3817
+ this._entitySet = value;
3818
+ if (oldValue != this._entitySet) {
3819
+ this.queueAutoRefresh();
3820
+ if (this.valid() && this.deferAutoRefresh) {
3821
+ this.queueSchemaFetch();
3822
+ }
3823
+ }
3824
+ },
3825
+ enumerable: true,
3826
+ configurable: true
3827
+ });
3828
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "timeoutMilliseconds", {
3829
+ get: function () {
3830
+ return this._timeoutMilliseconds;
3831
+ },
3832
+ set: function (value) {
3833
+ this._timeoutMilliseconds = value;
3834
+ this.queueAutoRefresh();
3835
+ },
3836
+ enumerable: true,
3837
+ configurable: true
3838
+ });
3839
+ RestVirtualDataSourceDataProvider.prototype.getItemValue = function (item, valueName) {
3840
+ var dic = item;
3841
+ if (dic.has(valueName)) {
3842
+ return dic.get(valueName);
3843
+ }
3844
+ else {
3845
+ return null;
3846
+ }
3847
+ };
3848
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "actualCount", {
3849
+ get: function () {
3850
+ return this._currentFullCount;
3851
+ },
3852
+ enumerable: true,
3853
+ configurable: true
3854
+ });
3855
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "actualSchema", {
3856
+ get: function () {
3857
+ return this._currentSchema;
3858
+ },
3859
+ enumerable: true,
3860
+ configurable: true
3861
+ });
3862
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "executionContext", {
3863
+ get: function () {
3864
+ return this._executionContext;
3865
+ },
3866
+ set: function (value) {
3867
+ this._executionContext = value;
3868
+ this.queueAutoRefresh();
3869
+ },
3870
+ enumerable: true,
3871
+ configurable: true
3872
+ });
3873
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "updateNotifier", {
3874
+ get: function () {
3875
+ return this._updateNotifier;
3876
+ },
3877
+ set: function (value) {
3878
+ this._updateNotifier = value;
3879
+ },
3880
+ enumerable: true,
3881
+ configurable: true
3882
+ });
3883
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "deferAutoRefresh", {
3884
+ get: function () {
3885
+ return this._deferAutoRefresh;
3886
+ },
3887
+ set: function (value) {
3888
+ this._deferAutoRefresh = value;
3889
+ if (!this._deferAutoRefresh) {
3890
+ this.queueAutoRefresh();
3891
+ }
3892
+ if (this._deferAutoRefresh && this.valid() && this._currentSchema == null) {
3893
+ this.queueSchemaFetch();
3894
+ }
3895
+ },
3896
+ enumerable: true,
3897
+ configurable: true
3898
+ });
3899
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isSortingSupported", {
3900
+ get: function () {
3901
+ return true;
3902
+ },
3903
+ enumerable: true,
3904
+ configurable: true
3905
+ });
3906
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isGroupingSupported", {
3907
+ get: function () {
3908
+ return this.isAggregationSupported;
3909
+ },
3910
+ enumerable: true,
3911
+ configurable: true
3912
+ });
3913
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isFilteringSupported", {
3914
+ get: function () {
3915
+ return true;
3916
+ },
3917
+ enumerable: true,
3918
+ configurable: true
3919
+ });
3920
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isAggregationSupported", {
3921
+ get: function () {
3922
+ return this._isAggregationSupported;
3923
+ },
3924
+ set: function (isSupported) {
3925
+ this._isAggregationSupported = isSupported;
3926
+ },
3927
+ enumerable: true,
3928
+ configurable: true
3929
+ });
3930
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "sortDescriptions", {
3931
+ get: function () {
3932
+ return this._sortDescriptions;
3933
+ },
3934
+ enumerable: true,
3935
+ configurable: true
3936
+ });
3937
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "groupDescriptions", {
3938
+ get: function () {
3939
+ return this._groupDescriptions;
3940
+ },
3941
+ enumerable: true,
3942
+ configurable: true
3943
+ });
3944
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "propertiesRequested", {
3945
+ get: function () {
3946
+ return this._propertiesRequested;
3947
+ },
3948
+ set: function (value) {
3949
+ this._propertiesRequested = value;
3950
+ this.queueAutoRefresh();
3951
+ },
3952
+ enumerable: true,
3953
+ configurable: true
3954
+ });
3955
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "filterExpressions", {
3956
+ get: function () {
3957
+ return this._filterExpressions;
3958
+ },
3959
+ enumerable: true,
3960
+ configurable: true
3961
+ });
3962
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "summaryDescriptions", {
3963
+ get: function () {
3964
+ return this._summaryDescriptions;
3965
+ },
3966
+ enumerable: true,
3967
+ configurable: true
3968
+ });
3969
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "summaryScope", {
3970
+ get: function () {
3971
+ return this._summaryScope;
3972
+ },
3973
+ set: function (value) {
3974
+ this._summaryScope = value;
3975
+ },
3976
+ enumerable: true,
3977
+ configurable: true
3978
+ });
3979
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "enableJsonp", {
3980
+ get: function () {
3981
+ return this._enableJsonp;
3982
+ },
3983
+ set: function (isEnabled) {
3984
+ this._enableJsonp = isEnabled;
3985
+ },
3986
+ enumerable: true,
3987
+ configurable: true
3988
+ });
3989
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "fixedFullCount", {
3990
+ get: function () {
3991
+ return this._fixedFullCount;
3992
+ },
3993
+ set: function (value) {
3994
+ this._fixedFullCount = value;
3995
+ },
3996
+ enumerable: true,
3997
+ configurable: true
3998
+ });
3999
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideFullCount", {
4000
+ get: function () {
4001
+ return this._provideFullCount;
4002
+ },
4003
+ set: function (value) {
4004
+ this._provideFullCount = value;
4005
+ },
4006
+ enumerable: true,
4007
+ configurable: true
4008
+ });
4009
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideOrderByParameter", {
4010
+ get: function () {
4011
+ return this._provideOrderByParameter;
4012
+ },
4013
+ set: function (value) {
4014
+ this._provideOrderByParameter = value;
4015
+ },
4016
+ enumerable: true,
4017
+ configurable: true
4018
+ });
4019
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideFilterParameter", {
4020
+ get: function () {
4021
+ return this._provideFilterParameter;
4022
+ },
4023
+ set: function (value) {
4024
+ this._provideFilterParameter = value;
4025
+ },
4026
+ enumerable: true,
4027
+ configurable: true
4028
+ });
4029
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideAggregationParameter", {
4030
+ get: function () {
4031
+ return this._provideAggregationParameter;
4032
+ },
4033
+ set: function (value) {
4034
+ this._provideAggregationParameter = value;
4035
+ },
4036
+ enumerable: true,
4037
+ configurable: true
4038
+ });
4039
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideAggregatedCount", {
4040
+ get: function () {
4041
+ return this._provideAggregatedCount;
4042
+ },
4043
+ set: function (value) {
4044
+ this._provideAggregatedCount = value;
4045
+ },
4046
+ enumerable: true,
4047
+ configurable: true
4048
+ });
4049
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideUri", {
4050
+ get: function () {
4051
+ return this._provideUri;
4052
+ },
4053
+ set: function (value) {
4054
+ this._provideUri = value;
4055
+ },
4056
+ enumerable: true,
4057
+ configurable: true
4058
+ });
4059
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "performFetch", {
4060
+ get: function () {
4061
+ return this._performFetch;
4062
+ },
4063
+ set: function (value) {
4064
+ this._performFetch = value;
4065
+ },
4066
+ enumerable: true,
4067
+ configurable: true
4068
+ });
4069
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "providePagingParameter", {
4070
+ get: function () {
4071
+ return this._providePagingParameter;
4072
+ },
4073
+ set: function (value) {
4074
+ this._providePagingParameter = value;
4075
+ },
4076
+ enumerable: true,
4077
+ configurable: true
4078
+ });
4079
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideDesiredPropertiesParameter", {
4080
+ get: function () {
4081
+ return this._provideDesiredPropertiesParameter;
4082
+ },
4083
+ set: function (value) {
4084
+ this._provideDesiredPropertiesParameter = value;
4085
+ },
4086
+ enumerable: true,
4087
+ configurable: true
4088
+ });
4089
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "provideItems", {
4090
+ get: function () {
4091
+ return this._provideItems;
4092
+ },
4093
+ set: function (value) {
4094
+ this._provideItems = value;
4095
+ },
4096
+ enumerable: true,
4097
+ configurable: true
4098
+ });
4099
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "notifyUsingSourceIndexes", {
4100
+ get: function () {
4101
+ return true;
4102
+ },
4103
+ enumerable: true,
4104
+ configurable: true
4105
+ });
4106
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isItemIndexLookupSupported", {
4107
+ get: function () {
4108
+ return false;
4109
+ },
4110
+ enumerable: true,
4111
+ configurable: true
4112
+ });
4113
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "isKeyIndexLookupSupported", {
4114
+ get: function () {
4115
+ return false;
4116
+ },
4117
+ enumerable: true,
4118
+ configurable: true
4119
+ });
4120
+ RestVirtualDataSourceDataProvider.prototype.notifySetItem = function (index, oldItem, newItem) {
4121
+ if (this.updateNotifier != null) {
4122
+ this.updateNotifier.notifySetItem(index, oldItem, newItem);
4123
+ }
4124
+ };
4125
+ RestVirtualDataSourceDataProvider.prototype.notifyClearItems = function () {
4126
+ if (this.updateNotifier != null) {
4127
+ this.updateNotifier.notifyClearItems();
4128
+ }
4129
+ };
4130
+ RestVirtualDataSourceDataProvider.prototype.notifyInsertItem = function (index, newItem) {
4131
+ if (this.updateNotifier != null) {
4132
+ this.updateNotifier.notifyInsertItem(index, newItem);
4133
+ }
4134
+ };
4135
+ RestVirtualDataSourceDataProvider.prototype.notifyRemoveItem = function (index, oldItem) {
4136
+ if (this.updateNotifier != null) {
4137
+ this.updateNotifier.notifyRemoveItem(index, oldItem);
4138
+ }
4139
+ };
4140
+ RestVirtualDataSourceDataProvider.prototype.queueSchemaFetch = function () {
4141
+ if (this._schemaFetchQueued) {
4142
+ return;
4143
+ }
4144
+ if (this.executionContext != null) {
4145
+ this._schemaFetchQueued = true;
4146
+ this.executionContext.enqueueAction(runOn(this, this.doSchemaFetchInternal));
4147
+ }
4148
+ };
4149
+ RestVirtualDataSourceDataProvider.prototype.doSchemaFetchInternal = function () {
4150
+ if (!this._schemaFetchQueued) {
4151
+ return;
4152
+ }
4153
+ this._schemaFetchQueued = false;
4154
+ this.schemaFetchInternal();
4155
+ };
4156
+ RestVirtualDataSourceDataProvider.prototype.schemaFetchInternal = function () {
4157
+ this.schemaFetchInternalOverride();
4158
+ };
4159
+ RestVirtualDataSourceDataProvider.prototype.schemaFetchInternalOverride = function () {
4160
+ if (!this.deferAutoRefresh) {
4161
+ return;
4162
+ }
4163
+ this.removeAllPageRequests();
4164
+ this.killWorker();
4165
+ this.createWorker();
4166
+ this.addSchemaRequest();
4167
+ };
4168
+ RestVirtualDataSourceDataProvider.prototype.addSchemaRequest = function () {
4169
+ this._worker.addPageRequest(RestVirtualDataSourceDataProviderWorker.schemaRequestIndex, DataSourcePageRequestPriority.High);
4170
+ };
4171
+ RestVirtualDataSourceDataProvider.prototype.queueAutoRefresh = function () {
4172
+ if (this.deferAutoRefresh) {
4173
+ return;
4174
+ }
4175
+ if (this._autoRefreshQueued) {
4176
+ return;
4177
+ }
4178
+ if (this.executionContext != null) {
4179
+ this._autoRefreshQueued = true;
4180
+ this.executionContext.enqueueAction(runOn(this, this.doRefreshInternal));
4181
+ }
4182
+ };
4183
+ RestVirtualDataSourceDataProvider.prototype.doRefreshInternal = function () {
4184
+ if (this.deferAutoRefresh) {
4185
+ this._autoRefreshQueued = false;
4186
+ return;
4187
+ }
4188
+ if (!this._autoRefreshQueued) {
4189
+ return;
4190
+ }
4191
+ this._autoRefreshQueued = false;
4192
+ this.refreshInternal();
4193
+ };
4194
+ RestVirtualDataSourceDataProvider.prototype.refreshInternal = function () {
4195
+ this.refreshInternalOverride();
4196
+ };
4197
+ RestVirtualDataSourceDataProvider.prototype.refreshInternalOverride = function () {
4198
+ this.removeAllPageRequests();
4199
+ this.killWorker();
4200
+ this.createWorker();
4201
+ this._worker.addPageRequest(0, DataSourcePageRequestPriority.Normal);
4202
+ };
4203
+ RestVirtualDataSourceDataProvider.prototype.flushAutoRefresh = function () {
4204
+ this.doRefreshInternal();
4205
+ };
4206
+ RestVirtualDataSourceDataProvider.prototype.refresh = function () {
4207
+ this.refreshInternal();
4208
+ };
4209
+ RestVirtualDataSourceDataProvider.prototype.indexOfItem = function (item) {
4210
+ return -1;
4211
+ };
4212
+ RestVirtualDataSourceDataProvider.prototype.indexOfKey = function (key) {
4213
+ return -1;
4214
+ };
4215
+ RestVirtualDataSourceDataProvider.prototype.resolveSchemaPropertyType = function (propertyPath) {
4216
+ if (this.actualSchema == null) {
4217
+ return DataSourceSchemaPropertyType.ObjectValue;
4218
+ }
4219
+ if (stringContains(propertyPath, ".")) {
4220
+ return DataSourceSchemaPropertyType.ObjectValue;
4221
+ }
4222
+ for (var i = 0; i < this.actualSchema.propertyNames.length; i++) {
4223
+ var name_1 = this.actualSchema.propertyNames[i];
4224
+ if (name_1 == propertyPath) {
4225
+ return this.actualSchema.propertyTypes[i];
4226
+ }
4227
+ }
4228
+ return DataSourceSchemaPropertyType.ObjectValue;
4229
+ };
4230
+ RestVirtualDataSourceDataProvider.prototype.setItemValue = function (item, valueName, value) {
4231
+ // does nothing.
4232
+ };
4233
+ RestVirtualDataSourceDataProvider.prototype.removeItem = function (item) {
4234
+ // does nothing.
4235
+ };
4236
+ RestVirtualDataSourceDataProvider.prototype.addItem = function (item) {
4237
+ // does nothing.
4238
+ };
4239
+ RestVirtualDataSourceDataProvider.prototype.createBatchRequest = function (changes) {
4240
+ if (this._worker != null) {
4241
+ this._worker.createBatchRequest(changes);
4242
+ }
4243
+ };
4244
+ Object.defineProperty(RestVirtualDataSourceDataProvider.prototype, "batchCompleted", {
4245
+ get: function () {
4246
+ return this._batchCompleted;
4247
+ },
4248
+ set: function (v) {
4249
+ this._batchCompleted = v;
4250
+ },
4251
+ enumerable: true,
4252
+ configurable: true
4253
+ });
4254
+ RestVirtualDataSourceDataProvider.$t = markType(RestVirtualDataSourceDataProvider, 'ODataVirtualDataSourceDataProvider', Base.$type, [IDataSourceVirtualDataProvider_$type]);
4255
+ return RestVirtualDataSourceDataProvider;
4256
+ }(Base));
4257
+
4258
+ var RestVirtualDataSource = /** @class */ /*@__PURE__*/ (function (_super) {
4259
+ __extends(RestVirtualDataSource, _super);
4260
+ function RestVirtualDataSource() {
4261
+ var _this = _super.call(this) || this;
4262
+ _this._baseUri = null;
4263
+ _this._isFilteringSupportedByServer = false;
4264
+ _this._entitySet = null;
4265
+ _this._timeoutMilliseconds = 10000;
4266
+ _this._isAggregationSupportedByServer = false;
4267
+ _this._enableJsonp = true;
4268
+ _this._fixedFullCount = -1;
4269
+ _this._provideFullCount = null;
4270
+ _this._provideOrderByParameter = null;
4271
+ _this._provideFilterParameter = null;
4272
+ _this._provideAggregationParameter = null;
4273
+ _this._provideAggregatedCount = null;
4274
+ _this._provideUri = null;
4275
+ _this._performFetch = null;
4276
+ _this._providePagingParameter = null;
4277
+ _this._provideDesiredPropertiesParameter = null;
4278
+ _this.dataProvider = ((function () {
4279
+ var $ret = new RestVirtualDataSourceDataProvider();
4280
+ $ret.executionContext = _this.executionContext;
4281
+ $ret.enableJsonp = _this.enableJsonp;
4282
+ $ret.isAggregationSupported = _this.isGroupingSupported;
4283
+ return $ret;
4284
+ })());
4285
+ _this.externalDataSource = _this;
4286
+ return _this;
4287
+ }
4288
+ RestVirtualDataSource.prototype.onBaseUriChanged = function (oldValue, newValue) {
4289
+ if (this.actualDataProvider) {
4290
+ this.actualDataProvider.baseUri = this.baseUri;
4291
+ this.queueAutoRefresh();
4292
+ }
4293
+ };
4294
+ Object.defineProperty(RestVirtualDataSource.prototype, "baseUri", {
4295
+ get: function () {
4296
+ return this._baseUri;
4297
+ },
4298
+ set: function (value) {
4299
+ var oldValue = this._baseUri;
4300
+ this._baseUri = value;
4301
+ if (oldValue != this._baseUri) {
4302
+ this.onBaseUriChanged(oldValue, this._baseUri);
4303
+ }
4304
+ },
4305
+ enumerable: true,
4306
+ configurable: true
4307
+ });
4308
+ RestVirtualDataSource.prototype.onEntitySetChanged = function (oldValue, newValue) {
4309
+ if (this.actualDataProvider) {
4310
+ this.actualDataProvider.entitySet = this.entitySet;
4311
+ this.queueAutoRefresh();
4312
+ }
4313
+ this.queueAutoRefresh();
4314
+ };
4315
+ Object.defineProperty(RestVirtualDataSource.prototype, "isFilteringSupportedByServer", {
4316
+ get: function () {
4317
+ return this._isFilteringSupportedByServer;
4318
+ },
4319
+ set: function (v) {
4320
+ this._isFilteringSupportedByServer = v;
4321
+ },
4322
+ enumerable: true,
4323
+ configurable: true
4324
+ });
4325
+ RestVirtualDataSource.prototype.get_isFilteringSupported = function () {
4326
+ if (this._isFilteringSupportedByServer) {
4327
+ return true;
4328
+ }
4329
+ return false;
4330
+ };
4331
+ Object.defineProperty(RestVirtualDataSource.prototype, "entitySet", {
4332
+ get: function () {
4333
+ return this._entitySet;
4334
+ },
4335
+ set: function (value) {
4336
+ var oldValue = this._entitySet;
4337
+ this._entitySet = value;
4338
+ if (this._entitySet != oldValue) {
4339
+ this.onEntitySetChanged(oldValue, this._entitySet);
4340
+ }
4341
+ },
4342
+ enumerable: true,
4343
+ configurable: true
4344
+ });
4345
+ RestVirtualDataSource.prototype.onTimeoutMillisecondsChanged = function (oldValue, newValue) {
4346
+ if (this.actualDataProvider) {
4347
+ this.actualDataProvider.timeoutMilliseconds = this.timeoutMilliseconds;
4348
+ }
4349
+ };
4350
+ Object.defineProperty(RestVirtualDataSource.prototype, "timeoutMilliseconds", {
4351
+ get: function () {
4352
+ return this._timeoutMilliseconds;
4353
+ },
4354
+ set: function (value) {
4355
+ var oldValue = this._timeoutMilliseconds;
4356
+ this._timeoutMilliseconds = value;
4357
+ if (oldValue != this._timeoutMilliseconds) {
4358
+ this.onTimeoutMillisecondsChanged(oldValue, this._timeoutMilliseconds);
4359
+ }
4360
+ },
4361
+ enumerable: true,
4362
+ configurable: true
4363
+ });
4364
+ Object.defineProperty(RestVirtualDataSource.prototype, "isSortingSupportedOverride", {
4365
+ get: function () {
4366
+ return true;
4367
+ },
4368
+ enumerable: true,
4369
+ configurable: true
4370
+ });
4371
+ Object.defineProperty(RestVirtualDataSource.prototype, "isFilteringSupportedOverride", {
4372
+ get: function () {
4373
+ return true;
4374
+ },
4375
+ enumerable: true,
4376
+ configurable: true
4377
+ });
4378
+ Object.defineProperty(RestVirtualDataSource.prototype, "isGroupingSupportedOverride", {
4379
+ get: function () {
4380
+ return this.isAggregationSupportedByServer;
4381
+ },
4382
+ enumerable: true,
4383
+ configurable: true
4384
+ });
4385
+ Object.defineProperty(RestVirtualDataSource.prototype, "isAggregationSupportedByServer", {
4386
+ get: function () {
4387
+ return this._isAggregationSupportedByServer;
4388
+ },
4389
+ set: function (isSupported) {
4390
+ this._isAggregationSupportedByServer = isSupported;
4391
+ if (this.actualDataProvider) {
4392
+ this.actualDataProvider.isAggregationSupported = this.isAggregationSupportedByServer;
4393
+ }
4394
+ },
4395
+ enumerable: true,
4396
+ configurable: true
4397
+ });
4398
+ Object.defineProperty(RestVirtualDataSource.prototype, "enableJsonp", {
4399
+ get: function () {
4400
+ return this._enableJsonp;
4401
+ },
4402
+ set: function (isEnabled) {
4403
+ this._enableJsonp = isEnabled;
4404
+ if (this.actualDataProvider) {
4405
+ this.actualDataProvider.enableJsonp = this.enableJsonp;
4406
+ }
4407
+ },
4408
+ enumerable: true,
4409
+ configurable: true
4410
+ });
4411
+ Object.defineProperty(RestVirtualDataSource.prototype, "fixedFullCount", {
4412
+ get: function () {
4413
+ return this._fixedFullCount;
4414
+ },
4415
+ set: function (value) {
4416
+ this._fixedFullCount = value;
4417
+ },
4418
+ enumerable: true,
4419
+ configurable: true
4420
+ });
4421
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideFullCount", {
4422
+ get: function () {
4423
+ return this._provideFullCount;
4424
+ },
4425
+ set: function (value) {
4426
+ this._provideFullCount = value;
4427
+ if (this.actualDataProvider) {
4428
+ this.actualDataProvider.provideFullCount = this.provideFullCount;
4429
+ this.queueAutoRefresh();
4430
+ }
4431
+ },
4432
+ enumerable: true,
4433
+ configurable: true
4434
+ });
4435
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideOrderByParameter", {
4436
+ get: function () {
4437
+ return this._provideOrderByParameter;
4438
+ },
4439
+ set: function (value) {
4440
+ this._provideOrderByParameter = value;
4441
+ if (this.actualDataProvider) {
4442
+ this.actualDataProvider.provideOrderByParameter = this.provideOrderByParameter;
4443
+ this.queueAutoRefresh();
4444
+ }
4445
+ },
4446
+ enumerable: true,
4447
+ configurable: true
4448
+ });
4449
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideFilterParameter", {
4450
+ get: function () {
4451
+ return this._provideFilterParameter;
4452
+ },
4453
+ set: function (value) {
4454
+ this._provideFilterParameter = value;
4455
+ if (this.actualDataProvider) {
4456
+ this.actualDataProvider.provideFilterParameter = this.provideFilterParameter;
4457
+ this.queueAutoRefresh();
4458
+ }
4459
+ },
4460
+ enumerable: true,
4461
+ configurable: true
4462
+ });
4463
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideAggregationParameter", {
4464
+ get: function () {
4465
+ return this._provideAggregationParameter;
4466
+ },
4467
+ set: function (value) {
4468
+ this._provideAggregationParameter = value;
4469
+ if (this.actualDataProvider) {
4470
+ this.actualDataProvider.provideAggregationParameter = this.provideAggregationParameter;
4471
+ this.queueAutoRefresh();
4472
+ }
4473
+ },
4474
+ enumerable: true,
4475
+ configurable: true
4476
+ });
4477
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideAggregatedCount", {
4478
+ get: function () {
4479
+ return this._provideAggregatedCount;
4480
+ },
4481
+ set: function (value) {
4482
+ this._provideAggregatedCount = value;
4483
+ if (this.actualDataProvider) {
4484
+ this.actualDataProvider.provideAggregatedCount = this.provideAggregatedCount;
4485
+ this.queueAutoRefresh();
4486
+ }
4487
+ },
4488
+ enumerable: true,
4489
+ configurable: true
4490
+ });
4491
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideUri", {
4492
+ get: function () {
4493
+ return this._provideUri;
4494
+ },
4495
+ set: function (value) {
4496
+ this._provideUri = value;
4497
+ if (this.actualDataProvider) {
4498
+ this.actualDataProvider.provideUri = this.provideUri;
4499
+ this.queueAutoRefresh();
4500
+ }
4501
+ },
4502
+ enumerable: true,
4503
+ configurable: true
4504
+ });
4505
+ Object.defineProperty(RestVirtualDataSource.prototype, "performFetch", {
4506
+ get: function () {
4507
+ return this._performFetch;
4508
+ },
4509
+ set: function (value) {
4510
+ this._performFetch = value;
4511
+ if (this.actualDataProvider) {
4512
+ this.actualDataProvider.performFetch = this.performFetch;
4513
+ this.queueAutoRefresh();
4514
+ }
4515
+ },
4516
+ enumerable: true,
4517
+ configurable: true
4518
+ });
4519
+ Object.defineProperty(RestVirtualDataSource.prototype, "providePagingParameter", {
4520
+ get: function () {
4521
+ return this._providePagingParameter;
4522
+ },
4523
+ set: function (value) {
4524
+ this._providePagingParameter = value;
4525
+ if (this.actualDataProvider) {
4526
+ this.actualDataProvider.providePagingParameter = this.providePagingParameter;
4527
+ this.queueAutoRefresh();
4528
+ }
4529
+ },
4530
+ enumerable: true,
4531
+ configurable: true
4532
+ });
4533
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideDesiredPropertiesParameter", {
4534
+ get: function () {
4535
+ return this._provideDesiredPropertiesParameter;
4536
+ },
4537
+ set: function (value) {
4538
+ this._provideDesiredPropertiesParameter = value;
4539
+ if (this.actualDataProvider) {
4540
+ this.actualDataProvider.provideDesiredPropertiesParameter = this.provideDesiredPropertiesParameter;
4541
+ this.queueAutoRefresh();
4542
+ }
4543
+ },
4544
+ enumerable: true,
4545
+ configurable: true
4546
+ });
4547
+ Object.defineProperty(RestVirtualDataSource.prototype, "provideItems", {
4548
+ get: function () {
4549
+ return this._provideItems;
4550
+ },
4551
+ set: function (value) {
4552
+ this._provideItems = value;
4553
+ if (this.actualDataProvider) {
4554
+ this.actualDataProvider.provideItems = this.provideItems;
4555
+ this.queueAutoRefresh();
4556
+ }
4557
+ },
4558
+ enumerable: true,
4559
+ configurable: true
4560
+ });
4561
+ RestVirtualDataSource.prototype.clone = function () {
4562
+ var dataSource = new RestVirtualDataSource();
4563
+ dataSource.executionContext = this.executionContext;
4564
+ dataSource.includeSummaryRowsInSection = this.includeSummaryRowsInSection;
4565
+ dataSource.isSectionCollapsable = this.isSectionCollapsable;
4566
+ dataSource.isSectionExpandedDefault = this.isSectionExpandedDefault;
4567
+ //dataSource.isSectionHeaderNormalRow = this.isSectionHeaderNormalRow;
4568
+ dataSource.isSectionSummaryRowsAtBottom = this.isSectionSummaryRowsAtBottom;
4569
+ //dataSource.isSectionContentVisible = this.isSectionContentVisible;
4570
+ dataSource.primaryKey = this.primaryKey;
4571
+ dataSource.propertiesRequested = this.propertiesRequested;
4572
+ dataSource.sectionHeaderDisplayMode = this.sectionHeaderDisplayMode;
4573
+ dataSource.shouldEmitSectionFooters = this.shouldEmitSectionFooters;
4574
+ dataSource.shouldEmitSectionHeaders = this.shouldEmitSectionHeaders;
4575
+ dataSource.shouldEmitShiftedRows = this.shouldEmitShiftedRows;
4576
+ dataSource.summaryScope = this.summaryScope;
4577
+ for (var i = 0; i < this.groupDescriptions.size(); i++) {
4578
+ dataSource.groupDescriptions.add(this.groupDescriptions.get(i));
4579
+ }
4580
+ for (var i = 0; i < this.sortDescriptions.size(); i++) {
4581
+ dataSource.sortDescriptions.add(this.sortDescriptions.get(i));
4582
+ }
4583
+ for (var i = 0; i < this.filterExpressions.size(); i++) {
4584
+ dataSource.filterExpressions.add(this.filterExpressions.get(i));
4585
+ }
4586
+ for (var i = 0; i < this.summaryDescriptions.size(); i++) {
4587
+ dataSource.summaryDescriptions.add(this.summaryDescriptions.get(i));
4588
+ }
4589
+ dataSource.pageSizeRequested = this.pageSizeRequested;
4590
+ dataSource.maxCachedPages = this.maxCachedPages;
4591
+ dataSource.baseUri = this.baseUri;
4592
+ dataSource.entitySet = this.entitySet;
4593
+ dataSource.timeoutMilliseconds = this.timeoutMilliseconds;
4594
+ dataSource.isAggregationSupportedByServer = this.isAggregationSupportedByServer;
4595
+ dataSource.enableJsonp = this.enableJsonp;
4596
+ dataSource.fixedFullCount = this.fixedFullCount;
4597
+ dataSource.provideAggregationParameter = this.provideAggregationParameter;
4598
+ dataSource.provideAggregatedCount = this.provideAggregatedCount;
4599
+ dataSource.provideFilterParameter = this.provideFilterParameter;
4600
+ dataSource.provideFullCount = this.provideFullCount;
4601
+ dataSource.provideOrderByParameter = this.provideOrderByParameter;
4602
+ dataSource.provideUri = this.provideUri;
4603
+ dataSource.performFetch = this.performFetch;
4604
+ dataSource.providePagingParameter = this.providePagingParameter;
4605
+ dataSource.provideItems = this.provideItems;
4606
+ dataSource.provideDesiredPropertiesParameter = this.provideDesiredPropertiesParameter;
4607
+ return dataSource;
4608
+ };
4609
+ return RestVirtualDataSource;
4610
+ }(VirtualDataSource));
4611
+
4612
+ export { Entity, EntityProperty, EntitySet, LinkedList, LinkedListNode, ODataDataSourcePage, ODataSchemaProvider, ODataVirtualDataSource, ODataVirtualDataSourceDataProvider, ODataVirtualDataSourceDataProviderWorker, ODataVirtualDataSourceDataProviderWorkerSettings, ODataVirtualDataSourceProviderTaskDataHolder, RestVirtualDataSource, RestVirtualDataSourceDataProvider, RestVirtualDataSourceDataProviderWorker, RestVirtualDataSourceDataProviderWorkerSettings, RestVirtualDataSourcePage, RestVirtualDataSourceProviderTaskDataHolder, Schema, first, toArray };