gd-sprest 9.3.5 → 9.3.7

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.
@@ -1,3 +1,5 @@
1
+ import { ListItemOData } from "gd-sprest-def/lib/SP/entitytypes";
2
+
1
3
  /**
2
4
  * Target Information
3
5
  */
@@ -45,6 +47,9 @@ export interface ITargetInfoProps {
45
47
  /** The method to execute after the asynchronous request executes. */
46
48
  callback?: () => void;
47
49
 
50
+ /** The method to execute for each set of pages using the OData query. */
51
+ callbackQuery?: (items?: ListItemOData[]) => void;
52
+
48
53
  /** The data to be passed in the body of the request. */
49
54
  data?: any;
50
55
 
package/build/rest.js CHANGED
@@ -9,7 +9,7 @@ var sptypes_1 = require("./sptypes");
9
9
  * SharePoint REST Library
10
10
  */
11
11
  exports.$REST = {
12
- __ver: 9.35,
12
+ __ver: 9.37,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -343,7 +343,7 @@ exports.Request = {
343
343
  var execute = function (targetInfo, batchIdx, onComplete) {
344
344
  // See if this is an asynchronous request
345
345
  if (asyncFl) {
346
- // See if the not a batch request, and it already exists
346
+ // See if this is not a batch request, and it already exists
347
347
  if (base.xhr && !isBatchRequest) {
348
348
  // Execute the callback
349
349
  callback ? callback(base, false) : null;
@@ -622,6 +622,11 @@ exports.Request = {
622
622
  else {
623
623
  // Update the base object's properties
624
624
  exports.Request.addProperties(obj, data);
625
+ // See if the response is an array
626
+ if (typeof (data) === "object" && typeof (data.length) === "number" && typeof (data.push) === "function") {
627
+ // Update the data collection
628
+ helper_1.Helper.updateDataCollection(obj, data);
629
+ }
625
630
  }
626
631
  // See if the batch request exists
627
632
  if (isBatchRequest) {
@@ -675,6 +680,11 @@ exports.Request = {
675
680
  }
676
681
  // Set the next item flag
677
682
  base.nextFl = data["@odata.nextLink"] || (data.d && data.d.__next);
683
+ // See if the callback for odata query exists
684
+ if (base.targetInfo.callbackQuery) {
685
+ // Call the method
686
+ base.targetInfo.callbackQuery(data.d.results);
687
+ }
678
688
  // See if there are more items to get
679
689
  if (base.nextFl) {
680
690
  // See if we are getting all items in the base request
@@ -7460,6 +7460,8 @@ declare module 'gd-sprest/utils/requestType' {
7460
7460
  }
7461
7461
 
7462
7462
  declare module 'gd-sprest/utils/targetInfo' {
7463
+ import { ListItemOData } from "gd-sprest-def/lib/SP/entitytypes";
7464
+
7463
7465
  /**
7464
7466
  * Target Information
7465
7467
  */
@@ -7507,6 +7509,9 @@ declare module 'gd-sprest/utils/targetInfo' {
7507
7509
  /** The method to execute after the asynchronous request executes. */
7508
7510
  callback?: () => void;
7509
7511
 
7512
+ /** The method to execute for each set of pages using the OData query. */
7513
+ callbackQuery?: (items?: ListItemOData[]) => void;
7514
+
7510
7515
  /** The data to be passed in the body of the request. */
7511
7516
  data?: any;
7512
7517