gd-sprest 9.7.0 → 9.7.1

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,12 @@ 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
+ /** Returns the root base object. */
80
+ root(): IBase;
81
+
82
+ /** Stops any requests for a batch or query. */
83
+ stop();
84
+
76
85
  /** Updates the metdata uri. */
77
86
  updateMetadataUri(metadata, targetInfo: ITargetInfoProps);
78
87
 
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.71,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -52,6 +52,12 @@ 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
+ // Returns the root base object
56
+ Base.prototype.root = function () { var root = this; while (root.parent) {
57
+ root = root.parent;
58
+ } return root; };
59
+ // Method to stop any requests related to getting all items with the query
60
+ Base.prototype.stop = function () { this.stopFl = true; };
55
61
  // Method to stringify the object
56
62
  Base.prototype.stringify = function () { return _1.Helper.stringify(this); };
57
63
  // Method to update the metadata uri
@@ -21,6 +21,8 @@ exports.Helper = {
21
21
  obj["getCollection"] = base.getCollection;
22
22
  obj["getProperty"] = base.getProperty;
23
23
  obj["parent"] = base;
24
+ obj["root"] = base.root;
25
+ obj["stop"] = base.stop;
24
26
  obj["targetInfo"] = base.targetInfo;
25
27
  obj["updateMetadataUri"] = base.updateMetadataUri;
26
28
  obj["waitForRequestsToComplete"] = base.waitForRequestsToComplete;
@@ -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 = base.root();
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 = base.root();
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,12 @@ declare module 'gd-sprest/utils/base' {
7454
7457
  /** Gets the property. */
7455
7458
  getProperty(propertyName: string, requestType?: string);
7456
7459
 
7460
+ /** Returns the root base object. */
7461
+ root(): IBase;
7462
+
7463
+ /** Stops any requests for a batch or query. */
7464
+ stop();
7465
+
7457
7466
  /** Updates the metdata uri. */
7458
7467
  updateMetadataUri(metadata, targetInfo: ITargetInfoProps);
7459
7468