@kwiz/common 1.0.73 → 1.0.74
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/_dependencies.js.map +1 -0
- package/lib/cjs/config.js.map +1 -0
- package/lib/cjs/exports-index.js.map +1 -0
- package/lib/cjs/helpers/Guid.js.map +1 -0
- package/lib/cjs/helpers/_dependencies.js.map +1 -0
- package/lib/cjs/helpers/base64.js.map +1 -0
- package/lib/cjs/helpers/browser.js.map +1 -0
- package/lib/cjs/helpers/browserinfo.js.map +1 -0
- package/{dist → lib/cjs}/helpers/collections.base.js +0 -3
- package/lib/cjs/helpers/collections.base.js.map +1 -0
- package/lib/cjs/helpers/collections.js.map +1 -0
- package/lib/cjs/helpers/color.js.map +1 -0
- package/lib/cjs/helpers/cookies.js.map +1 -0
- package/lib/cjs/helpers/date.js.map +1 -0
- package/{dist → lib/cjs}/helpers/debug.js +1 -1
- package/lib/cjs/helpers/debug.js.map +1 -0
- package/lib/cjs/helpers/emails.js.map +1 -0
- package/lib/cjs/helpers/eval.js.map +1 -0
- package/lib/cjs/helpers/exports-index.js.map +1 -0
- package/lib/cjs/helpers/file.js.map +1 -0
- package/lib/cjs/helpers/flatted.js.map +1 -0
- package/lib/cjs/helpers/functions.js.map +1 -0
- package/lib/cjs/helpers/graph/calendar.types.js.map +1 -0
- package/lib/cjs/helpers/graph/exports-index.js.map +1 -0
- package/lib/cjs/helpers/http.js.map +1 -0
- package/lib/cjs/helpers/images.js.map +1 -0
- package/lib/cjs/helpers/json.js.map +1 -0
- package/lib/cjs/helpers/md5.js.map +1 -0
- package/lib/cjs/helpers/objects.js.map +1 -0
- package/{dist → lib/cjs}/helpers/promises.js +8 -3
- package/lib/cjs/helpers/promises.js.map +1 -0
- package/lib/cjs/helpers/random.js.map +1 -0
- package/lib/cjs/helpers/scheduler/exports-index.js.map +1 -0
- package/lib/cjs/helpers/scheduler/scheduler.js.map +1 -0
- package/{dist → lib/cjs}/helpers/sharepoint.js +17 -17
- package/lib/cjs/helpers/sharepoint.js.map +1 -0
- package/lib/cjs/helpers/strings.js.map +1 -0
- package/lib/cjs/helpers/typecheckers.js.map +1 -0
- package/lib/cjs/helpers/url.js.map +1 -0
- package/lib/cjs/helpers/urlhelper.js.map +1 -0
- package/{dist → lib/cjs}/index.js +5 -2
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/auth.js.map +1 -0
- package/lib/cjs/types/common.types.js.map +1 -0
- package/lib/cjs/types/exports-index.js.map +1 -0
- package/lib/cjs/types/flatted.types.js.map +1 -0
- package/lib/cjs/types/globals.types.js.map +1 -0
- package/lib/cjs/types/graph/calendar.types.js.map +1 -0
- package/lib/cjs/types/graph/exports-index.js.map +1 -0
- package/lib/cjs/types/knownscript.types.js.map +1 -0
- package/lib/cjs/types/libs/datajs.types.js.map +1 -0
- package/lib/cjs/types/libs/exports-index.js.map +1 -0
- package/lib/cjs/types/libs/ics.types.js.map +1 -0
- package/lib/cjs/types/libs/msal.types.js.map +1 -0
- package/{dist → lib/cjs}/types/locales.js.map +1 -1
- package/lib/cjs/types/localstoragecache.types.js.map +1 -0
- package/lib/cjs/types/location.types.js.map +1 -0
- package/{dist → lib/cjs}/types/moment.js.map +1 -1
- package/{dist → lib/cjs}/types/regex.types.js.map +1 -1
- package/lib/cjs/types/rest.types.js.map +1 -0
- package/lib/cjs/types/sharepoint.types.js.map +1 -0
- package/lib/cjs/types/sharepoint.utils.types.js.map +1 -0
- package/lib/cjs/utils/_dependencies.js.map +1 -0
- package/lib/cjs/utils/auth/common.js.map +1 -0
- package/{dist → lib/cjs}/utils/auth/discovery.js +16 -14
- package/lib/cjs/utils/auth/discovery.js.map +1 -0
- package/lib/cjs/utils/auth/exports-index.js.map +1 -0
- package/{dist → lib/cjs}/utils/base64.js +4 -3
- package/lib/cjs/utils/base64.js.map +1 -0
- package/{dist → lib/cjs}/utils/consolelogger.js +31 -26
- package/lib/cjs/utils/consolelogger.js.map +1 -0
- package/{dist → lib/cjs}/utils/date.js +3 -3
- package/lib/cjs/utils/date.js.map +1 -0
- package/{dist → lib/cjs}/utils/emails.js +2 -2
- package/lib/cjs/utils/emails.js.map +1 -0
- package/lib/cjs/utils/exports-index.js.map +1 -0
- package/{dist → lib/cjs}/utils/knownscript.js +9 -5
- package/lib/cjs/utils/knownscript.js.map +1 -0
- package/{dist → lib/cjs}/utils/localstoragecache.js +40 -27
- package/lib/cjs/utils/localstoragecache.js.map +1 -0
- package/{dist → lib/cjs}/utils/rest.js +63 -48
- package/lib/cjs/utils/rest.js.map +1 -0
- package/{dist → lib/cjs}/utils/script.js +15 -10
- package/lib/cjs/utils/script.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/common.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/date.js +10 -9
- package/lib/cjs/utils/sharepoint.rest/date.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/exports-index.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/file.folder.js +49 -46
- package/lib/cjs/utils/sharepoint.rest/file.folder.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/item.js +51 -45
- package/lib/cjs/utils/sharepoint.rest/item.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/list.js +131 -124
- package/lib/cjs/utils/sharepoint.rest/list.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +55 -50
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/listutils/GetListItemsById.js +31 -23
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/listutils/common.js +20 -16
- package/lib/cjs/utils/sharepoint.rest/listutils/common.js.map +1 -0
- package/lib/cjs/utils/sharepoint.rest/listutils/exports-index.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/location.js +3 -3
- package/lib/cjs/utils/sharepoint.rest/location.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/navigation-links.js +3 -3
- package/lib/cjs/utils/sharepoint.rest/navigation-links.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/user-search.js +7 -5
- package/lib/cjs/utils/sharepoint.rest/user-search.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/user.js +52 -47
- package/lib/cjs/utils/sharepoint.rest/user.js.map +1 -0
- package/{dist → lib/cjs}/utils/sharepoint.rest/web.js +167 -158
- package/lib/cjs/utils/sharepoint.rest/web.js.map +1 -0
- package/{dist → lib/cjs}/utils/sod.js +12 -11
- package/lib/cjs/utils/sod.js.map +1 -0
- package/lib/esm/_dependencies.js +12 -0
- package/lib/esm/_dependencies.js.map +1 -0
- package/lib/esm/config.js +12 -0
- package/lib/esm/config.js.map +1 -0
- package/lib/esm/exports-index.js +5 -0
- package/lib/esm/exports-index.js.map +1 -0
- package/lib/esm/helpers/Guid.js +179 -0
- package/lib/esm/helpers/Guid.js.map +1 -0
- package/{src/helpers/_dependencies.ts → lib/esm/helpers/_dependencies.js} +3 -3
- package/lib/esm/helpers/_dependencies.js.map +1 -0
- package/lib/esm/helpers/base64.js +157 -0
- package/lib/esm/helpers/base64.js.map +1 -0
- package/lib/esm/helpers/browser.js +1158 -0
- package/lib/esm/helpers/browser.js.map +1 -0
- package/lib/esm/helpers/browserinfo.js +206 -0
- package/lib/esm/helpers/browserinfo.js.map +1 -0
- package/lib/esm/helpers/collections.base.js +372 -0
- package/lib/esm/helpers/collections.base.js.map +1 -0
- package/lib/esm/helpers/collections.js +96 -0
- package/lib/esm/helpers/collections.js.map +1 -0
- package/lib/esm/helpers/color.js +51 -0
- package/lib/esm/helpers/color.js.map +1 -0
- package/lib/esm/helpers/cookies.js +53 -0
- package/lib/esm/helpers/cookies.js.map +1 -0
- package/lib/esm/helpers/date.js +163 -0
- package/lib/esm/helpers/date.js.map +1 -0
- package/lib/esm/helpers/debug.js +156 -0
- package/lib/esm/helpers/debug.js.map +1 -0
- package/lib/esm/helpers/emails.js +6 -0
- package/lib/esm/helpers/emails.js.map +1 -0
- package/lib/esm/helpers/eval.js +6 -0
- package/lib/esm/helpers/eval.js.map +1 -0
- package/lib/esm/helpers/exports-index.js +30 -0
- package/lib/esm/helpers/exports-index.js.map +1 -0
- package/lib/esm/helpers/file.js +49 -0
- package/lib/esm/helpers/file.js.map +1 -0
- package/lib/esm/helpers/flatted.js +131 -0
- package/lib/esm/helpers/flatted.js.map +1 -0
- package/lib/esm/helpers/functions.js +13 -0
- package/lib/esm/helpers/functions.js.map +1 -0
- package/lib/esm/helpers/graph/calendar.types.js +10 -0
- package/lib/esm/helpers/graph/calendar.types.js.map +1 -0
- package/lib/esm/helpers/graph/exports-index.js +2 -0
- package/lib/esm/helpers/graph/exports-index.js.map +1 -0
- package/lib/esm/helpers/http.js +65 -0
- package/lib/esm/helpers/http.js.map +1 -0
- package/lib/esm/helpers/images.js +18 -0
- package/lib/esm/helpers/images.js.map +1 -0
- package/lib/esm/helpers/json.js +39 -0
- package/lib/esm/helpers/json.js.map +1 -0
- package/lib/esm/helpers/md5.js +168 -0
- package/lib/esm/helpers/md5.js.map +1 -0
- package/lib/esm/helpers/objects.js +258 -0
- package/lib/esm/helpers/objects.js.map +1 -0
- package/lib/esm/helpers/promises.js +152 -0
- package/lib/esm/helpers/promises.js.map +1 -0
- package/lib/esm/helpers/random.js +27 -0
- package/lib/esm/helpers/random.js.map +1 -0
- package/lib/esm/helpers/scheduler/exports-index.js +2 -0
- package/lib/esm/helpers/scheduler/exports-index.js.map +1 -0
- package/lib/esm/helpers/scheduler/scheduler.js +103 -0
- package/lib/esm/helpers/scheduler/scheduler.js.map +1 -0
- package/lib/esm/helpers/sharepoint.js +669 -0
- package/lib/esm/helpers/sharepoint.js.map +1 -0
- package/lib/esm/helpers/strings.js +273 -0
- package/lib/esm/helpers/strings.js.map +1 -0
- package/lib/esm/helpers/typecheckers.js +238 -0
- package/lib/esm/helpers/typecheckers.js.map +1 -0
- package/lib/esm/helpers/url.js +190 -0
- package/lib/esm/helpers/url.js.map +1 -0
- package/lib/esm/helpers/urlhelper.js +100 -0
- package/lib/esm/helpers/urlhelper.js.map +1 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/auth.js +38 -0
- package/lib/esm/types/auth.js.map +1 -0
- package/lib/esm/types/common.types.js +3 -0
- package/lib/esm/types/common.types.js.map +1 -0
- package/lib/esm/types/exports-index.js +16 -0
- package/lib/esm/types/exports-index.js.map +1 -0
- package/lib/esm/types/flatted.types.js +2 -0
- package/lib/esm/types/flatted.types.js.map +1 -0
- package/lib/esm/types/globals.types.js +2 -0
- package/lib/esm/types/globals.types.js.map +1 -0
- package/lib/esm/types/graph/calendar.types.js +2 -0
- package/lib/esm/types/graph/calendar.types.js.map +1 -0
- package/lib/esm/types/graph/exports-index.js +2 -0
- package/lib/esm/types/graph/exports-index.js.map +1 -0
- package/lib/esm/types/knownscript.types.js +2 -0
- package/lib/esm/types/knownscript.types.js.map +1 -0
- package/lib/esm/types/libs/datajs.types.js +2 -0
- package/lib/esm/types/libs/datajs.types.js.map +1 -0
- package/lib/esm/types/libs/exports-index.js +4 -0
- package/lib/esm/types/libs/exports-index.js.map +1 -0
- package/lib/esm/types/libs/ics.types.js +2 -0
- package/lib/esm/types/libs/ics.types.js.map +1 -0
- package/lib/esm/types/libs/msal.types.js +28 -0
- package/lib/esm/types/libs/msal.types.js.map +1 -0
- package/lib/esm/types/locales.js +2 -0
- package/lib/esm/types/locales.js.map +1 -0
- package/lib/esm/types/localstoragecache.types.js +2 -0
- package/lib/esm/types/localstoragecache.types.js.map +1 -0
- package/lib/esm/types/location.types.js +2 -0
- package/lib/esm/types/location.types.js.map +1 -0
- package/lib/esm/types/moment.js +2 -0
- package/lib/esm/types/moment.js.map +1 -0
- package/lib/esm/types/regex.types.js +2 -0
- package/lib/esm/types/regex.types.js.map +1 -0
- package/lib/esm/types/rest.types.js +21 -0
- package/lib/esm/types/rest.types.js.map +1 -0
- package/lib/esm/types/sharepoint.types.js +660 -0
- package/lib/esm/types/sharepoint.types.js.map +1 -0
- package/lib/esm/types/sharepoint.utils.types.js +51 -0
- package/lib/esm/types/sharepoint.utils.types.js.map +1 -0
- package/{src/utils/_dependencies.ts → lib/esm/utils/_dependencies.js} +4 -4
- package/lib/esm/utils/_dependencies.js.map +1 -0
- package/lib/esm/utils/auth/common.js +61 -0
- package/lib/esm/utils/auth/common.js.map +1 -0
- package/lib/esm/utils/auth/discovery.js +104 -0
- package/lib/esm/utils/auth/discovery.js.map +1 -0
- package/lib/esm/utils/auth/exports-index.js +3 -0
- package/lib/esm/utils/auth/exports-index.js.map +1 -0
- package/lib/esm/utils/base64.js +27 -0
- package/lib/esm/utils/base64.js.map +1 -0
- package/lib/esm/utils/consolelogger.js +271 -0
- package/lib/esm/utils/consolelogger.js.map +1 -0
- package/lib/esm/utils/date.js +26 -0
- package/lib/esm/utils/date.js.map +1 -0
- package/lib/esm/utils/emails.js +23 -0
- package/lib/esm/utils/emails.js.map +1 -0
- package/lib/esm/utils/exports-index.js +12 -0
- package/lib/esm/utils/exports-index.js.map +1 -0
- package/lib/esm/utils/knownscript.js +247 -0
- package/lib/esm/utils/knownscript.js.map +1 -0
- package/lib/esm/utils/localstoragecache.js +378 -0
- package/lib/esm/utils/localstoragecache.js.map +1 -0
- package/lib/esm/utils/rest.js +432 -0
- package/lib/esm/utils/rest.js.map +1 -0
- package/lib/esm/utils/script.js +154 -0
- package/lib/esm/utils/script.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/common.js +134 -0
- package/lib/esm/utils/sharepoint.rest/common.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/date.js +54 -0
- package/lib/esm/utils/sharepoint.rest/date.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/exports-index.js +12 -0
- package/lib/esm/utils/sharepoint.rest/exports-index.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/file.folder.js +444 -0
- package/lib/esm/utils/sharepoint.rest/file.folder.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/item.js +453 -0
- package/lib/esm/utils/sharepoint.rest/item.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/list.js +924 -0
- package/lib/esm/utils/sharepoint.rest/list.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +624 -0
- package/lib/esm/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/listutils/GetListItemsById.js +214 -0
- package/lib/esm/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/listutils/common.js +198 -0
- package/lib/esm/utils/sharepoint.rest/listutils/common.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/listutils/exports-index.js +4 -0
- package/lib/esm/utils/sharepoint.rest/listutils/exports-index.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/location.js +103 -0
- package/lib/esm/utils/sharepoint.rest/location.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/navigation-links.js +80 -0
- package/lib/esm/utils/sharepoint.rest/navigation-links.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/user-search.js +218 -0
- package/lib/esm/utils/sharepoint.rest/user-search.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/user.js +414 -0
- package/lib/esm/utils/sharepoint.rest/user.js.map +1 -0
- package/lib/esm/utils/sharepoint.rest/web.js +1158 -0
- package/lib/esm/utils/sharepoint.rest/web.js.map +1 -0
- package/lib/esm/utils/sod.js +164 -0
- package/lib/esm/utils/sod.js.map +1 -0
- package/{dist → lib/types}/helpers/collections.base.d.ts +1 -1
- package/{dist → lib/types}/helpers/collections.d.ts +1 -1
- package/{dist → lib/types}/helpers/flatted.d.ts +1 -1
- package/{dist → lib/types}/helpers/graph/calendar.types.d.ts +1 -1
- package/{dist → lib/types}/helpers/sharepoint.d.ts +3 -1
- package/{dist → lib/types}/helpers/strings.d.ts +1 -1
- package/{dist → lib/types}/helpers/url.d.ts +1 -1
- package/{dist → lib/types}/utils/auth/discovery.d.ts +1 -1
- package/{dist → lib/types}/utils/knownscript.d.ts +5 -1
- package/{dist → lib/types}/utils/localstoragecache.d.ts +1 -1
- package/{dist → lib/types}/utils/rest.d.ts +1 -1
- package/{dist → lib/types}/utils/script.d.ts +1 -1
- package/{dist → lib/types}/utils/sharepoint.rest/date.d.ts +1 -1
- package/{dist → lib/types}/utils/sharepoint.rest/file.folder.d.ts +4 -1
- package/{dist → lib/types}/utils/sharepoint.rest/item.d.ts +3 -1
- package/{dist → lib/types}/utils/sharepoint.rest/list.d.ts +4 -1
- package/{dist → lib/types}/utils/sharepoint.rest/listutils/GetListItemsByCaml.d.ts +1 -1
- package/{dist → lib/types}/utils/sharepoint.rest/listutils/GetListItemsById.d.ts +2 -1
- package/{dist → lib/types}/utils/sharepoint.rest/listutils/common.d.ts +2 -1
- package/{dist → lib/types}/utils/sharepoint.rest/navigation-links.d.ts +1 -1
- package/{dist → lib/types}/utils/sharepoint.rest/user-search.d.ts +1 -1
- package/{dist → lib/types}/utils/sharepoint.rest/user.d.ts +3 -1
- package/{dist → lib/types}/utils/sharepoint.rest/web.d.ts +3 -1
- package/{dist → lib/types}/utils/sod.d.ts +1 -1
- package/package.json +15 -7
- package/src/helpers/browser.ts +1 -1
- package/src/helpers/collections.base.ts +1 -2
- package/src/helpers/collections.ts +1 -1
- package/src/helpers/debug.ts +1 -1
- package/src/helpers/flatted.ts +1 -1
- package/src/helpers/graph/calendar.types.ts +1 -1
- package/src/helpers/promises.ts +10 -5
- package/src/helpers/sharepoint.ts +3 -1
- package/src/helpers/strings.ts +1 -1
- package/src/helpers/url.ts +1 -1
- package/src/utils/auth/discovery.ts +3 -1
- package/src/utils/base64.ts +2 -1
- package/src/utils/consolelogger.ts +7 -1
- package/src/utils/date.ts +1 -1
- package/src/utils/emails.ts +1 -1
- package/src/utils/knownscript.ts +7 -1
- package/src/utils/localstoragecache.ts +39 -20
- package/src/utils/rest.ts +23 -4
- package/src/utils/script.ts +4 -1
- package/src/utils/sharepoint.rest/date.ts +3 -1
- package/src/utils/sharepoint.rest/file.folder.ts +7 -1
- package/src/utils/sharepoint.rest/item.ts +9 -1
- package/src/utils/sharepoint.rest/list.ts +10 -1
- package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +9 -1
- package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +14 -4
- package/src/utils/sharepoint.rest/listutils/common.ts +6 -1
- package/src/utils/sharepoint.rest/location.ts +1 -1
- package/src/utils/sharepoint.rest/navigation-links.ts +2 -1
- package/src/utils/sharepoint.rest/user-search.ts +4 -1
- package/src/utils/sharepoint.rest/user.ts +7 -1
- package/src/utils/sharepoint.rest/web.ts +12 -2
- package/src/utils/sod.ts +3 -1
- package/dist/_dependencies.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/exports-index.js.map +0 -1
- package/dist/helpers/Guid.js.map +0 -1
- package/dist/helpers/_dependencies.js.map +0 -1
- package/dist/helpers/base64.js.map +0 -1
- package/dist/helpers/browser.js.map +0 -1
- package/dist/helpers/browserinfo.js.map +0 -1
- package/dist/helpers/collections.base.js.map +0 -1
- package/dist/helpers/collections.js.map +0 -1
- package/dist/helpers/color.js.map +0 -1
- package/dist/helpers/cookies.js.map +0 -1
- package/dist/helpers/date.js.map +0 -1
- package/dist/helpers/debug.js.map +0 -1
- package/dist/helpers/emails.js.map +0 -1
- package/dist/helpers/eval.js.map +0 -1
- package/dist/helpers/exports-index.js.map +0 -1
- package/dist/helpers/file.js.map +0 -1
- package/dist/helpers/flatted.js.map +0 -1
- package/dist/helpers/functions.js.map +0 -1
- package/dist/helpers/graph/calendar.types.js.map +0 -1
- package/dist/helpers/graph/exports-index.js.map +0 -1
- package/dist/helpers/http.js.map +0 -1
- package/dist/helpers/images.js.map +0 -1
- package/dist/helpers/json.js.map +0 -1
- package/dist/helpers/md5.js.map +0 -1
- package/dist/helpers/objects.js.map +0 -1
- package/dist/helpers/promises.js.map +0 -1
- package/dist/helpers/random.js.map +0 -1
- package/dist/helpers/scheduler/exports-index.js.map +0 -1
- package/dist/helpers/scheduler/scheduler.js.map +0 -1
- package/dist/helpers/sharepoint.js.map +0 -1
- package/dist/helpers/strings.js.map +0 -1
- package/dist/helpers/typecheckers.js.map +0 -1
- package/dist/helpers/url.js.map +0 -1
- package/dist/helpers/urlhelper.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/auth.js.map +0 -1
- package/dist/types/common.types.js.map +0 -1
- package/dist/types/exports-index.js.map +0 -1
- package/dist/types/flatted.types.js.map +0 -1
- package/dist/types/globals.types.js.map +0 -1
- package/dist/types/graph/calendar.types.js.map +0 -1
- package/dist/types/graph/exports-index.js.map +0 -1
- package/dist/types/knownscript.types.js.map +0 -1
- package/dist/types/libs/datajs.types.js.map +0 -1
- package/dist/types/libs/exports-index.js.map +0 -1
- package/dist/types/libs/ics.types.js.map +0 -1
- package/dist/types/libs/msal.types.js.map +0 -1
- package/dist/types/localstoragecache.types.js.map +0 -1
- package/dist/types/location.types.js.map +0 -1
- package/dist/types/rest.types.js.map +0 -1
- package/dist/types/sharepoint.types.js.map +0 -1
- package/dist/types/sharepoint.utils.types.js.map +0 -1
- package/dist/utils/_dependencies.js.map +0 -1
- package/dist/utils/auth/common.js.map +0 -1
- package/dist/utils/auth/discovery.js.map +0 -1
- package/dist/utils/auth/exports-index.js.map +0 -1
- package/dist/utils/base64.js.map +0 -1
- package/dist/utils/consolelogger.js.map +0 -1
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/emails.js.map +0 -1
- package/dist/utils/exports-index.js.map +0 -1
- package/dist/utils/knownscript.js.map +0 -1
- package/dist/utils/localstoragecache.js.map +0 -1
- package/dist/utils/rest.js.map +0 -1
- package/dist/utils/script.js.map +0 -1
- package/dist/utils/sharepoint.rest/common.js.map +0 -1
- package/dist/utils/sharepoint.rest/date.js.map +0 -1
- package/dist/utils/sharepoint.rest/exports-index.js.map +0 -1
- package/dist/utils/sharepoint.rest/file.folder.js.map +0 -1
- package/dist/utils/sharepoint.rest/item.js.map +0 -1
- package/dist/utils/sharepoint.rest/list.js.map +0 -1
- package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +0 -1
- package/dist/utils/sharepoint.rest/listutils/GetListItemsById.js.map +0 -1
- package/dist/utils/sharepoint.rest/listutils/common.js.map +0 -1
- package/dist/utils/sharepoint.rest/listutils/exports-index.js.map +0 -1
- package/dist/utils/sharepoint.rest/location.js.map +0 -1
- package/dist/utils/sharepoint.rest/navigation-links.js.map +0 -1
- package/dist/utils/sharepoint.rest/user-search.js.map +0 -1
- package/dist/utils/sharepoint.rest/user.js.map +0 -1
- package/dist/utils/sharepoint.rest/web.js.map +0 -1
- package/dist/utils/sod.js.map +0 -1
- /package/{dist → lib/cjs}/_dependencies.js +0 -0
- /package/{dist → lib/cjs}/config.js +0 -0
- /package/{dist → lib/cjs}/exports-index.js +0 -0
- /package/{dist → lib/cjs}/helpers/Guid.js +0 -0
- /package/{dist → lib/cjs}/helpers/_dependencies.js +0 -0
- /package/{dist → lib/cjs}/helpers/base64.js +0 -0
- /package/{dist → lib/cjs}/helpers/browser.js +0 -0
- /package/{dist → lib/cjs}/helpers/browserinfo.js +0 -0
- /package/{dist → lib/cjs}/helpers/collections.js +0 -0
- /package/{dist → lib/cjs}/helpers/color.js +0 -0
- /package/{dist → lib/cjs}/helpers/cookies.js +0 -0
- /package/{dist → lib/cjs}/helpers/date.js +0 -0
- /package/{dist → lib/cjs}/helpers/emails.js +0 -0
- /package/{dist → lib/cjs}/helpers/eval.js +0 -0
- /package/{dist → lib/cjs}/helpers/exports-index.js +0 -0
- /package/{dist → lib/cjs}/helpers/file.js +0 -0
- /package/{dist → lib/cjs}/helpers/flatted.js +0 -0
- /package/{dist → lib/cjs}/helpers/functions.js +0 -0
- /package/{dist → lib/cjs}/helpers/graph/calendar.types.js +0 -0
- /package/{dist → lib/cjs}/helpers/graph/exports-index.js +0 -0
- /package/{dist → lib/cjs}/helpers/http.js +0 -0
- /package/{dist → lib/cjs}/helpers/images.js +0 -0
- /package/{dist → lib/cjs}/helpers/json.js +0 -0
- /package/{dist → lib/cjs}/helpers/md5.js +0 -0
- /package/{dist → lib/cjs}/helpers/objects.js +0 -0
- /package/{dist → lib/cjs}/helpers/random.js +0 -0
- /package/{dist → lib/cjs}/helpers/scheduler/exports-index.js +0 -0
- /package/{dist → lib/cjs}/helpers/scheduler/scheduler.js +0 -0
- /package/{dist → lib/cjs}/helpers/strings.js +0 -0
- /package/{dist → lib/cjs}/helpers/typecheckers.js +0 -0
- /package/{dist → lib/cjs}/helpers/url.js +0 -0
- /package/{dist → lib/cjs}/helpers/urlhelper.js +0 -0
- /package/{dist → lib/cjs}/types/auth.js +0 -0
- /package/{dist → lib/cjs}/types/common.types.js +0 -0
- /package/{dist → lib/cjs}/types/exports-index.js +0 -0
- /package/{dist → lib/cjs}/types/flatted.types.js +0 -0
- /package/{dist → lib/cjs}/types/globals.types.js +0 -0
- /package/{dist → lib/cjs}/types/graph/calendar.types.js +0 -0
- /package/{dist → lib/cjs}/types/graph/exports-index.js +0 -0
- /package/{dist → lib/cjs}/types/knownscript.types.js +0 -0
- /package/{dist → lib/cjs}/types/libs/datajs.types.js +0 -0
- /package/{dist → lib/cjs}/types/libs/exports-index.js +0 -0
- /package/{dist → lib/cjs}/types/libs/ics.types.js +0 -0
- /package/{dist → lib/cjs}/types/libs/msal.types.js +0 -0
- /package/{dist → lib/cjs}/types/locales.js +0 -0
- /package/{dist → lib/cjs}/types/localstoragecache.types.js +0 -0
- /package/{dist → lib/cjs}/types/location.types.js +0 -0
- /package/{dist → lib/cjs}/types/moment.js +0 -0
- /package/{dist → lib/cjs}/types/regex.types.js +0 -0
- /package/{dist → lib/cjs}/types/rest.types.js +0 -0
- /package/{dist → lib/cjs}/types/sharepoint.types.js +0 -0
- /package/{dist → lib/cjs}/types/sharepoint.utils.types.js +0 -0
- /package/{dist → lib/cjs}/utils/_dependencies.js +0 -0
- /package/{dist → lib/cjs}/utils/auth/common.js +0 -0
- /package/{dist → lib/cjs}/utils/auth/exports-index.js +0 -0
- /package/{dist → lib/cjs}/utils/exports-index.js +0 -0
- /package/{dist → lib/cjs}/utils/sharepoint.rest/common.js +0 -0
- /package/{dist → lib/cjs}/utils/sharepoint.rest/exports-index.js +0 -0
- /package/{dist → lib/cjs}/utils/sharepoint.rest/listutils/exports-index.js +0 -0
- /package/{dist → lib/types}/_dependencies.d.ts +0 -0
- /package/{dist → lib/types}/config.d.ts +0 -0
- /package/{dist → lib/types}/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/helpers/Guid.d.ts +0 -0
- /package/{dist → lib/types}/helpers/_dependencies.d.ts +0 -0
- /package/{dist → lib/types}/helpers/base64.d.ts +0 -0
- /package/{dist → lib/types}/helpers/browser.d.ts +0 -0
- /package/{dist → lib/types}/helpers/browserinfo.d.ts +0 -0
- /package/{dist → lib/types}/helpers/color.d.ts +0 -0
- /package/{dist → lib/types}/helpers/cookies.d.ts +0 -0
- /package/{dist → lib/types}/helpers/date.d.ts +0 -0
- /package/{dist → lib/types}/helpers/debug.d.ts +0 -0
- /package/{dist → lib/types}/helpers/emails.d.ts +0 -0
- /package/{dist → lib/types}/helpers/eval.d.ts +0 -0
- /package/{dist → lib/types}/helpers/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/helpers/file.d.ts +0 -0
- /package/{dist → lib/types}/helpers/functions.d.ts +0 -0
- /package/{dist → lib/types}/helpers/graph/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/helpers/http.d.ts +0 -0
- /package/{dist → lib/types}/helpers/images.d.ts +0 -0
- /package/{dist → lib/types}/helpers/json.d.ts +0 -0
- /package/{dist → lib/types}/helpers/md5.d.ts +0 -0
- /package/{dist → lib/types}/helpers/objects.d.ts +0 -0
- /package/{dist → lib/types}/helpers/promises.d.ts +0 -0
- /package/{dist → lib/types}/helpers/random.d.ts +0 -0
- /package/{dist → lib/types}/helpers/scheduler/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/helpers/scheduler/scheduler.d.ts +0 -0
- /package/{dist → lib/types}/helpers/typecheckers.d.ts +0 -0
- /package/{dist → lib/types}/helpers/urlhelper.d.ts +0 -0
- /package/{dist → lib/types}/index.d.ts +0 -0
- /package/{dist → lib/types}/types/auth.d.ts +0 -0
- /package/{dist → lib/types}/types/common.types.d.ts +0 -0
- /package/{dist → lib/types}/types/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/types/flatted.types.d.ts +0 -0
- /package/{dist → lib/types}/types/globals.types.d.ts +0 -0
- /package/{dist → lib/types}/types/graph/calendar.types.d.ts +0 -0
- /package/{dist → lib/types}/types/graph/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/types/knownscript.types.d.ts +0 -0
- /package/{dist → lib/types}/types/libs/datajs.types.d.ts +0 -0
- /package/{dist → lib/types}/types/libs/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/types/libs/ics.types.d.ts +0 -0
- /package/{dist → lib/types}/types/libs/msal.types.d.ts +0 -0
- /package/{dist → lib/types}/types/locales.d.ts +0 -0
- /package/{dist → lib/types}/types/localstoragecache.types.d.ts +0 -0
- /package/{dist → lib/types}/types/location.types.d.ts +0 -0
- /package/{dist → lib/types}/types/moment.d.ts +0 -0
- /package/{dist → lib/types}/types/regex.types.d.ts +0 -0
- /package/{dist → lib/types}/types/rest.types.d.ts +0 -0
- /package/{dist → lib/types}/types/sharepoint.types.d.ts +0 -0
- /package/{dist → lib/types}/types/sharepoint.utils.types.d.ts +0 -0
- /package/{dist → lib/types}/utils/_dependencies.d.ts +0 -0
- /package/{dist → lib/types}/utils/auth/common.d.ts +0 -0
- /package/{dist → lib/types}/utils/auth/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/utils/base64.d.ts +0 -0
- /package/{dist → lib/types}/utils/consolelogger.d.ts +0 -0
- /package/{dist → lib/types}/utils/date.d.ts +0 -0
- /package/{dist → lib/types}/utils/emails.d.ts +0 -0
- /package/{dist → lib/types}/utils/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/utils/sharepoint.rest/common.d.ts +0 -0
- /package/{dist → lib/types}/utils/sharepoint.rest/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/utils/sharepoint.rest/listutils/exports-index.d.ts +0 -0
- /package/{dist → lib/types}/utils/sharepoint.rest/location.d.ts +0 -0
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BreakWebPermissionInheritance = exports.RestoreWebPermissionInheritance = exports.WebHasUniquePermissions = exports.ensureLegacyProps = exports.getFormDigest = exports.GetWebPropertyByName = exports.GetAllWebProperties = exports.GetRegionalSettings = exports.DeleteUserCustomAction = exports.UpdateUserCustomAction = exports.AddUserCustomAction = exports.GetUserCustomActionByName = exports.GetUserCustomActionById = exports.GetUserCustomActions = exports.GetContextWebInformationSync = exports.SPServerLocalTime = exports.SPServerLocalTimeSync = exports.UTCToSPServerLocalTimeSync = exports.UTCToSPServerLocalTime = exports.SPServerLocalTimeToUTCSync = exports.SPServerLocalTimeToUTC = exports.SPServerLocalTimeToUTCDateSync = exports.SPServerLocalTimeToUTCDate = exports.GetServerTimeZone = exports.GetAppTilesSync = exports.GetAppTiles = exports.GetSubWebs = exports.GetRoleAssignments = exports.GetWebRoleDefinitions = exports.GetWebInfoSync = exports.GetWebInfo = exports.__getSubSites = exports.GetAllSubWebs = exports.GetListsSync = exports.GetLists = exports.GetContentTypesSync = exports.GetContentTypes = exports.UserHasManageSitePermissions = exports.UserHasAllPermissions = exports.IsRootWeb = exports.GetWebIdSync = exports.GetWebId = exports.GetWebTitle = exports.GetRootWebInfo = exports.GetSiteIdSync = exports.GetSiteId = exports.GetPortalUrl = exports.GetTenantId = exports.GetSiteInfoSync = exports.GetSiteInfo = void 0;
|
|
4
4
|
exports.GetWebAssociatedGroups = exports.SetWelcomePage = exports.GetWelcomePage = exports.DectivateFeature = exports.ActivateFeature = exports.GetActiveFeatures = exports.GetAvailableTagsForSiteSync = exports.GetAvailableTagsForSite = exports.SetUserAsSiteAdmin = exports.RemoveWebPermission = exports.AssignWebPermission = void 0;
|
|
5
|
-
const
|
|
5
|
+
const collections_base_1 = require("../../helpers/collections.base");
|
|
6
|
+
const json_1 = require("../../helpers/json");
|
|
7
|
+
const objects_1 = require("../../helpers/objects");
|
|
8
|
+
const sharepoint_1 = require("../../helpers/sharepoint");
|
|
9
|
+
const strings_1 = require("../../helpers/strings");
|
|
10
|
+
const typecheckers_1 = require("../../helpers/typecheckers");
|
|
11
|
+
const url_1 = require("../../helpers/url");
|
|
12
|
+
const rest_types_1 = require("../../types/rest.types");
|
|
13
|
+
const sharepoint_types_1 = require("../../types/sharepoint.types");
|
|
14
|
+
const sharepoint_utils_types_1 = require("../../types/sharepoint.utils.types");
|
|
15
|
+
const discovery_1 = require("../auth/discovery");
|
|
6
16
|
const consolelogger_1 = require("../consolelogger");
|
|
7
17
|
const date_1 = require("../date");
|
|
8
|
-
const exports_index_1 = require("../exports-index");
|
|
9
18
|
const rest_1 = require("../rest");
|
|
10
19
|
const common_1 = require("./common");
|
|
11
20
|
const list_1 = require("./list");
|
|
@@ -14,9 +23,9 @@ async function GetSiteInfo(siteUrl) {
|
|
|
14
23
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
15
24
|
try {
|
|
16
25
|
const r = await (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site?$select=id,serverRelativeUrl", null, { ...rest_1.longLocalCache });
|
|
17
|
-
var id = (0,
|
|
18
|
-
var serverRelativeUrl = (0,
|
|
19
|
-
if ((0,
|
|
26
|
+
var id = (0, strings_1.normalizeGuid)(r.d.Id);
|
|
27
|
+
var serverRelativeUrl = (0, url_1.normalizeUrl)(r.d.ServerRelativeUrl);
|
|
28
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(serverRelativeUrl))
|
|
20
29
|
serverRelativeUrl = "/"; //can't return "" since it will be treated as current sub site, when tyring to access the root site from a sub-site
|
|
21
30
|
return { Id: id, ServerRelativeUrl: serverRelativeUrl };
|
|
22
31
|
}
|
|
@@ -29,8 +38,8 @@ function GetSiteInfoSync(siteUrl) {
|
|
|
29
38
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
30
39
|
let result = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site?$select=id,serverRelativeUrl", null, { ...rest_1.longLocalCache });
|
|
31
40
|
if (result.success) {
|
|
32
|
-
var id = (0,
|
|
33
|
-
var serverRelativeUrl = (0,
|
|
41
|
+
var id = (0, strings_1.normalizeGuid)(result.result.d.Id);
|
|
42
|
+
var serverRelativeUrl = (0, url_1.normalizeUrl)(result.result.d.ServerRelativeUrl);
|
|
34
43
|
return { Id: id, ServerRelativeUrl: serverRelativeUrl };
|
|
35
44
|
}
|
|
36
45
|
return null;
|
|
@@ -40,8 +49,8 @@ function _getSiteIdFromContext(siteUrl) {
|
|
|
40
49
|
if ((0, common_1.hasGlobalContext)()) {
|
|
41
50
|
//issue 7295
|
|
42
51
|
//make sure we return false for /sites/ab/c is not under /sites/a by adding a / at the end
|
|
43
|
-
let normalizedWebUrl = (0,
|
|
44
|
-
let normalizedCurrentSiteUrl = (0,
|
|
52
|
+
let normalizedWebUrl = (0, url_1.normalizeUrl)((0, url_1.makeServerRelativeUrl)(siteUrl), true).toLowerCase();
|
|
53
|
+
let normalizedCurrentSiteUrl = (0, url_1.normalizeUrl)(_spPageContextInfo.siteServerRelativeUrl, true).toLowerCase();
|
|
45
54
|
//test cases
|
|
46
55
|
//if (!testSub("/", "/hello")) console.error("1");
|
|
47
56
|
//if (testSub("/", "/sites/hello")) console.error("2");
|
|
@@ -50,11 +59,11 @@ function _getSiteIdFromContext(siteUrl) {
|
|
|
50
59
|
//if (!testSub("/", "/")) console.error("5");
|
|
51
60
|
//if (!testSub("/sites/a", "/sites/a")) console.error("6");
|
|
52
61
|
//if (testSub("/sites/a", "/hello")) console.error("7");
|
|
53
|
-
if ((0,
|
|
62
|
+
if ((0, typecheckers_1.isNullOrUndefined)(siteUrl)
|
|
54
63
|
|| normalizedCurrentSiteUrl === "/" && !normalizedWebUrl.startsWith("/sites")
|
|
55
64
|
|| normalizedCurrentSiteUrl !== "/" && normalizedWebUrl.startsWith(normalizedCurrentSiteUrl)) {
|
|
56
|
-
if (!(0,
|
|
57
|
-
return (0,
|
|
65
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(_spPageContextInfo.siteId)) {
|
|
66
|
+
return (0, strings_1.normalizeGuid)(_spPageContextInfo.siteId);
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
}
|
|
@@ -62,12 +71,12 @@ function _getSiteIdFromContext(siteUrl) {
|
|
|
62
71
|
}
|
|
63
72
|
/** Get tenant id lower case no {} */
|
|
64
73
|
function GetTenantId() {
|
|
65
|
-
if (!(0,
|
|
66
|
-
return (0,
|
|
74
|
+
if (!(0, typecheckers_1.isTypeofFullNameNullOrUndefined)("_spPageContextInfo")) {
|
|
75
|
+
return (0, strings_1.normalizeGuid)(_spPageContextInfo.aadTenantId);
|
|
67
76
|
}
|
|
68
|
-
let info = (0,
|
|
69
|
-
if (!(0,
|
|
70
|
-
return (0,
|
|
77
|
+
let info = (0, discovery_1.AutoDiscoverTenantInfo)(true);
|
|
78
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(info) && (0, typecheckers_1.isValidGuid)(info.idOrName)) {
|
|
79
|
+
return (0, strings_1.normalizeGuid)(info.idOrName);
|
|
71
80
|
}
|
|
72
81
|
return null;
|
|
73
82
|
}
|
|
@@ -80,12 +89,12 @@ exports.GetPortalUrl = GetPortalUrl;
|
|
|
80
89
|
/** Get site id lower case no {} */
|
|
81
90
|
async function GetSiteId(siteUrl) {
|
|
82
91
|
let siteId = _getSiteIdFromContext(siteUrl);
|
|
83
|
-
if (!(0,
|
|
92
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
84
93
|
return siteId;
|
|
85
94
|
}
|
|
86
95
|
return GetSiteInfo(siteUrl).then((info) => {
|
|
87
|
-
if (!(0,
|
|
88
|
-
return (0,
|
|
96
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(info) && !(0, typecheckers_1.isNullOrEmptyString)(info.Id)) {
|
|
97
|
+
return (0, strings_1.normalizeGuid)(info.Id);
|
|
89
98
|
}
|
|
90
99
|
return null;
|
|
91
100
|
}).catch(() => {
|
|
@@ -96,11 +105,11 @@ exports.GetSiteId = GetSiteId;
|
|
|
96
105
|
/** Get site id lower case no {} */
|
|
97
106
|
function GetSiteIdSync(siteUrl) {
|
|
98
107
|
let siteId = _getSiteIdFromContext(siteUrl);
|
|
99
|
-
if (!(0,
|
|
108
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
100
109
|
return siteId;
|
|
101
110
|
}
|
|
102
111
|
let result = GetSiteInfoSync(siteUrl);
|
|
103
|
-
return !(0,
|
|
112
|
+
return !(0, typecheckers_1.isNullOrUndefined)(result) ? (0, strings_1.normalizeGuid)(result.Id) : null;
|
|
104
113
|
}
|
|
105
114
|
exports.GetSiteIdSync = GetSiteIdSync;
|
|
106
115
|
/** Get root web id lower case no {} */
|
|
@@ -108,8 +117,8 @@ function GetRootWebInfo(siteUrl) {
|
|
|
108
117
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
109
118
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/site/rootWeb?$select=id,serverRelativeUrl", null, { ...rest_1.longLocalCache })
|
|
110
119
|
.then(r => {
|
|
111
|
-
var id = (0,
|
|
112
|
-
var serverRelativeUrl = (0,
|
|
120
|
+
var id = (0, strings_1.normalizeGuid)(r.d.Id);
|
|
121
|
+
var serverRelativeUrl = (0, url_1.normalizeUrl)(r.d.ServerRelativeUrl);
|
|
113
122
|
//console.log("site id: " + id);
|
|
114
123
|
return { Id: id, ServerRelativeUrl: serverRelativeUrl };
|
|
115
124
|
})
|
|
@@ -133,7 +142,7 @@ function _getWebIdRequestUrl(siteUrl) {
|
|
|
133
142
|
function GetWebId(siteUrl) {
|
|
134
143
|
return (0, rest_1.GetJson)(_getWebIdRequestUrl(siteUrl), null, { ...rest_1.longLocalCache })
|
|
135
144
|
.then(r => {
|
|
136
|
-
return (0,
|
|
145
|
+
return (0, strings_1.normalizeGuid)(r.d.Id);
|
|
137
146
|
})
|
|
138
147
|
.catch(() => null);
|
|
139
148
|
}
|
|
@@ -159,7 +168,7 @@ function UserHasAllPermissions(siteUrl, permissions) {
|
|
|
159
168
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
160
169
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache })
|
|
161
170
|
.then(r => {
|
|
162
|
-
var effectivePermissions = new
|
|
171
|
+
var effectivePermissions = new sharepoint_1.SPBasePermissions(r.d.EffectiveBasePermissions);
|
|
163
172
|
return permissions.every((perm) => {
|
|
164
173
|
return effectivePermissions.has(perm);
|
|
165
174
|
});
|
|
@@ -169,14 +178,14 @@ function UserHasAllPermissions(siteUrl, permissions) {
|
|
|
169
178
|
exports.UserHasAllPermissions = UserHasAllPermissions;
|
|
170
179
|
function UserHasManageSitePermissions(siteUrl) {
|
|
171
180
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
172
|
-
if (!(0,
|
|
181
|
+
if (!(0, typecheckers_1.isTypeofFullNameNullOrUndefined)("_spPageContextInfo")) {
|
|
173
182
|
if (siteUrl.startsWith(_spPageContextInfo.siteServerRelativeUrl))
|
|
174
183
|
if (_spPageContextInfo.isSiteAdmin || _spPageContextInfo["isSiteOwner"])
|
|
175
184
|
return Promise.resolve(true);
|
|
176
185
|
}
|
|
177
186
|
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + `/web/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache })
|
|
178
187
|
.then(r => {
|
|
179
|
-
return new
|
|
188
|
+
return new sharepoint_1.SPBasePermissions(r.d.EffectiveBasePermissions).has(sharepoint_types_1.SPBasePermissionKind.ManageWeb);
|
|
180
189
|
})
|
|
181
190
|
.catch(() => null);
|
|
182
191
|
}
|
|
@@ -184,7 +193,7 @@ exports.UserHasManageSitePermissions = UserHasManageSitePermissions;
|
|
|
184
193
|
function _getContentTypesRequestUrl(siteUrl, options = {}) {
|
|
185
194
|
const { fromRootWeb, includeFields, listIdOrTitle } = options;
|
|
186
195
|
let query = `$select=${includeFields === true ? common_1.CONTENT_TYPES_SELECT : common_1.CONTENT_TYPES_SELECT_WITH_FIELDS}${includeFields === true ? "&$expand=Fields" : ""}`;
|
|
187
|
-
if (!(0,
|
|
196
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(listIdOrTitle)) {
|
|
188
197
|
return `${(0, list_1.GetListRestUrl)(siteUrl, listIdOrTitle)}/contenttypes?${query}`;
|
|
189
198
|
}
|
|
190
199
|
else if (fromRootWeb) {
|
|
@@ -196,7 +205,7 @@ function _getContentTypesRequestUrl(siteUrl, options = {}) {
|
|
|
196
205
|
}
|
|
197
206
|
function _postProcessGetContentTypes(contentTypes, options = {}, allListFields) {
|
|
198
207
|
const { ignoreHidden, ignoreFolders, includeFields } = options;
|
|
199
|
-
if (!(0,
|
|
208
|
+
if (!(0, typecheckers_1.isNullOrEmptyArray)(contentTypes)) {
|
|
200
209
|
if (ignoreFolders === true || ignoreHidden === true) {
|
|
201
210
|
contentTypes = contentTypes.filter(rr => {
|
|
202
211
|
if (options.ignoreFolders && rr.StringId.startsWith('0x0120'))
|
|
@@ -208,9 +217,9 @@ function _postProcessGetContentTypes(contentTypes, options = {}, allListFields)
|
|
|
208
217
|
}
|
|
209
218
|
if (includeFields === true) {
|
|
210
219
|
contentTypes.forEach((result) => {
|
|
211
|
-
if (!(0,
|
|
220
|
+
if (!(0, typecheckers_1.isNullOrEmptyArray)(result.Fields)) {
|
|
212
221
|
result.Fields = result.Fields.map((field) => {
|
|
213
|
-
return (0,
|
|
222
|
+
return (0, sharepoint_1.extendFieldInfo)(field, allListFields || result.Fields);
|
|
214
223
|
});
|
|
215
224
|
}
|
|
216
225
|
});
|
|
@@ -225,9 +234,9 @@ async function GetContentTypes(siteUrl, options = {}, refreshCache = false) {
|
|
|
225
234
|
if (options.includeFields) {
|
|
226
235
|
allListFields = await (0, list_1.GetListFields)(siteUrl, options.listIdOrTitle);
|
|
227
236
|
}
|
|
228
|
-
return (0, rest_1.GetJson)(url, null, { allowCache: refreshCache !== true, jsonMetadata:
|
|
237
|
+
return (0, rest_1.GetJson)(url, null, { allowCache: refreshCache !== true, jsonMetadata: rest_types_1.jsonTypes.nometadata })
|
|
229
238
|
.then(result => {
|
|
230
|
-
if (!(0,
|
|
239
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(result)) {
|
|
231
240
|
return _postProcessGetContentTypes(result.value, options, allListFields);
|
|
232
241
|
}
|
|
233
242
|
return null;
|
|
@@ -241,8 +250,8 @@ function GetContentTypesSync(siteUrl, options = {}, refreshCache = false) {
|
|
|
241
250
|
if (options.includeFields) {
|
|
242
251
|
allListFields = (0, list_1.GetListFieldsSync)(siteUrl, options.listIdOrTitle);
|
|
243
252
|
}
|
|
244
|
-
let result = (0, rest_1.GetJsonSync)(url, null, { allowCache: refreshCache !== true, jsonMetadata:
|
|
245
|
-
if (!(0,
|
|
253
|
+
let result = (0, rest_1.GetJsonSync)(url, null, { allowCache: refreshCache !== true, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
254
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(result) && result.success === true && !(0, typecheckers_1.isNullOrUndefined)(result.result)) {
|
|
246
255
|
return _postProcessGetContentTypes(result.result.value, options, allListFields);
|
|
247
256
|
}
|
|
248
257
|
return null;
|
|
@@ -264,16 +273,16 @@ function _postProcessGetLists(lists, options = {}) {
|
|
|
264
273
|
lists = lists || [];
|
|
265
274
|
if (options && options.includeViews) {
|
|
266
275
|
lists.forEach(l => {
|
|
267
|
-
if ((0,
|
|
276
|
+
if ((0, typecheckers_1.isNullOrEmptyArray)(l.Views)) {
|
|
268
277
|
l.Views = [];
|
|
269
278
|
}
|
|
270
|
-
l.Views.forEach(v => { v.Id = (0,
|
|
279
|
+
l.Views.forEach(v => { v.Id = (0, strings_1.normalizeGuid)(v.Id); });
|
|
271
280
|
});
|
|
272
281
|
}
|
|
273
282
|
lists.forEach((list) => {
|
|
274
283
|
if (list.EffectiveBasePermissions
|
|
275
|
-
&& ((0,
|
|
276
|
-
|| (0,
|
|
284
|
+
&& ((0, typecheckers_1.isString)(list.EffectiveBasePermissions.High)
|
|
285
|
+
|| (0, typecheckers_1.isString)(list.EffectiveBasePermissions.Low))) {
|
|
277
286
|
list.EffectiveBasePermissions = {
|
|
278
287
|
High: Number(list.EffectiveBasePermissions.High),
|
|
279
288
|
Low: Number(list.EffectiveBasePermissions.Low)
|
|
@@ -284,7 +293,7 @@ function _postProcessGetLists(lists, options = {}) {
|
|
|
284
293
|
}
|
|
285
294
|
function GetLists(siteUrl, options = {}) {
|
|
286
295
|
let url = _getListsRequestUrl(siteUrl, options);
|
|
287
|
-
return (0, rest_1.GetJson)(url, null, { allowCache: true, jsonMetadata:
|
|
296
|
+
return (0, rest_1.GetJson)(url, null, { allowCache: true, jsonMetadata: rest_types_1.jsonTypes.nometadata })
|
|
288
297
|
.then(result => {
|
|
289
298
|
return _postProcessGetLists(result.value, options);
|
|
290
299
|
})
|
|
@@ -293,8 +302,8 @@ function GetLists(siteUrl, options = {}) {
|
|
|
293
302
|
exports.GetLists = GetLists;
|
|
294
303
|
function GetListsSync(siteUrl, options = {}) {
|
|
295
304
|
let url = _getListsRequestUrl(siteUrl, options);
|
|
296
|
-
let response = (0, rest_1.GetJsonSync)(url, null, { ...rest_1.shortLocalCache, jsonMetadata:
|
|
297
|
-
if (response && response.success && response.result && (0,
|
|
305
|
+
let response = (0, rest_1.GetJsonSync)(url, null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
306
|
+
if (response && response.success && response.result && (0, typecheckers_1.isNotEmptyArray)(response.result.value)) {
|
|
298
307
|
return _postProcessGetLists(response.result.value, options);
|
|
299
308
|
}
|
|
300
309
|
return [];
|
|
@@ -334,7 +343,7 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
334
343
|
let skip = false;
|
|
335
344
|
for (var i = 0; i < row.Cells.results.length; i++) {
|
|
336
345
|
let cell = row.Cells.results[i];
|
|
337
|
-
let value = (0,
|
|
346
|
+
let value = (0, typecheckers_1.isNullOrEmptyString)(cell.Value) ? "" : cell.Value;
|
|
338
347
|
switch (cell.Key) {
|
|
339
348
|
case "WebTemplate":
|
|
340
349
|
WebTemplate = value;
|
|
@@ -345,7 +354,7 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
345
354
|
Title = value;
|
|
346
355
|
break;
|
|
347
356
|
case "WebId":
|
|
348
|
-
WebId = (0,
|
|
357
|
+
WebId = (0, strings_1.normalizeGuid)(value);
|
|
349
358
|
break;
|
|
350
359
|
case "Url":
|
|
351
360
|
if (addedSites.indexOf(value.toLowerCase()) >= 0) {
|
|
@@ -371,19 +380,19 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
371
380
|
{
|
|
372
381
|
sites.push({
|
|
373
382
|
Title: Title,
|
|
374
|
-
ServerRelativeUrl: (0,
|
|
383
|
+
ServerRelativeUrl: (0, url_1.makeServerRelativeUrl)(Url),
|
|
375
384
|
WebId: WebId,
|
|
376
385
|
WebTemplate: WebTemplate,
|
|
377
|
-
WebType: WebTemplate === "APP" ?
|
|
378
|
-
WebTemplate === "GROUP" ?
|
|
379
|
-
WebTemplate === "STS" ?
|
|
380
|
-
|
|
386
|
+
WebType: WebTemplate === "APP" ? sharepoint_utils_types_1.WebTypes.App :
|
|
387
|
+
WebTemplate === "GROUP" ? sharepoint_utils_types_1.WebTypes.Group :
|
|
388
|
+
WebTemplate === "STS" ? sharepoint_utils_types_1.WebTypes.Team :
|
|
389
|
+
sharepoint_utils_types_1.WebTypes.Other
|
|
381
390
|
});
|
|
382
391
|
}
|
|
383
392
|
});
|
|
384
393
|
}
|
|
385
394
|
//Issue 7161
|
|
386
|
-
if (sites.length === 1 || (!(0,
|
|
395
|
+
if (sites.length === 1 || (!(0, typecheckers_1.isNullOrUndefined)(currentSite) && !sites.filter((site) => {
|
|
387
396
|
return site.WebId !== currentSite.WebId;
|
|
388
397
|
})[0])) {
|
|
389
398
|
queryFailed = true;
|
|
@@ -402,20 +411,20 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
402
411
|
//we make a request for the site collection root web. If we get a valid response, replace currentSite/siteUrl with
|
|
403
412
|
//the site collection root web info.
|
|
404
413
|
let currentSiteCollection = await GetWebInfo(_spPageContextInfo.siteServerRelativeUrl);
|
|
405
|
-
if (currentSiteCollection && !(0,
|
|
414
|
+
if (currentSiteCollection && !(0, typecheckers_1.isNullOrEmptyString)(currentSiteCollection.ServerRelativeUrl)) {
|
|
406
415
|
currentSite = currentSiteCollection;
|
|
407
416
|
siteUrl = _spPageContextInfo.siteServerRelativeUrl;
|
|
408
417
|
}
|
|
409
418
|
}
|
|
410
419
|
//add current site
|
|
411
|
-
if (currentSite && (options.allowAppWebs || currentSite.WebType !==
|
|
420
|
+
if (currentSite && (options.allowAppWebs || currentSite.WebType !== sharepoint_utils_types_1.WebTypes.App)) {
|
|
412
421
|
sites.push(currentSite);
|
|
413
422
|
}
|
|
414
423
|
//Issue 6651
|
|
415
424
|
//add sub sites
|
|
416
425
|
//if the query failed, we can't rely on search to get the subwebs
|
|
417
426
|
var currentSiteSubSites = await __getSubSites(siteUrl, options.allowAppWebs);
|
|
418
|
-
if ((0,
|
|
427
|
+
if ((0, typecheckers_1.isNotEmptyArray)(currentSiteSubSites)) {
|
|
419
428
|
sites = [...sites, ...currentSiteSubSites];
|
|
420
429
|
}
|
|
421
430
|
}
|
|
@@ -427,7 +436,7 @@ async function GetAllSubWebs(siteUrl, options) {
|
|
|
427
436
|
filteredSites.push(site);
|
|
428
437
|
}
|
|
429
438
|
}
|
|
430
|
-
(0,
|
|
439
|
+
(0, collections_base_1.sortArray)(filteredSites, s => s.ServerRelativeUrl);
|
|
431
440
|
return filteredSites;
|
|
432
441
|
}
|
|
433
442
|
exports.GetAllSubWebs = GetAllSubWebs;
|
|
@@ -438,7 +447,7 @@ async function __getSubSites(siteUrl, allowAppWebs) {
|
|
|
438
447
|
//maybe search is not wokring? use regular REST API
|
|
439
448
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getsubwebsfilteredforcurrentuser(nwebtemplatefilter=-1,nconfigurationfilter=0)?$Select=Title,ServerRelativeUrl,Id,WebTemplate`;
|
|
440
449
|
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.shortLocalCache });
|
|
441
|
-
if (result && result.d && (0,
|
|
450
|
+
if (result && result.d && (0, typecheckers_1.isNotEmptyArray)(result.d.results)) {
|
|
442
451
|
let results = (allowAppWebs) ? result.d.results : result.d.results.filter(s => s.WebTemplate !== "APP");
|
|
443
452
|
let promises = [];
|
|
444
453
|
results.forEach(s => {
|
|
@@ -447,10 +456,10 @@ async function __getSubSites(siteUrl, allowAppWebs) {
|
|
|
447
456
|
ServerRelativeUrl: s.ServerRelativeUrl,
|
|
448
457
|
WebId: s.Id,
|
|
449
458
|
WebTemplate: s.WebTemplate,
|
|
450
|
-
WebType: s.WebTemplate === "APP" ?
|
|
451
|
-
s.WebTemplate === "GROUP" ?
|
|
452
|
-
s.WebTemplate === "STS" ?
|
|
453
|
-
|
|
459
|
+
WebType: s.WebTemplate === "APP" ? sharepoint_utils_types_1.WebTypes.App :
|
|
460
|
+
s.WebTemplate === "GROUP" ? sharepoint_utils_types_1.WebTypes.Group :
|
|
461
|
+
s.WebTemplate === "STS" ? sharepoint_utils_types_1.WebTypes.Team :
|
|
462
|
+
sharepoint_utils_types_1.WebTypes.Other
|
|
454
463
|
});
|
|
455
464
|
promises.push(__getSubSites(s.ServerRelativeUrl, allowAppWebs));
|
|
456
465
|
});
|
|
@@ -473,7 +482,7 @@ function _getCurrentWebInfoRequestUrl(siteUrl) {
|
|
|
473
482
|
return `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web?$Select=${common_1.WEB_SELECT}`;
|
|
474
483
|
}
|
|
475
484
|
function _postProcessGetWebInfo(webInfo) {
|
|
476
|
-
if (!(0,
|
|
485
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(webInfo)) {
|
|
477
486
|
return {
|
|
478
487
|
Title: webInfo.Title,
|
|
479
488
|
ServerRelativeUrl: webInfo.ServerRelativeUrl,
|
|
@@ -489,23 +498,23 @@ function _postProcessGetWebInfo(webInfo) {
|
|
|
489
498
|
async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
490
499
|
let webInfoResponse = null;
|
|
491
500
|
try {
|
|
492
|
-
if (!(0,
|
|
493
|
-
webId = (0,
|
|
501
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(webId) && (0, typecheckers_1.isValidGuid)(webId)) {
|
|
502
|
+
webId = (0, strings_1.normalizeGuid)(webId);
|
|
494
503
|
let currentWebId = await GetWebId(siteUrl);
|
|
495
504
|
if (currentWebId !== webId) {
|
|
496
505
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
497
506
|
webInfoResponse = await (0, rest_1.GetJson)(url, null, {
|
|
498
507
|
method: "POST", spWebUrl: (0, common_1.GetSiteUrl)(siteUrl), ...rest_1.shortLocalCache,
|
|
499
|
-
jsonMetadata:
|
|
508
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
500
509
|
allowCache: refreshCache !== true
|
|
501
510
|
});
|
|
502
511
|
}
|
|
503
512
|
}
|
|
504
|
-
if ((0,
|
|
513
|
+
if ((0, typecheckers_1.isNullOrUndefined)(webInfoResponse)) {
|
|
505
514
|
let url = _getCurrentWebInfoRequestUrl(siteUrl);
|
|
506
515
|
webInfoResponse = await (0, rest_1.GetJson)(url, null, {
|
|
507
516
|
...rest_1.shortLocalCache,
|
|
508
|
-
jsonMetadata:
|
|
517
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
509
518
|
allowCache: refreshCache !== true
|
|
510
519
|
});
|
|
511
520
|
}
|
|
@@ -516,25 +525,25 @@ async function GetWebInfo(siteUrl, webId, refreshCache) {
|
|
|
516
525
|
exports.GetWebInfo = GetWebInfo;
|
|
517
526
|
function GetWebInfoSync(siteUrl, webId) {
|
|
518
527
|
let webInfoResponse = null;
|
|
519
|
-
if (!(0,
|
|
520
|
-
webId = (0,
|
|
528
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(webId) && (0, typecheckers_1.isValidGuid)(webId)) {
|
|
529
|
+
webId = (0, strings_1.normalizeGuid)(webId);
|
|
521
530
|
let currentWebId = GetWebIdSync(siteUrl);
|
|
522
531
|
if (currentWebId !== webId) {
|
|
523
532
|
let url = _getWebInfoByIdRequestUrl(siteUrl, webId);
|
|
524
533
|
let syncResult = (0, rest_1.GetJsonSync)(url, null, {
|
|
525
534
|
method: "POST", spWebUrl: (0, common_1.GetSiteUrl)(siteUrl), ...rest_1.shortLocalCache,
|
|
526
|
-
jsonMetadata:
|
|
535
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
527
536
|
});
|
|
528
537
|
if (syncResult.success) {
|
|
529
538
|
webInfoResponse = syncResult.result;
|
|
530
539
|
}
|
|
531
540
|
}
|
|
532
541
|
}
|
|
533
|
-
if ((0,
|
|
542
|
+
if ((0, typecheckers_1.isNullOrUndefined)(webInfoResponse)) {
|
|
534
543
|
let url = _getCurrentWebInfoRequestUrl(siteUrl);
|
|
535
544
|
let syncResult = (0, rest_1.GetJsonSync)(url, null, {
|
|
536
545
|
...rest_1.shortLocalCache,
|
|
537
|
-
jsonMetadata:
|
|
546
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
538
547
|
});
|
|
539
548
|
if (syncResult.success) {
|
|
540
549
|
webInfoResponse = syncResult.result;
|
|
@@ -554,8 +563,8 @@ exports.GetWebRoleDefinitions = GetWebRoleDefinitions;
|
|
|
554
563
|
;
|
|
555
564
|
/** get roles for site or list */
|
|
556
565
|
async function GetRoleAssignments(siteUrl, listIdOrTitle, itemId) {
|
|
557
|
-
const url = `${(0,
|
|
558
|
-
const result = await (0, rest_1.GetJson)(url, undefined, { jsonMetadata:
|
|
566
|
+
const url = `${(0, typecheckers_1.isNullOrEmptyString)(listIdOrTitle) ? (0, common_1.GetRestBaseUrl)(siteUrl) + "/web" : (0, list_1.GetListRestUrl)(siteUrl, listIdOrTitle)}/${(0, typecheckers_1.isNullOrNaN)(itemId) ? '' : `items(${itemId})/`}roleassignments?$expand=Member/users,RoleDefinitionBindings`;
|
|
567
|
+
const result = await (0, rest_1.GetJson)(url, undefined, { jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
559
568
|
return result.value;
|
|
560
569
|
}
|
|
561
570
|
exports.GetRoleAssignments = GetRoleAssignments;
|
|
@@ -575,12 +584,12 @@ async function GetAppTiles(siteUrl) {
|
|
|
575
584
|
logger.warn('GetAppTiles does not work in an app web');
|
|
576
585
|
return null;
|
|
577
586
|
}
|
|
578
|
-
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, { ...rest_1.shortLocalCache, jsonMetadata:
|
|
587
|
+
return (0, rest_1.GetJson)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata })
|
|
579
588
|
.then(r => {
|
|
580
|
-
return (0,
|
|
589
|
+
return (0, typecheckers_1.isNotEmptyArray)(r.value) ? r.value.map(t => {
|
|
581
590
|
return {
|
|
582
591
|
Title: t.Title,
|
|
583
|
-
ProductId: (0,
|
|
592
|
+
ProductId: (0, strings_1.normalizeGuid)(t.ProductId)
|
|
584
593
|
};
|
|
585
594
|
}) : [];
|
|
586
595
|
})
|
|
@@ -595,26 +604,26 @@ function GetAppTilesSync(siteUrl) {
|
|
|
595
604
|
logger.warn('GetAppTiles does not work in an app web');
|
|
596
605
|
return null;
|
|
597
606
|
}
|
|
598
|
-
let r = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, { ...rest_1.shortLocalCache, jsonMetadata:
|
|
599
|
-
return r.success && r.result && (0,
|
|
607
|
+
let r = (0, rest_1.GetJsonSync)((0, common_1.GetRestBaseUrl)(siteUrl) + "/web/AppTiles?$filter=AppType%20eq%203&$select=Title,ProductId", null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
608
|
+
return r.success && r.result && (0, typecheckers_1.isNotEmptyArray)(r.result.value) ? r.result.value.map(t => {
|
|
600
609
|
return {
|
|
601
610
|
Title: t.Title,
|
|
602
|
-
ProductId: (0,
|
|
611
|
+
ProductId: (0, strings_1.normalizeGuid)(t.ProductId)
|
|
603
612
|
};
|
|
604
613
|
}) : [];
|
|
605
614
|
}
|
|
606
615
|
exports.GetAppTilesSync = GetAppTilesSync;
|
|
607
616
|
function GetWebType(WebTemplate) {
|
|
608
|
-
return WebTemplate === "APP" ?
|
|
609
|
-
WebTemplate === "GROUP" ?
|
|
610
|
-
WebTemplate === "STS" ?
|
|
611
|
-
|
|
617
|
+
return WebTemplate === "APP" ? sharepoint_utils_types_1.WebTypes.App :
|
|
618
|
+
WebTemplate === "GROUP" ? sharepoint_utils_types_1.WebTypes.Group :
|
|
619
|
+
WebTemplate === "STS" ? sharepoint_utils_types_1.WebTypes.Team :
|
|
620
|
+
sharepoint_utils_types_1.WebTypes.Other;
|
|
612
621
|
}
|
|
613
622
|
async function GetServerTimeZone(siteUrl) {
|
|
614
623
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
615
624
|
let getTimeZoneUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone`;
|
|
616
625
|
let result = await (0, rest_1.GetJson)(getTimeZoneUrl, null, { ...rest_1.longLocalCache });
|
|
617
|
-
if (result && result.d && !(0,
|
|
626
|
+
if (result && result.d && !(0, typecheckers_1.isNullOrUndefined)(result.d)) {
|
|
618
627
|
return result.d;
|
|
619
628
|
}
|
|
620
629
|
else
|
|
@@ -634,8 +643,8 @@ async function GetServerTimeOffset(siteUrl, date) {
|
|
|
634
643
|
let dateStr = (0, date_1.toIsoDateFormat)(date, { zeroTime: true, omitZ: true });
|
|
635
644
|
let inputDate = new Date(dateStr);
|
|
636
645
|
let getTimeZoneOffsetUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(dateStr)}'`;
|
|
637
|
-
let result = await (0, rest_1.GetJson)(getTimeZoneOffsetUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata:
|
|
638
|
-
if (result && !(0,
|
|
646
|
+
let result = await (0, rest_1.GetJson)(getTimeZoneOffsetUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
647
|
+
if (result && !(0, typecheckers_1.isNullOrEmptyString)(result.value)) {
|
|
639
648
|
let resultDate = new Date(result.value.slice(0, result.value.length - 1)); //remove Z and get as date.
|
|
640
649
|
return (resultDate.getTime() - inputDate.getTime());
|
|
641
650
|
}
|
|
@@ -655,8 +664,8 @@ function GetServerTimeOffsetSync(siteUrl, date) {
|
|
|
655
664
|
let dateStr = (0, date_1.toIsoDateFormat)(date, { zeroTime: true, omitZ: true });
|
|
656
665
|
let inputDate = new Date(dateStr);
|
|
657
666
|
let getTimeZoneOffsetUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(dateStr)}'`;
|
|
658
|
-
let result = (0, rest_1.GetJsonSync)(getTimeZoneOffsetUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata:
|
|
659
|
-
if (result && result.success && !(0,
|
|
667
|
+
let result = (0, rest_1.GetJsonSync)(getTimeZoneOffsetUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
668
|
+
if (result && result.success && !(0, typecheckers_1.isNullOrEmptyString)(result.result.value)) {
|
|
660
669
|
let resultDate = new Date(result.result.value.slice(0, result.result.value.length - 1)); //remove Z and get as date.
|
|
661
670
|
return (resultDate.getTime() - inputDate.getTime());
|
|
662
671
|
}
|
|
@@ -666,10 +675,10 @@ function GetServerTimeOffsetSync(siteUrl, date) {
|
|
|
666
675
|
/** 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 */
|
|
667
676
|
async function SPServerLocalTimeToUTCDate(siteUrl, date) {
|
|
668
677
|
//used in 7700
|
|
669
|
-
if ((0,
|
|
678
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(date))
|
|
670
679
|
return null;
|
|
671
680
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
672
|
-
if (!(0,
|
|
681
|
+
if (!(0, typecheckers_1.isDate)(date))
|
|
673
682
|
date = new Date(date);
|
|
674
683
|
let serverTimeOffset = await GetServerTimeOffset(siteUrl, date);
|
|
675
684
|
return _SPServerLocalTimeToUTCDate(date, serverTimeOffset);
|
|
@@ -678,10 +687,10 @@ exports.SPServerLocalTimeToUTCDate = SPServerLocalTimeToUTCDate;
|
|
|
678
687
|
/** 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 */
|
|
679
688
|
function SPServerLocalTimeToUTCDateSync(siteUrl, date) {
|
|
680
689
|
//used in 7700
|
|
681
|
-
if ((0,
|
|
690
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(date))
|
|
682
691
|
return null;
|
|
683
692
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
684
|
-
if (!(0,
|
|
693
|
+
if (!(0, typecheckers_1.isDate)(date))
|
|
685
694
|
date = new Date(date);
|
|
686
695
|
let serverTimeOffset = GetServerTimeOffsetSync(siteUrl, date);
|
|
687
696
|
return _SPServerLocalTimeToUTCDate(date, serverTimeOffset);
|
|
@@ -698,11 +707,11 @@ function _SPServerLocalTimeToUTCDate(date, serverTimeOffset) {
|
|
|
698
707
|
*/
|
|
699
708
|
async function SPServerLocalTimeToUTC(siteUrl, date) {
|
|
700
709
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
701
|
-
if ((0,
|
|
710
|
+
if ((0, typecheckers_1.isDate)(date)) {
|
|
702
711
|
date = (0, date_1.toIsoDateFormat)(date, { omitZ: true });
|
|
703
712
|
}
|
|
704
713
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(date)}'`;
|
|
705
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata:
|
|
714
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
706
715
|
return result && result.value || null;
|
|
707
716
|
}
|
|
708
717
|
exports.SPServerLocalTimeToUTC = SPServerLocalTimeToUTC;
|
|
@@ -714,11 +723,11 @@ exports.SPServerLocalTimeToUTC = SPServerLocalTimeToUTC;
|
|
|
714
723
|
*/
|
|
715
724
|
function SPServerLocalTimeToUTCSync(siteUrl, date) {
|
|
716
725
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
717
|
-
if ((0,
|
|
726
|
+
if ((0, typecheckers_1.isDate)(date)) {
|
|
718
727
|
date = (0, date_1.toIsoDateFormat)(date, { omitZ: true });
|
|
719
728
|
}
|
|
720
729
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/localTimeToUTC(@date)?@date='${encodeURIComponent(date)}'`;
|
|
721
|
-
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata:
|
|
730
|
+
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.weeekLongLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
722
731
|
return result.success && result.result.value || null;
|
|
723
732
|
}
|
|
724
733
|
exports.SPServerLocalTimeToUTCSync = SPServerLocalTimeToUTCSync;
|
|
@@ -728,11 +737,11 @@ exports.SPServerLocalTimeToUTCSync = SPServerLocalTimeToUTCSync;
|
|
|
728
737
|
*/
|
|
729
738
|
async function UTCToSPServerLocalTime(siteUrl, date) {
|
|
730
739
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
731
|
-
if ((0,
|
|
740
|
+
if ((0, typecheckers_1.isDate)(date)) {
|
|
732
741
|
date = (0, date_1.toIsoDateFormat)(date);
|
|
733
742
|
}
|
|
734
743
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/utcToLocalTime(@date)?@date='${encodeURIComponent(date)}'`;
|
|
735
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata:
|
|
744
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
736
745
|
return result && result.value || null;
|
|
737
746
|
}
|
|
738
747
|
exports.UTCToSPServerLocalTime = UTCToSPServerLocalTime;
|
|
@@ -742,20 +751,20 @@ exports.UTCToSPServerLocalTime = UTCToSPServerLocalTime;
|
|
|
742
751
|
*/
|
|
743
752
|
function UTCToSPServerLocalTimeSync(siteUrl, date) {
|
|
744
753
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
745
|
-
if ((0,
|
|
754
|
+
if ((0, typecheckers_1.isDate)(date)) {
|
|
746
755
|
date = (0, date_1.toIsoDateFormat)(date);
|
|
747
756
|
}
|
|
748
757
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings/timeZone/utcToLocalTime(@date)?@date='${encodeURIComponent(date)}'`;
|
|
749
|
-
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata:
|
|
758
|
+
let result = (0, rest_1.GetJsonSync)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
750
759
|
return result.success && result.result.value || null;
|
|
751
760
|
}
|
|
752
761
|
exports.UTCToSPServerLocalTimeSync = UTCToSPServerLocalTimeSync;
|
|
753
762
|
function SPServerLocalTimeSync(siteUrl) {
|
|
754
763
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
755
|
-
var clientNowServerDeltas = (0,
|
|
764
|
+
var clientNowServerDeltas = (0, objects_1.getGlobal)("ClientNowServerDeltas");
|
|
756
765
|
var clientNowServerDelta = clientNowServerDeltas[siteUrl];
|
|
757
766
|
var now = new Date();
|
|
758
|
-
if ((0,
|
|
767
|
+
if ((0, typecheckers_1.isNullOrUndefined)(clientNowServerDelta)) {
|
|
759
768
|
var local = UTCToSPServerLocalTimeSync(siteUrl, now.toISOString());
|
|
760
769
|
clientNowServerDelta = (+now - +(new Date(local)));
|
|
761
770
|
clientNowServerDeltas[siteUrl] = clientNowServerDelta;
|
|
@@ -766,10 +775,10 @@ function SPServerLocalTimeSync(siteUrl) {
|
|
|
766
775
|
exports.SPServerLocalTimeSync = SPServerLocalTimeSync;
|
|
767
776
|
async function SPServerLocalTime(siteUrl) {
|
|
768
777
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
769
|
-
var clientNowServerDeltas = (0,
|
|
778
|
+
var clientNowServerDeltas = (0, objects_1.getGlobal)("ClientNowServerDeltas");
|
|
770
779
|
var clientNowServerDelta = clientNowServerDeltas[siteUrl];
|
|
771
780
|
var now = new Date();
|
|
772
|
-
if ((0,
|
|
781
|
+
if ((0, typecheckers_1.isNullOrUndefined)(clientNowServerDelta)) {
|
|
773
782
|
var local = await UTCToSPServerLocalTime(siteUrl, now.toISOString());
|
|
774
783
|
clientNowServerDelta = (+now - +(new Date(local)));
|
|
775
784
|
clientNowServerDeltas[siteUrl] = clientNowServerDelta;
|
|
@@ -787,7 +796,7 @@ function GetContextWebInformationSync(siteUrl) {
|
|
|
787
796
|
}
|
|
788
797
|
else {
|
|
789
798
|
siteId = GetSiteIdSync(siteUrl);
|
|
790
|
-
if ((0,
|
|
799
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(siteId)) {
|
|
791
800
|
return null;
|
|
792
801
|
}
|
|
793
802
|
}
|
|
@@ -796,7 +805,7 @@ function GetContextWebInformationSync(siteUrl) {
|
|
|
796
805
|
maxAge: 5 * 60,
|
|
797
806
|
includeDigestInPost: false,
|
|
798
807
|
allowCache: true,
|
|
799
|
-
postCacheKey: `GetContextWebInformation_${(0,
|
|
808
|
+
postCacheKey: `GetContextWebInformation_${(0, strings_1.normalizeGuid)(siteId)}`
|
|
800
809
|
});
|
|
801
810
|
if (result && result.success) {
|
|
802
811
|
return result.result.d.GetContextWebInformation;
|
|
@@ -809,24 +818,24 @@ exports.GetContextWebInformationSync = GetContextWebInformationSync;
|
|
|
809
818
|
function _getCustomActionsBaseRestUrl(siteUrl, options = {}) {
|
|
810
819
|
const { listId, actionId } = { ...options };
|
|
811
820
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web`;
|
|
812
|
-
if (!(0,
|
|
813
|
-
restUrl += `/lists('${(0,
|
|
821
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(listId)) {
|
|
822
|
+
restUrl += `/lists('${(0, strings_1.normalizeGuid)(listId)}')`;
|
|
814
823
|
}
|
|
815
824
|
restUrl += `/UserCustomActions`;
|
|
816
|
-
if (!(0,
|
|
825
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(actionId)) {
|
|
817
826
|
restUrl += `('${actionId}')`;
|
|
818
827
|
}
|
|
819
828
|
return restUrl;
|
|
820
829
|
}
|
|
821
830
|
function _parseCustomActionReponse(action) {
|
|
822
|
-
if ((0,
|
|
831
|
+
if ((0, typecheckers_1.isNullOrUndefined)(action)) {
|
|
823
832
|
return action;
|
|
824
833
|
}
|
|
825
|
-
if (!(0,
|
|
826
|
-
if ((0,
|
|
834
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(action.Rights)) {
|
|
835
|
+
if ((0, typecheckers_1.isNumeric)(action.Rights.High)) {
|
|
827
836
|
action.Rights.High = Number(action.Rights.High);
|
|
828
837
|
}
|
|
829
|
-
if ((0,
|
|
838
|
+
if ((0, typecheckers_1.isNumeric)(action.Rights.Low)) {
|
|
830
839
|
action.Rights.Low = Number(action.Rights.Low);
|
|
831
840
|
}
|
|
832
841
|
}
|
|
@@ -836,7 +845,7 @@ function _convertCustomActionToPostData(action) {
|
|
|
836
845
|
//The rest end point expects the rights in string format for some odd reason despite IBasePermissions being stored
|
|
837
846
|
//as High/Low numbers and the methods using numbers (ie. SPBasePermission). Even EffectiveBasePermissions on
|
|
838
847
|
//a list are stored using numbers.
|
|
839
|
-
let hasRights = !(0,
|
|
848
|
+
let hasRights = !(0, typecheckers_1.isNullOrUndefined)(action.Rights);
|
|
840
849
|
let partialAction;
|
|
841
850
|
if (hasRights) {
|
|
842
851
|
partialAction = {
|
|
@@ -855,12 +864,12 @@ async function GetUserCustomActions(siteUrl, listId, allowCache = true) {
|
|
|
855
864
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId });
|
|
856
865
|
let cacheOptions = allowCache === true ? rest_1.shortLocalCache : { allowCache: false };
|
|
857
866
|
let restOptions = {
|
|
858
|
-
jsonMetadata:
|
|
867
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
859
868
|
...cacheOptions
|
|
860
869
|
};
|
|
861
870
|
try {
|
|
862
871
|
let response = await (0, rest_1.GetJson)(restUrl, null, restOptions);
|
|
863
|
-
if (!(0,
|
|
872
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response) && !(0, typecheckers_1.isNullOrEmptyArray)(response.value)) {
|
|
864
873
|
return response.value.map(_parseCustomActionReponse);
|
|
865
874
|
}
|
|
866
875
|
}
|
|
@@ -874,12 +883,12 @@ async function GetUserCustomActionById(siteUrl, customActionId, listId, allowCac
|
|
|
874
883
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
875
884
|
let cacheOptions = allowCache === true ? rest_1.shortLocalCache : { allowCache: false };
|
|
876
885
|
let restOptions = {
|
|
877
|
-
jsonMetadata:
|
|
886
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
878
887
|
...cacheOptions
|
|
879
888
|
};
|
|
880
889
|
try {
|
|
881
890
|
let response = await (0, rest_1.GetJson)(restUrl, null, restOptions);
|
|
882
|
-
if (!(0,
|
|
891
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response)) {
|
|
883
892
|
return _parseCustomActionReponse(response);
|
|
884
893
|
}
|
|
885
894
|
}
|
|
@@ -893,12 +902,12 @@ async function GetUserCustomActionByName(siteUrl, name, listId, allowCache = tru
|
|
|
893
902
|
let restUrl = `${_getCustomActionsBaseRestUrl(siteUrl, { listId: listId })}?$filter=Name eq '${encodeURIComponent(name)}'`;
|
|
894
903
|
let cacheOptions = allowCache === true ? rest_1.shortLocalCache : { allowCache: false };
|
|
895
904
|
let restOptions = {
|
|
896
|
-
jsonMetadata:
|
|
905
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
897
906
|
...cacheOptions
|
|
898
907
|
};
|
|
899
908
|
try {
|
|
900
909
|
let response = await (0, rest_1.GetJson)(restUrl, null, restOptions);
|
|
901
|
-
if (!(0,
|
|
910
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response) && !(0, typecheckers_1.isNullOrEmptyArray)(response.value)) {
|
|
902
911
|
return response.value.map(_parseCustomActionReponse);
|
|
903
912
|
}
|
|
904
913
|
}
|
|
@@ -911,14 +920,14 @@ exports.GetUserCustomActionByName = GetUserCustomActionByName;
|
|
|
911
920
|
async function AddUserCustomAction(siteUrl, userCustomActionInfo, listId) {
|
|
912
921
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId });
|
|
913
922
|
let restOptions = {
|
|
914
|
-
jsonMetadata:
|
|
923
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
915
924
|
method: "POST",
|
|
916
925
|
includeDigestInPost: true
|
|
917
926
|
};
|
|
918
927
|
try {
|
|
919
928
|
let data = _convertCustomActionToPostData(userCustomActionInfo);
|
|
920
929
|
let response = await (0, rest_1.GetJson)(restUrl, JSON.stringify(data), restOptions);
|
|
921
|
-
if (!(0,
|
|
930
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response)) {
|
|
922
931
|
return _parseCustomActionReponse(response);
|
|
923
932
|
}
|
|
924
933
|
}
|
|
@@ -931,7 +940,7 @@ exports.AddUserCustomAction = AddUserCustomAction;
|
|
|
931
940
|
async function UpdateUserCustomAction(siteUrl, customActionId, userCustomActionInfo, listId) {
|
|
932
941
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
933
942
|
let restOptions = {
|
|
934
|
-
jsonMetadata:
|
|
943
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
935
944
|
method: "POST",
|
|
936
945
|
xHttpMethod: "MERGE",
|
|
937
946
|
includeDigestInPost: true
|
|
@@ -939,7 +948,7 @@ async function UpdateUserCustomAction(siteUrl, customActionId, userCustomActionI
|
|
|
939
948
|
try {
|
|
940
949
|
let data = _convertCustomActionToPostData(userCustomActionInfo);
|
|
941
950
|
let result = await (0, rest_1.GetJson)(restUrl, JSON.stringify(data), restOptions);
|
|
942
|
-
return !(0,
|
|
951
|
+
return !(0, typecheckers_1.isNullOrUndefined)(result) && result["odata.null"] === true || (0, typecheckers_1.isNullOrEmptyString)(result);
|
|
943
952
|
}
|
|
944
953
|
catch {
|
|
945
954
|
}
|
|
@@ -950,14 +959,14 @@ exports.UpdateUserCustomAction = UpdateUserCustomAction;
|
|
|
950
959
|
async function DeleteUserCustomAction(siteUrl, customActionId, listId) {
|
|
951
960
|
let restUrl = _getCustomActionsBaseRestUrl(siteUrl, { listId: listId, actionId: customActionId });
|
|
952
961
|
let restOptions = {
|
|
953
|
-
jsonMetadata:
|
|
962
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
954
963
|
method: "POST",
|
|
955
964
|
xHttpMethod: "DELETE",
|
|
956
965
|
includeDigestInPost: true
|
|
957
966
|
};
|
|
958
967
|
try {
|
|
959
968
|
let result = await (0, rest_1.GetJson)(restUrl, null, restOptions);
|
|
960
|
-
return !(0,
|
|
969
|
+
return !(0, typecheckers_1.isNullOrUndefined)(result) && result["odata.null"] === true || (0, typecheckers_1.isNullOrEmptyString)(result);
|
|
961
970
|
}
|
|
962
971
|
catch {
|
|
963
972
|
}
|
|
@@ -969,7 +978,7 @@ async function GetRegionalSettings(siteUrl) {
|
|
|
969
978
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
970
979
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/regionalSettings`;
|
|
971
980
|
try {
|
|
972
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.mediumLocalCache, jsonMetadata:
|
|
981
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.mediumLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
973
982
|
return result;
|
|
974
983
|
}
|
|
975
984
|
catch {
|
|
@@ -982,7 +991,7 @@ async function GetAllWebProperties(siteUrl) {
|
|
|
982
991
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
983
992
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/AllProperties`;
|
|
984
993
|
try {
|
|
985
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.shortLocalCache, jsonMetadata:
|
|
994
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
986
995
|
return result;
|
|
987
996
|
}
|
|
988
997
|
catch {
|
|
@@ -995,8 +1004,8 @@ async function GetWebPropertyByName(name, siteUrl) {
|
|
|
995
1004
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
996
1005
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/AllProperties?$select=${name}`;
|
|
997
1006
|
try {
|
|
998
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.shortLocalCache, jsonMetadata:
|
|
999
|
-
if (!(0,
|
|
1007
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.shortLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
1008
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(result) && !(0, typecheckers_1.isNullOrUndefined)(result[name])) {
|
|
1000
1009
|
return result[name];
|
|
1001
1010
|
}
|
|
1002
1011
|
}
|
|
@@ -1012,23 +1021,23 @@ function getFormDigest(serverRelativeWebUrl) {
|
|
|
1012
1021
|
exports.getFormDigest = getFormDigest;
|
|
1013
1022
|
function ensureLegacyProps(pageContext) {
|
|
1014
1023
|
try {
|
|
1015
|
-
let isContextOk = (ctx) => !(0,
|
|
1016
|
-
let getLegacyContext = (ctx) => !(0,
|
|
1024
|
+
let isContextOk = (ctx) => !(0, typecheckers_1.isNullOrUndefined)(ctx) && !(0, typecheckers_1.isNullOrUndefined)(ctx.webServerRelativeUrl);
|
|
1025
|
+
let getLegacyContext = (ctx) => !(0, typecheckers_1.isNullOrUndefined)(ctx) && !(0, typecheckers_1.isNullOrUndefined)(ctx.legacyPageContext) ? ctx.legacyPageContext : null;
|
|
1017
1026
|
let getContext = (ctx) => isContextOk(ctx) ? ctx : getLegacyContext(ctx);
|
|
1018
|
-
if ((0,
|
|
1019
|
-
logger.info(`_spPageContextInfo ${(0,
|
|
1027
|
+
if ((0, typecheckers_1.isTypeofFullNameNullOrUndefined)("_spPageContextInfo") || !isContextOk(_spPageContextInfo)) {
|
|
1028
|
+
logger.info(`_spPageContextInfo ${(0, typecheckers_1.isTypeofFullNameNullOrUndefined)("_spPageContextInfo") ? 'is missing' : 'is broken'}, wrapping with our property`);
|
|
1020
1029
|
//bug in SPFx during inplace left navigation will put an SPFx object into this global. Correct it using the setter.
|
|
1021
1030
|
let _currentContext = pageContext.legacyPageContext;
|
|
1022
1031
|
Object.defineProperty(window, "_spPageContextInfo", {
|
|
1023
1032
|
set: (newContext) => {
|
|
1024
|
-
if (!(0,
|
|
1033
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(newContext)) {
|
|
1025
1034
|
if (isContextOk(newContext)) {
|
|
1026
1035
|
logger.debug("Context ok");
|
|
1027
1036
|
_currentContext = newContext;
|
|
1028
1037
|
}
|
|
1029
1038
|
else {
|
|
1030
1039
|
let legacy = getLegacyContext(newContext);
|
|
1031
|
-
if (!(0,
|
|
1040
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(legacy)) {
|
|
1032
1041
|
logger.error("Context NOT ok - using legacy context");
|
|
1033
1042
|
_currentContext = legacy;
|
|
1034
1043
|
}
|
|
@@ -1047,34 +1056,34 @@ function ensureLegacyProps(pageContext) {
|
|
|
1047
1056
|
exports.ensureLegacyProps = ensureLegacyProps;
|
|
1048
1057
|
async function WebHasUniquePermissions(siteUrl) {
|
|
1049
1058
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web?$select=hasuniqueroleassignments`;
|
|
1050
|
-
let has = await (0, rest_1.GetJson)(url, undefined, { allowCache: false, jsonMetadata:
|
|
1059
|
+
let has = await (0, rest_1.GetJson)(url, undefined, { allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
1051
1060
|
return has.HasUniqueRoleAssignments === true;
|
|
1052
1061
|
}
|
|
1053
1062
|
exports.WebHasUniquePermissions = WebHasUniquePermissions;
|
|
1054
1063
|
async function RestoreWebPermissionInheritance(siteUrl) {
|
|
1055
1064
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/ResetRoleInheritance`;
|
|
1056
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
1065
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1057
1066
|
}
|
|
1058
1067
|
exports.RestoreWebPermissionInheritance = RestoreWebPermissionInheritance;
|
|
1059
1068
|
async function BreakWebPermissionInheritance(siteUrl, clear = true) {
|
|
1060
1069
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/breakroleinheritance(copyRoleAssignments=${clear ? 'false' : 'true'}, clearSubscopes=true)`;
|
|
1061
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
1070
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1062
1071
|
}
|
|
1063
1072
|
exports.BreakWebPermissionInheritance = BreakWebPermissionInheritance;
|
|
1064
1073
|
async function AssignWebPermission(siteUrl, principalId, roleId) {
|
|
1065
1074
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/roleassignments/addroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
1066
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
1075
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1067
1076
|
}
|
|
1068
1077
|
exports.AssignWebPermission = AssignWebPermission;
|
|
1069
1078
|
async function RemoveWebPermission(siteUrl, principalId, roleId) {
|
|
1070
1079
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/roleassignments/removeroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
1071
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
1080
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
1072
1081
|
}
|
|
1073
1082
|
exports.RemoveWebPermission = RemoveWebPermission;
|
|
1074
1083
|
/** set a user as site admin - rejects/throws if not successful */
|
|
1075
1084
|
async function SetUserAsSiteAdmin(siteUrl, userId) {
|
|
1076
1085
|
const url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getuserbyid(${userId})`;
|
|
1077
|
-
await (0, rest_1.GetJson)(url, (0,
|
|
1086
|
+
await (0, rest_1.GetJson)(url, (0, json_1.jsonStringify)({
|
|
1078
1087
|
"__metadata": { "type": "SP.User" },
|
|
1079
1088
|
"IsSiteAdmin": true
|
|
1080
1089
|
}), { method: 'POST', xHttpMethod: 'MERGE' });
|
|
@@ -1085,9 +1094,9 @@ exports.SetUserAsSiteAdmin = SetUserAsSiteAdmin;
|
|
|
1085
1094
|
async function GetAvailableTagsForSite(siteUrlOrId) {
|
|
1086
1095
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1087
1096
|
try {
|
|
1088
|
-
let url = `${siteUrl}_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${encodeURIComponent((0,
|
|
1097
|
+
let url = `${siteUrl}_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${encodeURIComponent((0, url_1.makeFullUrl)(siteUrl))}'`;
|
|
1089
1098
|
let result = await (0, rest_1.GetJson)(url, null, {
|
|
1090
|
-
jsonMetadata:
|
|
1099
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
1091
1100
|
});
|
|
1092
1101
|
return result.value;
|
|
1093
1102
|
}
|
|
@@ -1100,9 +1109,9 @@ exports.GetAvailableTagsForSite = GetAvailableTagsForSite;
|
|
|
1100
1109
|
function GetAvailableTagsForSiteSync(siteUrlOrId) {
|
|
1101
1110
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1102
1111
|
try {
|
|
1103
|
-
let url = `${siteUrl}_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${encodeURIComponent((0,
|
|
1112
|
+
let url = `${siteUrl}_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${encodeURIComponent((0, url_1.makeFullUrl)(siteUrl))}'`;
|
|
1104
1113
|
let response = (0, rest_1.GetJsonSync)(url, null, {
|
|
1105
|
-
jsonMetadata:
|
|
1114
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
1106
1115
|
});
|
|
1107
1116
|
return response.success ? response.result.value : [];
|
|
1108
1117
|
}
|
|
@@ -1117,7 +1126,7 @@ async function GetActiveFeatures(siteUrlOrId, allowCache = true) {
|
|
|
1117
1126
|
let url = `${siteUrl}/_api/web/features?$select=DisplayName,DefinitionId`;
|
|
1118
1127
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
1119
1128
|
method: "GET",
|
|
1120
|
-
jsonMetadata:
|
|
1129
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1121
1130
|
includeDigestInGet: true,
|
|
1122
1131
|
...(allowCache === true ? rest_1.mediumLocalCache : rest_1.noLocalCache)
|
|
1123
1132
|
});
|
|
@@ -1131,14 +1140,14 @@ exports.GetActiveFeatures = GetActiveFeatures;
|
|
|
1131
1140
|
async function ActivateFeature(siteUrlOrId, id) {
|
|
1132
1141
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1133
1142
|
try {
|
|
1134
|
-
id = (0,
|
|
1143
|
+
id = (0, strings_1.normalizeGuid)(id);
|
|
1135
1144
|
let url = `${siteUrl}/_api/web/features/add('${id}')`;
|
|
1136
1145
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
1137
1146
|
method: "POST",
|
|
1138
|
-
jsonMetadata:
|
|
1147
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1139
1148
|
includeDigestInPost: true
|
|
1140
1149
|
});
|
|
1141
|
-
return !(0,
|
|
1150
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) && (0, strings_1.normalizeGuid)(response.DefinitionId) === id;
|
|
1142
1151
|
}
|
|
1143
1152
|
catch {
|
|
1144
1153
|
}
|
|
@@ -1148,14 +1157,14 @@ exports.ActivateFeature = ActivateFeature;
|
|
|
1148
1157
|
async function DectivateFeature(siteUrlOrId, id) {
|
|
1149
1158
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
1150
1159
|
try {
|
|
1151
|
-
id = (0,
|
|
1160
|
+
id = (0, strings_1.normalizeGuid)(id);
|
|
1152
1161
|
let url = `${siteUrl}/_api/web/features/remove('${id}')`;
|
|
1153
1162
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
1154
1163
|
method: "POST",
|
|
1155
|
-
jsonMetadata:
|
|
1164
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1156
1165
|
includeDigestInPost: true
|
|
1157
1166
|
});
|
|
1158
|
-
return !(0,
|
|
1167
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) && response["odata.null"] === true;
|
|
1159
1168
|
}
|
|
1160
1169
|
catch {
|
|
1161
1170
|
}
|
|
@@ -1168,9 +1177,9 @@ async function GetWelcomePage(siteUrlOrId) {
|
|
|
1168
1177
|
let url = `${siteUrl}/_api/web/rootFolder`;
|
|
1169
1178
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
1170
1179
|
method: "GET",
|
|
1171
|
-
jsonMetadata:
|
|
1180
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
1172
1181
|
});
|
|
1173
|
-
if (!(0,
|
|
1182
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response) && response.Exists && !(0, typecheckers_1.isNullOrEmptyString)(response.WelcomePage)) {
|
|
1174
1183
|
return response.WelcomePage;
|
|
1175
1184
|
}
|
|
1176
1185
|
}
|
|
@@ -1188,10 +1197,10 @@ async function SetWelcomePage(siteUrlOrId, welcomePage) {
|
|
|
1188
1197
|
}), {
|
|
1189
1198
|
method: "POST",
|
|
1190
1199
|
xHttpMethod: "MERGE",
|
|
1191
|
-
jsonMetadata:
|
|
1200
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
1192
1201
|
includeDigestInPost: true
|
|
1193
1202
|
});
|
|
1194
|
-
return !(0,
|
|
1203
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) && response["odata.null"] === true || (0, typecheckers_1.isNullOrEmptyString)(response);
|
|
1195
1204
|
}
|
|
1196
1205
|
catch {
|
|
1197
1206
|
}
|
|
@@ -1203,7 +1212,7 @@ async function GetWebAssociatedGroups(siteUrl) {
|
|
|
1203
1212
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
1204
1213
|
let restUrl = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web?$select=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup&$expand=AssociatedOwnerGroup,AssociatedMemberGroup,AssociatedVisitorGroup`;
|
|
1205
1214
|
try {
|
|
1206
|
-
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata:
|
|
1215
|
+
let result = await (0, rest_1.GetJson)(restUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
1207
1216
|
return result;
|
|
1208
1217
|
}
|
|
1209
1218
|
catch {
|