gd-sprest 9.6.9 → 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
 
@@ -86,6 +86,9 @@ export interface ITargetInfoProps {
86
86
  /** The request type. */
87
87
  requestType?: number;
88
88
 
89
+ /** The property that contains the request response. */
90
+ returnProp?: string;
91
+
89
92
  /** The url of the site/web to execute the request against. */
90
93
  url?: string;
91
94
  }
@@ -3796,6 +3796,7 @@ exports.Mapper = {
3796
3796
  },
3797
3797
  validateGroupName: {
3798
3798
  argNames: ["displayName", "alias"],
3799
+ returnProp: "ValidateGroupName"
3799
3800
  },
3800
3801
  },
3801
3802
  "SP.Directory.Group": {
@@ -5315,6 +5316,7 @@ exports.Mapper = {
5315
5316
  getUserEffectivePermissions: {
5316
5317
  argNames: ["userName"],
5317
5318
  name: "getUserEffectivePermissions(@user)?@user='[[userName]]'",
5319
+ returnProp: "GetUserEffectivePermissions",
5318
5320
  requestType: utils_1.RequestType.GetReplace
5319
5321
  },
5320
5322
  getView: {
@@ -5552,6 +5554,7 @@ exports.Mapper = {
5552
5554
  getUserEffectivePermissions: {
5553
5555
  argNames: ["userName"],
5554
5556
  name: "getUserEffectivePermissions(@user)?@user='[[userName]]'",
5557
+ returnProp: "GetUserEffectivePermissions",
5555
5558
  requestType: utils_1.RequestType.GetReplace
5556
5559
  },
5557
5560
  getVersionById: {
@@ -8521,6 +8524,7 @@ exports.Mapper = {
8521
8524
  getUserEffectivePermissions: {
8522
8525
  argNames: ["userName"],
8523
8526
  name: "getUserEffectivePermissions(@user)?@user='[[userName]]'",
8527
+ returnProp: "GetUserEffectivePermissions",
8524
8528
  requestType: utils_1.RequestType.GetReplace
8525
8529
  },
8526
8530
  getViewFromPath: {
@@ -9012,6 +9016,7 @@ exports.Mapper = {
9012
9016
  getUserEffectivePermissions: {
9013
9017
  argNames: ["userName"],
9014
9018
  name: "getUserEffectivePermissions(@user)?@user='[[userName]]'",
9019
+ returnProp: "GetUserEffectivePermissions",
9015
9020
  requestType: utils_1.RequestType.GetReplace
9016
9021
  },
9017
9022
  getVersionById: {
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;
@@ -91,6 +93,7 @@ exports.Helper = {
91
93
  targetInfo.method = methodInfo.requestMethod;
92
94
  targetInfo.requestDigest = typeof (targetInfo.requestDigest) === "undefined" && base.base && base.base.targetInfo.requestDigest ? base.base.targetInfo.requestDigest : targetInfo.requestDigest;
93
95
  targetInfo.requestType = methodConfig.requestType;
96
+ targetInfo.returnProp = methodConfig.returnProp;
94
97
  // See if we are appending the endpoint
95
98
  if (methodInfo.appendEndpointFl) {
96
99
  // Append to the endpoint
@@ -217,6 +217,13 @@ exports.Request = {
217
217
  }
218
218
  }
219
219
  }
220
+ // See if a return property was set and value exists
221
+ if (base.targetInfo.returnProp && data[base.targetInfo.returnProp]) {
222
+ // Parse the data properties
223
+ for (var key in data[base.targetInfo.returnProp]) {
224
+ base[key] = data[base.targetInfo.returnProp][key];
225
+ }
226
+ }
220
227
  },
221
228
  // Method to execute the request
222
229
  execute: function (base, args) {
@@ -428,8 +435,13 @@ exports.Request = {
428
435
  var isBatchRequest = base.base && base.base.batchRequests && base.base.batchRequests.length > 0;
429
436
  if (isBatchRequest) {
430
437
  var batchIdx_1 = 0;
438
+ var root_1 = base.root();
431
439
  // Parse the requests
432
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
+ }
433
445
  // Return a promise
434
446
  return new Promise(function (resolve) {
435
447
  // Execute the request
@@ -695,8 +707,10 @@ exports.Request = {
695
707
  }
696
708
  // See if there are more items to get
697
709
  if (base.nextFl) {
710
+ // Get the root base object
711
+ var root = base.root();
698
712
  // See if we are getting all items in the base request
699
- if (base.getAllItemsFl) {
713
+ if (base.getAllItemsFl && root.stopFl != true) {
700
714
  // Create the target information to query the next set of results
701
715
  var targetInfo = Object.create(base.targetInfo);
702
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
 
@@ -7707,6 +7716,9 @@ declare module 'gd-sprest/utils/targetInfo' {
7707
7716
  /** The request type. */
7708
7717
  requestType?: number;
7709
7718
 
7719
+ /** The property that contains the request response. */
7720
+ returnProp?: string;
7721
+
7710
7722
  /** The url of the site/web to execute the request against. */
7711
7723
  url?: string;
7712
7724
  }