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.
- package/@types/utils/base.d.ts +3 -0
- package/build/mapper/def.js +1 -1
- package/build/rest.js +1 -1
- package/build/utils/helper.js +1 -0
- package/build/utils/methodInfo.js +3 -0
- package/build/utils/oData.js +4 -0
- package/build/utils/request.js +28 -25
- package/dist/gd-sprest.d.ts +3 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
package/@types/utils/base.d.ts
CHANGED
|
@@ -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
|
|
package/build/mapper/def.js
CHANGED
|
@@ -3798,7 +3798,7 @@ export const Mapper = {
|
|
|
3798
3798
|
},
|
|
3799
3799
|
"SP.Directory.Group": {
|
|
3800
3800
|
properties: [
|
|
3801
|
-
"
|
|
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
package/build/utils/helper.js
CHANGED
|
@@ -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) {
|
package/build/utils/oData.js
CHANGED
|
@@ -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; }
|
package/build/utils/request.js
CHANGED
|
@@ -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
|
-
//
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
if (
|
|
709
|
-
//
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
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
|
-
|
|
727
|
+
// Resolve the promise
|
|
728
|
+
resolve();
|
|
720
729
|
}
|
|
721
|
-
|
|
722
|
-
|
|
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
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -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
|
|