gd-sprest 9.6.6 → 9.6.8
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.
- package/@types/lib/site.d.ts +6 -0
- package/build/lib/site.js +28 -0
- package/build/lib/web.js +1 -1
- package/build/rest.js +1 -1
- package/build/utils/request.js +5 -0
- package/dist/gd-sprest.d.ts +6 -0
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
package/@types/lib/site.d.ts
CHANGED
|
@@ -55,6 +55,12 @@ export interface ISite {
|
|
|
55
55
|
*/
|
|
56
56
|
getAppContext(siteUrl: string): IBaseExecution;
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Method to return the web of the current user's OneDrive.
|
|
60
|
+
* @param targetInfo - (Optional) The target information.
|
|
61
|
+
*/
|
|
62
|
+
getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
|
|
63
|
+
|
|
58
64
|
/**
|
|
59
65
|
* Method to get the url of a site, by its id.
|
|
60
66
|
* @param id - The site id.
|
package/build/lib/site.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
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.Site = void 0;
|
|
4
15
|
var utils_1 = require("../utils");
|
|
16
|
+
var contextInfo_1 = require("./contextInfo");
|
|
17
|
+
var graph_1 = require("./graph");
|
|
5
18
|
/**
|
|
6
19
|
* Site
|
|
7
20
|
*/
|
|
@@ -40,6 +53,21 @@ exports.Site.getAppContext = (function (siteUrl) {
|
|
|
40
53
|
method: "POST"
|
|
41
54
|
});
|
|
42
55
|
});
|
|
56
|
+
// Method to get the onedive web for the current user
|
|
57
|
+
exports.Site.getOneDrive = function (targetInfo) {
|
|
58
|
+
if (targetInfo === void 0) { targetInfo = {}; }
|
|
59
|
+
// Set the url of the drive
|
|
60
|
+
var host = document.location.host.split('.');
|
|
61
|
+
var url = "https://".concat(host[0], "-my.").concat(host[1], ".").concat(host[2], "/personal/").concat(contextInfo_1.ContextInfo.userPrincipalName.replace(/[@,.]/g, '_'));
|
|
62
|
+
// Return the web for the user's onedrive
|
|
63
|
+
return (0, exports.Site)(url, __assign(__assign({}, targetInfo), {
|
|
64
|
+
requestHeader: {
|
|
65
|
+
Authorization: "Bearer " + graph_1.Graph.Token,
|
|
66
|
+
Accept: "application/json",
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
43
71
|
// Method to get the url by id
|
|
44
72
|
exports.Site.getUrlById = (function (id) {
|
|
45
73
|
// Return the base object
|
package/build/lib/web.js
CHANGED
|
@@ -12,8 +12,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.Web = void 0;
|
|
15
|
-
var contextInfo_1 = require("./contextInfo");
|
|
16
15
|
var utils_1 = require("../utils");
|
|
16
|
+
var contextInfo_1 = require("./contextInfo");
|
|
17
17
|
var graph_1 = require("./graph");
|
|
18
18
|
exports.Web = (function (url, targetInfo) {
|
|
19
19
|
var web = new utils_1.Base(targetInfo);
|
package/build/rest.js
CHANGED
package/build/utils/request.js
CHANGED
|
@@ -186,6 +186,11 @@ exports.Request = {
|
|
|
186
186
|
base[key] = value;
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
|
+
// See if this is a graph collection
|
|
190
|
+
if (typeof (value === null || value === void 0 ? void 0 : value.length) === "number" && typeof (base[key + "@odata.navigationLinkUrl"]) === "string") {
|
|
191
|
+
// Set the results
|
|
192
|
+
base[key].results = base[key].splice(0, base[key].length);
|
|
193
|
+
}
|
|
189
194
|
// See if the base is a collection
|
|
190
195
|
if (base[key] && base[key].results) {
|
|
191
196
|
// Ensure the collection is an object
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -4256,6 +4256,12 @@ declare module 'gd-sprest/lib/site' {
|
|
|
4256
4256
|
*/
|
|
4257
4257
|
getAppContext(siteUrl: string): IBaseExecution;
|
|
4258
4258
|
|
|
4259
|
+
/**
|
|
4260
|
+
* Method to return the web of the current user's OneDrive.
|
|
4261
|
+
* @param targetInfo - (Optional) The target information.
|
|
4262
|
+
*/
|
|
4263
|
+
getOneDrive(targetInfo?: ITargetInfoProps): SP.IWeb;
|
|
4264
|
+
|
|
4259
4265
|
/**
|
|
4260
4266
|
* Method to get the url of a site, by its id.
|
|
4261
4267
|
* @param id - The site id.
|