gd-sprest 7.0.3 → 7.0.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.
@@ -364,6 +364,9 @@ export interface ISPCfgListInfo {
364
364
  /** Flag to index the title field. */
365
365
  TitleFieldIndexed?: boolean;
366
366
 
367
+ /** Flag to enforce unique values. */
368
+ TitleFieldUniqueValues?: boolean;
369
+
367
370
  /** The user custom actions. */
368
371
  UserCustomActions?: Array<UserCustomActionProps>;
369
372
 
@@ -385,6 +388,9 @@ export interface ISPCfgListInfo {
385
388
  * SharePoint Configuration - View Information
386
389
  */
387
390
  export interface ISPCfgViewInfo {
391
+ /** Flag to set the view as the default view. */
392
+ Default?: boolean;
393
+
388
394
  /** The JSLink property. */
389
395
  JSLink?: string;
390
396
 
@@ -945,10 +945,16 @@ exports.SPConfig = function (cfg, webUrl) {
945
945
  values["Title"] = cfgList.TitleFieldDisplayName;
946
946
  }
947
947
  // See if we are indexing the field
948
- if (cfgList.TitleFieldIndexed) {
948
+ // Note - To enforce unique values, the field must be indexed
949
+ if (cfgList.TitleFieldUniqueValues || cfgList.TitleFieldIndexed) {
949
950
  // Update the values
950
951
  values["Indexed"] = true;
951
952
  }
953
+ // See if we are enforcing unique values
954
+ if (cfgList.TitleFieldUniqueValues) {
955
+ // Update the values
956
+ values["EnforceUniqueValues"] = true;
957
+ }
952
958
  // Update the field name
953
959
  list.Fields.getByInternalNameOrTitle("Title").update(values).execute(function () {
954
960
  // Log
@@ -987,11 +993,12 @@ exports.SPConfig = function (cfg, webUrl) {
987
993
  }
988
994
  }
989
995
  // See if we are updating the view properties
990
- if (cfg.JSLink || cfg.ViewQuery) {
996
+ if (typeof (cfg.Default) === "boolean" || cfg.JSLink || cfg.ViewQuery) {
991
997
  var props = {};
992
998
  // Log
993
999
  console.log("[gd-sprest][View] Updating the view properties for the '" + cfg.ViewName + "' view.");
994
1000
  // Set the properties
1001
+ typeof (cfg.Default) === "boolean" ? props["DefaultView"] = cfg.Default : null;
995
1002
  cfg.JSLink ? props["JSLink"] = cfg.JSLink : null;
996
1003
  cfg.ViewQuery ? props["ViewQuery"] = cfg.ViewQuery : null;
997
1004
  // Update the view
package/build/rest.js CHANGED
@@ -8,7 +8,7 @@ var sptypes_1 = require("./sptypes");
8
8
  * SharePoint REST Library
9
9
  */
10
10
  exports.$REST = {
11
- __ver: 7.03,
11
+ __ver: 7.06,
12
12
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
13
13
  Apps: Lib.Apps,
14
14
  ContextInfo: Lib.ContextInfo,
@@ -89,8 +89,13 @@ var Batch = /** @class */ (function () {
89
89
  batch.push("Content-Type: application/http");
90
90
  batch.push("Content-Transfer-Encoding: binary");
91
91
  batch.push("");
92
- batch.push("POST " + request_1.targetInfo.requestUrl + " HTTP/1.1");
92
+ batch.push(request_1.targetInfo.requestMethod + " " + request_1.targetInfo.requestUrl + " HTTP/1.1");
93
93
  batch.push("Content-Type: application/json;odata=verbose");
94
+ // See if we are making a delete/update
95
+ if (request_1.targetInfo.requestMethod == "DELETE" || request_1.targetInfo.requestMethod == "MERGE") {
96
+ // Append the header for deleting/updating
97
+ batch.push("IF-MATCH: *");
98
+ }
94
99
  batch.push("");
95
100
  request_1.targetInfo.requestData ? batch.push(request_1.targetInfo.requestData) : null;
96
101
  batch.push("");
@@ -312,7 +312,7 @@ exports.Request = {
312
312
  }
313
313
  else {
314
314
  // Update the data object
315
- exports.Request.updateDataObject(base, isBatchRequest, batchIdx, callback);
315
+ exports.Request.updateDataObject(base, isBatchRequest, batchIdx);
316
316
  // Ensure this isn't a batch request
317
317
  if (!isBatchRequest) {
318
318
  // See if this is an xml response
@@ -358,7 +358,7 @@ exports.Request = {
358
358
  return base.response;
359
359
  }
360
360
  // Update the base object
361
- exports.Request.updateDataObject(base, isBatchRequest, batchIdx, callback);
361
+ exports.Request.updateDataObject(base, isBatchRequest, batchIdx);
362
362
  // See if the base is a collection and has more results
363
363
  if (base["d"] && base["d"].__next) {
364
364
  // Add the "next" method to get the next set of results
@@ -385,6 +385,8 @@ exports.Request = {
385
385
  });
386
386
  });
387
387
  }).then(function () {
388
+ // Execute the callback if it exists
389
+ callback ? callback(base.base.batchRequests, false) : null;
388
390
  // Clear the batch requests
389
391
  base.base.batchRequests = null;
390
392
  });
@@ -448,7 +450,7 @@ exports.Request = {
448
450
  return objData;
449
451
  },
450
452
  // Method to convert the input arguments into an object
451
- updateDataObject: function (base, isBatchRequest, batchIdx, batchCallback) {
453
+ updateDataObject: function (base, isBatchRequest, batchIdx) {
452
454
  if (isBatchRequest === void 0) { isBatchRequest = false; }
453
455
  if (batchIdx === void 0) { batchIdx = 0; }
454
456
  // Ensure the request was successful
@@ -562,8 +564,6 @@ exports.Request = {
562
564
  if (isBatchRequest) {
563
565
  // Process the callbacks
564
566
  batch_1.Batch.processCallbacks(base.base.batchRequests[batchIdx]);
565
- // Execute the callback if it exists
566
- batchCallback ? batchCallback(base.base.batchRequests) : null;
567
567
  }
568
568
  }
569
569
  },
@@ -3368,6 +3368,9 @@ declare module 'gd-sprest/helper/spCfg' {
3368
3368
  /** Flag to index the title field. */
3369
3369
  TitleFieldIndexed?: boolean;
3370
3370
 
3371
+ /** Flag to enforce unique values. */
3372
+ TitleFieldUniqueValues?: boolean;
3373
+
3371
3374
  /** The user custom actions. */
3372
3375
  UserCustomActions?: Array<UserCustomActionProps>;
3373
3376
 
@@ -3389,6 +3392,9 @@ declare module 'gd-sprest/helper/spCfg' {
3389
3392
  * SharePoint Configuration - View Information
3390
3393
  */
3391
3394
  export interface ISPCfgViewInfo {
3395
+ /** Flag to set the view as the default view. */
3396
+ Default?: boolean;
3397
+
3392
3398
  /** The JSLink property. */
3393
3399
  JSLink?: string;
3394
3400