@kwiz/common 1.0.150 → 1.0.151
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/.mocharc.js +12 -0
- package/lib/cjs/_dependencies.js +2 -2
- package/lib/cjs/_dependencies.js.map +1 -1
- package/lib/cjs/config.js +1 -2
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/helpers/base64.js +7 -8
- package/lib/cjs/helpers/base64.js.map +1 -1
- package/lib/cjs/helpers/browser.js +80 -93
- package/lib/cjs/helpers/browser.js.map +1 -1
- package/lib/cjs/helpers/browserinfo.js +10 -5
- package/lib/cjs/helpers/browserinfo.js.map +1 -1
- package/lib/cjs/helpers/collections.base.js +33 -34
- package/lib/cjs/helpers/collections.base.js.map +1 -1
- package/lib/cjs/helpers/collections.js +3 -4
- package/lib/cjs/helpers/collections.js.map +1 -1
- package/lib/cjs/helpers/color.js +3 -4
- package/lib/cjs/helpers/color.js.map +1 -1
- package/lib/cjs/helpers/cookies.js +5 -6
- package/lib/cjs/helpers/cookies.js.map +1 -1
- package/lib/cjs/helpers/date.js +17 -17
- package/lib/cjs/helpers/date.js.map +1 -1
- package/lib/cjs/helpers/debug.js +7 -8
- package/lib/cjs/helpers/debug.js.map +1 -1
- package/lib/cjs/helpers/emails.js +2 -2
- package/lib/cjs/helpers/emails.js.map +1 -1
- package/lib/cjs/helpers/eval.js +1 -2
- package/lib/cjs/helpers/eval.js.map +1 -1
- package/lib/cjs/helpers/file.js +4 -4
- package/lib/cjs/helpers/file.js.map +1 -1
- package/lib/cjs/helpers/flatted.js +2 -2
- package/lib/cjs/helpers/flatted.js.map +1 -1
- package/lib/cjs/helpers/functions.js +1 -2
- package/lib/cjs/helpers/functions.js.map +1 -1
- package/lib/cjs/helpers/graph/calendar.types.js +2 -3
- package/lib/cjs/helpers/graph/calendar.types.js.map +1 -1
- package/lib/cjs/helpers/http.js +3 -3
- package/lib/cjs/helpers/http.js.map +1 -1
- package/lib/cjs/helpers/json.js +3 -4
- package/lib/cjs/helpers/json.js.map +1 -1
- package/lib/cjs/helpers/md5.js +5 -2
- package/lib/cjs/helpers/md5.js.map +1 -1
- package/lib/cjs/helpers/objects.js +16 -16
- package/lib/cjs/helpers/objects.js.map +1 -1
- package/lib/cjs/helpers/promises.js +8 -9
- package/lib/cjs/helpers/promises.js.map +1 -1
- package/lib/cjs/helpers/random.js +2 -3
- package/lib/cjs/helpers/random.js.map +1 -1
- package/lib/cjs/helpers/scheduler/scheduler.js +4 -4
- package/lib/cjs/helpers/scheduler/scheduler.js.map +1 -1
- package/lib/cjs/helpers/sharepoint.js +53 -55
- package/lib/cjs/helpers/sharepoint.js.map +1 -1
- package/lib/cjs/helpers/strings.js +29 -30
- package/lib/cjs/helpers/strings.js.map +1 -1
- package/lib/cjs/helpers/typecheckers.js +36 -36
- package/lib/cjs/helpers/typecheckers.js.map +1 -1
- package/lib/cjs/helpers/url.js +14 -15
- package/lib/cjs/helpers/url.js.map +1 -1
- package/lib/cjs/utils/auth/common.js +11 -10
- package/lib/cjs/utils/auth/common.js.map +1 -1
- package/lib/cjs/utils/auth/discovery.js +4 -5
- package/lib/cjs/utils/auth/discovery.js.map +1 -1
- package/lib/cjs/utils/base64.js +1 -2
- package/lib/cjs/utils/base64.js.map +1 -1
- package/lib/cjs/utils/date.js +2 -3
- package/lib/cjs/utils/date.js.map +1 -1
- package/lib/cjs/utils/emails.js +1 -2
- package/lib/cjs/utils/emails.js.map +1 -1
- package/lib/cjs/utils/localstoragecache.js +8 -8
- package/lib/cjs/utils/localstoragecache.js.map +1 -1
- package/lib/cjs/utils/rest.js +52 -42
- package/lib/cjs/utils/rest.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/common.js +32 -27
- package/lib/cjs/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/date.js +8 -6
- package/lib/cjs/utils/sharepoint.rest/date.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/file.folder.js +28 -29
- package/lib/cjs/utils/sharepoint.rest/file.folder.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/item.js +33 -32
- package/lib/cjs/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/list.js +116 -72
- package/lib/cjs/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +1 -2
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsById.js +2 -3
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/common.js +2 -2
- package/lib/cjs/utils/sharepoint.rest/listutils/common.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/location.js +2 -3
- package/lib/cjs/utils/sharepoint.rest/location.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/navigation-links.js +3 -4
- package/lib/cjs/utils/sharepoint.rest/navigation-links.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/user.js +26 -27
- package/lib/cjs/utils/sharepoint.rest/user.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/web.js +109 -73
- package/lib/cjs/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/esm/helpers/browser.js +8 -20
- package/lib/esm/helpers/browser.js.map +1 -1
- package/lib/esm/helpers/browserinfo.js +5 -1
- package/lib/esm/helpers/browserinfo.js.map +1 -1
- package/lib/esm/helpers/md5.js +4 -0
- package/lib/esm/helpers/md5.js.map +1 -1
- package/lib/esm/helpers/sharepoint.js +8 -10
- package/lib/esm/helpers/sharepoint.js.map +1 -1
- package/lib/esm/helpers/typecheckers.js +1 -1
- package/lib/esm/helpers/typecheckers.js.map +1 -1
- package/lib/esm/utils/auth/common.js +7 -5
- package/lib/esm/utils/auth/common.js.map +1 -1
- package/lib/esm/utils/rest.js +48 -38
- package/lib/esm/utils/rest.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/common.js +20 -16
- package/lib/esm/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/date.js +7 -4
- package/lib/esm/utils/sharepoint.rest/date.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/item.js +7 -6
- package/lib/esm/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/list.js +57 -13
- package/lib/esm/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/web.js +46 -9
- package/lib/esm/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/types/helpers/browser.d.ts +1 -1
- package/lib/types/helpers/browserinfo.d.ts +1 -0
- package/lib/types/helpers/sharepoint.d.ts +1 -1
- package/lib/types/utils/sharepoint.rest/common.d.ts +2 -0
- package/lib/types/utils/sharepoint.rest/item.d.ts +4 -1
- package/lib/types/utils/sharepoint.rest/list.d.ts +11 -2
- package/lib/types/utils/sharepoint.rest/web.d.ts +3 -1
- package/package.json +12 -3
- package/test/auth.ts +31 -0
- package/test/hooks.ts +181 -0
- package/test/readme.md +61 -0
- package/test/sp/files-folders.ts +258 -0
- package/test/sp/items.ts +295 -0
- package/test/sp/lists.ts +679 -0
- package/test/sp/users.ts +57 -0
- package/test/sp/webs.ts +43 -0
|
@@ -1,7 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.GetSiteInfo = GetSiteInfo;
|
|
4
|
+
exports.GetSiteInfoSync = GetSiteInfoSync;
|
|
5
|
+
exports.GetTenantId = GetTenantId;
|
|
6
|
+
exports.GetPortalUrl = GetPortalUrl;
|
|
7
|
+
exports.GetSiteId = GetSiteId;
|
|
8
|
+
exports.GetSiteIdSync = GetSiteIdSync;
|
|
9
|
+
exports.GetRootWebInfo = GetRootWebInfo;
|
|
10
|
+
exports.GetWebTitle = GetWebTitle;
|
|
11
|
+
exports.GetWebId = GetWebId;
|
|
12
|
+
exports.GetWebIdSync = GetWebIdSync;
|
|
13
|
+
exports.IsRootWeb = IsRootWeb;
|
|
14
|
+
exports.UserHasAllPermissions = UserHasAllPermissions;
|
|
15
|
+
exports.UserHasManageSitePermissions = UserHasManageSitePermissions;
|
|
16
|
+
exports.GetContentTypes = GetContentTypes;
|
|
17
|
+
exports.GetContentTypesSync = GetContentTypesSync;
|
|
18
|
+
exports.GetLists = GetLists;
|
|
19
|
+
exports.GetListsSync = GetListsSync;
|
|
20
|
+
exports.GetAllSubWebs = GetAllSubWebs;
|
|
21
|
+
exports.__getSubSites = __getSubSites;
|
|
22
|
+
exports.GetWebInfo = GetWebInfo;
|
|
23
|
+
exports.GetWebInfoSync = GetWebInfoSync;
|
|
24
|
+
exports.GetWebRoleDefinitions = GetWebRoleDefinitions;
|
|
25
|
+
exports.GetRoleAssignments = GetRoleAssignments;
|
|
26
|
+
exports.GetSubWebs = GetSubWebs;
|
|
27
|
+
exports.GetAppTiles = GetAppTiles;
|
|
28
|
+
exports.GetAppTilesSync = GetAppTilesSync;
|
|
29
|
+
exports.GetServerTimeZone = GetServerTimeZone;
|
|
30
|
+
exports.GetServerTimeZoneSync = GetServerTimeZoneSync;
|
|
31
|
+
exports.SPServerLocalTimeToUTCDate = SPServerLocalTimeToUTCDate;
|
|
32
|
+
exports.SPServerLocalTimeToUTCDateSync = SPServerLocalTimeToUTCDateSync;
|
|
33
|
+
exports.SPServerLocalTimeToUTC = SPServerLocalTimeToUTC;
|
|
34
|
+
exports.SPServerLocalTimeToUTCSync = SPServerLocalTimeToUTCSync;
|
|
35
|
+
exports.UTCToSPServerLocalTime = UTCToSPServerLocalTime;
|
|
36
|
+
exports.UTCToSPServerLocalTimeSync = UTCToSPServerLocalTimeSync;
|
|
37
|
+
exports.SPServerLocalTimeSync = SPServerLocalTimeSync;
|
|
38
|
+
exports.SPServerLocalTime = SPServerLocalTime;
|
|
39
|
+
exports.SPServerLocalToday = SPServerLocalToday;
|
|
40
|
+
exports.GetContextWebInformationSync = GetContextWebInformationSync;
|
|
41
|
+
exports.GetContextWebInformation = GetContextWebInformation;
|
|
42
|
+
exports.GetUserCustomActions = GetUserCustomActions;
|
|
43
|
+
exports.GetUserCustomActionById = GetUserCustomActionById;
|
|
44
|
+
exports.GetUserCustomActionByName = GetUserCustomActionByName;
|
|
45
|
+
exports.AddUserCustomAction = AddUserCustomAction;
|
|
46
|
+
exports.UpdateUserCustomAction = UpdateUserCustomAction;
|
|
47
|
+
exports.DeleteUserCustomAction = DeleteUserCustomAction;
|
|
48
|
+
exports.GetRegionalSettings = GetRegionalSettings;
|
|
49
|
+
exports.GetAllWebProperties = GetAllWebProperties;
|
|
50
|
+
exports.GetWebPropertyByName = GetWebPropertyByName;
|
|
51
|
+
exports.getFormDigest = getFormDigest;
|
|
52
|
+
exports.ensureLegacyProps = ensureLegacyProps;
|
|
53
|
+
exports.WebHasUniquePermissions = WebHasUniquePermissions;
|
|
54
|
+
exports.RestoreWebPermissionInheritance = RestoreWebPermissionInheritance;
|
|
55
|
+
exports.BreakWebPermissionInheritance = BreakWebPermissionInheritance;
|
|
56
|
+
exports.AssignWebPermission = AssignWebPermission;
|
|
57
|
+
exports.RemoveWebPermission = RemoveWebPermission;
|
|
58
|
+
exports.SetUserAsSiteAdmin = SetUserAsSiteAdmin;
|
|
59
|
+
exports.GetAvailableTagsForSite = GetAvailableTagsForSite;
|
|
60
|
+
exports.GetAvailableTagsForSiteSync = GetAvailableTagsForSiteSync;
|
|
61
|
+
exports.GetActiveFeatures = GetActiveFeatures;
|
|
62
|
+
exports.ActivateFeature = ActivateFeature;
|
|
63
|
+
exports.DectivateFeature = DectivateFeature;
|
|
64
|
+
exports.GetWelcomePage = GetWelcomePage;
|
|
65
|
+
exports.SetWelcomePage = SetWelcomePage;
|
|
66
|
+
exports.GetWebAssociatedGroups = GetWebAssociatedGroups;
|
|
5
67
|
const collections_base_1 = require("../../helpers/collections.base");
|
|
6
68
|
const date_1 = require("../../helpers/date");
|
|
7
69
|
const json_1 = require("../../helpers/json");
|
|
@@ -36,7 +98,6 @@ async function GetSiteInfo(siteUrl) {
|
|
|
36
98
|
return null;
|
|
37
99
|
}
|
|
38
100
|
}
|
|
39
|
-
exports.GetSiteInfo = GetSiteInfo;
|
|
40
101
|
function GetSiteInfoSync(siteUrl) {
|
|
41
102
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
42
103
|
let result = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site?$select=id,serverRelativeUrl", null, { ...rest_1.longLocalCache });
|
|
@@ -47,7 +108,6 @@ function GetSiteInfoSync(siteUrl) {
|
|
|
47
108
|
}
|
|
48
109
|
return null;
|
|
49
110
|
}
|
|
50
|
-
exports.GetSiteInfoSync = GetSiteInfoSync;
|
|
51
111
|
function _getSiteIdFromContext(siteUrl) {
|
|
52
112
|
if ((0, common_1.hasGlobalContext)()) {
|
|
53
113
|
//issue 7295
|
|
@@ -83,12 +143,13 @@ function GetTenantId() {
|
|
|
83
143
|
}
|
|
84
144
|
return null;
|
|
85
145
|
}
|
|
86
|
-
exports.GetTenantId = GetTenantId;
|
|
87
146
|
/** Get tenant id lower case no {} */
|
|
88
147
|
function GetPortalUrl() {
|
|
89
|
-
|
|
148
|
+
if ((0, common_1.hasGlobalContext)()) {
|
|
149
|
+
return _spPageContextInfo.portalUrl;
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
90
152
|
}
|
|
91
|
-
exports.GetPortalUrl = GetPortalUrl;
|
|
92
153
|
/** Get site id lower case no {} */
|
|
93
154
|
async function GetSiteId(siteUrl) {
|
|
94
155
|
let siteId = _getSiteIdFromContext(siteUrl);
|
|
@@ -104,7 +165,6 @@ async function GetSiteId(siteUrl) {
|
|
|
104
165
|
return null;
|
|
105
166
|
});
|
|
106
167
|
}
|
|
107
|
-
exports.GetSiteId = GetSiteId;
|
|
108
168
|
/** Get site id lower case no {} */
|
|
109
169
|
function GetSiteIdSync(siteUrl) {
|
|
110
170
|
let siteId = _getSiteIdFromContext(siteUrl);
|
|
@@ -114,7 +174,6 @@ function GetSiteIdSync(siteUrl) {
|
|
|
114
174
|
let result = GetSiteInfoSync(siteUrl);
|
|
115
175
|
return !(0, typecheckers_1.isNullOrUndefined)(result) ? (0, strings_1.normalizeGuid)(result.Id) : null;
|
|
116
176
|
}
|
|
117
|
-
exports.GetSiteIdSync = GetSiteIdSync;
|
|
118
177
|
/** Get root web id lower case no {} */
|
|
119
178
|
function GetRootWebInfo(siteUrl) {
|
|
120
179
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -127,7 +186,6 @@ function GetRootWebInfo(siteUrl) {
|
|
|
127
186
|
})
|
|
128
187
|
.catch(() => null);
|
|
129
188
|
}
|
|
130
|
-
exports.GetRootWebInfo = GetRootWebInfo;
|
|
131
189
|
/** Return the web Title */
|
|
132
190
|
function GetWebTitle(siteUrl) {
|
|
133
191
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -137,7 +195,6 @@ function GetWebTitle(siteUrl) {
|
|
|
137
195
|
})
|
|
138
196
|
.catch(() => null);
|
|
139
197
|
}
|
|
140
|
-
exports.GetWebTitle = GetWebTitle;
|
|
141
198
|
function _getWebIdRequestUrl(siteUrl) {
|
|
142
199
|
return `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/Id`;
|
|
143
200
|
}
|
|
@@ -149,7 +206,6 @@ function GetWebId(siteUrl) {
|
|
|
149
206
|
})
|
|
150
207
|
.catch(() => null);
|
|
151
208
|
}
|
|
152
|
-
exports.GetWebId = GetWebId;
|
|
153
209
|
/** Return the web id */
|
|
154
210
|
function GetWebIdSync(siteUrl) {
|
|
155
211
|
let syncResult = (0, rest_1.GetJsonSync)(_getWebIdRequestUrl(siteUrl), null, { ...rest_1.longLocalCache });
|
|
@@ -158,7 +214,6 @@ function GetWebIdSync(siteUrl) {
|
|
|
158
214
|
else
|
|
159
215
|
return null;
|
|
160
216
|
}
|
|
161
|
-
exports.GetWebIdSync = GetWebIdSync;
|
|
162
217
|
/** Return the web id */
|
|
163
218
|
async function IsRootWeb(siteUrl) {
|
|
164
219
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -166,7 +221,6 @@ async function IsRootWeb(siteUrl) {
|
|
|
166
221
|
let rootWeb = await GetRootWebInfo(siteUrl);
|
|
167
222
|
return webId === rootWeb.Id;
|
|
168
223
|
}
|
|
169
|
-
exports.IsRootWeb = IsRootWeb;
|
|
170
224
|
function UserHasAllPermissions(siteUrl, permissions) {
|
|
171
225
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
172
226
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache })
|
|
@@ -178,7 +232,6 @@ function UserHasAllPermissions(siteUrl, permissions) {
|
|
|
178
232
|
})
|
|
179
233
|
.catch(() => null);
|
|
180
234
|
}
|
|
181
|
-
exports.UserHasAllPermissions = UserHasAllPermissions;
|
|
182
235
|
function UserHasManageSitePermissions(siteUrl) {
|
|
183
236
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
184
237
|
if (!(0, typecheckers_1.isTypeofFullNameNullOrUndefined)("_spPageContextInfo")) {
|
|
@@ -192,7 +245,6 @@ function UserHasManageSitePermissions(siteUrl) {
|
|
|
192
245
|
})
|
|
193
246
|
.catch(() => null);
|
|
194
247
|
}
|
|
195
|
-
exports.UserHasManageSitePermissions = UserHasManageSitePermissions;
|
|
196
248
|
function _getContentTypesRequestUrl(siteUrl, options = {}) {
|
|
197
249
|
const { fromRootWeb, includeFields, listIdOrTitle } = options;
|
|
198
250
|
let query = `$select=${includeFields === true ? common_1.CONTENT_TYPES_SELECT : common_1.CONTENT_TYPES_SELECT_WITH_FIELDS}${includeFields === true ? "&$expand=Fields" : ""}`;
|
|
@@ -246,7 +298,6 @@ async function GetContentTypes(siteUrl, options = {}, refreshCache = false) {
|
|
|
246
298
|
})
|
|
247
299
|
.catch(() => null);
|
|
248
300
|
}
|
|
249
|
-
exports.GetContentTypes = GetContentTypes;
|
|
250
301
|
function GetContentTypesSync(siteUrl, options = {}, refreshCache = false) {
|
|
251
302
|
let url = _getContentTypesRequestUrl(siteUrl, options);
|
|
252
303
|
let allListFields = null;
|
|
@@ -259,7 +310,6 @@ function GetContentTypesSync(siteUrl, options = {}, refreshCache = false) {
|
|
|
259
310
|
}
|
|
260
311
|
return null;
|
|
261
312
|
}
|
|
262
|
-
exports.GetContentTypesSync = GetContentTypesSync;
|
|
263
313
|
function _getListsRequestUrl(siteUrl, options) {
|
|
264
314
|
let select = common_1.LIST_SELECT;
|
|
265
315
|
let expand = common_1.LIST_EXPAND;
|
|
@@ -303,7 +353,6 @@ function GetLists(siteUrl, options = {}) {
|
|
|
303
353
|
})
|
|
304
354
|
.catch(() => []);
|
|
305
355
|
}
|
|
306
|
-
exports.GetLists = GetLists;
|
|
307
356
|
function GetListsSync(siteUrl, options = {}) {
|
|
308
357
|
let url = _getListsRequestUrl(siteUrl, options);
|
|
309
358
|
let response = (0, rest_1.GetJsonSync)(url, null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
@@ -312,7 +361,6 @@ function GetListsSync(siteUrl, options = {}) {
|
|
|
312
361
|
}
|
|
313
362
|
return [];
|
|
314
363
|
}
|
|
315
|
-
exports.GetListsSync = GetListsSync;
|
|
316
364
|
/**
|
|
317
365
|
* Get all sub webs. Results will be cached in memory and sorted
|
|
318
366
|
* @param siteUrl the starting URL you want to get the sites for
|
|
@@ -407,7 +455,7 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
407
455
|
}
|
|
408
456
|
if (queryFailed) {
|
|
409
457
|
// Igor: Issue #7702
|
|
410
|
-
if (_spPageContextInfo && _spPageContextInfo.siteServerRelativeUrl.toLowerCase() !== siteUrl.toLowerCase()) {
|
|
458
|
+
if ((0, common_1.hasGlobalContext)() && _spPageContextInfo && _spPageContextInfo.siteServerRelativeUrl.toLowerCase() !== siteUrl.toLowerCase()) {
|
|
411
459
|
//siteUrl = _spPageContextInfo.siteServerRelativeUrl;
|
|
412
460
|
//currentSite = await GetWebInfo(siteUrl);
|
|
413
461
|
//Kevin: Issue 1028
|
|
@@ -443,7 +491,6 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
443
491
|
(0, collections_base_1.sortArray)(filteredSites, s => s.ServerRelativeUrl);
|
|
444
492
|
return filteredSites;
|
|
445
493
|
}
|
|
446
|
-
exports.GetAllSubWebs = GetAllSubWebs;
|
|
447
494
|
async function __getSubSites(siteUrl, allowAppWebs) {
|
|
448
495
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
449
496
|
let sites = [];
|
|
@@ -478,7 +525,6 @@ async function __getSubSites(siteUrl, allowAppWebs) {
|
|
|
478
525
|
//}
|
|
479
526
|
return sites;
|
|
480
527
|
}
|
|
481
|
-
exports.__getSubSites = __getSubSites;
|
|
482
528
|
function _getWebInfoByIdRequestUrl(siteUrl, webId) {
|
|
483
529
|
return `${(0, common_1.GetRestBaseUrl)(siteUrl)}/site/openWebById('${webId}')?$Select=${common_1.WEB_SELECT}`;
|
|
484
530
|
}
|
|
@@ -508,7 +554,7 @@ async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
|
508
554
|
if (currentWebId !== webId) {
|
|
509
555
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
510
556
|
webInfoResponse = await (0, rest_1.GetJson)(url, null, {
|
|
511
|
-
method: "POST", spWebUrl: (0, common_1.
|
|
557
|
+
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...rest_1.shortLocalCache,
|
|
512
558
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
513
559
|
allowCache: refreshCache !== true
|
|
514
560
|
});
|
|
@@ -526,7 +572,6 @@ async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
|
526
572
|
catch (e) { }
|
|
527
573
|
return _postProcessGetWebInfo(webInfoResponse);
|
|
528
574
|
}
|
|
529
|
-
exports.GetWebInfo = GetWebInfo;
|
|
530
575
|
function GetWebInfoSync(siteUrl, webId) {
|
|
531
576
|
let webInfoResponse = null;
|
|
532
577
|
if (!(0, typecheckers_1.isNullOrEmptyString)(webId) && (0, typecheckers_1.isValidGuid)(webId)) {
|
|
@@ -535,7 +580,7 @@ function GetWebInfoSync(siteUrl, webId) {
|
|
|
535
580
|
if (currentWebId !== webId) {
|
|
536
581
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
537
582
|
let syncResult = (0, rest_1.GetJsonSync)(url, null, {
|
|
538
|
-
method: "POST", spWebUrl: (0, common_1.
|
|
583
|
+
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...rest_1.shortLocalCache,
|
|
539
584
|
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
540
585
|
});
|
|
541
586
|
if (syncResult.success) {
|
|
@@ -555,7 +600,6 @@ function GetWebInfoSync(siteUrl, webId) {
|
|
|
555
600
|
}
|
|
556
601
|
return _postProcessGetWebInfo(webInfoResponse);
|
|
557
602
|
}
|
|
558
|
-
exports.GetWebInfoSync = GetWebInfoSync;
|
|
559
603
|
async function GetWebRoleDefinitions(siteUrl) {
|
|
560
604
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/RoleDefinitions?filter=Hidden ne true`, null, { ...rest_1.longLocalCache })
|
|
561
605
|
.then(r => {
|
|
@@ -563,7 +607,6 @@ async function GetWebRoleDefinitions(siteUrl) {
|
|
|
563
607
|
})
|
|
564
608
|
.catch(() => []);
|
|
565
609
|
}
|
|
566
|
-
exports.GetWebRoleDefinitions = GetWebRoleDefinitions;
|
|
567
610
|
;
|
|
568
611
|
/** get roles for site or list */
|
|
569
612
|
async function GetRoleAssignments(siteUrl, listIdOrTitle, itemId) {
|
|
@@ -571,7 +614,6 @@ async function GetRoleAssignments(siteUrl, listIdOrTitle, itemId) {
|
|
|
571
614
|
const result = await (0, rest_1.GetJson)(url, undefined, { jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
572
615
|
return result.value;
|
|
573
616
|
}
|
|
574
|
-
exports.GetRoleAssignments = GetRoleAssignments;
|
|
575
617
|
/** Web sub webs for the selected site */
|
|
576
618
|
async function GetSubWebs(siteUrl, options) {
|
|
577
619
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/webs${options && options.allowAppWebs ? "" : "&$filter=WebTemplate ne 'APP'"}`, null, { ...rest_1.shortLocalCache })
|
|
@@ -580,7 +622,6 @@ async function GetSubWebs(siteUrl, options) {
|
|
|
580
622
|
})
|
|
581
623
|
.catch(() => []);
|
|
582
624
|
}
|
|
583
|
-
exports.GetSubWebs = GetSubWebs;
|
|
584
625
|
/** Web sub webs for the selected site */
|
|
585
626
|
async function GetAppTiles(siteUrl) {
|
|
586
627
|
//Issue 933 this api does not work in a classic app web
|
|
@@ -599,7 +640,6 @@ async function GetAppTiles(siteUrl) {
|
|
|
599
640
|
})
|
|
600
641
|
.catch(() => []);
|
|
601
642
|
}
|
|
602
|
-
exports.GetAppTiles = GetAppTiles;
|
|
603
643
|
/** Web sub webs for the selected site */
|
|
604
644
|
function GetAppTilesSync(siteUrl) {
|
|
605
645
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -616,7 +656,6 @@ function GetAppTilesSync(siteUrl) {
|
|
|
616
656
|
};
|
|
617
657
|
}) : [];
|
|
618
658
|
}
|
|
619
|
-
exports.GetAppTilesSync = GetAppTilesSync;
|
|
620
659
|
function GetWebType(WebTemplate) {
|
|
621
660
|
return WebTemplate === "APP" ? sharepoint_utils_types_1.WebTypes.App :
|
|
622
661
|
WebTemplate === "GROUP" ? sharepoint_utils_types_1.WebTypes.Group :
|
|
@@ -633,7 +672,6 @@ async function GetServerTimeZone(siteUrl) {
|
|
|
633
672
|
else
|
|
634
673
|
return null;
|
|
635
674
|
}
|
|
636
|
-
exports.GetServerTimeZone = GetServerTimeZone;
|
|
637
675
|
function GetServerTimeZoneSync(siteUrl) {
|
|
638
676
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
639
677
|
let getTimeZoneUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone`;
|
|
@@ -644,7 +682,6 @@ function GetServerTimeZoneSync(siteUrl) {
|
|
|
644
682
|
else
|
|
645
683
|
return null;
|
|
646
684
|
}
|
|
647
|
-
exports.GetServerTimeZoneSync = GetServerTimeZoneSync;
|
|
648
685
|
/**
|
|
649
686
|
* to be used when parsing string date to date object in JavaScript like so:
|
|
650
687
|
* var clientTimezoneOffset = new Date().getTimezoneOffset() * 60 * 1000;
|
|
@@ -698,7 +735,6 @@ async function SPServerLocalTimeToUTCDate(siteUrl, date) {
|
|
|
698
735
|
let serverTimeOffset = await GetServerTimeOffset(siteUrl, date);
|
|
699
736
|
return _SPServerLocalTimeToUTCDate(date, serverTimeOffset);
|
|
700
737
|
}
|
|
701
|
-
exports.SPServerLocalTimeToUTCDate = SPServerLocalTimeToUTCDate;
|
|
702
738
|
/** get date yyyy:MM:ddTHH:mm:ss NO ZED, or a date object created in the server local time, and return a date object of the corrected UTC time */
|
|
703
739
|
function SPServerLocalTimeToUTCDateSync(siteUrl, date) {
|
|
704
740
|
//used in 7700
|
|
@@ -710,7 +746,6 @@ function SPServerLocalTimeToUTCDateSync(siteUrl, date) {
|
|
|
710
746
|
let serverTimeOffset = GetServerTimeOffsetSync(siteUrl, date);
|
|
711
747
|
return _SPServerLocalTimeToUTCDate(date, serverTimeOffset);
|
|
712
748
|
}
|
|
713
|
-
exports.SPServerLocalTimeToUTCDateSync = SPServerLocalTimeToUTCDateSync;
|
|
714
749
|
function _SPServerLocalTimeToUTCDate(date, serverTimeOffset) {
|
|
715
750
|
let localTimeOffset = date.getTimezoneOffset() * 60000;
|
|
716
751
|
return new Date(serverTimeOffset - localTimeOffset + date.getTime());
|
|
@@ -729,7 +764,6 @@ async function SPServerLocalTimeToUTC(siteUrl, date) {
|
|
|
729
764
|
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
730
765
|
return result && result.value || null;
|
|
731
766
|
}
|
|
732
|
-
exports.SPServerLocalTimeToUTC = SPServerLocalTimeToUTC;
|
|
733
767
|
/**
|
|
734
768
|
* convert date in ISO format (yyyy:MM:ddTHH:mm:ss) or SPServerLocalTime (5/27/2020 11:34, 5-27-2020 11:34)
|
|
735
769
|
* returns date in ISO UTC (yyyy:MM:ddTHH:mm:ssZ)
|
|
@@ -745,7 +779,6 @@ function SPServerLocalTimeToUTCSync(siteUrl, date) {
|
|
|
745
779
|
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
746
780
|
return result.success && result.result.value || null;
|
|
747
781
|
}
|
|
748
|
-
exports.SPServerLocalTimeToUTCSync = SPServerLocalTimeToUTCSync;
|
|
749
782
|
/** get utc date yyyy:MM:ddTHH:mm:ssZ
|
|
750
783
|
* returns yyyy:MM:ddTHH:mm:ss NO ZED
|
|
751
784
|
* expensive, but works. for faster bulk parsing use toIsoDateFormat(new Date(date.getTime()-GetServerTimeOffset,{omitZ:true}))
|
|
@@ -774,7 +807,6 @@ async function UTCToSPServerLocalTime(siteUrl, date) {
|
|
|
774
807
|
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
775
808
|
return result && result.value || null;
|
|
776
809
|
}
|
|
777
|
-
exports.UTCToSPServerLocalTime = UTCToSPServerLocalTime;
|
|
778
810
|
/** get utc date yyyy:MM:ddTHH:mm:ssZ
|
|
779
811
|
* returns yyyy:MM:ddTHH:mm:ss NO ZED
|
|
780
812
|
* expensive, but works. for faster bulk parsing use toIsoDateFormat(new Date(date.getTime()-GetServerTimeOffset,{omitZ:true}))
|
|
@@ -803,7 +835,6 @@ function UTCToSPServerLocalTimeSync(siteUrl, date) {
|
|
|
803
835
|
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
804
836
|
return result.success && result.result.value || null;
|
|
805
837
|
}
|
|
806
|
-
exports.UTCToSPServerLocalTimeSync = UTCToSPServerLocalTimeSync;
|
|
807
838
|
function _getSupportedLocaleForUTCToSPServerTime() {
|
|
808
839
|
try {
|
|
809
840
|
let supportedLocales = Intl.DateTimeFormat.supportedLocalesOf(["en-CA", "sv-SE"]);
|
|
@@ -847,7 +878,6 @@ function SPServerLocalTimeSync(siteUrl) {
|
|
|
847
878
|
var newdate = new Date(+now - clientNowServerDelta);
|
|
848
879
|
return (0, date_2.toIsoDateFormat)(newdate, { omitZ: true });
|
|
849
880
|
}
|
|
850
|
-
exports.SPServerLocalTimeSync = SPServerLocalTimeSync;
|
|
851
881
|
async function SPServerLocalTime(siteUrl) {
|
|
852
882
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
853
883
|
var clientNowServerDeltas = (0, objects_1.getGlobal)("ClientNowServerDeltas");
|
|
@@ -861,17 +891,15 @@ async function SPServerLocalTime(siteUrl) {
|
|
|
861
891
|
var newdate = new Date(+now - clientNowServerDelta);
|
|
862
892
|
return (0, date_2.toIsoDateFormat)(newdate, { omitZ: true });
|
|
863
893
|
}
|
|
864
|
-
exports.SPServerLocalTime = SPServerLocalTime;
|
|
865
894
|
async function SPServerLocalToday(siteUrl) {
|
|
866
895
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
867
896
|
return (0, promises_1.promiseLock)(`SPServerLocalToday)_${siteUrl}`, async () => {
|
|
868
897
|
return SPServerLocalTime(siteUrl);
|
|
869
898
|
}, 30000);
|
|
870
899
|
}
|
|
871
|
-
exports.SPServerLocalToday = SPServerLocalToday;
|
|
872
900
|
function GetContextWebInformationSync(siteUrl) {
|
|
873
901
|
var siteId = null;
|
|
874
|
-
if (_spPageContextInfo && _spPageContextInfo.isAppWeb) {
|
|
902
|
+
if ((0, common_1.hasGlobalContext)() && _spPageContextInfo && _spPageContextInfo.isAppWeb) {
|
|
875
903
|
//inside an app web you can't get the contextinfo for any other site
|
|
876
904
|
siteUrl = _spPageContextInfo.webServerRelativeUrl;
|
|
877
905
|
siteId = _spPageContextInfo.siteId;
|
|
@@ -896,7 +924,33 @@ function GetContextWebInformationSync(siteUrl) {
|
|
|
896
924
|
return null;
|
|
897
925
|
}
|
|
898
926
|
}
|
|
899
|
-
|
|
927
|
+
async function GetContextWebInformation(siteUrl) {
|
|
928
|
+
var siteId = null;
|
|
929
|
+
if ((0, common_1.hasGlobalContext)() && _spPageContextInfo && _spPageContextInfo.isAppWeb) {
|
|
930
|
+
//inside an app web you can't get the contextinfo for any other site
|
|
931
|
+
siteUrl = _spPageContextInfo.webServerRelativeUrl;
|
|
932
|
+
siteId = _spPageContextInfo.siteId;
|
|
933
|
+
}
|
|
934
|
+
else {
|
|
935
|
+
siteId = await GetSiteId(siteUrl);
|
|
936
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
try {
|
|
941
|
+
let result = await (0, rest_1.GetJson)(`${(0, common_1.GetRestBaseUrl)(siteUrl)}/contextinfo`, null, {
|
|
942
|
+
method: "POST",
|
|
943
|
+
maxAge: 5 * 60,
|
|
944
|
+
includeDigestInPost: false,
|
|
945
|
+
allowCache: true,
|
|
946
|
+
postCacheKey: `GetContextWebInformation_${(0, strings_1.normalizeGuid)(siteId)}`
|
|
947
|
+
});
|
|
948
|
+
return result.d.GetContextWebInformation;
|
|
949
|
+
}
|
|
950
|
+
catch {
|
|
951
|
+
return null;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
900
954
|
function _getCustomActionsBaseRestUrl(siteUrl, options = {}) {
|
|
901
955
|
const { listId, actionId } = { ...options };
|
|
902
956
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web`;
|
|
@@ -959,7 +1013,6 @@ async function GetUserCustomActions(siteUrl, listId, allowCache = true) {
|
|
|
959
1013
|
}
|
|
960
1014
|
return [];
|
|
961
1015
|
}
|
|
962
|
-
exports.GetUserCustomActions = GetUserCustomActions;
|
|
963
1016
|
/** Get UserCustomAction by id from web/list */
|
|
964
1017
|
async function GetUserCustomActionById(siteUrl, customActionId, listId, allowCache = true) {
|
|
965
1018
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
@@ -978,7 +1031,6 @@ async function GetUserCustomActionById(siteUrl, customActionId, listId, allowCac
|
|
|
978
1031
|
}
|
|
979
1032
|
return null;
|
|
980
1033
|
}
|
|
981
|
-
exports.GetUserCustomActionById = GetUserCustomActionById;
|
|
982
1034
|
/** Get UserCustomAction by name from web/list */
|
|
983
1035
|
async function GetUserCustomActionByName(siteUrl, name, listId, allowCache = true) {
|
|
984
1036
|
let restUrl = `${_getCustomActionsBaseRestUrl(siteUrl, { listId: listId })}?$filter=Name eq '${encodeURIComponent(name)}'`;
|
|
@@ -997,7 +1049,6 @@ async function GetUserCustomActionByName(siteUrl, name, listId, allowCache = tru
|
|
|
997
1049
|
}
|
|
998
1050
|
return [];
|
|
999
1051
|
}
|
|
1000
|
-
exports.GetUserCustomActionByName = GetUserCustomActionByName;
|
|
1001
1052
|
/** Add UserCustomAction to web/list */
|
|
1002
1053
|
async function AddUserCustomAction(siteUrl, userCustomActionInfo, listId) {
|
|
1003
1054
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId });
|
|
@@ -1017,7 +1068,6 @@ async function AddUserCustomAction(siteUrl, userCustomActionInfo, listId) {
|
|
|
1017
1068
|
}
|
|
1018
1069
|
return null;
|
|
1019
1070
|
}
|
|
1020
|
-
exports.AddUserCustomAction = AddUserCustomAction;
|
|
1021
1071
|
/** Update UserCustomAction to web/list */
|
|
1022
1072
|
async function UpdateUserCustomAction(siteUrl, customActionId, userCustomActionInfo, listId) {
|
|
1023
1073
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
@@ -1036,7 +1086,6 @@ async function UpdateUserCustomAction(siteUrl, customActionId, userCustomActionI
|
|
|
1036
1086
|
}
|
|
1037
1087
|
return false;
|
|
1038
1088
|
}
|
|
1039
|
-
exports.UpdateUserCustomAction = UpdateUserCustomAction;
|
|
1040
1089
|
/** Delete UserCustomAction from web/list */
|
|
1041
1090
|
async function DeleteUserCustomAction(siteUrl, customActionId, listId) {
|
|
1042
1091
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
@@ -1054,7 +1103,6 @@ async function DeleteUserCustomAction(siteUrl, customActionId, listId) {
|
|
|
1054
1103
|
}
|
|
1055
1104
|
return false;
|
|
1056
1105
|
}
|
|
1057
|
-
exports.DeleteUserCustomAction = DeleteUserCustomAction;
|
|
1058
1106
|
/** Get web regional settings */
|
|
1059
1107
|
async function GetRegionalSettings(siteUrl) {
|
|
1060
1108
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -1067,7 +1115,6 @@ async function GetRegionalSettings(siteUrl) {
|
|
|
1067
1115
|
}
|
|
1068
1116
|
return null;
|
|
1069
1117
|
}
|
|
1070
|
-
exports.GetRegionalSettings = GetRegionalSettings;
|
|
1071
1118
|
/** Get all web properties */
|
|
1072
1119
|
async function GetAllWebProperties(siteUrl) {
|
|
1073
1120
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -1080,7 +1127,6 @@ async function GetAllWebProperties(siteUrl) {
|
|
|
1080
1127
|
}
|
|
1081
1128
|
return null;
|
|
1082
1129
|
}
|
|
1083
|
-
exports.GetAllWebProperties = GetAllWebProperties;
|
|
1084
1130
|
/** Get web property by name */
|
|
1085
1131
|
async function GetWebPropertyByName(name, siteUrl) {
|
|
1086
1132
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -1095,12 +1141,17 @@ async function GetWebPropertyByName(name, siteUrl) {
|
|
|
1095
1141
|
}
|
|
1096
1142
|
return null;
|
|
1097
1143
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1144
|
+
function getFormDigest(serverRelativeWebUrl, async = false) {
|
|
1145
|
+
if (async) {
|
|
1146
|
+
return GetContextWebInformation(serverRelativeWebUrl).then(contextWebInformation => {
|
|
1147
|
+
return contextWebInformation && contextWebInformation.FormDigestValue || null;
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
let contextWebInformation = GetContextWebInformationSync(serverRelativeWebUrl);
|
|
1152
|
+
return contextWebInformation && contextWebInformation.FormDigestValue || null;
|
|
1153
|
+
}
|
|
1102
1154
|
}
|
|
1103
|
-
exports.getFormDigest = getFormDigest;
|
|
1104
1155
|
function ensureLegacyProps(pageContext) {
|
|
1105
1156
|
try {
|
|
1106
1157
|
let isContextOk = (ctx) => !(0, typecheckers_1.isNullOrUndefined)(ctx) && !(0, typecheckers_1.isNullOrUndefined)(ctx.webServerRelativeUrl);
|
|
@@ -1135,33 +1186,27 @@ function ensureLegacyProps(pageContext) {
|
|
|
1135
1186
|
catch (ex) {
|
|
1136
1187
|
}
|
|
1137
1188
|
}
|
|
1138
|
-
exports.ensureLegacyProps = ensureLegacyProps;
|
|
1139
1189
|
async function WebHasUniquePermissions(siteUrl) {
|
|
1140
1190
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web?$select=hasuniqueroleassignments`;
|
|
1141
1191
|
let has = await (0, rest_1.GetJson)(url, undefined, { allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
1142
1192
|
return has.HasUniqueRoleAssignments === true;
|
|
1143
1193
|
}
|
|
1144
|
-
exports.WebHasUniquePermissions = WebHasUniquePermissions;
|
|
1145
1194
|
async function RestoreWebPermissionInheritance(siteUrl) {
|
|
1146
1195
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/ResetRoleInheritance`;
|
|
1147
1196
|
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1148
1197
|
}
|
|
1149
|
-
exports.RestoreWebPermissionInheritance = RestoreWebPermissionInheritance;
|
|
1150
1198
|
async function BreakWebPermissionInheritance(siteUrl, clear = true) {
|
|
1151
1199
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/breakroleinheritance(copyRoleAssignments=${clear ? 'false' : 'true'}, clearSubscopes=true)`;
|
|
1152
1200
|
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1153
1201
|
}
|
|
1154
|
-
exports.BreakWebPermissionInheritance = BreakWebPermissionInheritance;
|
|
1155
1202
|
async function AssignWebPermission(siteUrl, principalId, roleId) {
|
|
1156
1203
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/roleassignments/addroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
1157
1204
|
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1158
1205
|
}
|
|
1159
|
-
exports.AssignWebPermission = AssignWebPermission;
|
|
1160
1206
|
async function RemoveWebPermission(siteUrl, principalId, roleId) {
|
|
1161
1207
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/roleassignments/removeroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
1162
1208
|
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1163
1209
|
}
|
|
1164
|
-
exports.RemoveWebPermission = RemoveWebPermission;
|
|
1165
1210
|
/** set a user as site admin - rejects/throws if not successful */
|
|
1166
1211
|
async function SetUserAsSiteAdmin(siteUrl, userId) {
|
|
1167
1212
|
const url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getuserbyid(${userId})`;
|
|
@@ -1171,7 +1216,6 @@ async function SetUserAsSiteAdmin(siteUrl, userId) {
|
|
|
1171
1216
|
}), { method: 'POST', xHttpMethod: 'MERGE' });
|
|
1172
1217
|
return true;
|
|
1173
1218
|
}
|
|
1174
|
-
exports.SetUserAsSiteAdmin = SetUserAsSiteAdmin;
|
|
1175
1219
|
/** get all the rentention labels (compliance tags) for a site */
|
|
1176
1220
|
async function GetAvailableTagsForSite(siteUrlOrId) {
|
|
1177
1221
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
@@ -1186,7 +1230,6 @@ async function GetAvailableTagsForSite(siteUrlOrId) {
|
|
|
1186
1230
|
return [];
|
|
1187
1231
|
}
|
|
1188
1232
|
}
|
|
1189
|
-
exports.GetAvailableTagsForSite = GetAvailableTagsForSite;
|
|
1190
1233
|
/** get all the rentention labels (compliance tags) for a site */
|
|
1191
1234
|
function GetAvailableTagsForSiteSync(siteUrlOrId) {
|
|
1192
1235
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
@@ -1201,7 +1244,6 @@ function GetAvailableTagsForSiteSync(siteUrlOrId) {
|
|
|
1201
1244
|
return [];
|
|
1202
1245
|
}
|
|
1203
1246
|
}
|
|
1204
|
-
exports.GetAvailableTagsForSiteSync = GetAvailableTagsForSiteSync;
|
|
1205
1247
|
async function GetActiveFeatures(siteUrlOrId, allowCache = true) {
|
|
1206
1248
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1207
1249
|
try {
|
|
@@ -1218,7 +1260,6 @@ async function GetActiveFeatures(siteUrlOrId, allowCache = true) {
|
|
|
1218
1260
|
}
|
|
1219
1261
|
return null;
|
|
1220
1262
|
}
|
|
1221
|
-
exports.GetActiveFeatures = GetActiveFeatures;
|
|
1222
1263
|
async function ActivateFeature(siteUrlOrId, id) {
|
|
1223
1264
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1224
1265
|
try {
|
|
@@ -1235,7 +1276,6 @@ async function ActivateFeature(siteUrlOrId, id) {
|
|
|
1235
1276
|
}
|
|
1236
1277
|
return false;
|
|
1237
1278
|
}
|
|
1238
|
-
exports.ActivateFeature = ActivateFeature;
|
|
1239
1279
|
async function DectivateFeature(siteUrlOrId, id) {
|
|
1240
1280
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1241
1281
|
try {
|
|
@@ -1252,7 +1292,6 @@ async function DectivateFeature(siteUrlOrId, id) {
|
|
|
1252
1292
|
}
|
|
1253
1293
|
return null;
|
|
1254
1294
|
}
|
|
1255
|
-
exports.DectivateFeature = DectivateFeature;
|
|
1256
1295
|
async function GetWelcomePage(siteUrlOrId) {
|
|
1257
1296
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1258
1297
|
try {
|
|
@@ -1269,7 +1308,6 @@ async function GetWelcomePage(siteUrlOrId) {
|
|
|
1269
1308
|
}
|
|
1270
1309
|
return null;
|
|
1271
1310
|
}
|
|
1272
|
-
exports.GetWelcomePage = GetWelcomePage;
|
|
1273
1311
|
async function SetWelcomePage(siteUrlOrId, welcomePage) {
|
|
1274
1312
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1275
1313
|
try {
|
|
@@ -1288,7 +1326,6 @@ async function SetWelcomePage(siteUrlOrId, welcomePage) {
|
|
|
1288
1326
|
}
|
|
1289
1327
|
return false;
|
|
1290
1328
|
}
|
|
1291
|
-
exports.SetWelcomePage = SetWelcomePage;
|
|
1292
1329
|
/** Get web associated groups */
|
|
1293
1330
|
async function GetWebAssociatedGroups(siteUrl) {
|
|
1294
1331
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
@@ -1301,5 +1338,4 @@ async function GetWebAssociatedGroups(siteUrl) {
|
|
|
1301
1338
|
}
|
|
1302
1339
|
return null;
|
|
1303
1340
|
}
|
|
1304
|
-
exports.GetWebAssociatedGroups = GetWebAssociatedGroups;
|
|
1305
1341
|
//# sourceMappingURL=web.js.map
|