@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,7 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateList = exports.RemoveListPermission = exports.AssignListPermission = exports.BreakListPermissionInheritance = exports.RestoreListPermissionInheritance = exports.ListHasUniquePermissions = exports.ReloadListLastModified = exports.GetListLastItemModifiedDate = exports.DeleteListEventReceiver = exports.AddListEventReceiver = exports.GetListEventReceivers = exports.FindListItemById = exports.GetListItemsSync = exports.GetListItems = exports.GetFieldSchema = exports.GetFieldSchemaSync = exports.GetListFormUrl = exports.GetListContentTypesSync = exports.GetListContentTypes = exports.RemoveViewFieldFromListView = exports.AddViewFieldToListView = exports.GetListViewsSync = exports.GetListViews = exports.DeleteField = exports.UpdateField = exports.CreateField = exports.UserHasPermissionsSync = exports.UserHasPermissions = exports.UserHasEditPermissions = exports.UserHasManagePermissions = exports.GetListWorkflows = exports.GetListFieldsAsHashSync = exports.GetListFieldsAsHash = exports.GetListFieldsSync = exports.GetListFields = exports.GetStandardListFields = exports.GetListField = exports.GetListRootFolderSync = exports.GetListRootFolder = exports.GetListName = exports.GetListNameSync = exports.GetListSync = exports.GetList = exports.GetListTitle = exports.GetSiteAssetLibrary = exports.EnsureSitePagesLibrary = exports.EnsureAssetLibrary = exports.GetListIdFromPageSync = exports.GetListId = exports.GetListRestUrl = void 0;
|
|
4
4
|
exports.UpdateListExperience = exports.SearchList = void 0;
|
|
5
|
-
const
|
|
5
|
+
const collections_base_1 = require("../../helpers/collections.base");
|
|
6
|
+
const json_1 = require("../../helpers/json");
|
|
7
|
+
const sharepoint_1 = require("../../helpers/sharepoint");
|
|
8
|
+
const strings_1 = require("../../helpers/strings");
|
|
9
|
+
const typecheckers_1 = require("../../helpers/typecheckers");
|
|
10
|
+
const url_1 = require("../../helpers/url");
|
|
11
|
+
const rest_types_1 = require("../../types/rest.types");
|
|
12
|
+
const sharepoint_types_1 = require("../../types/sharepoint.types");
|
|
6
13
|
const consolelogger_1 = require("../consolelogger");
|
|
7
14
|
const rest_1 = require("../rest");
|
|
8
15
|
const common_1 = require("./common");
|
|
@@ -13,14 +20,14 @@ const logger = consolelogger_1.ConsoleLogger.get("SharePoint.Rest.List");
|
|
|
13
20
|
function GetListRestUrl(siteUrl, listIdOrTitle) {
|
|
14
21
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
15
22
|
let listId = GetListId(siteUrl, listIdOrTitle);
|
|
16
|
-
let listPart = (0,
|
|
23
|
+
let listPart = (0, typecheckers_1.isValidGuid)(listId) ? `getById('${(0, strings_1.normalizeGuid)(listId)}')` : `getByTitle('${encodeURIComponent(listIdOrTitle)}')`;
|
|
17
24
|
return (0, common_1.GetRestBaseUrl)(siteUrl) + `/web/lists/${listPart}`;
|
|
18
25
|
}
|
|
19
26
|
exports.GetListRestUrl = GetListRestUrl;
|
|
20
27
|
function GetListId(siteUrl, listIdOrTitle) {
|
|
21
|
-
if ((0,
|
|
28
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(listIdOrTitle))
|
|
22
29
|
return null;
|
|
23
|
-
if ((0,
|
|
30
|
+
if ((0, typecheckers_1.isValidGuid)(listIdOrTitle))
|
|
24
31
|
return listIdOrTitle;
|
|
25
32
|
//Issue 7508
|
|
26
33
|
//When translation is enabled, and user changes list title but he is not on the same language as the site
|
|
@@ -29,20 +36,20 @@ function GetListId(siteUrl, listIdOrTitle) {
|
|
|
29
36
|
//instead, we need to get the list id from the web's lists collection.
|
|
30
37
|
let lists = (0, web_1.GetListsSync)(siteUrl);
|
|
31
38
|
var lower = listIdOrTitle.toLowerCase();
|
|
32
|
-
var list = (0,
|
|
39
|
+
var list = (0, collections_base_1.firstOrNull)(lists, l => l.Title.toLowerCase() === lower);
|
|
33
40
|
return list && list.Id || null;
|
|
34
41
|
}
|
|
35
42
|
exports.GetListId = GetListId;
|
|
36
43
|
/** get the list ID from a list page, such as a list view or an item form */
|
|
37
44
|
function GetListIdFromPageSync(siteUrl, listPageUrl) {
|
|
38
|
-
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getlist('${(0,
|
|
45
|
+
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/web/getlist('${(0, url_1.makeServerRelativeUrl)(listPageUrl.split('?')[0].split('#')[0])}')?$select=id`;
|
|
39
46
|
let response = (0, rest_1.GetJsonSync)(url, null, {
|
|
40
47
|
...rest_1.longLocalCache,
|
|
41
|
-
jsonMetadata:
|
|
48
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
42
49
|
});
|
|
43
|
-
if (!(0,
|
|
50
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response) && response.success) {
|
|
44
51
|
let listId = response.result.Id;
|
|
45
|
-
return (0,
|
|
52
|
+
return (0, strings_1.normalizeGuid)(listId);
|
|
46
53
|
}
|
|
47
54
|
return null;
|
|
48
55
|
}
|
|
@@ -71,11 +78,11 @@ async function EnsureSitePagesLibrary(siteUrl) {
|
|
|
71
78
|
+ `?$select=ID,RootFolder/Name,RootFolder/ServerRelativeUrl,RootFolder/Exists&$expand=RootFolder`;
|
|
72
79
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
73
80
|
method: "POST",
|
|
74
|
-
jsonMetadata:
|
|
81
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
75
82
|
includeDigestInPost: true,
|
|
76
83
|
...rest_1.longLocalCache
|
|
77
84
|
});
|
|
78
|
-
if (!(0,
|
|
85
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(response) && !(0, typecheckers_1.isNullOrUndefined)(response.RootFolder)) {
|
|
79
86
|
return {
|
|
80
87
|
Id: response.Id,
|
|
81
88
|
Name: response.RootFolder.Name,
|
|
@@ -92,9 +99,9 @@ function GetSiteAssetLibrary(siteUrl, sync) {
|
|
|
92
99
|
+ `$filter=EntityTypeName%20eq%20%27SiteAssets%27&$select=ID,RootFolder/Name,RootFolder/ServerRelativeUrl,RootFolder/Exists`
|
|
93
100
|
+ `&$expand=RootFolder`;
|
|
94
101
|
let caller = sync ? rest_1.GetJsonSync : rest_1.GetJson;
|
|
95
|
-
let result = caller(reqUrl, null, { ...rest_1.longLocalCache, jsonMetadata:
|
|
102
|
+
let result = caller(reqUrl, null, { ...rest_1.longLocalCache, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
96
103
|
let transform = (v) => {
|
|
97
|
-
if ((0,
|
|
104
|
+
if ((0, typecheckers_1.isNotEmptyArray)(v && v.value)) {
|
|
98
105
|
let assetLibrary = v.value[0];
|
|
99
106
|
return {
|
|
100
107
|
Id: assetLibrary.Id,
|
|
@@ -104,7 +111,7 @@ function GetSiteAssetLibrary(siteUrl, sync) {
|
|
|
104
111
|
}
|
|
105
112
|
return null;
|
|
106
113
|
};
|
|
107
|
-
if ((0,
|
|
114
|
+
if ((0, typecheckers_1.isPromise)(result))
|
|
108
115
|
return result.then(r => transform(r), () => null);
|
|
109
116
|
else
|
|
110
117
|
return result.success ? transform(result.result) : null;
|
|
@@ -123,7 +130,7 @@ exports.GetListTitle = GetListTitle;
|
|
|
123
130
|
/** Return the list */
|
|
124
131
|
function GetList(siteUrlOrId, listIdOrTitle, options) {
|
|
125
132
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
126
|
-
if ((0,
|
|
133
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(listIdOrTitle))
|
|
127
134
|
return null;
|
|
128
135
|
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `?$select=${common_1.LIST_SELECT}&$expand=${common_1.LIST_EXPAND}`, null, { allowCache: true })
|
|
129
136
|
.then(async (r) => {
|
|
@@ -139,8 +146,8 @@ function GetList(siteUrlOrId, listIdOrTitle, options) {
|
|
|
139
146
|
list.EventReceivers = await GetListEventReceivers(siteUrl, listIdOrTitle);
|
|
140
147
|
}
|
|
141
148
|
if (list.EffectiveBasePermissions
|
|
142
|
-
&& ((0,
|
|
143
|
-
|| (0,
|
|
149
|
+
&& ((0, typecheckers_1.isString)(list.EffectiveBasePermissions.High)
|
|
150
|
+
|| (0, typecheckers_1.isString)(list.EffectiveBasePermissions.Low))) {
|
|
144
151
|
list.EffectiveBasePermissions = {
|
|
145
152
|
High: Number(list.EffectiveBasePermissions.High),
|
|
146
153
|
Low: Number(list.EffectiveBasePermissions.Low)
|
|
@@ -154,14 +161,14 @@ exports.GetList = GetList;
|
|
|
154
161
|
/** Return the list */
|
|
155
162
|
function GetListSync(siteUrl, listIdOrTitle) {
|
|
156
163
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
157
|
-
if ((0,
|
|
164
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(listIdOrTitle))
|
|
158
165
|
return null;
|
|
159
166
|
let result = (0, rest_1.GetJsonSync)(GetListRestUrl(siteUrl, listIdOrTitle) + `?$select=${common_1.LIST_SELECT}&$expand=${common_1.LIST_EXPAND}`, null, rest_1.shortLocalCache);
|
|
160
167
|
if (result && result.success) {
|
|
161
168
|
let list = result.result.d;
|
|
162
169
|
if (list.EffectiveBasePermissions
|
|
163
|
-
&& ((0,
|
|
164
|
-
|| (0,
|
|
170
|
+
&& ((0, typecheckers_1.isString)(list.EffectiveBasePermissions.High)
|
|
171
|
+
|| (0, typecheckers_1.isString)(list.EffectiveBasePermissions.Low))) {
|
|
165
172
|
list.EffectiveBasePermissions = {
|
|
166
173
|
High: Number(list.EffectiveBasePermissions.High),
|
|
167
174
|
Low: Number(list.EffectiveBasePermissions.Low)
|
|
@@ -175,12 +182,12 @@ function GetListSync(siteUrl, listIdOrTitle) {
|
|
|
175
182
|
exports.GetListSync = GetListSync;
|
|
176
183
|
function GetListNameSync(webUrl, listIdOrTitle) {
|
|
177
184
|
let list = GetListSync(webUrl, listIdOrTitle);
|
|
178
|
-
return (0,
|
|
185
|
+
return (0, sharepoint_1.NormalizeListName)({ EntityTypeName: list.EntityTypeName, BaseType: list.BaseType });
|
|
179
186
|
}
|
|
180
187
|
exports.GetListNameSync = GetListNameSync;
|
|
181
188
|
async function GetListName(webUrl, listIdOrTitle) {
|
|
182
189
|
let list = await GetList(webUrl, listIdOrTitle);
|
|
183
|
-
return (0,
|
|
190
|
+
return (0, sharepoint_1.NormalizeListName)({ EntityTypeName: list.EntityTypeName, BaseType: list.BaseType });
|
|
184
191
|
}
|
|
185
192
|
exports.GetListName = GetListName;
|
|
186
193
|
function GetListRootFolder(siteUrlOrId, listIdOrTitle) {
|
|
@@ -195,14 +202,14 @@ exports.GetListRootFolder = GetListRootFolder;
|
|
|
195
202
|
function GetListRootFolderSync(siteUrlOrId, listIdOrTitle) {
|
|
196
203
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
197
204
|
let result = (0, rest_1.GetJsonSync)(GetListRestUrl(siteUrl, listIdOrTitle) + `/RootFolder?$Select=Name,ServerRelativeUrl`, null, rest_1.longLocalCache);
|
|
198
|
-
return (0,
|
|
205
|
+
return (0, typecheckers_1.SafeIfElse)(() => result.result.d, null);
|
|
199
206
|
}
|
|
200
207
|
exports.GetListRootFolderSync = GetListRootFolderSync;
|
|
201
208
|
function GetListField(siteUrlOrId, listIdOrTitle, fieldIdOrName, refreshCache) {
|
|
202
209
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
203
210
|
var url = GetListRestUrl(siteUrl, listIdOrTitle) + `/fields`;
|
|
204
|
-
if ((0,
|
|
205
|
-
url += `('${(0,
|
|
211
|
+
if ((0, typecheckers_1.isValidGuid)(fieldIdOrName)) {
|
|
212
|
+
url += `('${(0, strings_1.normalizeGuid)(fieldIdOrName)}')`;
|
|
206
213
|
}
|
|
207
214
|
else {
|
|
208
215
|
url += `/getbyinternalnameortitle(@u)?@u='${encodeURIComponent(fieldIdOrName)}'`;
|
|
@@ -225,11 +232,11 @@ function GetStandardListFields(siteUrlOrId, listIdOrTitle, refreshCache) {
|
|
|
225
232
|
}
|
|
226
233
|
exports.GetStandardListFields = GetStandardListFields;
|
|
227
234
|
function _processGetListFields(fields, fieldNames) {
|
|
228
|
-
if ((0,
|
|
235
|
+
if ((0, typecheckers_1.isNullOrEmptyArray)(fields)) {
|
|
229
236
|
return fields;
|
|
230
237
|
}
|
|
231
|
-
let extendedFields = fields.map(f => (0,
|
|
232
|
-
if (!(0,
|
|
238
|
+
let extendedFields = fields.map(f => (0, sharepoint_1.extendFieldInfo)(f, fields));
|
|
239
|
+
if (!(0, typecheckers_1.isNullOrEmptyArray)(fieldNames)) {
|
|
233
240
|
return extendedFields.filter((extendedField) => {
|
|
234
241
|
return fieldNames.includes(extendedField.InternalName);
|
|
235
242
|
});
|
|
@@ -241,7 +248,7 @@ function GetListFields(siteUrlOrId, listIdOrTitle, options = {}) {
|
|
|
241
248
|
let url = _getListFieldsRequestUrl(siteUrl, listIdOrTitle);
|
|
242
249
|
let restOptions = {
|
|
243
250
|
allowCache: options.refreshCache !== true,
|
|
244
|
-
jsonMetadata:
|
|
251
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
245
252
|
};
|
|
246
253
|
return (0, rest_1.GetJson)(url, null, restOptions)
|
|
247
254
|
.then((result) => {
|
|
@@ -256,10 +263,10 @@ function GetListFieldsSync(siteUrlOrId, listIdOrTitle, options = {}) {
|
|
|
256
263
|
let url = _getListFieldsRequestUrl(siteUrl, listIdOrTitle);
|
|
257
264
|
let restOptions = {
|
|
258
265
|
allowCache: options.refreshCache !== true,
|
|
259
|
-
jsonMetadata:
|
|
266
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
260
267
|
};
|
|
261
268
|
let result = (0, rest_1.GetJsonSync)(url, null, restOptions);
|
|
262
|
-
if (result.success && !(0,
|
|
269
|
+
if (result.success && !(0, typecheckers_1.isNullOrUndefined)(result.result)) {
|
|
263
270
|
return _processGetListFields(result.result.value, options.fieldNames);
|
|
264
271
|
}
|
|
265
272
|
return null;
|
|
@@ -269,8 +276,8 @@ async function GetListFieldsAsHash(siteUrlOrId, listIdOrTitle, refreshCache) {
|
|
|
269
276
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
270
277
|
let fields = await GetListFields(siteUrl, listIdOrTitle, { refreshCache: refreshCache });
|
|
271
278
|
let hash = {};
|
|
272
|
-
if ((0,
|
|
273
|
-
hash = (0,
|
|
279
|
+
if ((0, typecheckers_1.isNotEmptyArray)(fields)) {
|
|
280
|
+
hash = (0, collections_base_1.toHash)(fields, f => f.InternalName);
|
|
274
281
|
}
|
|
275
282
|
return hash;
|
|
276
283
|
}
|
|
@@ -279,7 +286,7 @@ function GetListFieldsAsHashSync(siteUrlOrId, listIdOrTitle, refreshCache) {
|
|
|
279
286
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
280
287
|
let fields = GetListFieldsSync(siteUrl, listIdOrTitle, { refreshCache: refreshCache });
|
|
281
288
|
let hash = {};
|
|
282
|
-
if ((0,
|
|
289
|
+
if ((0, typecheckers_1.isNotEmptyArray)(fields)) {
|
|
283
290
|
fields.forEach(f => { hash[f.InternalName] = f; });
|
|
284
291
|
}
|
|
285
292
|
return hash;
|
|
@@ -289,12 +296,12 @@ function GetListWorkflows(siteUrl, listIdOrTitle, refreshCache) {
|
|
|
289
296
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
290
297
|
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/workflowAssociations`, null, { allowCache: refreshCache !== true })
|
|
291
298
|
.then(r => {
|
|
292
|
-
if (r && r.d && (0,
|
|
299
|
+
if (r && r.d && (0, typecheckers_1.isNotEmptyArray)(r.d.results)) {
|
|
293
300
|
r.d.results.forEach(wf => {
|
|
294
|
-
wf.BaseId = (0,
|
|
295
|
-
wf.Id = (0,
|
|
296
|
-
wf.ListId = (0,
|
|
297
|
-
wf.WebId = (0,
|
|
301
|
+
wf.BaseId = (0, strings_1.normalizeGuid)(wf.BaseId);
|
|
302
|
+
wf.Id = (0, strings_1.normalizeGuid)(wf.Id);
|
|
303
|
+
wf.ListId = (0, strings_1.normalizeGuid)(wf.ListId);
|
|
304
|
+
wf.WebId = (0, strings_1.normalizeGuid)(wf.WebId);
|
|
298
305
|
});
|
|
299
306
|
return r.d.results;
|
|
300
307
|
}
|
|
@@ -308,20 +315,20 @@ function UserHasManagePermissions(siteUrl, listIdOrTitle) {
|
|
|
308
315
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
309
316
|
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache })
|
|
310
317
|
.then(r => {
|
|
311
|
-
return new
|
|
318
|
+
return new sharepoint_1.SPBasePermissions(r.d.EffectiveBasePermissions).has(sharepoint_types_1.SPBasePermissionKind.ManageLists);
|
|
312
319
|
})
|
|
313
320
|
.catch(() => null);
|
|
314
321
|
}
|
|
315
322
|
exports.UserHasManagePermissions = UserHasManagePermissions;
|
|
316
323
|
function UserHasEditPermissions(siteUrl, listIdOrTitle) {
|
|
317
|
-
return UserHasPermissions(siteUrl, listIdOrTitle,
|
|
324
|
+
return UserHasPermissions(siteUrl, listIdOrTitle, sharepoint_types_1.SPBasePermissionKind.EditListItems);
|
|
318
325
|
}
|
|
319
326
|
exports.UserHasEditPermissions = UserHasEditPermissions;
|
|
320
327
|
function UserHasPermissions(siteUrlOrId, listIdOrTitle, permissionKind) {
|
|
321
328
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
322
329
|
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache })
|
|
323
330
|
.then(r => {
|
|
324
|
-
return new
|
|
331
|
+
return new sharepoint_1.SPBasePermissions(r.d.EffectiveBasePermissions).has(permissionKind);
|
|
325
332
|
})
|
|
326
333
|
.catch(() => null);
|
|
327
334
|
}
|
|
@@ -329,7 +336,7 @@ exports.UserHasPermissions = UserHasPermissions;
|
|
|
329
336
|
function UserHasPermissionsSync(siteUrlOrId, listIdOrTitle, permissionKind) {
|
|
330
337
|
let siteUrl = (0, common_1.GetSiteUrl)(siteUrlOrId);
|
|
331
338
|
const res = (0, rest_1.GetJsonSync)(GetListRestUrl(siteUrl, listIdOrTitle) + `/EffectiveBasePermissions`, null, { ...rest_1.shortLocalCache });
|
|
332
|
-
return new
|
|
339
|
+
return new sharepoint_1.SPBasePermissions(res.result.d.EffectiveBasePermissions).has(permissionKind);
|
|
333
340
|
}
|
|
334
341
|
exports.UserHasPermissionsSync = UserHasPermissionsSync;
|
|
335
342
|
/** create a new column and try to add it to default view. Send either Title and Type, or SchemaXml. Create with SchemaXml also adds to all content types */
|
|
@@ -346,16 +353,16 @@ async function CreateField(siteUrl, listIdOrTitle, options) {
|
|
|
346
353
|
if (options.SkipAddToDefaultView !== true) {
|
|
347
354
|
//try to add it to default view, don't wait for it
|
|
348
355
|
GetListViews(siteUrl, listIdOrTitle).then(views => {
|
|
349
|
-
let defaultView = (0,
|
|
356
|
+
let defaultView = (0, collections_base_1.firstOrNull)(views, v => v.DefaultView);
|
|
350
357
|
if (defaultView)
|
|
351
358
|
(0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/views('${defaultView.Id}')/ViewFields/addViewField('${internalName}')`, null, { method: "POST", spWebUrl: siteUrl });
|
|
352
359
|
});
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
362
|
catch (e) { }
|
|
356
|
-
return (0,
|
|
363
|
+
return (0, collections_base_1.firstOrNull)(fields, f => f.InternalName === internalName);
|
|
357
364
|
};
|
|
358
|
-
if (!(0,
|
|
365
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.SchemaXml)) {
|
|
359
366
|
try {
|
|
360
367
|
let updateObject = {
|
|
361
368
|
'parameters': {
|
|
@@ -368,10 +375,10 @@ async function CreateField(siteUrl, listIdOrTitle, options) {
|
|
|
368
375
|
};
|
|
369
376
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/fields/createFieldAsXml`;
|
|
370
377
|
let newFieldResult = await (0, rest_1.GetJson)(url, JSON.stringify(updateObject));
|
|
371
|
-
if (!(0,
|
|
372
|
-
&& !(0,
|
|
373
|
-
if ((!(0,
|
|
374
|
-
|| ((0,
|
|
378
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(newFieldResult)
|
|
379
|
+
&& !(0, typecheckers_1.isNullOrUndefined)(newFieldResult.d)) {
|
|
380
|
+
if ((!(0, typecheckers_1.isNullOrEmptyString)(options.Title) && options.Title !== newFieldResult.d.Title)
|
|
381
|
+
|| ((0, typecheckers_1.isBoolean)(options.Indexed) && options.Indexed !== newFieldResult.d.Indexed)) {
|
|
375
382
|
let updatedField = await UpdateField(siteUrl, listIdOrTitle, newFieldResult.d.InternalName, {
|
|
376
383
|
Title: options.Title,
|
|
377
384
|
Indexed: options.Indexed === true
|
|
@@ -385,7 +392,7 @@ async function CreateField(siteUrl, listIdOrTitle, options) {
|
|
|
385
392
|
}
|
|
386
393
|
return null;
|
|
387
394
|
}
|
|
388
|
-
else if (!(0,
|
|
395
|
+
else if (!(0, typecheckers_1.isNullOrEmptyString)(options.Title) && !(0, typecheckers_1.isNullOrUndefined)(options.Type)) {
|
|
389
396
|
let updateObject = {
|
|
390
397
|
'__metadata': { 'type': 'SP.Field' },
|
|
391
398
|
'Title': options.Title,
|
|
@@ -393,13 +400,13 @@ async function CreateField(siteUrl, listIdOrTitle, options) {
|
|
|
393
400
|
'Required': options.Required === true,
|
|
394
401
|
'Indexed': options.Indexed === true
|
|
395
402
|
};
|
|
396
|
-
if (!(0,
|
|
403
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.ClientSideComponentId)) {
|
|
397
404
|
updateObject.ClientSideComponentId = options.ClientSideComponentId;
|
|
398
405
|
}
|
|
399
|
-
if (!(0,
|
|
406
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.ClientSideComponentProperties)) {
|
|
400
407
|
updateObject.ClientSideComponentProperties = options.ClientSideComponentProperties;
|
|
401
408
|
}
|
|
402
|
-
if (!(0,
|
|
409
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.JSLink)) {
|
|
403
410
|
updateObject.JSLink = options.JSLink;
|
|
404
411
|
}
|
|
405
412
|
try {
|
|
@@ -423,7 +430,7 @@ async function UpdateField(siteUrlOrId, listIdOrTitle, fieldInternalName, option
|
|
|
423
430
|
let finish = async () => {
|
|
424
431
|
//we need to clear and reload the list fields cache, so call it and return our field from that collection.
|
|
425
432
|
let fields = await GetListFields(siteUrl, listIdOrTitle, { refreshCache: true });
|
|
426
|
-
return (0,
|
|
433
|
+
return (0, collections_base_1.firstOrNull)(fields, f => f.InternalName === fieldInternalName);
|
|
427
434
|
};
|
|
428
435
|
let fields = await GetListFieldsAsHash(siteUrl, listIdOrTitle, true);
|
|
429
436
|
let thisField = fields[fieldInternalName];
|
|
@@ -431,24 +438,24 @@ async function UpdateField(siteUrlOrId, listIdOrTitle, fieldInternalName, option
|
|
|
431
438
|
let updates = {
|
|
432
439
|
'__metadata': { 'type': 'SP.Field' }
|
|
433
440
|
};
|
|
434
|
-
if (!(0,
|
|
441
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.SchemaXml)) {
|
|
435
442
|
updates.SchemaXml = options.SchemaXml;
|
|
436
443
|
}
|
|
437
444
|
else {
|
|
438
445
|
//cannot send schema updates with other updates.
|
|
439
|
-
if (!(0,
|
|
446
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.Title)) {
|
|
440
447
|
updates.Title = options.Title;
|
|
441
448
|
}
|
|
442
|
-
if (!(0,
|
|
449
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.FieldType)) {
|
|
443
450
|
updates.TypeAsString = options.FieldType;
|
|
444
451
|
}
|
|
445
|
-
if ((0,
|
|
452
|
+
if ((0, typecheckers_1.isBoolean)(options.Required)) {
|
|
446
453
|
updates.Required = options.Required === true;
|
|
447
454
|
}
|
|
448
|
-
if ((0,
|
|
455
|
+
if ((0, typecheckers_1.isBoolean)(options.Indexed)) {
|
|
449
456
|
updates.Indexed = options.Indexed === true;
|
|
450
457
|
}
|
|
451
|
-
if (!(0,
|
|
458
|
+
if (!(0, typecheckers_1.isNullOrEmptyArray)(options.Choices)) {
|
|
452
459
|
let choiceType = options.FieldType || thisField.TypeAsString;
|
|
453
460
|
if (choiceType === "Choice" || choiceType === "MultiChoice") {
|
|
454
461
|
updates["__metadata"]["type"] = choiceType === "Choice" ? "SP.FieldChoice" : "SP.FieldMultiChoice";
|
|
@@ -458,7 +465,7 @@ async function UpdateField(siteUrlOrId, listIdOrTitle, fieldInternalName, option
|
|
|
458
465
|
logger.warn("Can only update 'Choices' property on 'Choice' and 'MultiChoice' field types.");
|
|
459
466
|
}
|
|
460
467
|
}
|
|
461
|
-
if ((0,
|
|
468
|
+
if ((0, typecheckers_1.isBoolean)(options.Hidden)) {
|
|
462
469
|
//this requries the CanToggleHidden to be in the schema... if not - we will need to add it before we can update this.
|
|
463
470
|
let fields = await GetListFieldsAsHash(siteUrl, listIdOrTitle, false);
|
|
464
471
|
let thisField = fields[fieldInternalName];
|
|
@@ -473,11 +480,11 @@ async function UpdateField(siteUrlOrId, listIdOrTitle, fieldInternalName, option
|
|
|
473
480
|
updates.Hidden = options.Hidden === true;
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
|
-
if (!(0,
|
|
483
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.ClientSideComponentId))
|
|
477
484
|
updates.ClientSideComponentId = options.ClientSideComponentId;
|
|
478
|
-
if (!(0,
|
|
485
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.ClientSideComponentProperties))
|
|
479
486
|
updates.ClientSideComponentProperties = options.ClientSideComponentProperties;
|
|
480
|
-
if (!(0,
|
|
487
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.JSLink))
|
|
481
488
|
updates.JSLink = options.JSLink;
|
|
482
489
|
}
|
|
483
490
|
if (Object.keys(updates).length > 1) {
|
|
@@ -512,12 +519,12 @@ async function DeleteField(siteUrl, listIdOrTitle, fieldInternalName, options) {
|
|
|
512
519
|
exports.DeleteField = DeleteField;
|
|
513
520
|
function GetListViews(siteUrl, listIdOrTitle, options) {
|
|
514
521
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
515
|
-
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/views?$select=Title,Id,ServerRelativeUrl,RowLimit,Paged,ViewQuery,ListViewXml,PersonalView,MobileView,MobileDefaultView,Hidden,DefaultView,ReadOnlyView${options && options.includeViewFields ? "&$expand=ViewFields" : ""}`, null, { allowCache: true, jsonMetadata:
|
|
522
|
+
return (0, rest_1.GetJson)(GetListRestUrl(siteUrl, listIdOrTitle) + `/views?$select=Title,Id,ServerRelativeUrl,RowLimit,Paged,ViewQuery,ListViewXml,PersonalView,MobileView,MobileDefaultView,Hidden,DefaultView,ReadOnlyView${options && options.includeViewFields ? "&$expand=ViewFields" : ""}`, null, { allowCache: true, jsonMetadata: rest_types_1.jsonTypes.nometadata })
|
|
516
523
|
.then(r => {
|
|
517
524
|
let views = r.value;
|
|
518
|
-
if ((0,
|
|
525
|
+
if ((0, typecheckers_1.isNotEmptyArray)(views)) {
|
|
519
526
|
views.forEach(v => {
|
|
520
|
-
v.Id = (0,
|
|
527
|
+
v.Id = (0, strings_1.normalizeGuid)(v.Id);
|
|
521
528
|
if (options && options.includeViewFields) {
|
|
522
529
|
v.ViewFields = v.ViewFields && v.ViewFields["Items"] && v.ViewFields["Items"] || [];
|
|
523
530
|
}
|
|
@@ -533,8 +540,8 @@ function GetListViewsSync(siteUrl, listIdOrTitle) {
|
|
|
533
540
|
let result = (0, rest_1.GetJsonSync)(GetListRestUrl(siteUrl, listIdOrTitle) + `/views`, null, { allowCache: true });
|
|
534
541
|
if (result.success) {
|
|
535
542
|
let views = result && result.result && result.result.d && result.result.d.results;
|
|
536
|
-
if ((0,
|
|
537
|
-
views.forEach(v => { v.Id = (0,
|
|
543
|
+
if ((0, typecheckers_1.isNotEmptyArray)(views)) {
|
|
544
|
+
views.forEach(v => { v.Id = (0, strings_1.normalizeGuid)(v.Id); });
|
|
538
545
|
}
|
|
539
546
|
return views;
|
|
540
547
|
}
|
|
@@ -551,17 +558,17 @@ async function RemoveViewFieldFromListView(siteUrl, listIdOrTitle, viewId, viewF
|
|
|
551
558
|
exports.RemoveViewFieldFromListView = RemoveViewFieldFromListView;
|
|
552
559
|
async function _addOrRemoveViewField(siteUrl, listIdOrTitle, viewId, viewField, action) {
|
|
553
560
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
554
|
-
if ((0,
|
|
561
|
+
if ((0, typecheckers_1.isNullOrEmptyString)(viewField) || !(0, typecheckers_1.isValidGuid)(viewId)) {
|
|
555
562
|
return false;
|
|
556
563
|
}
|
|
557
564
|
let views = await GetListViews(siteUrl, listIdOrTitle, { includeViewFields: true });
|
|
558
|
-
if ((0,
|
|
565
|
+
if ((0, typecheckers_1.isNullOrEmptyArray)(views)) {
|
|
559
566
|
return false;
|
|
560
567
|
}
|
|
561
568
|
let view = views.filter((view) => {
|
|
562
|
-
return (0,
|
|
569
|
+
return (0, strings_1.normalizeGuid)(view.Id) === (0, strings_1.normalizeGuid)(viewId);
|
|
563
570
|
})[0];
|
|
564
|
-
if ((0,
|
|
571
|
+
if ((0, typecheckers_1.isNullOrUndefined)(view)) {
|
|
565
572
|
return false;
|
|
566
573
|
}
|
|
567
574
|
let hasField = view.ViewFields.includes(viewField);
|
|
@@ -572,7 +579,7 @@ async function _addOrRemoveViewField(siteUrl, listIdOrTitle, viewId, viewField,
|
|
|
572
579
|
return true;
|
|
573
580
|
}
|
|
574
581
|
try {
|
|
575
|
-
let url = GetListRestUrl(siteUrl, listIdOrTitle) + `/views('${(0,
|
|
582
|
+
let url = GetListRestUrl(siteUrl, listIdOrTitle) + `/views('${(0, strings_1.normalizeGuid)(view.Id)}')/viewfields/${action}('${viewField}')`;
|
|
576
583
|
let result = await (0, rest_1.GetJson)(url, null, { method: "POST" });
|
|
577
584
|
if (result && result["odata.null"] === true) {
|
|
578
585
|
return true;
|
|
@@ -592,15 +599,15 @@ exports.GetListContentTypesSync = GetListContentTypesSync;
|
|
|
592
599
|
/** generic version. for the KWIZ forms version that supports action id call GetListFormUrlAppsWeb instead */
|
|
593
600
|
function GetListFormUrl(siteUrl, listId, pageType, params) {
|
|
594
601
|
siteUrl = (0, common_1.GetSiteUrl)(siteUrl);
|
|
595
|
-
if (!(0,
|
|
602
|
+
if (!(0, typecheckers_1.isValidGuid)(listId))
|
|
596
603
|
console.error('GetListFormUrl requires a list id');
|
|
597
|
-
let url = `${(0,
|
|
604
|
+
let url = `${(0, url_1.normalizeUrl)(siteUrl)}/_layouts/15/listform.aspx?PageType=${pageType}&ListId=${encodeURIComponent(listId)}`;
|
|
598
605
|
if (params) {
|
|
599
|
-
if (!(0,
|
|
606
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(params.contentTypeId))
|
|
600
607
|
url += `&ContentTypeId=${encodeURIComponent(params.contentTypeId)}`;
|
|
601
|
-
if (!(0,
|
|
608
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(params.itemId))
|
|
602
609
|
url += `&ID=${encodeURIComponent(params.itemId)}`;
|
|
603
|
-
if (!(0,
|
|
610
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(params.rootFolder))
|
|
604
611
|
url += `&RootFolder=${encodeURIComponent(params.rootFolder)}`;
|
|
605
612
|
}
|
|
606
613
|
return url;
|
|
@@ -614,11 +621,11 @@ function GetFieldSchemaSync(siteUrl, listIdOrTitle, fieldInternalName, refreshCa
|
|
|
614
621
|
refreshCache: refreshCache,
|
|
615
622
|
fieldNames: [fieldInternalName]
|
|
616
623
|
});
|
|
617
|
-
if ((0,
|
|
624
|
+
if ((0, typecheckers_1.isNullOrEmptyArray)(fields)) {
|
|
618
625
|
return null;
|
|
619
626
|
}
|
|
620
627
|
let field = fields[0];
|
|
621
|
-
return (0,
|
|
628
|
+
return (0, sharepoint_1.SchemaXmlToJson)(field.SchemaXml);
|
|
622
629
|
// let url = GetListRestUrl(siteUrl, listIdOrTitle) + `/fields/getByInternalNameOrTitle('${fieldInternalName}')?$select=SchemaXml`;
|
|
623
630
|
// let result = GetJsonSync<{ d: { SchemaXml: string; }; }>(
|
|
624
631
|
// url,
|
|
@@ -642,11 +649,11 @@ async function GetFieldSchema(siteUrl, listIdOrTitle, fieldInternalName, refresh
|
|
|
642
649
|
refreshCache: refreshCache,
|
|
643
650
|
fieldNames: [fieldInternalName]
|
|
644
651
|
});
|
|
645
|
-
if ((0,
|
|
652
|
+
if ((0, typecheckers_1.isNullOrEmptyArray)(fields)) {
|
|
646
653
|
return null;
|
|
647
654
|
}
|
|
648
655
|
let field = fields[0];
|
|
649
|
-
return (0,
|
|
656
|
+
return (0, sharepoint_1.SchemaXmlToJson)(field.SchemaXml);
|
|
650
657
|
}
|
|
651
658
|
exports.GetFieldSchema = GetFieldSchema;
|
|
652
659
|
async function GetListItems(siteUrl, listIdOrTitle, options) {
|
|
@@ -670,13 +677,13 @@ async function GetListItems(siteUrl, listIdOrTitle, options) {
|
|
|
670
677
|
resultItems = requestResult.d.results;
|
|
671
678
|
next = requestResult.d.__next;
|
|
672
679
|
}
|
|
673
|
-
if ((0,
|
|
680
|
+
if ((0, typecheckers_1.isNotEmptyArray)(resultItems))
|
|
674
681
|
items.push(...resultItems);
|
|
675
682
|
if (info.totalNumberOfItemsToGet > items.length)
|
|
676
683
|
info.requestUrl = next;
|
|
677
684
|
else
|
|
678
685
|
info.requestUrl = null;
|
|
679
|
-
} while (!(0,
|
|
686
|
+
} while (!(0, typecheckers_1.isNullOrEmptyString)(info.requestUrl));
|
|
680
687
|
return (0, common_2.__fixGetListItemsResults)(siteUrl, listIdOrTitle, items, options.foldersBehaviour, info.expandedLookupFields);
|
|
681
688
|
}
|
|
682
689
|
exports.GetListItems = GetListItems;
|
|
@@ -700,13 +707,13 @@ function GetListItemsSync(siteUrl, listIdOrTitle, options) {
|
|
|
700
707
|
next = requestResult.result.d.__next;
|
|
701
708
|
}
|
|
702
709
|
}
|
|
703
|
-
if ((0,
|
|
710
|
+
if ((0, typecheckers_1.isNotEmptyArray)(resultItems))
|
|
704
711
|
items.push(...resultItems);
|
|
705
712
|
if (info.totalNumberOfItemsToGet > items.length)
|
|
706
713
|
info.requestUrl = next;
|
|
707
714
|
else
|
|
708
715
|
info.requestUrl = null;
|
|
709
|
-
} while (!(0,
|
|
716
|
+
} while (!(0, typecheckers_1.isNullOrEmptyString)(info.requestUrl));
|
|
710
717
|
return (0, common_2.__fixGetListItemsResults)(siteUrl, listIdOrTitle, items, options.foldersBehaviour, info.expandedLookupFields);
|
|
711
718
|
}
|
|
712
719
|
exports.GetListItemsSync = GetListItemsSync;
|
|
@@ -719,7 +726,7 @@ function _GetListItemsInfo(siteUrl, listIdOrTitle, options) {
|
|
|
719
726
|
let expand = [];
|
|
720
727
|
let expandedLookupFields = [];
|
|
721
728
|
options.columns.forEach(c => {
|
|
722
|
-
if ((0,
|
|
729
|
+
if ((0, typecheckers_1.isString)(c))
|
|
723
730
|
columns.push(c);
|
|
724
731
|
else {
|
|
725
732
|
let internalName = c.InternalName;
|
|
@@ -731,7 +738,7 @@ function _GetListItemsInfo(siteUrl, listIdOrTitle, options) {
|
|
|
731
738
|
if (isLookupField || isUserField) {
|
|
732
739
|
//ISSUE: 1519 - Added lookupField property to able to retrieve value of the additional lookup field key
|
|
733
740
|
let lookupField = c.LookupField;
|
|
734
|
-
if (!(0,
|
|
741
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(lookupField) && isLookupField) {
|
|
735
742
|
columns.push(`${internalName}/${lookupField}`);
|
|
736
743
|
}
|
|
737
744
|
//we want to expand it
|
|
@@ -744,24 +751,24 @@ function _GetListItemsInfo(siteUrl, listIdOrTitle, options) {
|
|
|
744
751
|
columns.push(internalName);
|
|
745
752
|
}
|
|
746
753
|
});
|
|
747
|
-
if ((0,
|
|
754
|
+
if ((0, typecheckers_1.isNotEmptyArray)(options.expand)) {
|
|
748
755
|
expand.push(...options.expand);
|
|
749
756
|
}
|
|
750
757
|
//add the ones we need
|
|
751
|
-
(0,
|
|
752
|
-
(0,
|
|
753
|
-
(0,
|
|
754
|
-
queryParams.push(`$select=${encodeURIComponent((0,
|
|
755
|
-
if ((0,
|
|
756
|
-
queryParams.push(`$expand=${encodeURIComponent((0,
|
|
758
|
+
(0, collections_base_1.PushNoDuplicate)(columns, "Id");
|
|
759
|
+
(0, collections_base_1.PushNoDuplicate)(columns, "FileRef");
|
|
760
|
+
(0, collections_base_1.PushNoDuplicate)(columns, "FileSystemObjectType");
|
|
761
|
+
queryParams.push(`$select=${encodeURIComponent((0, collections_base_1.makeUniqueArray)(columns).join(','))}`);
|
|
762
|
+
if ((0, typecheckers_1.isNotEmptyArray)(expand))
|
|
763
|
+
queryParams.push(`$expand=${encodeURIComponent((0, collections_base_1.makeUniqueArray)(expand).join(','))}`);
|
|
757
764
|
let batchSize = 2000;
|
|
758
765
|
let limit = options.rowLimit >= 0 && options.rowLimit < batchSize ? options.rowLimit : batchSize;
|
|
759
|
-
let totalNumberOfItemsToGet = !(0,
|
|
760
|
-
if (!(0,
|
|
766
|
+
let totalNumberOfItemsToGet = !(0, typecheckers_1.isNumber)(options.rowLimit) || options.rowLimit < 1 ? 99999 : options.rowLimit > batchSize ? options.rowLimit : limit;
|
|
767
|
+
if (!(0, typecheckers_1.isNullOrEmptyString)(options.$filter))
|
|
761
768
|
queryParams.push(`$filter=${options.$filter}`);
|
|
762
769
|
queryParams.push(`$top=${limit}`);
|
|
763
770
|
let requestUrl = url + (queryParams.length > 0 ? '?' + queryParams.join('&') : '');
|
|
764
|
-
let noMetadata = options.jsonMetadata ===
|
|
771
|
+
let noMetadata = options.jsonMetadata === rest_types_1.jsonTypes.nometadata;
|
|
765
772
|
return { requestUrl, noMetadata, totalNumberOfItemsToGet, expandedLookupFields };
|
|
766
773
|
}
|
|
767
774
|
/** Find an item by id, even if it is nested in a sub-folder */
|
|
@@ -770,10 +777,10 @@ function FindListItemById(items, itemId) {
|
|
|
770
777
|
let current = items[i];
|
|
771
778
|
if (current.Id === itemId)
|
|
772
779
|
return current;
|
|
773
|
-
else if ((0,
|
|
780
|
+
else if ((0, typecheckers_1.isNotEmptyArray)(current.__Items)) //folder? look inside
|
|
774
781
|
{
|
|
775
782
|
let nestedResult = FindListItemById(current.__Items, itemId);
|
|
776
|
-
if (!(0,
|
|
783
|
+
if (!(0, typecheckers_1.isNullOrUndefined)(nestedResult))
|
|
777
784
|
return nestedResult;
|
|
778
785
|
}
|
|
779
786
|
}
|
|
@@ -789,9 +796,9 @@ async function GetListEventReceivers(siteUrl, listIdOrTitle, refreshCache) {
|
|
|
789
796
|
let url = _getListEventReceiversRequestUrl(siteUrl, listIdOrTitle);
|
|
790
797
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
791
798
|
allowCache: refreshCache !== true,
|
|
792
|
-
jsonMetadata:
|
|
799
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
793
800
|
});
|
|
794
|
-
return !(0,
|
|
801
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) ? response.value : null;
|
|
795
802
|
}
|
|
796
803
|
catch {
|
|
797
804
|
}
|
|
@@ -809,12 +816,12 @@ async function AddListEventReceiver(siteUrl, listIdOrTitle, eventReceiverDefinit
|
|
|
809
816
|
let response = await (0, rest_1.GetJson)(url, JSON.stringify(newEventReceiver), {
|
|
810
817
|
method: "POST",
|
|
811
818
|
includeDigestInPost: true,
|
|
812
|
-
jsonMetadata:
|
|
819
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
813
820
|
headers: {
|
|
814
|
-
"content-type":
|
|
821
|
+
"content-type": rest_types_1.contentTypes.json
|
|
815
822
|
}
|
|
816
823
|
});
|
|
817
|
-
return !(0,
|
|
824
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) && (0, typecheckers_1.isValidGuid)(response.ReceiverId) ? response : null;
|
|
818
825
|
}
|
|
819
826
|
catch {
|
|
820
827
|
}
|
|
@@ -823,13 +830,13 @@ async function AddListEventReceiver(siteUrl, listIdOrTitle, eventReceiverDefinit
|
|
|
823
830
|
exports.AddListEventReceiver = AddListEventReceiver;
|
|
824
831
|
async function DeleteListEventReceiver(siteUrl, listIdOrTitle, eventReceiverId) {
|
|
825
832
|
try {
|
|
826
|
-
let url = `${_getListEventReceiversRequestUrl(siteUrl, listIdOrTitle)}('${(0,
|
|
833
|
+
let url = `${_getListEventReceiversRequestUrl(siteUrl, listIdOrTitle)}('${(0, strings_1.normalizeGuid)(eventReceiverId)}')/deleteObject`;
|
|
827
834
|
let response = await (0, rest_1.GetJson)(url, null, {
|
|
828
835
|
method: "POST",
|
|
829
836
|
includeDigestInPost: true,
|
|
830
|
-
jsonMetadata:
|
|
837
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
831
838
|
});
|
|
832
|
-
return !(0,
|
|
839
|
+
return !(0, typecheckers_1.isNullOrUndefined)(response) && response["odata.null"] === true;
|
|
833
840
|
}
|
|
834
841
|
catch {
|
|
835
842
|
}
|
|
@@ -843,10 +850,10 @@ function GetListLastItemModifiedDate(siteUrl, listIdOrTitle, options) {
|
|
|
843
850
|
let caller = sync ? rest_1.GetJsonSync : rest_1.GetJson;
|
|
844
851
|
let result = caller(GetListRestUrl(siteUrl, listIdOrTitle) + `/${endPoint}`, null, {
|
|
845
852
|
allowCache: true, //in memory only
|
|
846
|
-
jsonMetadata:
|
|
853
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata,
|
|
847
854
|
forceCacheUpdate: options && options.refreshCache === true || false
|
|
848
855
|
});
|
|
849
|
-
if ((0,
|
|
856
|
+
if ((0, typecheckers_1.isPromise)(result))
|
|
850
857
|
return result.then(r => r.value, () => null);
|
|
851
858
|
else
|
|
852
859
|
return result.success ? result.result.value : null;
|
|
@@ -855,7 +862,7 @@ exports.GetListLastItemModifiedDate = GetListLastItemModifiedDate;
|
|
|
855
862
|
async function ReloadListLastModified(siteUrl, listIdOrTitle) {
|
|
856
863
|
await GetListLastItemModifiedDate(siteUrl, listIdOrTitle, { refreshCache: true });
|
|
857
864
|
//make sure we do it for both title and id, we don't know how the other callers may use this in their API
|
|
858
|
-
if (!(0,
|
|
865
|
+
if (!(0, typecheckers_1.isValidGuid)(listIdOrTitle)) {
|
|
859
866
|
try {
|
|
860
867
|
var listId = GetListId(siteUrl, listIdOrTitle);
|
|
861
868
|
await GetListLastItemModifiedDate(siteUrl, listId, { refreshCache: true });
|
|
@@ -873,28 +880,28 @@ async function ReloadListLastModified(siteUrl, listIdOrTitle) {
|
|
|
873
880
|
exports.ReloadListLastModified = ReloadListLastModified;
|
|
874
881
|
async function ListHasUniquePermissions(siteUrl, listIdOrTitle) {
|
|
875
882
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/?$select=hasuniqueroleassignments`;
|
|
876
|
-
let has = await (0, rest_1.GetJson)(url, undefined, { allowCache: false, jsonMetadata:
|
|
883
|
+
let has = await (0, rest_1.GetJson)(url, undefined, { allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
877
884
|
return has.HasUniqueRoleAssignments === true;
|
|
878
885
|
}
|
|
879
886
|
exports.ListHasUniquePermissions = ListHasUniquePermissions;
|
|
880
887
|
async function RestoreListPermissionInheritance(siteUrl, listIdOrTitle) {
|
|
881
888
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/ResetRoleInheritance`;
|
|
882
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
889
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
883
890
|
}
|
|
884
891
|
exports.RestoreListPermissionInheritance = RestoreListPermissionInheritance;
|
|
885
892
|
async function BreakListPermissionInheritance(siteUrl, listIdOrTitle, clear = true) {
|
|
886
893
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/breakroleinheritance(copyRoleAssignments=${clear ? 'false' : 'true'}, clearSubscopes=true)`;
|
|
887
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
894
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
888
895
|
}
|
|
889
896
|
exports.BreakListPermissionInheritance = BreakListPermissionInheritance;
|
|
890
897
|
async function AssignListPermission(siteUrl, listIdOrTitle, principalId, roleId) {
|
|
891
898
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/roleassignments/addroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
892
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
899
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
893
900
|
}
|
|
894
901
|
exports.AssignListPermission = AssignListPermission;
|
|
895
902
|
async function RemoveListPermission(siteUrl, listIdOrTitle, principalId, roleId) {
|
|
896
903
|
let url = `${GetListRestUrl(siteUrl, listIdOrTitle)}/roleassignments/removeroleassignment(principalid=${principalId},roleDefId=${roleId})`;
|
|
897
|
-
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata:
|
|
904
|
+
await (0, rest_1.GetJson)(url, undefined, { method: "POST", allowCache: false, jsonMetadata: rest_types_1.jsonTypes.nometadata, spWebUrl: siteUrl });
|
|
898
905
|
}
|
|
899
906
|
exports.RemoveListPermission = RemoveListPermission;
|
|
900
907
|
async function CreateList(siteUrl, info) {
|
|
@@ -908,8 +915,8 @@ async function CreateList(siteUrl, info) {
|
|
|
908
915
|
Description: info.description,
|
|
909
916
|
Title: info.title
|
|
910
917
|
};
|
|
911
|
-
let newList = (await (0, rest_1.GetJson)(url, (0,
|
|
912
|
-
(0,
|
|
918
|
+
let newList = (await (0, rest_1.GetJson)(url, (0, json_1.jsonStringify)(body))).d;
|
|
919
|
+
(0, strings_1.normalizeGuid)(newList.Id);
|
|
913
920
|
return newList;
|
|
914
921
|
}
|
|
915
922
|
exports.CreateList = CreateList;
|
|
@@ -917,7 +924,7 @@ async function SearchList(siteUrl, listIdOrTitle, query) {
|
|
|
917
924
|
let listId = GetListId(siteUrl, listIdOrTitle);
|
|
918
925
|
let url = `${(0, common_1.GetRestBaseUrl)(siteUrl)}/search/query?querytext='(${query}*)'&querytemplate='{searchTerms} (NormListID:${listId})'`;
|
|
919
926
|
try {
|
|
920
|
-
const result = await (0, rest_1.GetJson)(url, null, { jsonMetadata:
|
|
927
|
+
const result = await (0, rest_1.GetJson)(url, null, { jsonMetadata: rest_types_1.jsonTypes.nometadata });
|
|
921
928
|
logger.json(result.PrimaryQueryResult.RelevantResults, `search ${query}`);
|
|
922
929
|
let rows = result.PrimaryQueryResult.RelevantResults.Table.Rows;
|
|
923
930
|
const mapped = [];
|
|
@@ -933,7 +940,7 @@ async function SearchList(siteUrl, listIdOrTitle, query) {
|
|
|
933
940
|
? ""
|
|
934
941
|
: cell.Value;
|
|
935
942
|
});
|
|
936
|
-
let resultPath = (0,
|
|
943
|
+
let resultPath = (0, typecheckers_1.isNullOrEmptyString)(rowValues.Path) ? "" : rowValues.Path.toLowerCase();
|
|
937
944
|
let indexOfId = resultPath.toLowerCase().indexOf("id=");
|
|
938
945
|
let itemId = indexOfId >= 0 ? parseInt(resultPath.slice(indexOfId + 3)) : -1;
|
|
939
946
|
if (itemId >= 0)
|
|
@@ -960,9 +967,9 @@ async function UpdateListExperience(siteUrl, listId, experience) {
|
|
|
960
967
|
};
|
|
961
968
|
let result = await (0, rest_1.GetJson)(url, JSON.stringify(data), {
|
|
962
969
|
xHttpMethod: "MERGE",
|
|
963
|
-
jsonMetadata:
|
|
970
|
+
jsonMetadata: rest_types_1.jsonTypes.nometadata
|
|
964
971
|
});
|
|
965
|
-
return (0,
|
|
972
|
+
return (0, typecheckers_1.isNullOrEmptyString)(result);
|
|
966
973
|
}
|
|
967
974
|
catch (e) {
|
|
968
975
|
logger.error(e);
|