gd-sprest 9.7.4 → 9.7.6

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.
@@ -58,6 +58,9 @@ export interface IBase<Type = any, Result = Type, QueryResult = Result> extends
58
58
  /** Flag to get all items. */
59
59
  getAllItemsFl: boolean;
60
60
 
61
+ /** Time in ms to wait inbetween requests when getting all items. */
62
+ getAllItemsWaitTime: number;
63
+
61
64
  /** Flag determining if more items exist. */
62
65
  nextFl: boolean;
63
66
 
@@ -3798,7 +3798,7 @@ export const Mapper = {
3798
3798
  },
3799
3799
  "SP.Directory.Group": {
3800
3800
  properties: [
3801
- "Members|SP.Directory.Group.Collection", "Owners|SP.Directory.Group.Collection"
3801
+ "members|SP.Directory.Group.Collection", "owners|SP.Directory.Group.Collection"
3802
3802
  ],
3803
3803
  delete: {
3804
3804
  requestType: RequestType.Delete
package/build/rest.js CHANGED
@@ -6,7 +6,7 @@ import { GraphTypes, SPTypes } from "./sptypes";
6
6
  * SharePoint REST Library
7
7
  */
8
8
  export const $REST = {
9
- __ver: 9.74,
9
+ __ver: 9.76,
10
10
  AppContext: (siteUrl) => { return Lib.Site.getAppContext(siteUrl); },
11
11
  Apps: Lib.Apps,
12
12
  ContextInfo: Lib.ContextInfo,
@@ -124,6 +124,7 @@ export const Helper = {
124
124
  // Set the properties
125
125
  obj.base = base.base ? base.base : base;
126
126
  obj.getAllItemsFl = methodInfo.getAllItemsFl;
127
+ obj.getAllItemsWaitTime = methodInfo.getAllItemsWaitTime;
127
128
  obj.parent = base;
128
129
  obj.requestType = methodConfig.requestType;
129
130
  // Ensure the return type exists
@@ -28,6 +28,8 @@ export class MethodInfo {
28
28
  get body() { return this.methodData; }
29
29
  // Flag to determine if we are getting all items
30
30
  get getAllItemsFl() { return this.methodInfo.getAllItemsFl; }
31
+ // Time in ms to wait inbetween requests for getting all items
32
+ get getAllItemsWaitTime() { return this.methodInfo.getAllItemsWaitTime; }
31
33
  // Flag to determine if this method replaces the endpoint
32
34
  get replaceEndpointFl() { return this.methodInfo.replaceEndpointFl ? true : false; }
33
35
  // The request method
@@ -196,6 +198,7 @@ export class MethodInfo {
196
198
  url = "?" + oData.QueryString;
197
199
  // Set the get all items Flag
198
200
  this.methodInfo.getAllItemsFl = oData.GetAllItems;
201
+ this.methodInfo.getAllItemsWaitTime = oData.GetAllItemsWaitTime;
199
202
  }
200
203
  // Else, see if we are not passing the data in the body or query string as a variable
201
204
  else if (!this.passDataInBody && !this.passDataInQSAsVar) {
@@ -12,6 +12,7 @@ export class OData {
12
12
  this._expand = oData && oData.Expand ? oData.Expand : [];
13
13
  this._filter = oData && oData.Filter ? oData.Filter : null;
14
14
  this._getAllItems = oData && oData.GetAllItems ? oData.GetAllItems : false;
15
+ this._getAllItemsWaitTime = oData && oData.GetAllItemsWaitTime ? oData.GetAllItemsWaitTime : 0;
15
16
  this._orderBy = oData && oData.OrderBy ? oData.OrderBy : [];
16
17
  this._search = oData && oData.Search ? oData.Search : null;
17
18
  this._select = oData && oData.Select ? oData.Select : [];
@@ -34,6 +35,9 @@ export class OData {
34
35
  // Flag to get all items
35
36
  get GetAllItems() { return this._getAllItems; }
36
37
  set GetAllItems(value) { this._getAllItems = value; }
38
+ // Time in ms to wait between calls to avoid throttling
39
+ get GetAllItemsWaitTime() { return this._getAllItemsWaitTime; }
40
+ set GetAllItemsWaitTime(value) { this._getAllItemsWaitTime = value; }
37
41
  // Order By
38
42
  get OrderBy() { return this._orderBy; }
39
43
  set OrderBy(value) { this._orderBy = value; }
@@ -698,34 +698,37 @@ export const Request = {
698
698
  targetInfo.accessToken = base.targetInfo.accessToken || (base.xhr.isGraph ? Graph.Token : null);
699
699
  targetInfo.endpoint = "";
700
700
  targetInfo.url = data["@odata.nextLink"] || data.d.__next;
701
- // Create a new object
702
- new XHRRequest(true, new TargetInfo(targetInfo), (xhr) => {
703
- var _a, _b;
704
- // Convert the response and see if values were returned
705
- let data = JSON.parse(xhr.response);
706
- if (data.d || data.value) {
707
- // See if we are not bypassing the processing of the response
708
- if (base.targetInfo.disableProcessing != true) {
709
- // Update the data collection
710
- Helper.updateDataCollection(base, ((_a = data.d) === null || _a === void 0 ? void 0 : _a.results) || data.value);
711
- // Update the expanded properties
712
- Helper.updateExpandedProperties(base);
713
- }
714
- // Append the raw data results
715
- if ((_b = base["d"]) === null || _b === void 0 ? void 0 : _b.results) {
716
- base["d"].results = base["d"].results.concat(data.d.results);
701
+ // Wait before we execute the call
702
+ setTimeout(() => {
703
+ // Create a new object
704
+ new XHRRequest(true, new TargetInfo(targetInfo), (xhr) => {
705
+ var _a, _b;
706
+ // Convert the response and see if values were returned
707
+ let data = JSON.parse(xhr.response);
708
+ if (data.d || data.value) {
709
+ // See if we are not bypassing the processing of the response
710
+ if (base.targetInfo.disableProcessing != true) {
711
+ // Update the data collection
712
+ Helper.updateDataCollection(base, ((_a = data.d) === null || _a === void 0 ? void 0 : _a.results) || data.value);
713
+ // Update the expanded properties
714
+ Helper.updateExpandedProperties(base);
715
+ }
716
+ // Append the raw data results
717
+ if ((_b = base["d"]) === null || _b === void 0 ? void 0 : _b.results) {
718
+ base["d"].results = base["d"].results.concat(data.d.results);
719
+ }
720
+ else {
721
+ base["value"] = base["value"].concat(data.value);
722
+ }
723
+ // Validate the data collection
724
+ request(xhr, resolve);
717
725
  }
718
726
  else {
719
- base["value"] = base["value"].concat(data.value);
727
+ // Resolve the promise
728
+ resolve();
720
729
  }
721
- // Validate the data collection
722
- request(xhr, resolve);
723
- }
724
- else {
725
- // Resolve the promise
726
- resolve();
727
- }
728
- });
730
+ });
731
+ }, typeof (base.getAllItemsWaitTime) === "number" ? base.getAllItemsWaitTime : 0);
729
732
  }
730
733
  else {
731
734
  // Add a method to get the next set of results
@@ -7439,6 +7439,9 @@ declare module 'gd-sprest/utils/base' {
7439
7439
  /** Flag to get all items. */
7440
7440
  getAllItemsFl: boolean;
7441
7441
 
7442
+ /** Time in ms to wait inbetween requests when getting all items. */
7443
+ getAllItemsWaitTime: number;
7444
+
7442
7445
  /** Flag determining if more items exist. */
7443
7446
  nextFl: boolean;
7444
7447