gd-sprest 9.7.2 → 9.7.4
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/utils/base.d.ts +0 -3
- package/build/helper/executor.js +10 -20
- package/build/helper/fieldSchemaXML.js +85 -89
- package/build/helper/index.js +12 -28
- package/build/helper/jslink.js +124 -128
- package/build/helper/listForm.js +109 -118
- package/build/helper/listFormField.js +62 -65
- package/build/helper/methods/addContentEditorWebPart.js +9 -17
- package/build/helper/methods/addPermissionLevel.js +12 -16
- package/build/helper/methods/addScriptEditorWebPart.js +9 -17
- package/build/helper/methods/copyPermissionLevel.js +22 -26
- package/build/helper/methods/createContentType.js +96 -19
- package/build/helper/methods/createDocSet.js +10 -14
- package/build/helper/methods/getCurrentTheme.js +26 -31
- package/build/helper/methods/hasPermissions.js +8 -13
- package/build/helper/methods/index.js +16 -32
- package/build/helper/methods/loadSPCore.js +13 -17
- package/build/helper/methods/parse.js +5 -9
- package/build/helper/methods/request.js +4 -8
- package/build/helper/methods/setContentTypeFields.js +71 -79
- package/build/helper/methods/setGroupOwner.js +6 -10
- package/build/helper/methods/setWebProperty.js +26 -30
- package/build/helper/methods/stringify.js +3 -7
- package/build/helper/methods/webWorker.js +40 -20
- package/build/helper/ribbonLink.js +10 -14
- package/build/helper/sbLink.js +11 -15
- package/build/helper/sp/calloutManager.js +22 -25
- package/build/helper/sp/index.js +13 -16
- package/build/helper/sp/modalDialog.js +32 -35
- package/build/helper/sp/notify.js +9 -12
- package/build/helper/sp/ribbon.js +1 -4
- package/build/helper/sp/sod.js +9 -18
- package/build/helper/sp/status.js +18 -21
- package/build/helper/spCfg.js +232 -259
- package/build/helper/spCfgTypes.js +2 -5
- package/build/helper/taxonomy.js +144 -182
- package/build/helper/webpart.js +110 -94
- package/build/index.js +6 -23
- package/build/lib/apps.js +4 -7
- package/build/lib/contextInfo.js +217 -781
- package/build/lib/directorySession.js +4 -7
- package/build/lib/graph.js +16 -19
- package/build/lib/groupService.js +4 -7
- package/build/lib/groupSiteManager.js +4 -7
- package/build/lib/hubSites.js +11 -25
- package/build/lib/hubSitesUtility.js +4 -7
- package/build/lib/index.js +27 -43
- package/build/lib/list.js +49 -53
- package/build/lib/navigation.js +4 -7
- package/build/lib/peopleManager.js +4 -7
- package/build/lib/peoplePicker.js +4 -7
- package/build/lib/profileLoader.js +4 -7
- package/build/lib/search.js +30 -33
- package/build/lib/sensitivityLabels.js +6 -9
- package/build/lib/site.js +20 -35
- package/build/lib/siteIconManager.js +4 -7
- package/build/lib/siteManager.js +4 -7
- package/build/lib/sitePages.js +37 -51
- package/build/lib/socialFeed.js +13 -16
- package/build/lib/themeManager.js +4 -7
- package/build/lib/userProfile.js +4 -7
- package/build/lib/utility.js +12 -17
- package/build/lib/web.js +34 -49
- package/build/lib/webTemplateExtensions.js +4 -7
- package/build/lib/wfInstanceService.js +4 -7
- package/build/lib/wfSubscriptionService.js +4 -7
- package/build/mapper/custom/audit.js +3 -6
- package/build/mapper/custom/graph.js +13 -16
- package/build/mapper/custom/index.js +8 -24
- package/build/mapper/custom/odata.js +3 -6
- package/build/mapper/custom/old.js +42 -45
- package/build/mapper/custom/peoplePicker.js +4 -7
- package/build/mapper/custom/propertyValues.js +3 -6
- package/build/mapper/custom/utility.js +17 -20
- package/build/mapper/custom/webTemplateExtensions.js +19 -22
- package/build/mapper/def.js +1032 -989
- package/build/mapper/index.js +4 -9
- package/build/mapper/v2.js +2629 -2632
- package/build/rest.js +16 -19
- package/build/sptypes/graphtypes.js +694 -710
- package/build/sptypes/index.js +3 -7
- package/build/sptypes/sptypes.js +49 -52
- package/build/utils/base.js +20 -37
- package/build/utils/batch.js +53 -63
- package/build/utils/helper.js +79 -83
- package/build/utils/index.js +9 -25
- package/build/utils/methodInfo.js +88 -141
- package/build/utils/oData.js +62 -112
- package/build/utils/request.js +137 -155
- package/build/utils/requestType.js +1 -4
- package/build/utils/targetInfo.js +39 -52
- package/build/utils/xhrRequest.js +59 -107
- package/build/v2/drive.js +9 -13
- package/build/v2/drives.js +8 -12
- package/build/v2/index.js +3 -19
- package/build/v2/sites.js +61 -65
- package/dist/gd-sprest.d.ts +0 -3
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DirectorySession = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Directory Session
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const DirectorySession = ((targetInfo) => {
|
|
6
|
+
let svc = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
svc.targetInfo.defaultToWebFl = true;
|
|
12
9
|
svc.targetInfo.endpoint = "SP.Directory.DirectorySession";
|
|
13
10
|
// Add the methods
|
|
14
|
-
|
|
11
|
+
Request.addMethods(svc, { __metadata: { type: "SP.Directory.DirectorySession" } });
|
|
15
12
|
// Return the directory session
|
|
16
13
|
return svc;
|
|
17
14
|
});
|
package/build/lib/graph.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Graph = void 0;
|
|
4
|
-
var sptypes_1 = require("../sptypes");
|
|
5
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { SPTypes } from "../sptypes";
|
|
2
|
+
import { Base, Request, RequestType } from "../utils";
|
|
6
3
|
// Default Token
|
|
7
4
|
//export const Token
|
|
8
5
|
/**
|
|
9
6
|
* Graph
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const Graph = ((props) => {
|
|
9
|
+
let graph = new Base({ accessToken: props && props.accessToken ? props.accessToken : Graph.Token });
|
|
13
10
|
// Default the target information
|
|
14
|
-
graph.targetInfo.requestType = (props && props.requestType ? props.requestType : "").toLowerCase() == "post" ?
|
|
11
|
+
graph.targetInfo.requestType = (props && props.requestType ? props.requestType : "").toLowerCase() == "post" ? RequestType.GraphPost : RequestType.GraphGet;
|
|
15
12
|
// Set the endpoint
|
|
16
13
|
graph.targetInfo.data = props ? props.data : null;
|
|
17
|
-
graph.targetInfo.endpoint = props && props.cloud ? props.cloud :
|
|
18
|
-
graph.targetInfo.endpoint += "/" + (props && props.version ? props.version :
|
|
14
|
+
graph.targetInfo.endpoint = props && props.cloud ? props.cloud : Graph.Cloud || SPTypes.CloudEnvironment.Default;
|
|
15
|
+
graph.targetInfo.endpoint += "/" + (props && props.version ? props.version : Graph.Version || "v1.0");
|
|
19
16
|
// See if the url is set
|
|
20
17
|
if (props && props.url) {
|
|
21
18
|
// Set the endpoint
|
|
@@ -23,29 +20,29 @@ exports.Graph = (function (props) {
|
|
|
23
20
|
}
|
|
24
21
|
else {
|
|
25
22
|
// Add the default methods
|
|
26
|
-
|
|
23
|
+
Request.addMethods(graph, { __metadata: { type: "graph" } });
|
|
27
24
|
}
|
|
28
25
|
// Return the graph
|
|
29
26
|
return graph;
|
|
30
27
|
});
|
|
31
28
|
// Default Values
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
Graph.Cloud = "";
|
|
30
|
+
Graph.Token = "";
|
|
31
|
+
Graph.TokenExpiration = null;
|
|
32
|
+
Graph.Version = "";
|
|
36
33
|
// Method to get the graph token from a classic page
|
|
37
|
-
|
|
34
|
+
Graph.getAccessToken = (resource, tokenType) => {
|
|
38
35
|
// Set the data
|
|
39
|
-
|
|
36
|
+
let data = { "resource": resource || Graph.Cloud || SPTypes.CloudEnvironment.Default };
|
|
40
37
|
// Set the token type
|
|
41
38
|
if (tokenType) {
|
|
42
39
|
data["tokenType"] = tokenType;
|
|
43
40
|
}
|
|
44
41
|
// Get the access token
|
|
45
|
-
return new
|
|
42
|
+
return new Base({
|
|
46
43
|
endpoint: "SP.OAuth.Token/Acquire",
|
|
47
44
|
keepalive: true,
|
|
48
45
|
method: "POST",
|
|
49
|
-
data
|
|
46
|
+
data
|
|
50
47
|
});
|
|
51
48
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupService = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Group Service
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const GroupService = ((targetInfo) => {
|
|
6
|
+
let svc = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
svc.targetInfo.defaultToWebFl = true;
|
|
12
9
|
svc.targetInfo.endpoint = "groupservice";
|
|
13
10
|
// Add the methods
|
|
14
|
-
|
|
11
|
+
Request.addMethods(svc, { __metadata: { type: "Microsoft.SharePoint.Portal.GroupService" } });
|
|
15
12
|
// Return the group service
|
|
16
13
|
return svc;
|
|
17
14
|
});
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupSiteManager = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Group Site Manager
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const GroupSiteManager = ((targetInfo) => {
|
|
6
|
+
let mgr = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
mgr.targetInfo.defaultToWebFl = true;
|
|
12
9
|
mgr.targetInfo.endpoint = "groupsitemanager";
|
|
13
10
|
// Add the methods
|
|
14
|
-
|
|
11
|
+
Request.addMethods(mgr, { __metadata: { type: "Microsoft.SharePoint.Portal.GroupSiteManager" } });
|
|
15
12
|
// Return the group site manager
|
|
16
13
|
return mgr;
|
|
17
14
|
});
|
package/build/lib/hubSites.js
CHANGED
|
@@ -1,46 +1,32 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.HubSites = void 0;
|
|
15
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request, RequestType } from "../utils";
|
|
16
2
|
/**
|
|
17
3
|
* Hub Sites
|
|
18
4
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
export const HubSites = ((targetInfo) => {
|
|
6
|
+
let hubs = new Base(targetInfo);
|
|
21
7
|
// Default the properties
|
|
22
8
|
hubs.targetInfo.defaultToWebFl = true;
|
|
23
9
|
hubs.targetInfo.endpoint = "hubsites";
|
|
24
10
|
// Add the methods
|
|
25
|
-
|
|
11
|
+
Request.addMethods(hubs, { __metadata: { type: "SP.HubSite.Collection" } });
|
|
26
12
|
// Return the hub sites
|
|
27
13
|
return hubs;
|
|
28
14
|
});
|
|
29
15
|
// Static method to see if the current user can create hub sites
|
|
30
|
-
|
|
16
|
+
HubSites.canCreate = (() => {
|
|
31
17
|
// Return the base object
|
|
32
|
-
return new
|
|
18
|
+
return new Base({
|
|
33
19
|
endpoint: "SP.HubSites.CanCreate"
|
|
34
20
|
});
|
|
35
21
|
});
|
|
36
22
|
// Static method to update a hub site
|
|
37
|
-
|
|
23
|
+
HubSites.update = ((id, props) => {
|
|
38
24
|
// Return the base object
|
|
39
|
-
return new
|
|
40
|
-
data:
|
|
41
|
-
endpoint:
|
|
25
|
+
return new Base({
|
|
26
|
+
data: Object.assign({ __metadata: { type: "SP.HubSite" } }, props),
|
|
27
|
+
endpoint: `HubSites/getById('${id}')`,
|
|
42
28
|
method: "POST",
|
|
43
|
-
requestType:
|
|
29
|
+
requestType: RequestType.PostBodyNoArgs,
|
|
44
30
|
requestHeader: {
|
|
45
31
|
"Accept": "application/json;odata=verbose",
|
|
46
32
|
"Content-Type": "application/json;odata=verbose",
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HubSitesUtility = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Hub Sites Utility
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const HubSitesUtility = ((targetInfo) => {
|
|
6
|
+
let utility = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
utility.targetInfo.defaultToWebFl = true;
|
|
12
9
|
utility.targetInfo.endpoint = "hubsitesutility";
|
|
13
10
|
// Add the methods
|
|
14
|
-
|
|
11
|
+
Request.addMethods(utility, { __metadata: { type: "Microsoft.SharePoint.Portal.SPHubSitesUtility" } });
|
|
15
12
|
// Return the hub sites utility
|
|
16
13
|
return utility;
|
|
17
14
|
});
|
package/build/lib/index.js
CHANGED
|
@@ -1,43 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
__exportStar(require("./peoplePicker"), exports);
|
|
29
|
-
__exportStar(require("./profileLoader"), exports);
|
|
30
|
-
__exportStar(require("./search"), exports);
|
|
31
|
-
__exportStar(require("./sensitivityLabels"), exports);
|
|
32
|
-
__exportStar(require("./site"), exports);
|
|
33
|
-
__exportStar(require("./siteIconManager"), exports);
|
|
34
|
-
__exportStar(require("./siteManager"), exports);
|
|
35
|
-
__exportStar(require("./sitePages"), exports);
|
|
36
|
-
__exportStar(require("./socialFeed"), exports);
|
|
37
|
-
__exportStar(require("./themeManager"), exports);
|
|
38
|
-
__exportStar(require("./userProfile"), exports);
|
|
39
|
-
__exportStar(require("./utility"), exports);
|
|
40
|
-
__exportStar(require("./web"), exports);
|
|
41
|
-
__exportStar(require("./webTemplateExtensions"), exports);
|
|
42
|
-
__exportStar(require("./wfInstanceService"), exports);
|
|
43
|
-
__exportStar(require("./wfSubscriptionService"), exports);
|
|
1
|
+
export * from "./apps";
|
|
2
|
+
export * from "./contextInfo";
|
|
3
|
+
export * from "./directorySession";
|
|
4
|
+
export * from "./graph";
|
|
5
|
+
export * from "./groupService";
|
|
6
|
+
export * from "./groupSiteManager";
|
|
7
|
+
export * from "./hubSites";
|
|
8
|
+
export * from "./hubSitesUtility";
|
|
9
|
+
export * from "./list";
|
|
10
|
+
export * from "./navigation";
|
|
11
|
+
export * from "./peopleManager";
|
|
12
|
+
export * from "./peoplePicker";
|
|
13
|
+
export * from "./profileLoader";
|
|
14
|
+
export * from "./search";
|
|
15
|
+
export * from "./sensitivityLabels";
|
|
16
|
+
export * from "./site";
|
|
17
|
+
export * from "./siteIconManager";
|
|
18
|
+
export * from "./siteManager";
|
|
19
|
+
export * from "./sitePages";
|
|
20
|
+
export * from "./socialFeed";
|
|
21
|
+
export * from "./themeManager";
|
|
22
|
+
export * from "./userProfile";
|
|
23
|
+
export * from "./utility";
|
|
24
|
+
export * from "./web";
|
|
25
|
+
export * from "./webTemplateExtensions";
|
|
26
|
+
export * from "./wfInstanceService";
|
|
27
|
+
export * from "./wfSubscriptionService";
|
package/build/lib/list.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var utils_1 = require("../utils");
|
|
6
|
-
var graph_1 = require("./graph");
|
|
7
|
-
var web_1 = require("./web");
|
|
1
|
+
import { SPTypes } from "../sptypes";
|
|
2
|
+
import { Base, Request, RequestType } from "../utils";
|
|
3
|
+
import { Graph } from "./graph";
|
|
4
|
+
import { Web } from "./web";
|
|
8
5
|
/**
|
|
9
6
|
* List
|
|
10
7
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const List = ((listName, targetInfo) => {
|
|
9
|
+
let list = new Base(targetInfo);
|
|
13
10
|
// Default the properties
|
|
14
11
|
list.targetInfo.defaultToWebFl = true;
|
|
15
12
|
list.targetInfo.endpoint = "web/lists/getByTitle('" + listName.replace(/\'/g, "''") + "')";
|
|
16
13
|
// Add the methods
|
|
17
|
-
|
|
14
|
+
Request.addMethods(list, { __metadata: { type: "SP.List" } });
|
|
18
15
|
// Return the list
|
|
19
16
|
return list;
|
|
20
17
|
});
|
|
21
18
|
// Static method to get the list by the entity name.
|
|
22
|
-
|
|
19
|
+
List.getByEntityName = ((props) => {
|
|
23
20
|
// Query for the list
|
|
24
|
-
|
|
21
|
+
let query = Web(props.url, props.targetInfo)
|
|
25
22
|
// Get the lists
|
|
26
23
|
.Lists()
|
|
27
24
|
// Set the query
|
|
@@ -32,64 +29,63 @@ exports.List.getByEntityName = (function (props) {
|
|
|
32
29
|
// See if the callback exists
|
|
33
30
|
if (props.callback) {
|
|
34
31
|
// Execute the request asynchronously
|
|
35
|
-
query.execute(
|
|
32
|
+
query.execute((lists) => {
|
|
36
33
|
// Execute the callback method
|
|
37
34
|
props.callback(lists.results ? lists.results[0] : null);
|
|
38
35
|
});
|
|
39
36
|
}
|
|
40
37
|
else {
|
|
41
38
|
// Execute the request synchronously and return it
|
|
42
|
-
|
|
39
|
+
let list = query.executeAndWait();
|
|
43
40
|
return list.results ? list.results[0] : list;
|
|
44
41
|
}
|
|
45
42
|
});
|
|
46
43
|
// Static method to get the list data from the SP.List.getListDataAsStream endpoint
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var params = "?listFullUrl='" + listFullUrl + "'";
|
|
44
|
+
List.getDataAsStream = ((listFullUrl, parameters = {}) => {
|
|
45
|
+
let params = "?listFullUrl='" + listFullUrl + "'";
|
|
50
46
|
// Parse the parameters
|
|
51
|
-
for (
|
|
47
|
+
for (let key in parameters) {
|
|
52
48
|
// Append the parameter
|
|
53
49
|
params += "&" + key + "=" + parameters[key];
|
|
54
50
|
}
|
|
55
51
|
// Return the base object
|
|
56
|
-
return new
|
|
52
|
+
return new Base({
|
|
57
53
|
endpoint: "SP.List.getListDataAsStream" + params
|
|
58
54
|
});
|
|
59
55
|
});
|
|
60
56
|
// Static method for executing a flow against a list item
|
|
61
|
-
|
|
57
|
+
List.runFlow = (props) => {
|
|
62
58
|
// Determine the urls
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
let authUrl = "";
|
|
60
|
+
let flowUrl = "";
|
|
65
61
|
switch (props.cloudEnv) {
|
|
66
|
-
case
|
|
67
|
-
authUrl =
|
|
68
|
-
flowUrl =
|
|
62
|
+
case SPTypes.CloudEnvironment.USL4:
|
|
63
|
+
authUrl = SPTypes.CloudEnvironment.FlowHigh;
|
|
64
|
+
flowUrl = SPTypes.CloudEnvironment.FlowHighAPI;
|
|
69
65
|
break;
|
|
70
|
-
case
|
|
71
|
-
authUrl =
|
|
72
|
-
flowUrl =
|
|
66
|
+
case SPTypes.CloudEnvironment.USL5:
|
|
67
|
+
authUrl = SPTypes.CloudEnvironment.FlowDoD;
|
|
68
|
+
flowUrl = SPTypes.CloudEnvironment.FlowDoDAPI;
|
|
73
69
|
break;
|
|
74
70
|
// Default
|
|
75
71
|
default:
|
|
76
|
-
authUrl =
|
|
77
|
-
flowUrl =
|
|
72
|
+
authUrl = SPTypes.CloudEnvironment.Flow;
|
|
73
|
+
flowUrl = SPTypes.CloudEnvironment.FlowAPI;
|
|
78
74
|
break;
|
|
79
75
|
}
|
|
80
76
|
// Return a promise
|
|
81
|
-
return new Promise(
|
|
77
|
+
return new Promise((resolve) => {
|
|
82
78
|
// Gets the graph token
|
|
83
|
-
|
|
79
|
+
let getGraphToken = () => {
|
|
84
80
|
// Return a promise
|
|
85
|
-
return new Promise(
|
|
81
|
+
return new Promise(resolveAuth => {
|
|
86
82
|
// Get the graph token
|
|
87
|
-
|
|
83
|
+
Graph.getAccessToken(authUrl).execute(auth => {
|
|
88
84
|
// Resolve the request
|
|
89
85
|
resolveAuth(auth.access_token);
|
|
90
86
|
},
|
|
91
87
|
// Error
|
|
92
|
-
|
|
88
|
+
(ex) => {
|
|
93
89
|
// Resolve the request
|
|
94
90
|
resolve({
|
|
95
91
|
executed: false,
|
|
@@ -100,9 +96,9 @@ exports.List.runFlow = function (props) {
|
|
|
100
96
|
});
|
|
101
97
|
};
|
|
102
98
|
// Gets the flow token
|
|
103
|
-
|
|
99
|
+
let getFlowToken = (flowInfo) => {
|
|
104
100
|
// Return a promise
|
|
105
|
-
return new Promise(
|
|
101
|
+
return new Promise(resolveAuth => {
|
|
106
102
|
// See if the flow token is provided
|
|
107
103
|
if (props.token) {
|
|
108
104
|
// Resolve the request
|
|
@@ -110,28 +106,28 @@ exports.List.runFlow = function (props) {
|
|
|
110
106
|
}
|
|
111
107
|
else {
|
|
112
108
|
// Get the graph token
|
|
113
|
-
getGraphToken().then(
|
|
109
|
+
getGraphToken().then(token => {
|
|
114
110
|
// Set the url
|
|
115
|
-
|
|
111
|
+
let authUrl = `${flowUrl}${flowInfo.properties.environment.id}/users/me/onBehalfOfTokenBundle?api-version=2016-11-01`;
|
|
116
112
|
// Get the graph token from SharePoint
|
|
117
|
-
new
|
|
113
|
+
new Base({
|
|
118
114
|
endpoint: authUrl,
|
|
119
115
|
method: "POST",
|
|
120
|
-
requestType:
|
|
116
|
+
requestType: RequestType.GraphPost,
|
|
121
117
|
requestHeader: {
|
|
122
118
|
"authorization": "bearer " + token
|
|
123
119
|
}
|
|
124
|
-
}).execute(
|
|
120
|
+
}).execute((tokenInfo) => {
|
|
125
121
|
// Resolve the request
|
|
126
122
|
resolveAuth(tokenInfo.audienceToToken["https://" + flowInfo.properties.connectionReferences.shared_sharepointonline.swagger.host] || token);
|
|
127
123
|
},
|
|
128
124
|
// Error
|
|
129
|
-
|
|
125
|
+
(ex) => {
|
|
130
126
|
// Resolve the request
|
|
131
127
|
resolve({
|
|
132
128
|
executed: false,
|
|
133
129
|
errorDetails: ex.response,
|
|
134
|
-
errorMessage:
|
|
130
|
+
errorMessage: `Auth Error: Unable to get the flow token for cloud: ${props.cloudEnv}`
|
|
135
131
|
});
|
|
136
132
|
});
|
|
137
133
|
});
|
|
@@ -139,18 +135,18 @@ exports.List.runFlow = function (props) {
|
|
|
139
135
|
});
|
|
140
136
|
};
|
|
141
137
|
// Get the flow information
|
|
142
|
-
|
|
138
|
+
Web(props.webUrl).Lists(props.list).syncFlowInstance(props.id).execute(
|
|
143
139
|
// Success
|
|
144
|
-
|
|
140
|
+
flow => {
|
|
145
141
|
// Get the flow information
|
|
146
|
-
|
|
142
|
+
let flowInfo = JSON.parse(flow.SynchronizationData);
|
|
147
143
|
if (flowInfo) {
|
|
148
144
|
// Get the flow token
|
|
149
|
-
getFlowToken(flowInfo).then(
|
|
145
|
+
getFlowToken(flowInfo).then(token => {
|
|
150
146
|
// Trigger the flow
|
|
151
|
-
new
|
|
147
|
+
new Base({
|
|
152
148
|
accessToken: token,
|
|
153
|
-
requestType:
|
|
149
|
+
requestType: RequestType.GraphPost,
|
|
154
150
|
endpoint: flowInfo.properties.flowTriggerUri,
|
|
155
151
|
data: {
|
|
156
152
|
rows: [{
|
|
@@ -159,7 +155,7 @@ exports.List.runFlow = function (props) {
|
|
|
159
155
|
}
|
|
160
156
|
}).execute(
|
|
161
157
|
// Success
|
|
162
|
-
|
|
158
|
+
() => {
|
|
163
159
|
// Resolve the request
|
|
164
160
|
resolve({
|
|
165
161
|
executed: true,
|
|
@@ -167,7 +163,7 @@ exports.List.runFlow = function (props) {
|
|
|
167
163
|
});
|
|
168
164
|
},
|
|
169
165
|
// Error
|
|
170
|
-
|
|
166
|
+
(ex) => {
|
|
171
167
|
// Resolve the request
|
|
172
168
|
resolve({
|
|
173
169
|
executed: false,
|
|
@@ -187,7 +183,7 @@ exports.List.runFlow = function (props) {
|
|
|
187
183
|
}
|
|
188
184
|
},
|
|
189
185
|
// Error
|
|
190
|
-
|
|
186
|
+
(ex) => {
|
|
191
187
|
// Resolve the request
|
|
192
188
|
resolve({
|
|
193
189
|
executed: false,
|
package/build/lib/navigation.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Navigation = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Navigation
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const Navigation = ((url, targetInfo) => {
|
|
6
|
+
let navigation = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
navigation.targetInfo.defaultToWebFl = true;
|
|
12
9
|
navigation.targetInfo.endpoint = "navigation";
|
|
@@ -16,7 +13,7 @@ exports.Navigation = (function (url, targetInfo) {
|
|
|
16
13
|
navigation.targetInfo.url = url;
|
|
17
14
|
}
|
|
18
15
|
// Add the methods
|
|
19
|
-
|
|
16
|
+
Request.addMethods(navigation, { __metadata: { type: "Microsoft.SharePoint.Navigation.REST.NavigationServiceRest" } });
|
|
20
17
|
// Return the navigation
|
|
21
18
|
return navigation;
|
|
22
19
|
});
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PeopleManager = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* People Manager
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const PeopleManager = ((targetInfo) => {
|
|
6
|
+
let peopleManager = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
peopleManager.targetInfo.defaultToWebFl = true;
|
|
12
9
|
peopleManager.targetInfo.endpoint = "sp.userprofiles.peoplemanager";
|
|
13
10
|
// Add the methods
|
|
14
|
-
|
|
11
|
+
Request.addMethods(peopleManager, { __metadata: { type: "SP.UserProfiles.PeopleManager" } });
|
|
15
12
|
// Return the people manager
|
|
16
13
|
return peopleManager;
|
|
17
14
|
});
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PeoplePicker = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* People Picker
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const PeoplePicker = ((targetInfo) => {
|
|
6
|
+
let peoplePicker = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
peoplePicker.targetInfo.defaultToWebFl = true;
|
|
12
9
|
peoplePicker.targetInfo.endpoint = "SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface";
|
|
13
10
|
peoplePicker.targetInfo.overrideDefaultRequestToHostFl = true;
|
|
14
11
|
// Add the methods
|
|
15
|
-
|
|
12
|
+
Request.addMethods(peoplePicker, { __metadata: { type: "peoplepicker" } });
|
|
16
13
|
// Return the people picker
|
|
17
14
|
return peoplePicker;
|
|
18
15
|
});
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProfileLoader = void 0;
|
|
4
|
-
var utils_1 = require("../utils");
|
|
1
|
+
import { Base, Request } from "../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Profile Loader
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const ProfileLoader = ((targetInfo) => {
|
|
6
|
+
let profileLoader = new Base(targetInfo);
|
|
10
7
|
// Default the properties
|
|
11
8
|
profileLoader.targetInfo.defaultToWebFl = true;
|
|
12
9
|
profileLoader.targetInfo.endpoint = "sp.userprofiles.profileloader.getprofileloader";
|
|
13
10
|
profileLoader.targetInfo.method = "POST";
|
|
14
11
|
// Add the methods
|
|
15
|
-
|
|
12
|
+
Request.addMethods(profileLoader, { __metadata: { type: "SP.UserProfiles.ProfileLoader" } });
|
|
16
13
|
// Return the profile loader
|
|
17
14
|
return profileLoader;
|
|
18
15
|
});
|