gd-sprest 9.5.9 → 9.6.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.
@@ -47,9 +47,9 @@ export interface IWeb {
47
47
 
48
48
  /**
49
49
  * Method to return the web of the current user's OneDrive.
50
- * @param token - The token to use for the call.
50
+ * @param targetInfo - (Optional) The target information.
51
51
  */
52
- getOneDrive(token?: string): SP.IWeb;
52
+ getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
53
53
 
54
54
  /**
55
55
  * Method to get a remote web.
package/build/lib/web.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.Web = void 0;
4
15
  var contextInfo_1 = require("./contextInfo");
@@ -20,18 +31,19 @@ exports.Web = (function (url, targetInfo) {
20
31
  return web;
21
32
  });
22
33
  // Method to get the onedive web for the current user
23
- exports.Web.getOneDrive = function (token) {
34
+ exports.Web.getOneDrive = function (targetInfo) {
35
+ if (targetInfo === void 0) { targetInfo = {}; }
24
36
  // Set the url of the drive
25
37
  var host = document.location.host.split('.');
26
38
  var url = "https://".concat(host[0], "-my.").concat(host[1], ".").concat(host[2], "/personal/").concat(contextInfo_1.ContextInfo.userPrincipalName.replace(/[@,.]/g, '_'));
27
39
  // Return the web for the user's onedrive
28
- return (0, exports.Web)(url, {
40
+ return (0, exports.Web)(url, __assign(__assign({}, targetInfo), {
29
41
  requestHeader: {
30
- Authorization: "Bearer " + (token || graph_1.Graph.Token),
42
+ Authorization: "Bearer " + graph_1.Graph.Token,
31
43
  Accept: "application/json",
32
44
  "Content-Type": "application/json"
33
45
  }
34
- });
46
+ }));
35
47
  };
36
48
  // Static method to get a remote web
37
49
  exports.Web.getRemoteWeb = (function (requestUrl) {
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.59,
12
+ __ver: 9.61,
13
13
  AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
14
14
  Apps: Lib.Apps,
15
15
  ContextInfo: Lib.ContextInfo,
@@ -606,13 +606,13 @@ exports.Request = {
606
606
  helper_1.Helper.updateSearchResults(obj);
607
607
  }
608
608
  // Else, see if this is a graph request
609
- else if (data["@odata.context"]) {
609
+ else if (data["@odata.context"] || data["odata.type"]) {
610
610
  // Save a reference to it
611
611
  obj["d"] = data;
612
612
  // Update the base object's properties
613
613
  exports.Request.addProperties(obj, data);
614
614
  // Add the methods
615
- exports.Request.addMethods(obj, data, data["@odata.context"]);
615
+ exports.Request.addMethods(obj, data, data["@odata.context"] || data["odata.type"]);
616
616
  // See if we are not bypassing the processing of the response
617
617
  if (base.targetInfo.disableProcessing != true) {
618
618
  // Update the data collection
@@ -4568,9 +4568,9 @@ declare module 'gd-sprest/lib/web' {
4568
4568
 
4569
4569
  /**
4570
4570
  * Method to return the web of the current user's OneDrive.
4571
- * @param token - The token to use for the call.
4571
+ * @param targetInfo - (Optional) The target information.
4572
4572
  */
4573
- getOneDrive(token?: string): SP.IWeb;
4573
+ getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
4574
4574
 
4575
4575
  /**
4576
4576
  * Method to get a remote web.