gd-sprest 8.4.1 → 8.4.3

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.
@@ -531,9 +531,14 @@ exports.ListForm = {
531
531
  // See if this is an existing item
532
532
  if (info.item && info.item.update) {
533
533
  // Set the request properties if we are checking the item version
534
- var requestProps = checkItemVersion && info.item.etag ? {
535
- requestHeader: { "IF-MATCH": info.item.etag }
536
- } : null;
534
+ var requestProps = {
535
+ requestDigest: info.item.getRequestDigest()
536
+ };
537
+ // See if we are checking the item versions
538
+ if (checkItemVersion && info.item.etag) {
539
+ // Set the etag value
540
+ requestProps.requestHeader = { "IF-MATCH": info.item.etag };
541
+ }
537
542
  // Update the item
538
543
  __1.Web(info.webUrl, requestProps).Lists(info.list.Title).Items(info.item.Id).update(formValues).execute(function (response) {
539
544
  // Refresh the item
@@ -165,12 +165,17 @@ exports.MapperV2 = {
165
165
  },
166
166
  assignSensitivityLabel: {
167
167
  argNames: ["values"],
168
+ name: "[base.eTag]/assignSensitivityLabel",
168
169
  requestType: utils_1.RequestType.PostBodyNoArgs
169
170
  },
170
171
  driveItem: {
171
172
  requestType: utils_1.RequestType.Get,
172
173
  returnType: "driveItem"
173
174
  },
175
+ extractSensitivityLabels: {
176
+ name: "[base.eTag]/extractSensitivityLabel",
177
+ requestType: utils_1.RequestType.Post
178
+ },
174
179
  fields: {
175
180
  appendRequest: true,
176
181
  requestType: utils_1.RequestType.Get,
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: 8.41,
12
+ __ver: 8.43,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -50,6 +50,8 @@ var Base = /** @class */ (function () {
50
50
  Base.prototype.getNextSetOfResults = function () { return _1.Helper.getNextSetOfResults(this); };
51
51
  // Method to return a property of the base object
52
52
  Base.prototype.getProperty = function (propertyName, requestType) { return _1.Helper.getProperty(this, propertyName, requestType); };
53
+ // Method to get the request digest value
54
+ Base.prototype.getRequestDigest = function () { return this.targetInfo.requestDigest; };
53
55
  // Method to stringify the object
54
56
  Base.prototype.stringify = function () { return _1.Helper.stringify(this); };
55
57
  // Method to update the metadata uri
@@ -73,7 +73,7 @@ exports.Helper = {
73
73
  var endIdx = methodConfig.name.indexOf("]", startIdx);
74
74
  var propName = methodConfig.name.substring(startIdx, endIdx).split(".")[1];
75
75
  // Get the property value
76
- var propValue = base[propName] || "";
76
+ var propValue = (base[propName] || "").replace(/"/g, '').split(',')[0];
77
77
  // Update the method name
78
78
  methodConfig.name = methodConfig.name.replace("[base." + propName + "]", propValue);
79
79
  }
@@ -40,21 +40,21 @@ exports.Request = {
40
40
  if (isV2) {
41
41
  // See if we are overriding the object type
42
42
  if (resultsObjType) {
43
- // Set the object type
43
+ // Update the object type
44
44
  objType = resultsObjType;
45
45
  }
46
+ // Get the object type from the context
47
+ var metadataType = (obj["@odata.context"] || objType);
48
+ var values = metadataType.split("_api/v2.0/$metadata#");
49
+ if (values.length > 1) {
50
+ objType = values[1];
51
+ }
46
52
  else {
47
- // Get the object type from the context
48
- var metadataType = (obj["@odata.context"] || objType);
49
- var values = metadataType.split("_api/v2.0/$metadata#");
50
- if (values.length > 1) {
51
- objType = values[1];
52
- }
53
- else {
54
- values = metadataType.split("/");
55
- objType = values[values.length - 1].split("?")[0];
56
- }
53
+ values = metadataType.split("/");
54
+ objType = values[values.length - 1].split("?")[0];
57
55
  }
56
+ // Update the object type if it's a single instance
57
+ objType = objType.replace("s/$entity", "");
58
58
  // Get the methods for this object type
59
59
  methods = mapper_1.MapperV2[objType];
60
60
  console.log("[gd-sprest] v2 response detected. Type is: " + objType, methods);
package/build/v2/drive.js CHANGED
@@ -17,7 +17,7 @@ exports.drive = (function (props) {
17
17
  // See if an endpoint is not defined
18
18
  if (drive.targetInfo.endpoint == undefined) {
19
19
  // Default the endpoint
20
- drive.targetInfo.endpoint = "_api/v2.0/sites/" + (props.siteId || ((_a = contextInfo_1.ContextInfo === null || contextInfo_1.ContextInfo === void 0 ? void 0 : contextInfo_1.ContextInfo.siteId) === null || _a === void 0 ? void 0 : _a.replace(/[{}]/g, '')) + "/drive");
20
+ drive.targetInfo.endpoint = "_api/v2.0/sites/" + (props.siteId || ((_a = contextInfo_1.ContextInfo === null || contextInfo_1.ContextInfo === void 0 ? void 0 : contextInfo_1.ContextInfo.siteId) === null || _a === void 0 ? void 0 : _a.replace(/[{}]/g, ''))) + "/drive";
21
21
  // Add the methods
22
22
  utils_1.Request.addMethods(drive, { __metadata: { type: "@odata.context/_api/v2.0/$metadata#drive" } });
23
23
  }
@@ -17,7 +17,7 @@ exports.drives = (function (props) {
17
17
  // See if an endpoint is not defined
18
18
  if (drives.targetInfo.endpoint == undefined) {
19
19
  // Default the endpoint
20
- drives.targetInfo.endpoint = "_api/v2.0/sites/" + (props.siteId || ((_a = contextInfo_1.ContextInfo === null || contextInfo_1.ContextInfo === void 0 ? void 0 : contextInfo_1.ContextInfo.siteId) === null || _a === void 0 ? void 0 : _a.replace(/[{}]/g, '')) + "/drives");
20
+ drives.targetInfo.endpoint = "_api/v2.0/sites/" + (props.siteId || ((_a = contextInfo_1.ContextInfo === null || contextInfo_1.ContextInfo === void 0 ? void 0 : contextInfo_1.ContextInfo.siteId) === null || _a === void 0 ? void 0 : _a.replace(/[{}]/g, ''))) + "/drives";
21
21
  // See if the drive id was provided
22
22
  if (props.driveId) {
23
23
  // Append the id