@kwiz/common 1.0.211 → 1.0.213
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/lib/cjs/config.js +0 -1
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/helpers/sharepoint.js +0 -180
- package/lib/cjs/helpers/sharepoint.js.map +1 -1
- package/lib/cjs/types/config.typs.js +4 -0
- package/lib/cjs/types/config.typs.js.map +1 -0
- package/lib/cjs/types/exports-index.js +1 -0
- package/lib/cjs/types/exports-index.js.map +1 -1
- package/lib/cjs/types/rest.types.js +5 -3
- package/lib/cjs/types/rest.types.js.map +1 -1
- package/lib/cjs/utils/auth/common.js +3 -3
- package/lib/cjs/utils/auth/common.js.map +1 -1
- package/lib/cjs/utils/emails.js +2 -1
- package/lib/cjs/utils/emails.js.map +1 -1
- package/lib/cjs/utils/exports-index.js +1 -0
- package/lib/cjs/utils/exports-index.js.map +1 -1
- package/lib/cjs/utils/rest.js +3 -18
- package/lib/cjs/utils/rest.js.map +1 -1
- package/lib/cjs/utils/rest.vars.js +18 -0
- package/lib/cjs/utils/rest.vars.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/common.js +2 -2
- package/lib/cjs/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/context.js +190 -0
- package/lib/cjs/utils/sharepoint.rest/context.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/digest.js +78 -0
- package/lib/cjs/utils/sharepoint.rest/digest.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/exports-index.js +2 -0
- package/lib/cjs/utils/sharepoint.rest/exports-index.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/file.folder.js +5 -4
- package/lib/cjs/utils/sharepoint.rest/file.folder.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/item.js +2 -1
- package/lib/cjs/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/list.js +10 -9
- package/lib/cjs/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/location.js +2 -1
- package/lib/cjs/utils/sharepoint.rest/location.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/user.js +22 -21
- package/lib/cjs/utils/sharepoint.rest/user.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/web.js +36 -105
- package/lib/cjs/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/esm/config.js +0 -1
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/helpers/sharepoint.js +3 -177
- package/lib/esm/helpers/sharepoint.js.map +1 -1
- package/lib/esm/types/config.typs.js +3 -0
- package/lib/esm/types/config.typs.js.map +1 -0
- package/lib/esm/types/exports-index.js +1 -0
- package/lib/esm/types/exports-index.js.map +1 -1
- package/lib/esm/types/rest.types.js +5 -3
- package/lib/esm/types/rest.types.js.map +1 -1
- package/lib/esm/utils/auth/common.js +1 -1
- package/lib/esm/utils/auth/common.js.map +1 -1
- package/lib/esm/utils/emails.js +2 -1
- package/lib/esm/utils/emails.js.map +1 -1
- package/lib/esm/utils/exports-index.js +1 -0
- package/lib/esm/utils/exports-index.js.map +1 -1
- package/lib/esm/utils/rest.js +1 -15
- package/lib/esm/utils/rest.js.map +1 -1
- package/lib/esm/utils/rest.vars.js +15 -0
- package/lib/esm/utils/rest.vars.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/common.js +1 -1
- package/lib/esm/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/context.js +182 -0
- package/lib/esm/utils/sharepoint.rest/context.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/digest.js +73 -0
- package/lib/esm/utils/sharepoint.rest/digest.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/exports-index.js +2 -0
- package/lib/esm/utils/sharepoint.rest/exports-index.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/file.folder.js +2 -1
- package/lib/esm/utils/sharepoint.rest/file.folder.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/item.js +2 -1
- package/lib/esm/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/list.js +2 -1
- package/lib/esm/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/location.js +2 -1
- package/lib/esm/utils/sharepoint.rest/location.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/user.js +2 -1
- package/lib/esm/utils/sharepoint.rest/user.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/web.js +2 -68
- package/lib/esm/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/types/_dependencies.d.ts +1 -1
- package/lib/types/config.d.ts +3 -16
- package/lib/types/helpers/sharepoint.d.ts +0 -10
- package/lib/types/types/config.typs.d.ts +14 -0
- package/lib/types/types/exports-index.d.ts +1 -0
- package/lib/types/types/rest.types.d.ts +21 -7
- package/lib/types/utils/exports-index.d.ts +1 -0
- package/lib/types/utils/rest.d.ts +0 -14
- package/lib/types/utils/rest.vars.d.ts +15 -0
- package/lib/types/utils/sharepoint.rest/context.d.ts +10 -0
- package/lib/types/utils/sharepoint.rest/digest.d.ts +5 -0
- package/lib/types/utils/sharepoint.rest/exports-index.d.ts +2 -0
- package/lib/types/utils/sharepoint.rest/web.d.ts +1 -5
- package/package.json +3 -2
|
@@ -37,8 +37,6 @@ exports.UTCToSPServerLocalTimeSync = UTCToSPServerLocalTimeSync;
|
|
|
37
37
|
exports.SPServerLocalTimeSync = SPServerLocalTimeSync;
|
|
38
38
|
exports.SPServerLocalTime = SPServerLocalTime;
|
|
39
39
|
exports.SPServerLocalToday = SPServerLocalToday;
|
|
40
|
-
exports.GetContextWebInformationSync = GetContextWebInformationSync;
|
|
41
|
-
exports.GetContextWebInformation = GetContextWebInformation;
|
|
42
40
|
exports.GetUserCustomActions = GetUserCustomActions;
|
|
43
41
|
exports.GetUserCustomActionById = GetUserCustomActionById;
|
|
44
42
|
exports.GetUserCustomActionByName = GetUserCustomActionByName;
|
|
@@ -48,7 +46,6 @@ exports.DeleteUserCustomAction = DeleteUserCustomAction;
|
|
|
48
46
|
exports.GetRegionalSettings = GetRegionalSettings;
|
|
49
47
|
exports.GetAllWebProperties = GetAllWebProperties;
|
|
50
48
|
exports.GetWebPropertyByName = GetWebPropertyByName;
|
|
51
|
-
exports.getFormDigest = getFormDigest;
|
|
52
49
|
exports.ensureLegacyProps = ensureLegacyProps;
|
|
53
50
|
exports.WebHasUniquePermissions = WebHasUniquePermissions;
|
|
54
51
|
exports.RestoreWebPermissionInheritance = RestoreWebPermissionInheritance;
|
|
@@ -81,6 +78,7 @@ const consolelogger_1 = require("../consolelogger");
|
|
|
81
78
|
const date_2 = require("../date");
|
|
82
79
|
const knownscript_1 = require("../knownscript");
|
|
83
80
|
const rest_1 = require("../rest");
|
|
81
|
+
const rest_vars_1 = require("../rest.vars");
|
|
84
82
|
const common_1 = require("./common");
|
|
85
83
|
const list_1 = require("./list");
|
|
86
84
|
const timzone_map_1 = require("./timzone-map");
|
|
@@ -89,7 +87,7 @@ async function GetSiteInfo(siteUrl) {
|
|
|
89
87
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
90
88
|
try {
|
|
91
89
|
const r = await (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site?$select=id,serverRelativeUrl", null, {
|
|
92
|
-
...
|
|
90
|
+
...rest_vars_1.longLocalCache,
|
|
93
91
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
94
92
|
});
|
|
95
93
|
var id = (0, strings_1.normalizeGuid)(r.d.Id);
|
|
@@ -105,7 +103,7 @@ async function GetSiteInfo(siteUrl) {
|
|
|
105
103
|
function GetSiteInfoSync(siteUrl) {
|
|
106
104
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
107
105
|
let result = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site?$select=id,serverRelativeUrl", null, {
|
|
108
|
-
...
|
|
106
|
+
...rest_vars_1.longLocalCache,
|
|
109
107
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
110
108
|
});
|
|
111
109
|
if (result.success) {
|
|
@@ -185,7 +183,7 @@ function GetSiteIdSync(siteUrl) {
|
|
|
185
183
|
function GetRootWebInfo(siteUrl) {
|
|
186
184
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
187
185
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site/rootWeb?$select=id,serverRelativeUrl", null, {
|
|
188
|
-
...
|
|
186
|
+
...rest_vars_1.longLocalCache,
|
|
189
187
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
190
188
|
})
|
|
191
189
|
.then(r => {
|
|
@@ -200,7 +198,7 @@ function GetRootWebInfo(siteUrl) {
|
|
|
200
198
|
function GetWebTitle(siteUrl) {
|
|
201
199
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
202
200
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/Title`, null, {
|
|
203
|
-
...
|
|
201
|
+
...rest_vars_1.shortLocalCache,
|
|
204
202
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
205
203
|
})
|
|
206
204
|
.then(r => {
|
|
@@ -214,7 +212,7 @@ function _getWebIdRequestUrl(siteUrl) {
|
|
|
214
212
|
/** Return the web id */
|
|
215
213
|
function GetWebId(siteUrl) {
|
|
216
214
|
return (0, rest_1.GetJson)(_getWebIdRequestUrl(siteUrl), null, {
|
|
217
|
-
...
|
|
215
|
+
...rest_vars_1.longLocalCache,
|
|
218
216
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
219
217
|
})
|
|
220
218
|
.then(r => {
|
|
@@ -225,7 +223,7 @@ function GetWebId(siteUrl) {
|
|
|
225
223
|
/** Return the web id */
|
|
226
224
|
function GetWebIdSync(siteUrl) {
|
|
227
225
|
let syncResult = (0, rest_1.GetJsonSync)(_getWebIdRequestUrl(siteUrl), null, {
|
|
228
|
-
...
|
|
226
|
+
...rest_vars_1.longLocalCache,
|
|
229
227
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
230
228
|
});
|
|
231
229
|
if (syncResult.success)
|
|
@@ -243,7 +241,7 @@ async function IsRootWeb(siteUrl) {
|
|
|
243
241
|
function UserHasAllPermissions(siteUrl, permissions) {
|
|
244
242
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
245
243
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/EffectiveBasePermissions`, null, {
|
|
246
|
-
...
|
|
244
|
+
...rest_vars_1.shortLocalCache,
|
|
247
245
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
248
246
|
})
|
|
249
247
|
.then(r => {
|
|
@@ -262,7 +260,7 @@ function UserHasManageSitePermissions(siteUrl) {
|
|
|
262
260
|
return Promise.resolve(true);
|
|
263
261
|
}
|
|
264
262
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/EffectiveBasePermissions`, null, {
|
|
265
|
-
...
|
|
263
|
+
...rest_vars_1.shortLocalCache,
|
|
266
264
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
267
265
|
})
|
|
268
266
|
.then(r => {
|
|
@@ -390,7 +388,7 @@ function GetLists(siteUrl, options = {}) {
|
|
|
390
388
|
function GetListsSync(siteUrl, options = {}) {
|
|
391
389
|
let url = _getListsRequestUrl(siteUrl, options);
|
|
392
390
|
let response = (0, rest_1.GetJsonSync)(url, null, {
|
|
393
|
-
...
|
|
391
|
+
...rest_vars_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
394
392
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
395
393
|
});
|
|
396
394
|
if (response && response.success && response.result && (0, typecheckers_1.isNotEmptyArray)(response.result.value)) {
|
|
@@ -420,7 +418,7 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
420
418
|
//Issue 6735 missing WebId for some customer (US, government GCC tenant will not return WebId)
|
|
421
419
|
let queryUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/search/query?querytext=%27${queryFilter}(contentclass:STS_Site)%20(contentclass:STS_Web)%27&trimduplicates=false&rowlimit=5000&selectproperties=%27Title,Url,WebTemplate,WebId%27`;
|
|
422
420
|
let response = await (0, rest_1.GetJson)(queryUrl, null, {
|
|
423
|
-
...
|
|
421
|
+
...rest_vars_1.shortLocalCache,
|
|
424
422
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
425
423
|
});
|
|
426
424
|
let results = response && response.d && response.d.query && response.d.query.PrimaryQueryResult;
|
|
@@ -538,7 +536,7 @@ async function __getSubSites(siteUrl, allowAppWebs) {
|
|
|
538
536
|
//maybe search is not wokring? use regular REST API
|
|
539
537
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getsubwebsfilteredforcurrentuser(nwebtemplatefilter=-1,nconfigurationfilter=0)?$Select=Title,ServerRelativeUrl,Id,WebTemplate`;
|
|
540
538
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
541
|
-
...
|
|
539
|
+
...rest_vars_1.shortLocalCache,
|
|
542
540
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
543
541
|
});
|
|
544
542
|
if (result && result.d && (0, typecheckers_1.isNotEmptyArray)(result.d.results)) {
|
|
@@ -597,7 +595,7 @@ async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
|
597
595
|
if (currentWebId !== webId) {
|
|
598
596
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
599
597
|
webInfoResponse = await (0, rest_1.GetJson)(url, null, {
|
|
600
|
-
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...
|
|
598
|
+
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...rest_vars_1.shortLocalCache,
|
|
601
599
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
602
600
|
allowCache: refreshCache !== true
|
|
603
601
|
});
|
|
@@ -606,7 +604,7 @@ async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
|
606
604
|
if ((0, typecheckers_1.isNullOrUndefined)(webInfoResponse)) {
|
|
607
605
|
let url = _getCurrentWebInfoRequestUrl(siteUrl);
|
|
608
606
|
webInfoResponse = await (0, rest_1.GetJson)(url, null, {
|
|
609
|
-
...
|
|
607
|
+
...rest_vars_1.shortLocalCache,
|
|
610
608
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
611
609
|
allowCache: refreshCache !== true,
|
|
612
610
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
@@ -624,7 +622,7 @@ function GetWebInfoSync(siteUrl, webId) {
|
|
|
624
622
|
if (currentWebId !== webId) {
|
|
625
623
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
626
624
|
let syncResult = (0, rest_1.GetJsonSync)(url, null, {
|
|
627
|
-
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...
|
|
625
|
+
method: "POST", spWebUrl: (0, common_1.GetSiteUrlLocally)(siteUrl), ...rest_vars_1.shortLocalCache,
|
|
628
626
|
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
629
627
|
});
|
|
630
628
|
if (syncResult.success) {
|
|
@@ -635,7 +633,7 @@ function GetWebInfoSync(siteUrl, webId) {
|
|
|
635
633
|
if ((0, typecheckers_1.isNullOrUndefined)(webInfoResponse)) {
|
|
636
634
|
let url = _getCurrentWebInfoRequestUrl(siteUrl);
|
|
637
635
|
let syncResult = (0, rest_1.GetJsonSync)(url, null, {
|
|
638
|
-
...
|
|
636
|
+
...rest_vars_1.shortLocalCache,
|
|
639
637
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
640
638
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
641
639
|
});
|
|
@@ -647,7 +645,7 @@ function GetWebInfoSync(siteUrl, webId) {
|
|
|
647
645
|
}
|
|
648
646
|
async function GetWebRoleDefinitions(siteUrl) {
|
|
649
647
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/RoleDefinitions?filter=Hidden ne true`, null, {
|
|
650
|
-
...
|
|
648
|
+
...rest_vars_1.longLocalCache,
|
|
651
649
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
652
650
|
})
|
|
653
651
|
.then(r => {
|
|
@@ -668,7 +666,7 @@ async function GetRoleAssignments(siteUrl, listIdOrTitle, itemId) {
|
|
|
668
666
|
/** Web sub webs for the selected site */
|
|
669
667
|
async function GetSubWebs(siteUrl, options) {
|
|
670
668
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/webs${options && options.allowAppWebs ? "" : "&$filter=WebTemplate ne 'APP'"}`, null, {
|
|
671
|
-
...
|
|
669
|
+
...rest_vars_1.shortLocalCache,
|
|
672
670
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
673
671
|
})
|
|
674
672
|
.then(r => {
|
|
@@ -684,7 +682,7 @@ async function GetAppTiles(siteUrl) {
|
|
|
684
682
|
return null;
|
|
685
683
|
}
|
|
686
684
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, {
|
|
687
|
-
...
|
|
685
|
+
...rest_vars_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
688
686
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
689
687
|
})
|
|
690
688
|
.then(r => {
|
|
@@ -706,7 +704,7 @@ function GetAppTilesSync(siteUrl) {
|
|
|
706
704
|
return null;
|
|
707
705
|
}
|
|
708
706
|
let r = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, {
|
|
709
|
-
...
|
|
707
|
+
...rest_vars_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
710
708
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
711
709
|
});
|
|
712
710
|
return r.success && r.result && (0, typecheckers_1.isNotEmptyArray)(r.result.value) ? r.result.value.map(t => {
|
|
@@ -726,7 +724,7 @@ async function GetServerTimeZone(siteUrl) {
|
|
|
726
724
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
727
725
|
let getTimeZoneUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone`;
|
|
728
726
|
let result = await (0, rest_1.GetJson)(getTimeZoneUrl, null, {
|
|
729
|
-
...
|
|
727
|
+
...rest_vars_1.extraLongLocalCache,
|
|
730
728
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
731
729
|
});
|
|
732
730
|
if (result && result.d && !(0, typecheckers_1.isNullOrUndefined)(result.d)) {
|
|
@@ -739,7 +737,7 @@ function GetServerTimeZoneSync(siteUrl) {
|
|
|
739
737
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
740
738
|
let getTimeZoneUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone`;
|
|
741
739
|
let response = (0, rest_1.GetJsonSync)(getTimeZoneUrl, null, {
|
|
742
|
-
...
|
|
740
|
+
...rest_vars_1.extraLongLocalCache,
|
|
743
741
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
744
742
|
});
|
|
745
743
|
if (response && response.result.d && !(0, typecheckers_1.isNullOrUndefined)(response.result.d)) {
|
|
@@ -762,7 +760,7 @@ async function GetServerTimeOffset(siteUrl, date) {
|
|
|
762
760
|
let inputDate = new Date(dateStr);
|
|
763
761
|
let getTimeZoneOffsetUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(dateStr)}'`;
|
|
764
762
|
let result = await (0, rest_1.GetJson)(getTimeZoneOffsetUrl, null, {
|
|
765
|
-
...
|
|
763
|
+
...rest_vars_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
766
764
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
767
765
|
});
|
|
768
766
|
if (result && !(0, typecheckers_1.isNullOrEmptyString)(result.value)) {
|
|
@@ -786,7 +784,7 @@ function GetServerTimeOffsetSync(siteUrl, date) {
|
|
|
786
784
|
let inputDate = new Date(dateStr);
|
|
787
785
|
let getTimeZoneOffsetUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(dateStr)}'`;
|
|
788
786
|
let result = (0, rest_1.GetJsonSync)(getTimeZoneOffsetUrl, null, {
|
|
789
|
-
...
|
|
787
|
+
...rest_vars_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
790
788
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
791
789
|
});
|
|
792
790
|
if (result && result.success && !(0, typecheckers_1.isNullOrEmptyString)(result.result.value)) {
|
|
@@ -850,7 +848,7 @@ async function SPServerLocalTimeToUTC(siteUrl, date) {
|
|
|
850
848
|
}
|
|
851
849
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(date)}'`;
|
|
852
850
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
853
|
-
...
|
|
851
|
+
...rest_vars_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
854
852
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
855
853
|
});
|
|
856
854
|
return result && result.value || null;
|
|
@@ -884,7 +882,7 @@ function SPServerLocalTimeToUTCSync(siteUrl, date) {
|
|
|
884
882
|
}
|
|
885
883
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(date)}'`;
|
|
886
884
|
let result = (0, rest_1.GetJsonSync)(restUrl, null, {
|
|
887
|
-
...
|
|
885
|
+
...rest_vars_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
888
886
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
889
887
|
});
|
|
890
888
|
return result.success && result.result.value || null;
|
|
@@ -926,7 +924,7 @@ async function UTCToSPServerLocalTime(siteUrl, date) {
|
|
|
926
924
|
}
|
|
927
925
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/utcToLocalTime(@date)?@date='${encodeURIComponent(date)}'`;
|
|
928
926
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
929
|
-
...
|
|
927
|
+
...rest_vars_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
930
928
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
931
929
|
});
|
|
932
930
|
if (result && result.value) {
|
|
@@ -974,7 +972,7 @@ function UTCToSPServerLocalTimeSync(siteUrl, date) {
|
|
|
974
972
|
}
|
|
975
973
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/utcToLocalTime(@date)?@date='${encodeURIComponent(date)}'`;
|
|
976
974
|
let result = (0, rest_1.GetJsonSync)(restUrl, null, {
|
|
977
|
-
...
|
|
975
|
+
...rest_vars_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
978
976
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
979
977
|
});
|
|
980
978
|
if (result.success && result.result.value) {
|
|
@@ -1079,62 +1077,6 @@ async function SPServerLocalToday(siteUrl) {
|
|
|
1079
1077
|
return SPServerLocalTime(siteUrl);
|
|
1080
1078
|
}, 30000);
|
|
1081
1079
|
}
|
|
1082
|
-
function GetContextWebInformationSync(siteUrl) {
|
|
1083
|
-
var siteId = null;
|
|
1084
|
-
if ((0, common_1.hasGlobalContext)() && _spPageContextInfo && _spPageContextInfo.isAppWeb) {
|
|
1085
|
-
//inside an app web you can't get the contextinfo for any other site
|
|
1086
|
-
siteUrl = _spPageContextInfo.webServerRelativeUrl;
|
|
1087
|
-
siteId = _spPageContextInfo.siteId;
|
|
1088
|
-
}
|
|
1089
|
-
else {
|
|
1090
|
-
siteId = GetSiteIdSync(siteUrl);
|
|
1091
|
-
if ((0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
1092
|
-
return null;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
let result = (0, rest_1.GetJsonSync)(`${(0, common_1.GetRestBaseUrl)(siteUrl)}/contextinfo`, null, {
|
|
1096
|
-
method: "POST",
|
|
1097
|
-
maxAge: 5 * 60,
|
|
1098
|
-
includeDigestInPost: false,
|
|
1099
|
-
allowCache: true,
|
|
1100
|
-
postCacheKey: `GetContextWebInformation_${(0, strings_1.normalizeGuid)(siteId)}`,
|
|
1101
|
-
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1102
|
-
});
|
|
1103
|
-
if (result && result.success) {
|
|
1104
|
-
return result.result.d.GetContextWebInformation;
|
|
1105
|
-
}
|
|
1106
|
-
else {
|
|
1107
|
-
return null;
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
async function GetContextWebInformation(siteUrl) {
|
|
1111
|
-
var siteId = null;
|
|
1112
|
-
if ((0, common_1.hasGlobalContext)() && _spPageContextInfo && _spPageContextInfo.isAppWeb) {
|
|
1113
|
-
//inside an app web you can't get the contextinfo for any other site
|
|
1114
|
-
siteUrl = _spPageContextInfo.webServerRelativeUrl;
|
|
1115
|
-
siteId = _spPageContextInfo.siteId;
|
|
1116
|
-
}
|
|
1117
|
-
else {
|
|
1118
|
-
siteId = await GetSiteId(siteUrl);
|
|
1119
|
-
if ((0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
1120
|
-
return null;
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
try {
|
|
1124
|
-
let result = await (0, rest_1.GetJson)(`${(0, common_1.GetRestBaseUrl)(siteUrl)}/contextinfo`, null, {
|
|
1125
|
-
method: "POST",
|
|
1126
|
-
maxAge: 5 * 60,
|
|
1127
|
-
includeDigestInPost: false,
|
|
1128
|
-
allowCache: true,
|
|
1129
|
-
postCacheKey: `GetContextWebInformation_${(0, strings_1.normalizeGuid)(siteId)}`,
|
|
1130
|
-
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1131
|
-
});
|
|
1132
|
-
return result.d.GetContextWebInformation;
|
|
1133
|
-
}
|
|
1134
|
-
catch {
|
|
1135
|
-
return null;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
1080
|
function _getCustomActionsBaseRestUrl(siteUrl, options = {}) {
|
|
1139
1081
|
const { listId, actionId } = { ...options };
|
|
1140
1082
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web`;
|
|
@@ -1182,7 +1124,7 @@ function _convertCustomActionToPostData(action) {
|
|
|
1182
1124
|
/** Get UserCustomActions for web/list */
|
|
1183
1125
|
async function GetUserCustomActions(siteUrl, listId, allowCache = true) {
|
|
1184
1126
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId });
|
|
1185
|
-
let cacheOptions = allowCache === true ?
|
|
1127
|
+
let cacheOptions = allowCache === true ? rest_vars_1.shortLocalCache : { allowCache: false };
|
|
1186
1128
|
let restOptions = {
|
|
1187
1129
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1188
1130
|
...cacheOptions,
|
|
@@ -1201,7 +1143,7 @@ async function GetUserCustomActions(siteUrl, listId, allowCache = true) {
|
|
|
1201
1143
|
/** Get UserCustomAction by id from web/list */
|
|
1202
1144
|
async function GetUserCustomActionById(siteUrl, customActionId, listId, allowCache = true) {
|
|
1203
1145
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
1204
|
-
let cacheOptions = allowCache === true ?
|
|
1146
|
+
let cacheOptions = allowCache === true ? rest_vars_1.shortLocalCache : { allowCache: false };
|
|
1205
1147
|
let restOptions = {
|
|
1206
1148
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1207
1149
|
...cacheOptions,
|
|
@@ -1220,7 +1162,7 @@ async function GetUserCustomActionById(siteUrl, customActionId, listId, allowCac
|
|
|
1220
1162
|
/** Get UserCustomAction by name from web/list */
|
|
1221
1163
|
async function GetUserCustomActionByName(siteUrl, name, listId, allowCache = true) {
|
|
1222
1164
|
let restUrl = `${_getCustomActionsBaseRestUrl(siteUrl, { listId: listId })}?$filter=Name eq '${encodeURIComponent(name)}'`;
|
|
1223
|
-
let cacheOptions = allowCache === true ?
|
|
1165
|
+
let cacheOptions = allowCache === true ? rest_vars_1.shortLocalCache : { allowCache: false };
|
|
1224
1166
|
let restOptions = {
|
|
1225
1167
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1226
1168
|
...cacheOptions,
|
|
@@ -1299,7 +1241,7 @@ async function GetRegionalSettings(siteUrl) {
|
|
|
1299
1241
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings`;
|
|
1300
1242
|
try {
|
|
1301
1243
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
1302
|
-
...
|
|
1244
|
+
...rest_vars_1.mediumLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1303
1245
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1304
1246
|
});
|
|
1305
1247
|
return result;
|
|
@@ -1314,7 +1256,7 @@ async function GetAllWebProperties(siteUrl) {
|
|
|
1314
1256
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/AllProperties`;
|
|
1315
1257
|
try {
|
|
1316
1258
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
1317
|
-
...
|
|
1259
|
+
...rest_vars_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1318
1260
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1319
1261
|
});
|
|
1320
1262
|
return result;
|
|
@@ -1329,7 +1271,7 @@ async function GetWebPropertyByName(name, siteUrl) {
|
|
|
1329
1271
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/AllProperties?$select=${name}`;
|
|
1330
1272
|
try {
|
|
1331
1273
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
1332
|
-
...
|
|
1274
|
+
...rest_vars_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1333
1275
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1334
1276
|
});
|
|
1335
1277
|
if (!(0, typecheckers_1.isNullOrUndefined)(result) && !(0, typecheckers_1.isNullOrUndefined)(result[name])) {
|
|
@@ -1340,17 +1282,6 @@ async function GetWebPropertyByName(name, siteUrl) {
|
|
|
1340
1282
|
}
|
|
1341
1283
|
return null;
|
|
1342
1284
|
}
|
|
1343
|
-
function getFormDigest(serverRelativeWebUrl, async = false) {
|
|
1344
|
-
if (async) {
|
|
1345
|
-
return GetContextWebInformation(serverRelativeWebUrl).then(contextWebInformation => {
|
|
1346
|
-
return contextWebInformation && contextWebInformation.FormDigestValue || null;
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
else {
|
|
1350
|
-
let contextWebInformation = GetContextWebInformationSync(serverRelativeWebUrl);
|
|
1351
|
-
return contextWebInformation && contextWebInformation.FormDigestValue || null;
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
1285
|
function ensureLegacyProps(pageContext) {
|
|
1355
1286
|
try {
|
|
1356
1287
|
let isContextOk = (ctx) => !(0, typecheckers_1.isNullOrUndefined)(ctx) && !(0, typecheckers_1.isNullOrUndefined)(ctx.webServerRelativeUrl);
|
|
@@ -1459,7 +1390,7 @@ async function GetActiveFeatures(siteUrlOrId, allowCache = true) {
|
|
|
1459
1390
|
method: "GET",
|
|
1460
1391
|
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1461
1392
|
includeDigestInGet: true,
|
|
1462
|
-
...(allowCache === true ?
|
|
1393
|
+
...(allowCache === true ? rest_vars_1.mediumLocalCache : rest_vars_1.noLocalCache),
|
|
1463
1394
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1464
1395
|
});
|
|
1465
1396
|
return response.value;
|
|
@@ -1544,7 +1475,7 @@ async function GetWebAssociatedGroups(siteUrl) {
|
|
|
1544
1475
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web?$select=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup&$expand=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup`;
|
|
1545
1476
|
try {
|
|
1546
1477
|
let result = await (0, rest_1.GetJson)(restUrl, null, {
|
|
1547
|
-
...
|
|
1478
|
+
...rest_vars_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1548
1479
|
spWebUrl: siteUrl //allow getDigest to work when not in SharePoint
|
|
1549
1480
|
});
|
|
1550
1481
|
return result;
|