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,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContentType = void 0;
|
|
4
|
-
var lib_1 = require("../../lib");
|
|
1
|
+
import { Web } from "../../lib";
|
|
5
2
|
/**
|
|
6
3
|
* Creates a content type in a web or specified list.
|
|
7
4
|
* @param ctInfo - The content type information.
|
|
@@ -9,17 +6,17 @@ var lib_1 = require("../../lib");
|
|
|
9
6
|
* @param webUrl - The relative url to create the content type in.
|
|
10
7
|
* @param listName - The list name to add the content type to. If blank, it will add it to the web content types.
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const createContentType = (props) => {
|
|
13
10
|
// Return a promise
|
|
14
|
-
return new Promise(
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
15
12
|
// See if we are targeting a list
|
|
16
13
|
if (props.listName) {
|
|
17
14
|
// Process the request
|
|
18
|
-
|
|
15
|
+
Web.processQuery(ListTemplate(props.listName, props.ctInfo, props.parentContentTypeId), props.webUrl).then(() => {
|
|
19
16
|
// Get the content type and resolve the request
|
|
20
|
-
|
|
17
|
+
Web(props.webUrl).Lists(props.listName).ContentTypes().query({
|
|
21
18
|
Filter: "Name eq '" + props.ctInfo.Name + "'"
|
|
22
|
-
}).execute(
|
|
19
|
+
}).execute(cts => {
|
|
23
20
|
// Resolve the request
|
|
24
21
|
resolve(cts.results[0]);
|
|
25
22
|
}, reject);
|
|
@@ -27,11 +24,11 @@ var createContentType = function (props) {
|
|
|
27
24
|
}
|
|
28
25
|
else {
|
|
29
26
|
// Process the request
|
|
30
|
-
|
|
27
|
+
Web.processQuery(WebTemplate(props.ctInfo, props.parentContentTypeId), props.webUrl).then(() => {
|
|
31
28
|
// Get the content type and resolve the request
|
|
32
|
-
|
|
29
|
+
Web(props.webUrl).ContentTypes().query({
|
|
33
30
|
Filter: "Name eq '" + props.ctInfo.Name + "'"
|
|
34
|
-
}).execute(
|
|
31
|
+
}).execute(cts => {
|
|
35
32
|
// Resolve the request
|
|
36
33
|
resolve(cts.results[0]);
|
|
37
34
|
}, reject);
|
|
@@ -39,14 +36,94 @@ var createContentType = function (props) {
|
|
|
39
36
|
}
|
|
40
37
|
});
|
|
41
38
|
};
|
|
42
|
-
exports.createContentType = createContentType;
|
|
43
39
|
// List Template
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const ListTemplate = (listName, ctInfo, parentId = "0x01") => {
|
|
41
|
+
return `<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="Javascript Library">
|
|
42
|
+
<Actions>
|
|
43
|
+
<ObjectPath Id="1" ObjectPathId="0" />
|
|
44
|
+
<ObjectPath Id="3" ObjectPathId="2" />
|
|
45
|
+
<ObjectPath Id="5" ObjectPathId="4" />
|
|
46
|
+
<ObjectPath Id="7" ObjectPathId="6" />
|
|
47
|
+
<ObjectPath Id="9" ObjectPathId="8" />
|
|
48
|
+
<ObjectPath Id="11" ObjectPathId="10" />
|
|
49
|
+
<ObjectIdentityQuery Id="12" ObjectPathId="10" />
|
|
50
|
+
<ObjectPath Id="14" ObjectPathId="13" />
|
|
51
|
+
<ObjectPath Id="16" ObjectPathId="15" />
|
|
52
|
+
<ObjectIdentityQuery Id="17" ObjectPathId="15" />
|
|
53
|
+
<Query Id="18" ObjectPathId="13">
|
|
54
|
+
<Query SelectAllProperties="true">
|
|
55
|
+
<Properties />
|
|
56
|
+
</Query>
|
|
57
|
+
<ChildItemQuery SelectAllProperties="true">
|
|
58
|
+
<Properties />
|
|
59
|
+
</ChildItemQuery>
|
|
60
|
+
</Query>
|
|
61
|
+
</Actions>
|
|
62
|
+
<ObjectPaths>
|
|
63
|
+
<StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
|
|
64
|
+
<Property Id="2" ParentId="0" Name="Web" />
|
|
65
|
+
<Property Id="4" ParentId="2" Name="ContentTypes" />
|
|
66
|
+
<Method Id="6" ParentId="4" Name="GetById">
|
|
67
|
+
<Parameters>
|
|
68
|
+
<Parameter Type="String">${parentId}</Parameter>
|
|
69
|
+
</Parameters>
|
|
70
|
+
</Method>
|
|
71
|
+
<Property Id="8" ParentId="2" Name="Lists" />
|
|
72
|
+
<Method Id="10" ParentId="8" Name="GetByTitle">
|
|
73
|
+
<Parameters>
|
|
74
|
+
<Parameter Type="String">${listName}</Parameter>
|
|
75
|
+
</Parameters>
|
|
76
|
+
</Method>
|
|
77
|
+
<Property Id="13" ParentId="10" Name="ContentTypes" />
|
|
78
|
+
<Method Id="15" ParentId="13" Name="Add">
|
|
79
|
+
<Parameters>
|
|
80
|
+
<Parameter TypeId="{168f3091-4554-4f14-8866-b20d48e45b54}">
|
|
81
|
+
<Property Name="Description" Type="${ctInfo.Description ? "String" : "Null"}">${ctInfo.Description || ""}</Property>
|
|
82
|
+
<Property Name="Group" Type="${ctInfo.Group ? "String" : "Null"}">${ctInfo.Group || ""}</Property>
|
|
83
|
+
<Property Name="Id" Type="Null" />
|
|
84
|
+
<Property Name="Name" Type="String">${ctInfo.Name || ""}</Property>
|
|
85
|
+
<Property Name="ParentContentType" ObjectPathId="6" />
|
|
86
|
+
</Parameter>
|
|
87
|
+
</Parameters>
|
|
88
|
+
</Method>
|
|
89
|
+
</ObjectPaths>
|
|
90
|
+
</Request>`;
|
|
47
91
|
};
|
|
48
92
|
// Web Template
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
93
|
+
const WebTemplate = (ctInfo, parentId = "0x01") => {
|
|
94
|
+
return `<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="Javascript Library">
|
|
95
|
+
<Actions>
|
|
96
|
+
<ObjectPath Id="26" ObjectPathId="25" />
|
|
97
|
+
<ObjectIdentityQuery Id="27" ObjectPathId="25" />
|
|
98
|
+
<Query Id="28" ObjectPathId="4">
|
|
99
|
+
<Query SelectAllProperties="true">
|
|
100
|
+
<Properties />
|
|
101
|
+
</Query>
|
|
102
|
+
<ChildItemQuery SelectAllProperties="true">
|
|
103
|
+
<Properties />
|
|
104
|
+
</ChildItemQuery>
|
|
105
|
+
</Query>
|
|
106
|
+
</Actions>
|
|
107
|
+
<ObjectPaths>
|
|
108
|
+
<Property Id="4" ParentId="2" Name="ContentTypes" />
|
|
109
|
+
<Method Id="25" ParentId="4" Name="Add">
|
|
110
|
+
<Parameters>
|
|
111
|
+
<Parameter TypeId="{168f3091-4554-4f14-8866-b20d48e45b54}">
|
|
112
|
+
<Property Name="Description" Type="${ctInfo.Description ? "String" : "Null"}">${ctInfo.Description || ""}</Property>
|
|
113
|
+
<Property Name="Group" Type="${ctInfo.Group ? "String" : "Null"}">${ctInfo.Group || ""}</Property>
|
|
114
|
+
<Property Name="Id" Type="Null" />
|
|
115
|
+
<Property Name="Name" Type="String">${ctInfo.Name || ""}</Property>
|
|
116
|
+
<Property Name="ParentContentType" ObjectPathId="6" />
|
|
117
|
+
</Parameter>
|
|
118
|
+
</Parameters>
|
|
119
|
+
</Method>
|
|
120
|
+
<Property Id="2" ParentId="0" Name="Web" />
|
|
121
|
+
<Method Id="6" ParentId="4" Name="GetById">
|
|
122
|
+
<Parameters>
|
|
123
|
+
<Parameter Type="String">${parentId}</Parameter>
|
|
124
|
+
</Parameters>
|
|
125
|
+
</Method>
|
|
126
|
+
<StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
|
|
127
|
+
</ObjectPaths>
|
|
128
|
+
</Request>`;
|
|
52
129
|
};
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.createDocSet = void 0;
|
|
4
|
-
var lib_1 = require("../../lib");
|
|
5
|
-
var request_1 = require("./request");
|
|
1
|
+
import { Web } from "../../lib";
|
|
2
|
+
import { request } from "./request";
|
|
6
3
|
/**
|
|
7
4
|
* Creates a document set item.
|
|
8
5
|
* @param name - The name of the document set folder to create.
|
|
9
6
|
* @param listName - The name of the document set library.
|
|
10
7
|
* @param webUrl - The url of the web containing the document set library.
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const createDocSet = (name, listName, webUrl) => {
|
|
13
10
|
// Return a promise
|
|
14
|
-
return new Promise(
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
15
12
|
// Get the document set's root folder
|
|
16
|
-
|
|
13
|
+
Web(webUrl).Lists(listName).query({ Expand: ["ContentTypes", "ParentWeb", "RootFolder"] }).execute(list => {
|
|
17
14
|
// Parse the content types
|
|
18
|
-
|
|
19
|
-
for (
|
|
15
|
+
let ctId = "0x0120D520";
|
|
16
|
+
for (let i = 0; i < list.ContentTypes.results.length; i++) {
|
|
20
17
|
// See if this is the document set content type
|
|
21
18
|
if (list.ContentTypes.results[i].StringId.indexOf(ctId) == 0) {
|
|
22
19
|
// Set the content type id
|
|
@@ -25,7 +22,7 @@ var createDocSet = function (name, listName, webUrl) {
|
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
// Create the document set item
|
|
28
|
-
|
|
25
|
+
request({
|
|
29
26
|
method: "POST",
|
|
30
27
|
url: list.ParentWebUrl + "/_vti_bin/listdata.svc/" + list.Title.replace(/ /g, ""),
|
|
31
28
|
headers: {
|
|
@@ -38,11 +35,11 @@ var createDocSet = function (name, listName, webUrl) {
|
|
|
38
35
|
Title: name,
|
|
39
36
|
Path: list.RootFolder.ServerRelativeUrl
|
|
40
37
|
}
|
|
41
|
-
}).then(
|
|
38
|
+
}).then(response => {
|
|
42
39
|
// See if the request was successful
|
|
43
40
|
if (response.d && response.d.Id > 0) {
|
|
44
41
|
// Get the document set item and resolve the promise
|
|
45
|
-
|
|
42
|
+
Web(webUrl).Lists(listName).Items(response.d.Id).execute(resolve);
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
45
|
// Reject the promise
|
|
@@ -52,4 +49,3 @@ var createDocSet = function (name, listName, webUrl) {
|
|
|
52
49
|
}, reject);
|
|
53
50
|
});
|
|
54
51
|
};
|
|
55
|
-
exports.createDocSet = createDocSet;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCurrentTheme = void 0;
|
|
4
|
-
var lib_1 = require("../../lib");
|
|
1
|
+
import { Site, Web } from "../../lib";
|
|
5
2
|
/**
|
|
6
3
|
* Determines if the user has permissions, based on the permission kind value
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const getCurrentTheme = () => {
|
|
9
6
|
// Return a promise
|
|
10
|
-
return new Promise(
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
11
8
|
// Wait for the modern theme information to be loaded
|
|
12
9
|
waitForModernTheme().then(
|
|
13
10
|
// Success
|
|
14
|
-
|
|
11
|
+
() => {
|
|
15
12
|
// Resolve the request with the theme information
|
|
16
13
|
resolve(window["__themeState__"].theme);
|
|
17
14
|
},
|
|
18
15
|
// Error
|
|
19
|
-
|
|
16
|
+
() => {
|
|
20
17
|
// Get the current theme info
|
|
21
|
-
|
|
18
|
+
Web().Lists("Composed Looks").Items().query({
|
|
22
19
|
Filter: "DisplayOrder eq 0 or Title eq 'Office'",
|
|
23
20
|
OrderBy: ["DisplayOrder"],
|
|
24
21
|
Select: ["DisplayOrder", "MasterPageUrl", "ThemeUrl", "Title"]
|
|
25
|
-
}).execute(
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
}).execute(items => {
|
|
23
|
+
let currentItem = items.results[0];
|
|
24
|
+
let defaultItem = items.results[1];
|
|
28
25
|
// See if the current theme info exists
|
|
29
26
|
if (currentItem && currentItem["ThemeUrl"]) {
|
|
30
27
|
// Get the theme information
|
|
@@ -42,31 +39,29 @@ var getCurrentTheme = function () {
|
|
|
42
39
|
});
|
|
43
40
|
});
|
|
44
41
|
};
|
|
45
|
-
exports.getCurrentTheme = getCurrentTheme;
|
|
46
42
|
// Gets the theme information for a color palette
|
|
47
|
-
|
|
48
|
-
if (url === void 0) { url = ""; }
|
|
43
|
+
const getThemeInfo = (url = "") => {
|
|
49
44
|
// Return a promise
|
|
50
|
-
return new Promise(
|
|
51
|
-
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
let themeInfo = {};
|
|
52
47
|
// Ensure the url exists
|
|
53
48
|
if (url.length == 0) {
|
|
54
49
|
resolve(themeInfo);
|
|
55
50
|
return;
|
|
56
51
|
}
|
|
57
52
|
// Get the file item
|
|
58
|
-
|
|
53
|
+
Site().RootWeb().getFileByUrl(url).execute(file => {
|
|
59
54
|
// Read the contents
|
|
60
|
-
file.content().execute(
|
|
55
|
+
file.content().execute(contents => {
|
|
61
56
|
// Convert the xml
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
let parser = new DOMParser();
|
|
58
|
+
let xmlDoc = parser.parseFromString(String.fromCharCode.apply(null, new Uint8Array(contents)), "text/xml");
|
|
64
59
|
// Get the colors and parse them
|
|
65
|
-
|
|
66
|
-
for (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
let colors = xmlDoc.getElementsByTagName("s:color");
|
|
61
|
+
for (let i = 0; i < colors.length; i++) {
|
|
62
|
+
let color = colors[i];
|
|
63
|
+
let key = color.getAttribute("name");
|
|
64
|
+
let value = color.getAttribute("value");
|
|
70
65
|
// See if the length is > 6 characters
|
|
71
66
|
if (value.length > 6) {
|
|
72
67
|
// Convert the value
|
|
@@ -82,11 +77,11 @@ var getThemeInfo = function (url) {
|
|
|
82
77
|
});
|
|
83
78
|
};
|
|
84
79
|
// Waits for the modern theme information to be loaded
|
|
85
|
-
|
|
80
|
+
const waitForModernTheme = () => {
|
|
86
81
|
// Return a promise
|
|
87
|
-
return new Promise(
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
let counter = 0;
|
|
84
|
+
let maxAttempts = 100;
|
|
90
85
|
// See if the modern theme exists
|
|
91
86
|
if (window["__themeState__"] != null && window["__themeState__"].theme != null) {
|
|
92
87
|
// Theme is loaded
|
|
@@ -94,7 +89,7 @@ var waitForModernTheme = function () {
|
|
|
94
89
|
return;
|
|
95
90
|
}
|
|
96
91
|
// Wait for the theme to be loaded
|
|
97
|
-
|
|
92
|
+
let loopId = setInterval(() => {
|
|
98
93
|
// See if the modern theme exists
|
|
99
94
|
if (window["__themeState__"] != null && window["__themeState__"].theme != null) {
|
|
100
95
|
// Stop the loop
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasPermissions = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Determines if the user has permissions, based on the permission kind value
|
|
6
3
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var hasPermissions = true;
|
|
4
|
+
export const hasPermissions = (permissionMask, permissions = []) => {
|
|
5
|
+
let hasPermissions = true;
|
|
10
6
|
// Set the permissions
|
|
11
|
-
|
|
7
|
+
let requestedPermissions = typeof (permissions) === "number" ? [permissions] : permissions;
|
|
12
8
|
// Parse the requested permissions
|
|
13
|
-
for (
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
for (let i = 0; i < requestedPermissions.length; i++) {
|
|
10
|
+
let permission = requestedPermissions[i];
|
|
11
|
+
let hasPermission = false;
|
|
16
12
|
// Use the logic from SP.js
|
|
17
13
|
if (permission === 65) {
|
|
18
14
|
hasPermission = (permissionMask.High & 32767) === 32767 && permissionMask.Low === 65535;
|
|
19
15
|
}
|
|
20
16
|
else {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
let a = permission - 1;
|
|
18
|
+
let b = 1;
|
|
23
19
|
if (a >= 0 && a < 32) {
|
|
24
20
|
b = b << a;
|
|
25
21
|
hasPermission = 0 !== (permissionMask.Low & b);
|
|
@@ -42,4 +38,3 @@ var hasPermissions = function (permissionMask, permissions) {
|
|
|
42
38
|
// Return the result
|
|
43
39
|
return hasPermissions;
|
|
44
40
|
};
|
|
45
|
-
exports.hasPermissions = hasPermissions;
|
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__exportStar(require("./addContentEditorWebPart"), exports);
|
|
18
|
-
__exportStar(require("./addPermissionLevel"), exports);
|
|
19
|
-
__exportStar(require("./addScriptEditorWebPart"), exports);
|
|
20
|
-
__exportStar(require("./copyPermissionLevel"), exports);
|
|
21
|
-
__exportStar(require("./createContentType"), exports);
|
|
22
|
-
__exportStar(require("./createDocSet"), exports);
|
|
23
|
-
__exportStar(require("./getCurrentTheme"), exports);
|
|
24
|
-
__exportStar(require("./hasPermissions"), exports);
|
|
25
|
-
__exportStar(require("./loadSPCore"), exports);
|
|
26
|
-
__exportStar(require("./parse"), exports);
|
|
27
|
-
__exportStar(require("./request"), exports);
|
|
28
|
-
__exportStar(require("./setContentTypeFields"), exports);
|
|
29
|
-
__exportStar(require("./setGroupOwner"), exports);
|
|
30
|
-
__exportStar(require("./setWebProperty"), exports);
|
|
31
|
-
__exportStar(require("./stringify"), exports);
|
|
32
|
-
__exportStar(require("./webWorker"), exports);
|
|
1
|
+
export * from "./addContentEditorWebPart";
|
|
2
|
+
export * from "./addPermissionLevel";
|
|
3
|
+
export * from "./addScriptEditorWebPart";
|
|
4
|
+
export * from "./copyPermissionLevel";
|
|
5
|
+
export * from "./createContentType";
|
|
6
|
+
export * from "./createDocSet";
|
|
7
|
+
export * from "./getCurrentTheme";
|
|
8
|
+
export * from "./hasPermissions";
|
|
9
|
+
export * from "./loadSPCore";
|
|
10
|
+
export * from "./parse";
|
|
11
|
+
export * from "./request";
|
|
12
|
+
export * from "./setContentTypeFields";
|
|
13
|
+
export * from "./setGroupOwner";
|
|
14
|
+
export * from "./setWebProperty";
|
|
15
|
+
export * from "./stringify";
|
|
16
|
+
export * from "./webWorker";
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadSPCore = void 0;
|
|
4
|
-
var executor_1 = require("../executor");
|
|
1
|
+
import { Executor } from "../executor";
|
|
5
2
|
/**
|
|
6
3
|
* Loads the core SharePoint JavaScript library for JSOM.
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const loadSPCore = (additionalLibs) => {
|
|
9
6
|
// Return a promise
|
|
10
|
-
return new Promise(
|
|
7
|
+
return new Promise((resolve) => {
|
|
11
8
|
// Define the core libraries to load
|
|
12
|
-
|
|
9
|
+
let libs = ["init", "MicrosoftAjax", "SP.Runtime", "SP", "SP.Init"];
|
|
13
10
|
// See if we are loading additional libraries
|
|
14
11
|
if (additionalLibs && additionalLibs.length > 0) {
|
|
15
12
|
// Append the libs
|
|
16
13
|
libs = libs.concat(additionalLibs);
|
|
17
14
|
}
|
|
18
15
|
// Parse the libraries
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
let counter = 0;
|
|
17
|
+
Executor(libs, libName => {
|
|
21
18
|
// Return a promise
|
|
22
|
-
return new Promise(
|
|
19
|
+
return new Promise(resolve => {
|
|
23
20
|
// See if a script already exists
|
|
24
21
|
if (document.querySelector("script[title='" + libName + "']") == null) {
|
|
25
22
|
// Log
|
|
26
23
|
console.debug("[gd-sprest] Loading the core library: " + libName);
|
|
27
24
|
// Create the script element to load the library
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
let elScript = document.createElement("script");
|
|
26
|
+
elScript.title = libName;
|
|
27
|
+
elScript.src = document.location.origin + "/_layouts/15/" + libName + ".js";
|
|
31
28
|
// Wait for the previous library to load
|
|
32
|
-
setTimeout(
|
|
29
|
+
setTimeout(() => {
|
|
33
30
|
// Load the script
|
|
34
|
-
document.head.appendChild(
|
|
31
|
+
document.head.appendChild(elScript);
|
|
35
32
|
// Resolve the request
|
|
36
33
|
resolve(null);
|
|
37
34
|
}, 10 * counter++);
|
|
@@ -40,11 +37,10 @@ var loadSPCore = function (additionalLibs) {
|
|
|
40
37
|
// Log
|
|
41
38
|
console.debug("[gd-sprest] Core library already loaded: " + libName);
|
|
42
39
|
}
|
|
43
|
-
}).then(
|
|
40
|
+
}).then(() => {
|
|
44
41
|
// Resolve the request after all the libraries have been requested
|
|
45
42
|
resolve();
|
|
46
43
|
});
|
|
47
44
|
});
|
|
48
45
|
});
|
|
49
46
|
};
|
|
50
|
-
exports.loadSPCore = loadSPCore;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = void 0;
|
|
4
|
-
var utils_1 = require("../../utils");
|
|
1
|
+
import { Base, Request } from "../../utils";
|
|
5
2
|
/**
|
|
6
3
|
* Convert a JSON string to a base object
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const parse = (jsonString) => {
|
|
9
6
|
// Try to parse the string
|
|
10
7
|
try {
|
|
11
|
-
|
|
8
|
+
let obj = JSON.parse(jsonString);
|
|
12
9
|
// Create a base object
|
|
13
|
-
|
|
10
|
+
let base = new Base(obj.props);
|
|
14
11
|
// Set the properties
|
|
15
12
|
base.response = obj.response;
|
|
16
13
|
base.status = obj.status;
|
|
17
14
|
base.targetInfo = obj.targetInfo;
|
|
18
15
|
// Update the object
|
|
19
|
-
|
|
16
|
+
Request.updateDataObject(base, false);
|
|
20
17
|
// Return the base object
|
|
21
18
|
return base;
|
|
22
19
|
}
|
|
23
20
|
catch (_a) { }
|
|
24
21
|
return null;
|
|
25
22
|
};
|
|
26
|
-
exports.parse = parse;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.request = void 0;
|
|
4
|
-
var utils_1 = require("../../utils");
|
|
1
|
+
import { Base } from "../../utils";
|
|
5
2
|
/**
|
|
6
3
|
* XML HTTP Request
|
|
7
4
|
*/
|
|
8
|
-
|
|
5
|
+
export const request = (props) => {
|
|
9
6
|
// Return a promise
|
|
10
|
-
return new Promise(
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
11
8
|
// Execute the request and resolve the promise
|
|
12
|
-
(new
|
|
9
|
+
(new Base({
|
|
13
10
|
method: props.method || "GET",
|
|
14
11
|
url: props.url,
|
|
15
12
|
requestHeader: props.headers,
|
|
@@ -17,4 +14,3 @@ var request = function (props) {
|
|
|
17
14
|
})).execute(resolve, reject);
|
|
18
15
|
});
|
|
19
16
|
};
|
|
20
|
-
exports.request = request;
|