gd-sprest 9.7.0 → 9.7.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.
@@ -26,6 +26,9 @@ export interface IBase<Type = any, Result = Type, QueryResult = Result> extends
26
26
  /** The responses. */
27
27
  responses: Array<IBase>;
28
28
 
29
+ /** The flag to stop any requests for a query or batch request. */
30
+ stopFl: boolean;
31
+
29
32
  /** The wait flags. */
30
33
  waitFlags: Array<boolean>;
31
34
 
@@ -73,6 +76,9 @@ export interface IBase<Type = any, Result = Type, QueryResult = Result> extends
73
76
  /** Gets the property. */
74
77
  getProperty(propertyName: string, requestType?: string);
75
78
 
79
+ /** Stops any requests for a batch or query. */
80
+ stop();
81
+
76
82
  /** Updates the metdata uri. */
77
83
  updateMetadataUri(metadata, targetInfo: ITargetInfoProps);
78
84
 
@@ -27,6 +27,9 @@ export interface IBaseHelper {
27
27
  /** Gets the XHR request information. */
28
28
  getRequestInfo(base: IBase): IRequestInfo;
29
29
 
30
+ /** Returns the root base object. */
31
+ getRootParent(base: IBase): IBase;
32
+
30
33
  /** Converts the base object to a JSON string. */
31
34
  stringify(base: IBase): string;
32
35
 
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.69,
12
+ __ver: 9.72,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -52,6 +52,8 @@ var Base = /** @class */ (function () {
52
52
  Base.prototype.getProperty = function (propertyName, requestType) { return _1.Helper.getProperty(this, propertyName, requestType); };
53
53
  // Method to get the request digest value
54
54
  Base.prototype.getRequestDigest = function () { return this.targetInfo.requestDigest; };
55
+ // Method to stop any requests related to getting all items with the query
56
+ Base.prototype.stop = function () { this.stopFl = true; };
55
57
  // Method to stringify the object
56
58
  Base.prototype.stringify = function () { return _1.Helper.stringify(this); };
57
59
  // Method to update the metadata uri
@@ -21,6 +21,7 @@ exports.Helper = {
21
21
  obj["getCollection"] = base.getCollection;
22
22
  obj["getProperty"] = base.getProperty;
23
23
  obj["parent"] = base;
24
+ obj["stop"] = base.stop;
24
25
  obj["targetInfo"] = base.targetInfo;
25
26
  obj["updateMetadataUri"] = base.updateMetadataUri;
26
27
  obj["waitForRequestsToComplete"] = base.waitForRequestsToComplete;
@@ -225,6 +226,14 @@ exports.Helper = {
225
226
  // Return the request information
226
227
  return xhr.requestInfo;
227
228
  },
229
+ getRootParent: function (base) {
230
+ // Find the root base object and return it
231
+ var root = base;
232
+ while (root.parent) {
233
+ root = root.parent;
234
+ }
235
+ return root;
236
+ },
228
237
  // Method to stringify the object
229
238
  stringify: function (base) {
230
239
  // Stringify the object
@@ -435,8 +435,13 @@ exports.Request = {
435
435
  var isBatchRequest = base.base && base.base.batchRequests && base.base.batchRequests.length > 0;
436
436
  if (isBatchRequest) {
437
437
  var batchIdx_1 = 0;
438
+ var root_1 = helper_1.Helper.getRootParent(base);
438
439
  // Parse the requests
439
440
  (0, executor_1.Executor)(base.base.batchRequests, function (batchRequest) {
441
+ // Do nothing if the stop flag is set
442
+ if (root_1.stopFl) {
443
+ return;
444
+ }
440
445
  // Return a promise
441
446
  return new Promise(function (resolve) {
442
447
  // Execute the request
@@ -702,8 +707,10 @@ exports.Request = {
702
707
  }
703
708
  // See if there are more items to get
704
709
  if (base.nextFl) {
710
+ // Get the root base object
711
+ var root = helper_1.Helper.getRootParent(base);
705
712
  // See if we are getting all items in the base request
706
- if (base.getAllItemsFl) {
713
+ if (base.getAllItemsFl && root.stopFl != true) {
707
714
  // Create the target information to query the next set of results
708
715
  var targetInfo = Object.create(base.targetInfo);
709
716
  targetInfo.accessToken = base.targetInfo.accessToken || (base.xhr.isGraph ? lib_1.Graph.Token : null);
@@ -7413,6 +7413,9 @@ declare module 'gd-sprest/utils/base' {
7413
7413
  /** The responses. */
7414
7414
  responses: Array<IBase>;
7415
7415
 
7416
+ /** The flag to stop any requests for a query or batch request. */
7417
+ stopFl: boolean;
7418
+
7416
7419
  /** The wait flags. */
7417
7420
  waitFlags: Array<boolean>;
7418
7421
 
@@ -7454,6 +7457,9 @@ declare module 'gd-sprest/utils/base' {
7454
7457
  /** Gets the property. */
7455
7458
  getProperty(propertyName: string, requestType?: string);
7456
7459
 
7460
+ /** Stops any requests for a batch or query. */
7461
+ stop();
7462
+
7457
7463
  /** Updates the metdata uri. */
7458
7464
  updateMetadataUri(metadata, targetInfo: ITargetInfoProps);
7459
7465
 
@@ -7520,6 +7526,9 @@ declare module 'gd-sprest/utils/helper' {
7520
7526
  /** Gets the XHR request information. */
7521
7527
  getRequestInfo(base: IBase): IRequestInfo;
7522
7528
 
7529
+ /** Returns the root base object. */
7530
+ getRootParent(base: IBase): IBase;
7531
+
7523
7532
  /** Converts the base object to a JSON string. */
7524
7533
  stringify(base: IBase): string;
7525
7534