From 396031128a872da967308026c01dc63213c1892f Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Sat, 13 Mar 2021 23:18:22 -0500 Subject: [PATCH 1/3] Created the web template extensions lib. Need to complete request types for mapper. --- @types/intellisense/index.d.ts | 3 +- .../intellisense/webTemplateExtensions.d.ts | 38 ++++++ @types/lib/index.d.ts | 1 + @types/lib/webTemplateExtensions.d.ts | 21 ++++ @types/rest.d.ts | 5 + dist/gd-sprest.d.ts | 73 ++++++++++++ dist/gd-sprest.js | 34 +++++- dist/gd-sprest.min.js | 2 +- src/lib/index.ts | 1 + src/lib/webTemplateExtensions.ts | 26 +++++ src/mapper/custom/index.ts | 3 +- src/mapper/custom/webTemplateExtensions.ts | 109 ++++++++++++++++++ src/rest.ts | 1 + src/utils/helper.ts | 9 +- src/utils/methodInfo.ts | 3 + 15 files changed, 319 insertions(+), 10 deletions(-) create mode 100644 @types/intellisense/webTemplateExtensions.d.ts create mode 100644 @types/lib/webTemplateExtensions.d.ts create mode 100644 src/lib/webTemplateExtensions.ts create mode 100644 src/mapper/custom/webTemplateExtensions.ts diff --git a/@types/intellisense/index.d.ts b/@types/intellisense/index.d.ts index 494b83b3..ffe67adb 100644 --- a/@types/intellisense/index.d.ts +++ b/@types/intellisense/index.d.ts @@ -1,4 +1,5 @@ export * from "gd-sprest-def"; //export * from "./graph"; export * from "./peoplePicker"; -export * from "./utility"; \ No newline at end of file +export * from "./utility"; +export * from "./webTemplateExtensions"; \ No newline at end of file diff --git a/@types/intellisense/webTemplateExtensions.d.ts b/@types/intellisense/webTemplateExtensions.d.ts new file mode 100644 index 00000000..935bac0f --- /dev/null +++ b/@types/intellisense/webTemplateExtensions.d.ts @@ -0,0 +1,38 @@ +import { + +} from "gd-sprest-def/lib/Microsoft/SharePoint/Utilities/WebTemplateExtensions"; +import { IBaseExecution } from "gd-sprest-def/lib/base"; +import { WebTemplateExtensions } from "gd-sprest-def/lib/Microsoft/SharePoint/Utilities"; + +/** + * Web Template Extensions Results + */ +export interface IResult extends IBaseExecution { } + +/** + * Web Template Extensions Methods + */ +export interface IWebTemplateExtensionsMethods { + applySiteDesign(siteDesignId: string, webUrl: string): IBaseExecution; + addSiteDesignTaskToCurrentWeb(siteDesignId: string): IBaseExecution; + createSiteDesign(info: WebTemplateExtensions.SiteDesignCreationInfo) + createSiteScript(title: string, content: any): IBaseExecution; + deleteSiteDesign(id: string): IBaseExecution; + deleteSiteScript(id: string): IBaseExecution; + getSiteDesigns(): IBaseExecution; + getSiteDesignMetadata(id: string): IBaseExecution; + getSiteScripts(): IBaseExecution; + getSiteScriptFromWeb(webUrl: string, info: WebTemplateExtensions.SiteScriptSerializationInfo): IBaseExecution; + getSiteScriptFromList(listUrl: string): IBaseExecution; + getSiteScriptMetadata(id: string): IBaseExecution; + getSiteDesignRights(id: string): IBaseExecution; + grantSiteDesignRights(id: string, principalNames: string[], grantedRights: number): IBaseExecution; + revokeSiteDesignRights(id: string, principalNames: string[]): IBaseExecution; + updateSiteDesign(updateInfo: WebTemplateExtensions.SiteDesignCreationInfo & WebTemplateExtensions.SiteDesignMetadata): IBaseExecution; + updateSiteScript(updateInfo: WebTemplateExtensions.SiteScriptCreationInfo & WebTemplateExtensions.SiteScriptMetadata): IBaseExecution; +} + +/** + * Web Template Extensions + */ +export interface IWebTemplateExtensions extends IWebTemplateExtensionsMethods, IBaseExecution { } \ No newline at end of file diff --git a/@types/lib/index.d.ts b/@types/lib/index.d.ts index 2661092f..dee16903 100644 --- a/@types/lib/index.d.ts +++ b/@types/lib/index.d.ts @@ -18,5 +18,6 @@ export * from "./themeManager"; export * from "./userProfile"; export * from "./utility"; export * from "./web"; +export * from "./webTemplateExtensions"; export * from "./wfInstanceService"; export * from "./wfSubscriptionService"; \ No newline at end of file diff --git a/@types/lib/webTemplateExtensions.d.ts b/@types/lib/webTemplateExtensions.d.ts new file mode 100644 index 00000000..7c4c939b --- /dev/null +++ b/@types/lib/webTemplateExtensions.d.ts @@ -0,0 +1,21 @@ +import * as SP from "../intellisense/webTemplateExtensions"; +import { ITargetInfoProps } from "../utils"; + +/** + * #### REST API + * _api/Microsoft.SharePoint.Utilities.WebTemplateExtensions + */ +export const WebTemplateExtensions: IWebTemplateExtensions; + +/** + * Web Template Extensions + * @category WebTemplateExtensions + */ +export interface IWebTemplateExtensions { + /** + * Creates an instance of the utility library. + * @param url - (Optional) The web url. + * @param targetInfo - (Optional) The target information. + */ + (url?: string, targetInfo?: ITargetInfoProps): SP.IWebTemplateExtensions; +} \ No newline at end of file diff --git a/@types/rest.d.ts b/@types/rest.d.ts index 6345f4c1..1ad5dba4 100644 --- a/@types/rest.d.ts +++ b/@types/rest.d.ts @@ -175,6 +175,11 @@ export interface IREST { */ Web: LibTypes.IWeb; + /** + * Use this api to interact with a SharePoint web template extensions. + */ + WebTemplateExtensions: LibTypes.IWebTemplateExtensions; + /** * User this api to interact with the SharePoint 2013 workflow instance service. */ diff --git a/dist/gd-sprest.d.ts b/dist/gd-sprest.d.ts index aee379fa..20814c4a 100644 --- a/dist/gd-sprest.d.ts +++ b/dist/gd-sprest.d.ts @@ -17,6 +17,7 @@ // ../gd-sprest-def/base // ../gd-sprest-def/lib/SP/Taxonomy/entitytypes // ../gd-sprest-def/lib/SP/UI/ApplicationPages/complextypes +// ../gd-sprest-def/lib/Microsoft/SharePoint/Utilities // ../gd-sprest-def/lib/SP declare module 'gd-sprest' { @@ -81,6 +82,7 @@ declare module 'gd-sprest/lib' { export * from "gd-sprest/lib/userProfile"; export * from "gd-sprest/lib/utility"; export * from "gd-sprest/lib/web"; + export * from "gd-sprest/lib/webTemplateExtensions"; export * from "gd-sprest/lib/wfInstanceService"; export * from "gd-sprest/lib/wfSubscriptionService"; } @@ -330,6 +332,11 @@ declare module 'gd-sprest/rest' { */ Web: LibTypes.IWeb; + /** + * Use this api to interact with a SharePoint web template extensions. + */ + WebTemplateExtensions: LibTypes.IWebTemplateExtensions; + /** * User this api to interact with the SharePoint 2013 workflow instance service. */ @@ -395,6 +402,7 @@ declare module 'gd-sprest/intellisense' { export * from "gd-sprest-def"; export * from "gd-sprest/intellisense/peoplePicker"; export * from "gd-sprest/intellisense/utility"; + export * from "gd-sprest/intellisense/webTemplateExtensions"; } declare module 'gd-sprest/lib/apps' { @@ -1552,6 +1560,30 @@ declare module 'gd-sprest/lib/web' { } } +declare module 'gd-sprest/lib/webTemplateExtensions' { + import * as SP from "gd-sprest/intellisense/webTemplateExtensions"; + import { ITargetInfoProps } from "gd-sprest/utils"; + + /** + * #### REST API + * _api/Microsoft.SharePoint.Utilities.WebTemplateExtensions + */ + export const WebTemplateExtensions: IWebTemplateExtensions; + + /** + * Web Template Extensions + * @category WebTemplateExtensions + */ + export interface IWebTemplateExtensions { + /** + * Creates an instance of the utility library. + * @param url - (Optional) The web url. + * @param targetInfo - (Optional) The target information. + */ + (url?: string, targetInfo?: ITargetInfoProps): SP.IWebTemplateExtensions; + } +} + declare module 'gd-sprest/lib/wfInstanceService' { import { IBaseExecution } from "gd-sprest-def/lib/base"; import * as SP from "gd-sprest-def/lib/SP/WorkflowServices/entitytypes"; @@ -5398,6 +5430,47 @@ declare module 'gd-sprest/intellisense/utility' { } } +declare module 'gd-sprest/intellisense/webTemplateExtensions' { + import { + + } from "gd-sprest-def/lib/Microsoft/SharePoint/Utilities/WebTemplateExtensions"; + import { IBaseExecution } from "gd-sprest-def/lib/base"; + import { WebTemplateExtensions } from "gd-sprest-def/lib/Microsoft/SharePoint/Utilities"; + + /** + * Web Template Extensions Results + */ + export interface IResult extends IBaseExecution { } + + /** + * Web Template Extensions Methods + */ + export interface IWebTemplateExtensionsMethods { + applySiteDesign(siteDesignId: string, webUrl: string): IBaseExecution; + addSiteDesignTaskToCurrentWeb(siteDesignId: string): IBaseExecution; + createSiteDesign(info: WebTemplateExtensions.SiteDesignCreationInfo) + createSiteScript(title: string, content: any): IBaseExecution; + deleteSiteDesign(id: string): IBaseExecution; + deleteSiteScript(id: string): IBaseExecution; + getSiteDesigns(): IBaseExecution; + getSiteDesignMetadata(id: string): IBaseExecution; + getSiteScripts(): IBaseExecution; + getSiteScriptFromWeb(webUrl: string, info: WebTemplateExtensions.SiteScriptSerializationInfo): IBaseExecution; + getSiteScriptFromList(listUrl: string): IBaseExecution; + getSiteScriptMetadata(id: string): IBaseExecution; + getSiteDesignRights(id: string): IBaseExecution; + grantSiteDesignRights(id: string, principalNames: string[], grantedRights: number): IBaseExecution; + revokeSiteDesignRights(id: string, principalNames: string[]): IBaseExecution; + updateSiteDesign(updateInfo: WebTemplateExtensions.SiteDesignCreationInfo & WebTemplateExtensions.SiteDesignMetadata): IBaseExecution; + updateSiteScript(updateInfo: WebTemplateExtensions.SiteScriptCreationInfo & WebTemplateExtensions.SiteScriptMetadata): IBaseExecution; + } + + /** + * Web Template Extensions + */ + export interface IWebTemplateExtensions extends IWebTemplateExtensionsMethods, IBaseExecution { } +} + declare module 'gd-sprest/utils' { export * from "gd-sprest/utils/base"; export * from "gd-sprest/utils/helper"; diff --git a/dist/gd-sprest.js b/dist/gd-sprest.js index 49e28edd..0070c1ca 100644 --- a/dist/gd-sprest.js +++ b/dist/gd-sprest.js @@ -538,7 +538,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n__exportStar(__webpack_require__(/*! ./apps */ \"./build/lib/apps.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./contextInfo */ \"./build/lib/contextInfo.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./graph */ \"./build/lib/graph.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./groupService */ \"./build/lib/groupService.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./groupSiteManager */ \"./build/lib/groupSiteManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./hubSites */ \"./build/lib/hubSites.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./hubSitesUtility */ \"./build/lib/hubSitesUtility.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./list */ \"./build/lib/list.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/lib/navigation.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peopleManager */ \"./build/lib/peopleManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peoplePicker */ \"./build/lib/peoplePicker.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./profileLoader */ \"./build/lib/profileLoader.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./search */ \"./build/lib/search.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./site */ \"./build/lib/site.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./siteManager */ \"./build/lib/siteManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./socialFeed */ \"./build/lib/socialFeed.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./themeManager */ \"./build/lib/themeManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./userProfile */ \"./build/lib/userProfile.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./utility */ \"./build/lib/utility.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./web */ \"./build/lib/web.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./wfInstanceService */ \"./build/lib/wfInstanceService.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./wfSubscriptionService */ \"./build/lib/wfSubscriptionService.js\"), exports);\n\n//# sourceURL=webpack:///./build/lib/index.js?"); +eval("\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n__exportStar(__webpack_require__(/*! ./apps */ \"./build/lib/apps.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./contextInfo */ \"./build/lib/contextInfo.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./graph */ \"./build/lib/graph.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./groupService */ \"./build/lib/groupService.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./groupSiteManager */ \"./build/lib/groupSiteManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./hubSites */ \"./build/lib/hubSites.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./hubSitesUtility */ \"./build/lib/hubSitesUtility.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./list */ \"./build/lib/list.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/lib/navigation.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peopleManager */ \"./build/lib/peopleManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peoplePicker */ \"./build/lib/peoplePicker.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./profileLoader */ \"./build/lib/profileLoader.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./search */ \"./build/lib/search.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./site */ \"./build/lib/site.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./siteManager */ \"./build/lib/siteManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./socialFeed */ \"./build/lib/socialFeed.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./themeManager */ \"./build/lib/themeManager.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./userProfile */ \"./build/lib/userProfile.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./utility */ \"./build/lib/utility.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./web */ \"./build/lib/web.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./webTemplateExtensions */ \"./build/lib/webTemplateExtensions.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./wfInstanceService */ \"./build/lib/wfInstanceService.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./wfSubscriptionService */ \"./build/lib/wfSubscriptionService.js\"), exports);\n\n//# sourceURL=webpack:///./build/lib/index.js?"); /***/ }), @@ -698,6 +698,18 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ }), +/***/ "./build/lib/webTemplateExtensions.js": +/*!********************************************!*\ + !*** ./build/lib/webTemplateExtensions.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.WebTemplateExtensions = void 0;\n\nvar utils_1 = __webpack_require__(/*! ../utils */ \"./build/utils/index.js\");\n/**\r\n * Web Template Extensions\r\n */\n\n\nexports.WebTemplateExtensions = function (url, targetInfo) {\n var webTemplateExtensions = new utils_1.Base(targetInfo); // Default the properties\n\n webTemplateExtensions.targetInfo.defaultToWebFl = true;\n webTemplateExtensions.targetInfo.endpoint = \"Microsoft.SharePoint.Utilities.WebTemplateExtensions.SiteScriptUtility\"; // See if the web url exists\n\n if (url) {\n // Set the settings\n webTemplateExtensions.targetInfo.url = url;\n } // Add the methods\n\n\n utils_1.Request.addMethods(webTemplateExtensions, {\n __metadata: {\n type: \"webTemplateExtensions\"\n }\n }); // Return the web template extension utilities\n\n return webTemplateExtensions;\n};\n\n//# sourceURL=webpack:///./build/lib/webTemplateExtensions.js?"); + +/***/ }), + /***/ "./build/lib/wfInstanceService.js": /*!****************************************!*\ !*** ./build/lib/wfInstanceService.js ***! @@ -754,7 +766,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n__exportStar(__webpack_require__(/*! ./audit */ \"./build/mapper/custom/audit.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./graph */ \"./build/mapper/custom/graph.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./old */ \"./build/mapper/custom/old.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peoplePicker */ \"./build/mapper/custom/peoplePicker.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./propertyValues */ \"./build/mapper/custom/propertyValues.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./utility */ \"./build/mapper/custom/utility.js\"), exports);\n\n//# sourceURL=webpack:///./build/mapper/custom/index.js?"); +eval("\n\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n__exportStar(__webpack_require__(/*! ./audit */ \"./build/mapper/custom/audit.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./graph */ \"./build/mapper/custom/graph.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./old */ \"./build/mapper/custom/old.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./peoplePicker */ \"./build/mapper/custom/peoplePicker.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./propertyValues */ \"./build/mapper/custom/propertyValues.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./utility */ \"./build/mapper/custom/utility.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./webTemplateExtensions */ \"./build/mapper/custom/webTemplateExtensions.js\"), exports);\n\n//# sourceURL=webpack:///./build/mapper/custom/index.js?"); /***/ }), @@ -806,6 +818,18 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ }), +/***/ "./build/mapper/custom/webTemplateExtensions.js": +/*!******************************************************!*\ + !*** ./build/mapper/custom/webTemplateExtensions.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.webtemplateextensions = void 0;\n\nvar utils_1 = __webpack_require__(/*! ../../utils */ \"./build/utils/index.js\");\n/**\r\n * Web Template Extensions\r\n */\n\n\nexports.webtemplateextensions = {\n applySiteDesign: {\n argNames: [\"siteDesignId\", \"webUrl\"],\n appendEndpointFl: true,\n name: \"CreateSiteScript\",\n requestType: utils_1.RequestType.PostWithArgsInQSAsVar // TODO\n\n },\n addSiteDesignTaskToCurrentWeb: {\n argNames: [\"siteDesignId\"],\n appendEndpointFl: true,\n name: \"AddSiteDesignTaskToCurrentWeb\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n createSiteDesign: {\n argNames: [\"info\"],\n appendEndpointFl: true,\n name: \"CreateSiteDesign\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n createSiteScript: {\n argNames: [\"title\", \"content\"],\n appendEndpointFl: true,\n name: \"CreateSiteScript\",\n requestType: utils_1.RequestType.PostBodyNoArgs // TODO\n\n },\n deleteSiteDesign: {\n argNames: [\"id\"],\n appendEndpointFl: true,\n name: \"DeleteSiteDesign\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n deleteSiteScript: {\n argNames: [\"id\"],\n appendEndpointFl: true,\n name: \"DeleteSiteScript\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n getSiteDesigns: {\n argNames: [],\n appendEndpointFl: true,\n name: \"GetSiteDesigns\",\n requestType: utils_1.RequestType.Post\n },\n getSiteDesignMetadata: {\n argNames: [\"id\"],\n appendEndpointFl: true,\n name: \"\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n getSiteScripts: {\n argNames: [],\n appendEndpointFl: true,\n name: \"GetSiteScripts\",\n requestType: utils_1.RequestType.Post\n },\n getSiteScriptFromWeb: {\n argNames: [\"webUrl\", \"info\"],\n appendEndpointFl: true,\n name: \"GetSiteScriptFromWeb\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n getSiteScriptFromList: {\n argNames: [\"listUrl\"],\n appendEndpointFl: true,\n name: \"GetSiteScriptFromList\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n getSiteScriptMetadata: {\n argNames: [\"id\"],\n appendEndpointFl: true,\n name: \"GetSiteScriptMetadata\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n getSiteDesignRights: {\n argNames: [\"id\"],\n appendEndpointFl: true,\n name: \"GetSiteDesignRights\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n grantSiteDesignRights: {\n argNames: [\"id\", \"principalNames\", \"grantedRights\"],\n appendEndpointFl: true,\n name: \"GrantSiteDesignRights\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n revokeSiteDesignRights: {\n argNames: [\"id\", \"principalNames\"],\n appendEndpointFl: true,\n name: \"RevokeSiteDesignRights\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n updateSiteDesign: {\n argNames: [\"updateInfo\"],\n appendEndpointFl: true,\n name: \"UpdateSiteDesign\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n },\n updateSiteScript: {\n argNames: [\"updateInfo\"],\n appendEndpointFl: true,\n name: \"UpdateSiteScript\",\n requestType: utils_1.RequestType.PostBodyNoArgs\n }\n};\n\n//# sourceURL=webpack:///./build/mapper/custom/webTemplateExtensions.js?"); + +/***/ }), + /***/ "./build/mapper/def.js": /*!*****************************!*\ !*** ./build/mapper/def.js ***! @@ -838,7 +862,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.$REST = void 0;\n\nvar Helper = __webpack_require__(/*! ./helper */ \"./build/helper/index.js\");\n\nvar Lib = __webpack_require__(/*! ./lib */ \"./build/lib/index.js\");\n\nvar sptypes_1 = __webpack_require__(/*! ./sptypes */ \"./build/sptypes/index.js\");\n/**\r\n * SharePoint REST Library\r\n */\n\n\nexports.$REST = {\n __ver: 6.38,\n AppContext: function AppContext(siteUrl) {\n return Lib.Site.getAppContext(siteUrl);\n },\n Apps: Lib.Apps,\n ContextInfo: Lib.ContextInfo,\n DefaultRequestToHostFl: false,\n Graph: Lib.Graph,\n GroupService: Lib.GroupService,\n GroupSiteManager: Lib.GroupSiteManager,\n Helper: Helper,\n HubSites: Lib.HubSites,\n HubSitesUtility: Lib.HubSitesUtility,\n List: Lib.List,\n ListByEntityName: Lib.List.getByEntityName,\n ListDataAsStream: Lib.List.getDataAsStream,\n Navigation: Lib.Navigation,\n PeopleManager: Lib.PeopleManager,\n PeoplePicker: Lib.PeoplePicker,\n ProfileLoader: Lib.ProfileLoader,\n RemoteWeb: function RemoteWeb(requestUrl) {\n return Lib.Web.getRemoteWeb(requestUrl);\n },\n Search: Lib.Search,\n Site: Lib.Site,\n SiteManager: Lib.SiteManager,\n SiteExists: function SiteExists(url) {\n return Lib.Site.exists(url);\n },\n SiteUrl: function SiteUrl(id) {\n return Lib.Site.getUrlById(id);\n },\n SPTypes: sptypes_1.SPTypes,\n SocialFeed: Lib.SocialFeed,\n ThemeManager: Lib.ThemeManager,\n UserProfile: Lib.UserProfile,\n Utility: Lib.Utility,\n Web: Lib.Web,\n WorkflowInstanceService: Lib.WorkflowInstanceService,\n WorkflowSubscriptionService: Lib.WorkflowSubscriptionService\n}; // See if the library doesn't exist, or is an older version\n\nvar global = Lib.ContextInfo.window.$REST;\n\nif (global == null || global.__ver == null || global.__ver < exports.$REST.__ver) {\n // Set the global variable\n Lib.ContextInfo.window.$REST = exports.$REST; // Ensure the SP lib exists\n\n if (Lib.ContextInfo.window.SP) {\n // If MDS is turned on in a SP2013 environment, it may throw an error\n try {\n // Alert other scripts this library is loaded\n Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs(\"gd-sprest\");\n Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs(\"gd-sprest.js\");\n } catch (_a) {\n // Log\n console.error(\"[gd-sprest] Error notifying scripts using the SP SOD library.\");\n }\n }\n}\n\n//# sourceURL=webpack:///./build/rest.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.$REST = void 0;\n\nvar Helper = __webpack_require__(/*! ./helper */ \"./build/helper/index.js\");\n\nvar Lib = __webpack_require__(/*! ./lib */ \"./build/lib/index.js\");\n\nvar sptypes_1 = __webpack_require__(/*! ./sptypes */ \"./build/sptypes/index.js\");\n/**\r\n * SharePoint REST Library\r\n */\n\n\nexports.$REST = {\n __ver: 6.38,\n AppContext: function AppContext(siteUrl) {\n return Lib.Site.getAppContext(siteUrl);\n },\n Apps: Lib.Apps,\n ContextInfo: Lib.ContextInfo,\n DefaultRequestToHostFl: false,\n Graph: Lib.Graph,\n GroupService: Lib.GroupService,\n GroupSiteManager: Lib.GroupSiteManager,\n Helper: Helper,\n HubSites: Lib.HubSites,\n HubSitesUtility: Lib.HubSitesUtility,\n List: Lib.List,\n ListByEntityName: Lib.List.getByEntityName,\n ListDataAsStream: Lib.List.getDataAsStream,\n Navigation: Lib.Navigation,\n PeopleManager: Lib.PeopleManager,\n PeoplePicker: Lib.PeoplePicker,\n ProfileLoader: Lib.ProfileLoader,\n RemoteWeb: function RemoteWeb(requestUrl) {\n return Lib.Web.getRemoteWeb(requestUrl);\n },\n Search: Lib.Search,\n Site: Lib.Site,\n SiteManager: Lib.SiteManager,\n SiteExists: function SiteExists(url) {\n return Lib.Site.exists(url);\n },\n SiteUrl: function SiteUrl(id) {\n return Lib.Site.getUrlById(id);\n },\n SPTypes: sptypes_1.SPTypes,\n SocialFeed: Lib.SocialFeed,\n ThemeManager: Lib.ThemeManager,\n UserProfile: Lib.UserProfile,\n Utility: Lib.Utility,\n Web: Lib.Web,\n WebTemplateExtensions: Lib.WebTemplateExtensions,\n WorkflowInstanceService: Lib.WorkflowInstanceService,\n WorkflowSubscriptionService: Lib.WorkflowSubscriptionService\n}; // See if the library doesn't exist, or is an older version\n\nvar global = Lib.ContextInfo.window.$REST;\n\nif (global == null || global.__ver == null || global.__ver < exports.$REST.__ver) {\n // Set the global variable\n Lib.ContextInfo.window.$REST = exports.$REST; // Ensure the SP lib exists\n\n if (Lib.ContextInfo.window.SP) {\n // If MDS is turned on in a SP2013 environment, it may throw an error\n try {\n // Alert other scripts this library is loaded\n Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs(\"gd-sprest\");\n Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs(\"gd-sprest.js\");\n } catch (_a) {\n // Log\n console.error(\"[gd-sprest] Error notifying scripts using the SP SOD library.\");\n }\n }\n}\n\n//# sourceURL=webpack:///./build/rest.js?"); /***/ }), @@ -898,7 +922,7 @@ eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Helper = void 0;\n\nvar lib_1 = __webpack_require__(/*! ../lib */ \"./build/lib/index.js\");\n\nvar _1 = __webpack_require__(/*! . */ \"./build/utils/index.js\");\n\nvar xhrRequest_1 = __webpack_require__(/*! ./xhrRequest */ \"./build/utils/xhrRequest.js\");\n/**\r\n * Request Helper\r\n */\n\n\nexports.Helper = {\n // Method to add the base references\n addBaseMethods: function addBaseMethods(base, obj) {\n // Add the base references\n obj[\"addMethods\"] = base.addMethods;\n obj[\"base\"] = base.base;\n obj[\"done\"] = base.done;\n obj[\"execute\"] = base.execute;\n obj[\"executeAndWait\"] = base.executeAndWait;\n obj[\"executeMethod\"] = base.executeMethod;\n obj[\"existsFl\"] = true;\n obj[\"getCollection\"] = base.getCollection;\n obj[\"getProperty\"] = base.getProperty;\n obj[\"parent\"] = base;\n obj[\"targetInfo\"] = base.targetInfo;\n obj[\"updateMetadataUri\"] = base.updateMetadataUri;\n obj[\"waitForRequestsToComplete\"] = base.waitForRequestsToComplete;\n },\n // Method to wait for all requests to complete, before resolving the request\n done: function done(base, resolve) {\n // Ensure the base is set\n base.base = base.base ? base.base : base; // Ensure the response index is set\n\n base.responseIndex = base.responseIndex >= 0 ? base.responseIndex : 0; // Wait for the responses to execute\n\n _1.Request.waitForRequestsToComplete(base, function () {\n var responses = base.base.responses; // Clear the responses\n\n base.base.responses = []; // Clear the wait flags\n\n base.base.waitFlags = []; // Resolve the request\n\n resolve ? resolve.apply(base, responses) : null;\n });\n },\n // Method to execute a method\n executeMethod: function executeMethod(base, methodName, methodConfig, args) {\n var targetInfo = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Create the target information and use the url defined for the base object\n targetInfo = {\n url: metadata.uri\n }; // See if we are inheriting the metadata type\n\n if (methodConfig.inheritMetadataType && metadata.type) {\n // Copy the metadata type\n methodConfig.metadataType = metadata.type;\n } // Update the metadata uri\n\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo);\n } else {\n // Copy the target information\n targetInfo = Object.create(base.targetInfo);\n } // Get the method information\n\n\n var methodInfo = new _1.MethodInfo(methodName, methodConfig, args); // Update the target information\n\n targetInfo.bufferFl = methodConfig.requestType == _1.RequestType.GetBuffer;\n targetInfo.data = methodInfo.body;\n targetInfo.defaultToWebFl = typeof targetInfo.defaultToWebFl === \"undefined\" && base.base ? base.base.targetInfo.defaultToWebFl : targetInfo.defaultToWebFl;\n targetInfo.method = methodInfo.requestMethod;\n targetInfo.requestDigest = typeof targetInfo.requestDigest === \"undefined\" && base.base && base.base.targetInfo.requestDigest ? base.base.targetInfo.requestDigest : targetInfo.requestDigest;\n targetInfo.requestType = methodConfig.requestType; // See if we are replacing the endpoint\n\n if (methodInfo.replaceEndpointFl) {\n // Replace the endpoint\n targetInfo.endpoint = methodInfo.url;\n } // Else, ensure the method url exists\n else if (methodInfo.url && methodInfo.url.length > 0) {\n // Ensure the end point exists\n targetInfo.endpoint = targetInfo.endpoint ? targetInfo.endpoint : \"\"; // See if the endpoint exists, and the method is not a query string\n\n if (targetInfo.endpoint && methodInfo.url && methodInfo.url.indexOf(\"?\") != 0) {\n // Add a \"/\" separator to the url\n targetInfo.endpoint += \"/\";\n } // Append the url\n\n\n targetInfo.endpoint += methodInfo.url;\n } // Create a new object\n\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.getAllItemsFl = methodInfo.getAllItemsFl;\n obj.parent = base;\n obj.requestType = methodConfig.requestType; // Ensure the return type exists\n\n if (methodConfig.returnType) {\n // Add the methods\n _1.Request.addMethods(obj, {\n __metadata: {\n type: methodConfig.returnType\n }\n });\n } // Return the object\n\n\n return obj;\n },\n // Method to return a collection\n getCollection: function getCollection(base, method, args) {\n // Copy the target information\n var targetInfo = Object.create(base.targetInfo); // Clear the target information properties from any previous requests\n\n targetInfo.data = null;\n targetInfo.method = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Update the url of the target information\n targetInfo.url = metadata.uri; // Update the metadata uri\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo); // Set the endpoint\n\n targetInfo.endpoint = method;\n } else {\n // Append the method to the endpoint\n targetInfo.endpoint += \"/\" + method;\n } // Update the callback\n\n\n targetInfo.callback = args && typeof args[0] === \"function\" ? args[0] : null; // Create a new object\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Return the object\n\n return obj;\n },\n // Method to get the next set of results\n getNextSetOfResults: function getNextSetOfResults(base) {\n // Create the target information to query the next set of results\n var targetInfo = Object.create(base.targetInfo);\n targetInfo.endpoint = \"\";\n targetInfo.url = base[\"d\"].__next; // Create a new object\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Return the object\n\n return obj;\n },\n // Method to return a property of the base object\n getProperty: function getProperty(base, propertyName, requestType) {\n // Copy the target information\n var targetInfo = Object.create(base.targetInfo); // See if this is a graph request\n\n if (requestType.indexOf(\"graph\") == 0) {\n // Default the request type\n targetInfo.requestType = _1.RequestType.GraphGet;\n } // Clear the target information properties from any previous requests\n\n\n targetInfo.data = null;\n targetInfo.method = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Update the url of the target information\n targetInfo.url = metadata.uri; // Update the metadata uri\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo); // Set the endpoint\n\n targetInfo.endpoint = propertyName;\n } else {\n // Append the property name to the endpoint\n targetInfo.endpoint += \"/\" + propertyName;\n } // Create a new object\n\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Add the methods\n\n requestType ? _1.Request.addMethods(obj, {\n __metadata: {\n type: requestType\n }\n }) : null; // Return the object\n\n return obj;\n },\n // Method to get the request information\n getRequestInfo: function getRequestInfo(base) {\n // Create the request, but don't execute it\n var xhr = new xhrRequest_1.XHRRequest(true, new _1.TargetInfo(base.targetInfo), null, false); // Return the request information\n\n return xhr.requestInfo;\n },\n // Method to stringify the object\n stringify: function stringify(base) {\n // Stringify the object\n return JSON.stringify({\n response: base.response,\n status: base.status,\n targetInfo: {\n accessToken: base.targetInfo.accessToken,\n bufferFl: base.targetInfo.bufferFl,\n defaultToWebFl: base.targetInfo.defaultToWebFl,\n endpoint: base.targetInfo.endpoint,\n method: base.targetInfo.method,\n overrideDefaultRequestToHostFl: base.targetInfo.overrideDefaultRequestToHostFl,\n requestDigest: base.targetInfo.requestDigest,\n requestHeader: base.targetInfo.requestHeader,\n requestInfo: base.targetInfo.requestInfo,\n requestType: base.targetInfo.requestType,\n url: base.targetInfo.url\n }\n });\n },\n // Method to update a collection object\n updateDataCollection: function updateDataCollection(obj, results) {\n // Ensure the base is a collection\n if (results) {\n // Save the results\n obj[\"results\"] = obj[\"results\"] ? obj[\"results\"].concat(results) : results; // See if only one object exists\n\n if (obj[\"results\"].length > 0) {\n var results_2 = obj[\"results\"]; // Parse the results\n\n for (var _i = 0, results_1 = results_2; _i < results_1.length; _i++) {\n var result = results_1[_i]; // Add the base methods\n\n exports.Helper.addBaseMethods(obj, result); // Update the metadata\n\n exports.Helper.updateMetadata(obj, result); // Add the methods\n\n _1.Request.addMethods(result, result);\n }\n }\n }\n },\n // Method to update the expanded properties\n updateExpandedProperties: function updateExpandedProperties(base) {\n // Ensure this is an OData request\n if (base[\"results\"] == null || base.requestType != _1.RequestType.OData) {\n return;\n } // Parse the results\n\n\n for (var i = 0; i < base[\"results\"].length; i++) {\n var result = base[\"results\"][i]; // Parse the properties\n\n for (var key in result) {\n var prop = result[key]; // See if this property was expanded\n\n if (prop && prop[\"__metadata\"]) {\n // Add the base methods\n exports.Helper.addBaseMethods(result, prop); // Update the metadata\n\n exports.Helper.updateMetadata(result, prop); // Add the methods\n\n _1.Request.addMethods(prop, prop);\n }\n }\n }\n },\n // Method to update the metadata\n updateMetadata: function updateMetadata(base, data) {\n // See if this is the app web\n if (lib_1.ContextInfo.isAppWeb) {\n // Get the url information\n var hostUrl = lib_1.ContextInfo.webAbsoluteUrl.toLowerCase();\n var requestUrl = data && data.__metadata && data.__metadata.uri ? data.__metadata.uri.toLowerCase() : null;\n var targetUrl = base.targetInfo && base.targetInfo.url ? base.targetInfo.url.toLowerCase() : null; // Ensure the urls exist\n\n if (hostUrl == null || requestUrl == null || targetUrl == null) {\n return;\n } // See if we need to make an update\n\n\n if (targetUrl.indexOf(hostUrl) == 0) {\n return;\n } // Update the metadata uri\n\n\n data.__metadata.uri = requestUrl.replace(hostUrl, targetUrl);\n } // See if this is a webpart definition\n\n\n if (data.__metadata && /SP.WebParts.WebPartDefinition/.test(data.__metadata.type)) {\n // Update the metadata uri\n data.__metadata.uri = data.__metadata.uri.replace(/SP.WebParts.WebPartDefinition/, base.targetInfo.endpoint + \"/getById('\") + \"')\";\n }\n },\n // Method to update the metadata uri\n updateMetadataUri: function updateMetadataUri(base, metadata, targetInfo) {\n // See if this is a field\n if (/^SP.Field/.test(metadata.type) || /^SP\\..*Field$/.test(metadata.type)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.replace(/AvailableFields/, \"fields\");\n } // Else, see if this is an event receiver\n else if (/SP.EventReceiverDefinition/.test(metadata.type)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.replace(/\\/EventReceiver\\//, \"/EventReceivers/\");\n } // Else, see if this is a tenant app\n else if (/Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CorporateCatalogAppMetadata/.test(targetInfo.url)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.split(\"Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CorporateCatalogAppMetadata\")[0] + \"web/tenantappcatalog/availableapps/getbyid('\" + base[\"ID\"] + \"')\";\n }\n }\n};\n\n//# sourceURL=webpack:///./build/utils/helper.js?"); +eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Helper = void 0;\n\nvar lib_1 = __webpack_require__(/*! ../lib */ \"./build/lib/index.js\");\n\nvar _1 = __webpack_require__(/*! . */ \"./build/utils/index.js\");\n\nvar xhrRequest_1 = __webpack_require__(/*! ./xhrRequest */ \"./build/utils/xhrRequest.js\");\n/**\r\n * Request Helper\r\n */\n\n\nexports.Helper = {\n // Method to add the base references\n addBaseMethods: function addBaseMethods(base, obj) {\n // Add the base references\n obj[\"addMethods\"] = base.addMethods;\n obj[\"base\"] = base.base;\n obj[\"done\"] = base.done;\n obj[\"execute\"] = base.execute;\n obj[\"executeAndWait\"] = base.executeAndWait;\n obj[\"executeMethod\"] = base.executeMethod;\n obj[\"existsFl\"] = true;\n obj[\"getCollection\"] = base.getCollection;\n obj[\"getProperty\"] = base.getProperty;\n obj[\"parent\"] = base;\n obj[\"targetInfo\"] = base.targetInfo;\n obj[\"updateMetadataUri\"] = base.updateMetadataUri;\n obj[\"waitForRequestsToComplete\"] = base.waitForRequestsToComplete;\n },\n // Method to wait for all requests to complete, before resolving the request\n done: function done(base, resolve) {\n // Ensure the base is set\n base.base = base.base ? base.base : base; // Ensure the response index is set\n\n base.responseIndex = base.responseIndex >= 0 ? base.responseIndex : 0; // Wait for the responses to execute\n\n _1.Request.waitForRequestsToComplete(base, function () {\n var responses = base.base.responses; // Clear the responses\n\n base.base.responses = []; // Clear the wait flags\n\n base.base.waitFlags = []; // Resolve the request\n\n resolve ? resolve.apply(base, responses) : null;\n });\n },\n // Method to execute a method\n executeMethod: function executeMethod(base, methodName, methodConfig, args) {\n var targetInfo = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Create the target information and use the url defined for the base object\n targetInfo = {\n url: metadata.uri\n }; // See if we are inheriting the metadata type\n\n if (methodConfig.inheritMetadataType && metadata.type) {\n // Copy the metadata type\n methodConfig.metadataType = metadata.type;\n } // Update the metadata uri\n\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo);\n } else {\n // Copy the target information\n targetInfo = Object.create(base.targetInfo);\n } // Get the method information\n\n\n var methodInfo = new _1.MethodInfo(methodName, methodConfig, args); // Update the target information\n\n targetInfo.bufferFl = methodConfig.requestType == _1.RequestType.GetBuffer;\n targetInfo.data = methodInfo.body;\n targetInfo.defaultToWebFl = typeof targetInfo.defaultToWebFl === \"undefined\" && base.base ? base.base.targetInfo.defaultToWebFl : targetInfo.defaultToWebFl;\n targetInfo.method = methodInfo.requestMethod;\n targetInfo.requestDigest = typeof targetInfo.requestDigest === \"undefined\" && base.base && base.base.targetInfo.requestDigest ? base.base.targetInfo.requestDigest : targetInfo.requestDigest;\n targetInfo.requestType = methodConfig.requestType; // See if we are appending the endpoint\n\n if (methodInfo.appendEndpointFl) {\n // Append to the endpoint\n targetInfo.endpoint += \".\" + methodInfo.url;\n } // Else, see if we are replacing the endpoint\n else if (methodInfo.replaceEndpointFl) {\n // Replace the endpoint\n targetInfo.endpoint = methodInfo.url;\n } // Else, ensure the method url exists\n else if (methodInfo.url && methodInfo.url.length > 0) {\n // Ensure the end point exists\n targetInfo.endpoint = targetInfo.endpoint ? targetInfo.endpoint : \"\"; // See if the endpoint exists, and the method is not a query string\n\n if (targetInfo.endpoint && methodInfo.url && methodInfo.url.indexOf(\"?\") != 0) {\n // Add a \"/\" separator to the url\n targetInfo.endpoint += \"/\";\n } // Append the url\n\n\n targetInfo.endpoint += methodInfo.url;\n } // Create a new object\n\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.getAllItemsFl = methodInfo.getAllItemsFl;\n obj.parent = base;\n obj.requestType = methodConfig.requestType; // Ensure the return type exists\n\n if (methodConfig.returnType) {\n // Add the methods\n _1.Request.addMethods(obj, {\n __metadata: {\n type: methodConfig.returnType\n }\n });\n } // Return the object\n\n\n return obj;\n },\n // Method to return a collection\n getCollection: function getCollection(base, method, args) {\n // Copy the target information\n var targetInfo = Object.create(base.targetInfo); // Clear the target information properties from any previous requests\n\n targetInfo.data = null;\n targetInfo.method = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Update the url of the target information\n targetInfo.url = metadata.uri; // Update the metadata uri\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo); // Set the endpoint\n\n targetInfo.endpoint = method;\n } else {\n // Append the method to the endpoint\n targetInfo.endpoint += \"/\" + method;\n } // Update the callback\n\n\n targetInfo.callback = args && typeof args[0] === \"function\" ? args[0] : null; // Create a new object\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Return the object\n\n return obj;\n },\n // Method to get the next set of results\n getNextSetOfResults: function getNextSetOfResults(base) {\n // Create the target information to query the next set of results\n var targetInfo = Object.create(base.targetInfo);\n targetInfo.endpoint = \"\";\n targetInfo.url = base[\"d\"].__next; // Create a new object\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Return the object\n\n return obj;\n },\n // Method to return a property of the base object\n getProperty: function getProperty(base, propertyName, requestType) {\n // Copy the target information\n var targetInfo = Object.create(base.targetInfo); // See if this is a graph request\n\n if (requestType.indexOf(\"graph\") == 0) {\n // Default the request type\n targetInfo.requestType = _1.RequestType.GraphGet;\n } // Clear the target information properties from any previous requests\n\n\n targetInfo.data = null;\n targetInfo.method = null; // See if the metadata is defined for the base object\n\n var metadata = base[\"d\"] ? base[\"d\"].__metadata : base[\"__metadata\"];\n\n if (metadata && metadata.uri) {\n // Update the url of the target information\n targetInfo.url = metadata.uri; // Update the metadata uri\n\n exports.Helper.updateMetadataUri(base, metadata, targetInfo); // Set the endpoint\n\n targetInfo.endpoint = propertyName;\n } else {\n // Append the property name to the endpoint\n targetInfo.endpoint += \"/\" + propertyName;\n } // Create a new object\n\n\n var obj = new _1.Base(targetInfo); // Set the properties\n\n obj.base = base.base ? base.base : base;\n obj.parent = base; // Add the methods\n\n requestType ? _1.Request.addMethods(obj, {\n __metadata: {\n type: requestType\n }\n }) : null; // Return the object\n\n return obj;\n },\n // Method to get the request information\n getRequestInfo: function getRequestInfo(base) {\n // Create the request, but don't execute it\n var xhr = new xhrRequest_1.XHRRequest(true, new _1.TargetInfo(base.targetInfo), null, false); // Return the request information\n\n return xhr.requestInfo;\n },\n // Method to stringify the object\n stringify: function stringify(base) {\n // Stringify the object\n return JSON.stringify({\n response: base.response,\n status: base.status,\n targetInfo: {\n accessToken: base.targetInfo.accessToken,\n bufferFl: base.targetInfo.bufferFl,\n defaultToWebFl: base.targetInfo.defaultToWebFl,\n endpoint: base.targetInfo.endpoint,\n method: base.targetInfo.method,\n overrideDefaultRequestToHostFl: base.targetInfo.overrideDefaultRequestToHostFl,\n requestDigest: base.targetInfo.requestDigest,\n requestHeader: base.targetInfo.requestHeader,\n requestInfo: base.targetInfo.requestInfo,\n requestType: base.targetInfo.requestType,\n url: base.targetInfo.url\n }\n });\n },\n // Method to update a collection object\n updateDataCollection: function updateDataCollection(obj, results) {\n // Ensure the base is a collection\n if (results) {\n // Save the results\n obj[\"results\"] = obj[\"results\"] ? obj[\"results\"].concat(results) : results; // See if only one object exists\n\n if (obj[\"results\"].length > 0) {\n var results_2 = obj[\"results\"]; // Parse the results\n\n for (var _i = 0, results_1 = results_2; _i < results_1.length; _i++) {\n var result = results_1[_i]; // Add the base methods\n\n exports.Helper.addBaseMethods(obj, result); // Update the metadata\n\n exports.Helper.updateMetadata(obj, result); // Add the methods\n\n _1.Request.addMethods(result, result);\n }\n }\n }\n },\n // Method to update the expanded properties\n updateExpandedProperties: function updateExpandedProperties(base) {\n // Ensure this is an OData request\n if (base[\"results\"] == null || base.requestType != _1.RequestType.OData) {\n return;\n } // Parse the results\n\n\n for (var i = 0; i < base[\"results\"].length; i++) {\n var result = base[\"results\"][i]; // Parse the properties\n\n for (var key in result) {\n var prop = result[key]; // See if this property was expanded\n\n if (prop && prop[\"__metadata\"]) {\n // Add the base methods\n exports.Helper.addBaseMethods(result, prop); // Update the metadata\n\n exports.Helper.updateMetadata(result, prop); // Add the methods\n\n _1.Request.addMethods(prop, prop);\n }\n }\n }\n },\n // Method to update the metadata\n updateMetadata: function updateMetadata(base, data) {\n // See if this is the app web\n if (lib_1.ContextInfo.isAppWeb) {\n // Get the url information\n var hostUrl = lib_1.ContextInfo.webAbsoluteUrl.toLowerCase();\n var requestUrl = data && data.__metadata && data.__metadata.uri ? data.__metadata.uri.toLowerCase() : null;\n var targetUrl = base.targetInfo && base.targetInfo.url ? base.targetInfo.url.toLowerCase() : null; // Ensure the urls exist\n\n if (hostUrl == null || requestUrl == null || targetUrl == null) {\n return;\n } // See if we need to make an update\n\n\n if (targetUrl.indexOf(hostUrl) == 0) {\n return;\n } // Update the metadata uri\n\n\n data.__metadata.uri = requestUrl.replace(hostUrl, targetUrl);\n } // See if this is a webpart definition\n\n\n if (data.__metadata && /SP.WebParts.WebPartDefinition/.test(data.__metadata.type)) {\n // Update the metadata uri\n data.__metadata.uri = data.__metadata.uri.replace(/SP.WebParts.WebPartDefinition/, base.targetInfo.endpoint + \"/getById('\") + \"')\";\n }\n },\n // Method to update the metadata uri\n updateMetadataUri: function updateMetadataUri(base, metadata, targetInfo) {\n // See if this is a field\n if (/^SP.Field/.test(metadata.type) || /^SP\\..*Field$/.test(metadata.type)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.replace(/AvailableFields/, \"fields\");\n } // Else, see if this is an event receiver\n else if (/SP.EventReceiverDefinition/.test(metadata.type)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.replace(/\\/EventReceiver\\//, \"/EventReceivers/\");\n } // Else, see if this is a tenant app\n else if (/Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CorporateCatalogAppMetadata/.test(targetInfo.url)) {\n // Fix the url reference\n targetInfo.url = targetInfo.url.split(\"Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.CorporateCatalogAppMetadata\")[0] + \"web/tenantappcatalog/availableapps/getbyid('\" + base[\"ID\"] + \"')\";\n }\n }\n};\n\n//# sourceURL=webpack:///./build/utils/helper.js?"); /***/ }), @@ -922,7 +946,7 @@ eval("\n\nvar __createBinding = this && this.__createBinding || (Object.create ? /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.MethodInfo = void 0;\n\nvar _1 = __webpack_require__(/*! . */ \"./build/utils/index.js\");\n/*********************************************************************************************************************************/\n// Method Information\n// This class will create the method information for the request.\n\n/*********************************************************************************************************************************/\n\n\nvar MethodInfo =\n/** @class */\nfunction () {\n /*********************************************************************************************************************************/\n // Constructor\n\n /*********************************************************************************************************************************/\n function MethodInfo(methodName, methodInfo, args) {\n // Default the properties\n this.methodInfo = methodInfo;\n this.methodInfo.argValues = args;\n this.methodInfo.name = typeof this.methodInfo.name === \"string\" ? this.methodInfo.name : methodName; // Generate the parameters\n\n this.generateParams(); // Generate the url\n\n this.methodUrl = this.generateUrl();\n }\n\n Object.defineProperty(MethodInfo.prototype, \"body\", {\n /*********************************************************************************************************************************/\n // Public Properties\n\n /*********************************************************************************************************************************/\n // The data passed through the body of the request\n get: function get() {\n return this.methodData;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"getAllItemsFl\", {\n // Flag to determine if we are getting all items\n get: function get() {\n return this.methodInfo.getAllItemsFl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"replaceEndpointFl\", {\n // Flag to determine if this method replaces the endpoint\n get: function get() {\n return this.methodInfo.replaceEndpointFl ? true : false;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"requestMethod\", {\n // The request method\n get: function get() {\n // Return the request method if it exists\n if (typeof this.methodInfo.requestMethod === \"string\") {\n return this.methodInfo.requestMethod;\n } // Determine the request method, based on the request type\n\n\n switch (this.methodInfo.requestType) {\n case _1.RequestType.Delete:\n case _1.RequestType.Post:\n case _1.RequestType.PostBodyNoArgs:\n case _1.RequestType.PostWithArgs:\n case _1.RequestType.PostWithArgsAndData:\n case _1.RequestType.PostWithArgsInBody:\n case _1.RequestType.PostWithArgsInQS:\n case _1.RequestType.PostWithArgsInQSAsVar:\n case _1.RequestType.PostWithArgsValueOnly:\n case _1.RequestType.PostReplace:\n return \"POST\";\n\n default:\n return \"GET\";\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"url\", {\n // The url of the method and parameters\n get: function get() {\n return this.methodUrl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInBody\", {\n /*********************************************************************************************************************************/\n // Private Variables\n\n /*********************************************************************************************************************************/\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInBody || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs || this.methodInfo.requestType == _1.RequestType.PostWithArgsInBody;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInQS\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQS || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInQSAsVar\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQSAsVar || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQSAsVar;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"isTemplate\", {\n get: function get() {\n return this.methodInfo.data ? true : false;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"replace\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetReplace || this.methodInfo.requestType == _1.RequestType.PostReplace;\n },\n enumerable: false,\n configurable: true\n });\n /*********************************************************************************************************************************/\n // Private Methods\n\n /*********************************************************************************************************************************/\n // Method to generate the method input parameters\n\n MethodInfo.prototype.generateParams = function () {\n var maxArgNames = 0;\n var params = {}; // Ensure values exist\n\n if (this.methodInfo.argValues == null) {\n return;\n } // See if the argument names exist\n\n\n if (this.methodInfo.argNames) {\n // Set the max arguments\n maxArgNames = this.methodInfo.argNames.length - (this.methodInfo.requestType == _1.RequestType.PostWithArgsAndData || this.methodInfo.requestType == _1.RequestType.PostReplaceWithData ? 1 : 0); // Parse the argument names\n\n for (var i = 0; i < maxArgNames && i < this.methodInfo.argValues.length; i++) {\n var name_1 = this.methodInfo.argNames[i];\n var value = this.methodInfo.argValues[i]; // Copy the parameter value\n\n switch (_typeof(this.methodInfo.argValues[i])) {\n case \"boolean\":\n params[name_1] = this.methodInfo.argValues[i] ? \"true\" : \"false\";\n break;\n\n case \"number\":\n params[name_1] = this.methodInfo.argValues[i];\n break;\n //case \"string\":\n //params[name] = this.isTemplate || this.replace ? value : \"'\" + value + \"'\";\n //break;\n\n default:\n params[name_1] = value;\n break;\n }\n }\n } // See if the method has parameters\n\n\n var isEmpty = true;\n\n for (var k in params) {\n isEmpty = false;\n break;\n }\n\n this.methodParams = isEmpty ? null : params; // See if method parameters exist\n\n if (this.methodParams) {\n // See if a template is defined for the method data\n if (this.isTemplate) {\n // Ensure the object is a string\n if (typeof this.methodInfo.data !== \"string\") {\n // Stringify the object\n this.methodInfo.data = JSON.stringify(this.methodInfo.data);\n } // Parse the arguments\n\n\n for (var key in this.methodParams) {\n // Replace the argument in the template\n this.methodInfo.data = this.methodInfo.data.replace(\"[[\" + key + \"]]\", this.methodParams[key].replace(/\"/g, '\\\\\"').replace(/\\n/g, \"\"));\n } // Set the method data\n\n\n this.methodData = JSON.parse(this.methodInfo.data);\n }\n } // See if argument values exist\n\n\n if (this.methodInfo.argValues && this.methodInfo.argValues.length > 0) {\n // See if argument names exist\n if (this.methodInfo.argNames == null || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs) {\n // Set the method data to first argument value\n this.methodData = this.methodInfo.argValues[0];\n } // Else, see if we are passing arguments outside of the parameters\n else if (this.methodInfo.argValues.length > maxArgNames) {\n // Set the method data to the next available argument value\n this.methodData = this.methodInfo.argValues[maxArgNames];\n }\n } // See if the metadata type exists\n\n\n if (this.methodInfo.metadataType) {\n // See if parameters exist\n if (this.methodInfo.argNames && this.methodInfo.requestType != _1.RequestType.PostBodyNoArgs) {\n // Append the metadata to the first parameter, if it doesn't exist\n (this.methodData || this.methodParams)[this.methodInfo.argNames[0]][\"__metadata\"] = (this.methodData || this.methodParams)[this.methodInfo.argNames[0]][\"__metadata\"] || {\n \"type\": this.methodInfo.metadataType\n };\n } else {\n // Append the metadata to the parameters, if it doesn't exist\n (this.methodData || this.methodParams)[\"__metadata\"] = (this.methodData || this.methodParams)[\"__metadata\"] || {\n \"type\": this.methodInfo.metadataType\n };\n }\n }\n }; // Method to generate the method and parameters as a url\n\n\n MethodInfo.prototype.generateUrl = function () {\n var url = this.methodInfo.name; // See if we are deleting the object\n\n if (this.methodInfo.requestType == _1.RequestType.Delete) {\n // Update the url\n url = \"deleteObject\";\n } // See if we are passing the data in the body\n\n\n if (this.passDataInBody) {\n var data = this.methodData || this.methodParams; // Stringify the data to be passed in the body\n\n this.methodData = JSON.stringify(data);\n } // See if we are passing the data in the query string as a variable\n\n\n if (this.passDataInQSAsVar) {\n var data = this.methodParams || this.methodData; // Append the parameters in the query string\n\n url += \"(@v)?@v=\" + (typeof data === \"string\" ? \"'\" + encodeURIComponent(data) + \"'\" : JSON.stringify(data));\n } // See if we are replacing the arguments\n\n\n if (this.replace) {\n // Parse the arguments\n for (var key in this.methodParams) {\n // Replace the argument in the url\n url = url.replace(\"[[\" + key + \"]]\", encodeURIComponent(this.methodParams[key]));\n }\n } // Else, see if this is an odata request\n else if (this.methodInfo.requestType == _1.RequestType.OData) {\n var oData = new _1.OData(this.methodParams[\"oData\"]); // Update the url\n\n url = \"?\" + oData.QueryString; // Set the get all items Flag\n\n this.methodInfo.getAllItemsFl = oData.GetAllItems;\n } // Else, see if we are not passing the data in the body or query string as a variable\n else if (!this.passDataInBody && !this.passDataInQSAsVar) {\n var params = \"\"; // Ensure data exists\n\n var data = this.methodParams || this.methodData;\n\n if (data) {\n // Ensure the data is an object\n data = data && _typeof(data) === \"object\" ? data : {\n value: data\n }; // Parse the parameters\n\n for (var name_2 in data) {\n var value = data[name_2];\n value = typeof value === \"string\" ? \"'\" + value + \"'\" : value;\n\n switch (this.methodInfo.requestType) {\n // Append the value only\n case _1.RequestType.GetWithArgsValueOnly:\n case _1.RequestType.PostWithArgsValueOnly:\n params += value + \", \";\n break;\n // Append the parameter and value\n\n default:\n params += name_2 + \"=\" + value + \", \";\n break;\n }\n }\n } // See if we are passing data in the query string\n\n\n if (this.passDataInQS) {\n // Set the url\n url += params.length > 0 ? \"?\" + params.replace(/, $/, \"&\") : \"\";\n } else {\n // Set the url\n url += params.length > 0 ? \"(\" + params.replace(/, $/, \"\") + \")\" : \"\";\n }\n } // Return the url\n\n\n return url;\n };\n\n return MethodInfo;\n}();\n\nexports.MethodInfo = MethodInfo;\n\n//# sourceURL=webpack:///./build/utils/methodInfo.js?"); +eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.MethodInfo = void 0;\n\nvar _1 = __webpack_require__(/*! . */ \"./build/utils/index.js\");\n/*********************************************************************************************************************************/\n// Method Information\n// This class will create the method information for the request.\n\n/*********************************************************************************************************************************/\n\n\nvar MethodInfo =\n/** @class */\nfunction () {\n /*********************************************************************************************************************************/\n // Constructor\n\n /*********************************************************************************************************************************/\n function MethodInfo(methodName, methodInfo, args) {\n // Default the properties\n this.methodInfo = methodInfo;\n this.methodInfo.argValues = args;\n this.methodInfo.name = typeof this.methodInfo.name === \"string\" ? this.methodInfo.name : methodName; // Generate the parameters\n\n this.generateParams(); // Generate the url\n\n this.methodUrl = this.generateUrl();\n }\n\n Object.defineProperty(MethodInfo.prototype, \"appendEndpointFl\", {\n /*********************************************************************************************************************************/\n // Public Properties\n\n /*********************************************************************************************************************************/\n // Flag to determine if this method replaces the endpoint\n get: function get() {\n return this.methodInfo.appendEndpointFl ? true : false;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"body\", {\n // The data passed through the body of the request\n get: function get() {\n return this.methodData;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"getAllItemsFl\", {\n // Flag to determine if we are getting all items\n get: function get() {\n return this.methodInfo.getAllItemsFl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"replaceEndpointFl\", {\n // Flag to determine if this method replaces the endpoint\n get: function get() {\n return this.methodInfo.replaceEndpointFl ? true : false;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"requestMethod\", {\n // The request method\n get: function get() {\n // Return the request method if it exists\n if (typeof this.methodInfo.requestMethod === \"string\") {\n return this.methodInfo.requestMethod;\n } // Determine the request method, based on the request type\n\n\n switch (this.methodInfo.requestType) {\n case _1.RequestType.Delete:\n case _1.RequestType.Post:\n case _1.RequestType.PostBodyNoArgs:\n case _1.RequestType.PostWithArgs:\n case _1.RequestType.PostWithArgsAndData:\n case _1.RequestType.PostWithArgsInBody:\n case _1.RequestType.PostWithArgsInQS:\n case _1.RequestType.PostWithArgsInQSAsVar:\n case _1.RequestType.PostWithArgsValueOnly:\n case _1.RequestType.PostReplace:\n return \"POST\";\n\n default:\n return \"GET\";\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"url\", {\n // The url of the method and parameters\n get: function get() {\n return this.methodUrl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInBody\", {\n /*********************************************************************************************************************************/\n // Private Variables\n\n /*********************************************************************************************************************************/\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInBody || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs || this.methodInfo.requestType == _1.RequestType.PostWithArgsInBody;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInQS\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQS || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"passDataInQSAsVar\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetWithArgsInQSAsVar || this.methodInfo.requestType == _1.RequestType.PostWithArgsInQSAsVar;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"isTemplate\", {\n get: function get() {\n return this.methodInfo.data ? true : false;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(MethodInfo.prototype, \"replace\", {\n get: function get() {\n return this.methodInfo.requestType == _1.RequestType.GetReplace || this.methodInfo.requestType == _1.RequestType.PostReplace;\n },\n enumerable: false,\n configurable: true\n });\n /*********************************************************************************************************************************/\n // Private Methods\n\n /*********************************************************************************************************************************/\n // Method to generate the method input parameters\n\n MethodInfo.prototype.generateParams = function () {\n var maxArgNames = 0;\n var params = {}; // Ensure values exist\n\n if (this.methodInfo.argValues == null) {\n return;\n } // See if the argument names exist\n\n\n if (this.methodInfo.argNames) {\n // Set the max arguments\n maxArgNames = this.methodInfo.argNames.length - (this.methodInfo.requestType == _1.RequestType.PostWithArgsAndData || this.methodInfo.requestType == _1.RequestType.PostReplaceWithData ? 1 : 0); // Parse the argument names\n\n for (var i = 0; i < maxArgNames && i < this.methodInfo.argValues.length; i++) {\n var name_1 = this.methodInfo.argNames[i];\n var value = this.methodInfo.argValues[i]; // Copy the parameter value\n\n switch (_typeof(this.methodInfo.argValues[i])) {\n case \"boolean\":\n params[name_1] = this.methodInfo.argValues[i] ? \"true\" : \"false\";\n break;\n\n case \"number\":\n params[name_1] = this.methodInfo.argValues[i];\n break;\n //case \"string\":\n //params[name] = this.isTemplate || this.replace ? value : \"'\" + value + \"'\";\n //break;\n\n default:\n params[name_1] = value;\n break;\n }\n }\n } // See if the method has parameters\n\n\n var isEmpty = true;\n\n for (var k in params) {\n isEmpty = false;\n break;\n }\n\n this.methodParams = isEmpty ? null : params; // See if method parameters exist\n\n if (this.methodParams) {\n // See if a template is defined for the method data\n if (this.isTemplate) {\n // Ensure the object is a string\n if (typeof this.methodInfo.data !== \"string\") {\n // Stringify the object\n this.methodInfo.data = JSON.stringify(this.methodInfo.data);\n } // Parse the arguments\n\n\n for (var key in this.methodParams) {\n // Replace the argument in the template\n this.methodInfo.data = this.methodInfo.data.replace(\"[[\" + key + \"]]\", this.methodParams[key].replace(/\"/g, '\\\\\"').replace(/\\n/g, \"\"));\n } // Set the method data\n\n\n this.methodData = JSON.parse(this.methodInfo.data);\n }\n } // See if argument values exist\n\n\n if (this.methodInfo.argValues && this.methodInfo.argValues.length > 0) {\n // See if argument names exist\n if (this.methodInfo.argNames == null || this.methodInfo.requestType == _1.RequestType.PostBodyNoArgs) {\n // Set the method data to first argument value\n this.methodData = this.methodInfo.argValues[0];\n } // Else, see if we are passing arguments outside of the parameters\n else if (this.methodInfo.argValues.length > maxArgNames) {\n // Set the method data to the next available argument value\n this.methodData = this.methodInfo.argValues[maxArgNames];\n }\n } // See if the metadata type exists\n\n\n if (this.methodInfo.metadataType) {\n // See if parameters exist\n if (this.methodInfo.argNames && this.methodInfo.requestType != _1.RequestType.PostBodyNoArgs) {\n // Append the metadata to the first parameter, if it doesn't exist\n (this.methodData || this.methodParams)[this.methodInfo.argNames[0]][\"__metadata\"] = (this.methodData || this.methodParams)[this.methodInfo.argNames[0]][\"__metadata\"] || {\n \"type\": this.methodInfo.metadataType\n };\n } else {\n // Append the metadata to the parameters, if it doesn't exist\n (this.methodData || this.methodParams)[\"__metadata\"] = (this.methodData || this.methodParams)[\"__metadata\"] || {\n \"type\": this.methodInfo.metadataType\n };\n }\n }\n }; // Method to generate the method and parameters as a url\n\n\n MethodInfo.prototype.generateUrl = function () {\n var url = this.methodInfo.name; // See if we are deleting the object\n\n if (this.methodInfo.requestType == _1.RequestType.Delete) {\n // Update the url\n url = \"deleteObject\";\n } // See if we are passing the data in the body\n\n\n if (this.passDataInBody) {\n var data = this.methodData || this.methodParams; // Stringify the data to be passed in the body\n\n this.methodData = JSON.stringify(data);\n } // See if we are passing the data in the query string as a variable\n\n\n if (this.passDataInQSAsVar) {\n var data = this.methodParams || this.methodData; // Append the parameters in the query string\n\n url += \"(@v)?@v=\" + (typeof data === \"string\" ? \"'\" + encodeURIComponent(data) + \"'\" : JSON.stringify(data));\n } // See if we are replacing the arguments\n\n\n if (this.replace) {\n // Parse the arguments\n for (var key in this.methodParams) {\n // Replace the argument in the url\n url = url.replace(\"[[\" + key + \"]]\", encodeURIComponent(this.methodParams[key]));\n }\n } // Else, see if this is an odata request\n else if (this.methodInfo.requestType == _1.RequestType.OData) {\n var oData = new _1.OData(this.methodParams[\"oData\"]); // Update the url\n\n url = \"?\" + oData.QueryString; // Set the get all items Flag\n\n this.methodInfo.getAllItemsFl = oData.GetAllItems;\n } // Else, see if we are not passing the data in the body or query string as a variable\n else if (!this.passDataInBody && !this.passDataInQSAsVar) {\n var params = \"\"; // Ensure data exists\n\n var data = this.methodParams || this.methodData;\n\n if (data) {\n // Ensure the data is an object\n data = data && _typeof(data) === \"object\" ? data : {\n value: data\n }; // Parse the parameters\n\n for (var name_2 in data) {\n var value = data[name_2];\n value = typeof value === \"string\" ? \"'\" + value + \"'\" : value;\n\n switch (this.methodInfo.requestType) {\n // Append the value only\n case _1.RequestType.GetWithArgsValueOnly:\n case _1.RequestType.PostWithArgsValueOnly:\n params += value + \", \";\n break;\n // Append the parameter and value\n\n default:\n params += name_2 + \"=\" + value + \", \";\n break;\n }\n }\n } // See if we are passing data in the query string\n\n\n if (this.passDataInQS) {\n // Set the url\n url += params.length > 0 ? \"?\" + params.replace(/, $/, \"&\") : \"\";\n } else {\n // Set the url\n url += params.length > 0 ? \"(\" + params.replace(/, $/, \"\") + \")\" : \"\";\n }\n } // Return the url\n\n\n return url;\n };\n\n return MethodInfo;\n}();\n\nexports.MethodInfo = MethodInfo;\n\n//# sourceURL=webpack:///./build/utils/methodInfo.js?"); /***/ }), diff --git a/dist/gd-sprest.min.js b/dist/gd-sprest.min.js index 533eb18e..564c6a1c 100644 --- a/dist/gd-sprest.min.js +++ b/dist/gd-sprest.min.js @@ -1 +1 @@ -!function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=74)}([function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(65),t),n(r(66),t),n(r(67),t),n(r(68),t),n(r(121),t),n(r(122),t),n(r(123),t),n(r(70),t),n(r(39),t)},function(e,t,r){(function(t){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||Function("return this")()}).call(this,r(78))},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(120),t),n(r(132),t),n(r(133),t),n(r(134),t),n(r(135),t),n(r(136),t),n(r(137),t),n(r(138),t),n(r(139),t),n(r(140),t),n(r(141),t),n(r(142),t),n(r(143),t),n(r(144),t),n(r(145),t),n(r(146),t),n(r(147),t),n(r(148),t),n(r(149),t),n(r(71),t),n(r(150),t),n(r(151),t)},function(e,t,r){var a=r(1),n=r(42),o=r(5),s=r(46),i=r(47),u=r(79),l=n("wks"),p=a.Symbol,d=u?p:p&&p.withoutSetter||s;e.exports=function(e){return o(l,e)||(i&&o(p,e)?l[e]=p[e]:l[e]=d("Symbol."+e)),l[e]}},function(e,t,r){var a=r(10);e.exports=function(e){if(!a(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){var a=r(8),n=r(9),o=r(21);e.exports=a?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){var a=r(7);e.exports=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,r){var a=r(8),n=r(44),o=r(4),s=r(45),i=Object.defineProperty;t.f=a?i:function(e,t,r){if(o(e),t=s(t,!0),o(r),n)try{return i(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){var a=r(1),n=r(33).f,o=r(6),s=r(13),i=r(26),u=r(86),l=r(53);e.exports=function(e,t){var r,p,d,c,g,m=e.target,y=e.global,f=e.stat;if(r=y?a:f?a[m]||i(m,{}):(a[m]||{}).prototype)for(p in t){if(c=t[p],d=e.noTargetGet?(g=n(r,p))&&g.value:r[p],!l(y?p:m+(f?".":"#")+p,e.forced)&&void 0!==d){if(typeof c==typeof d)continue;u(c,d)}(e.sham||d&&d.sham)&&o(c,"sham",!0),s(r,p,c,e)}}},function(e,t,r){var a=r(50),n=r(1),o=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?o(a[e])||o(n[e]):a[e]&&a[e][t]||n[e]&&n[e][t]}},function(e,t,r){var a=r(1),n=r(6),o=r(5),s=r(26),i=r(28),u=r(16),l=u.get,p=u.enforce,d=String(String).split("String");(e.exports=function(e,t,r,i){var u=!!i&&!!i.unsafe,l=!!i&&!!i.enumerable,c=!!i&&!!i.noTargetGet;"function"==typeof r&&("string"!=typeof t||o(r,"name")||n(r,"name",t),p(r).source=d.join("string"==typeof t?t:"")),e!==a?(u?!c&&e[t]&&(l=!0):delete e[t],l?e[t]=r:n(e,t,r)):l?e[t]=r:s(t,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&l(this).source||i(this)}))},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t){e.exports=!1},function(e,t,r){var a,n,o,s=r(80),i=r(1),u=r(10),l=r(6),p=r(5),d=r(29),c=r(30),g=i.WeakMap;if(s){var m=new g,y=m.get,f=m.has,T=m.set;a=function(e,t){return T.call(m,e,t),t},n=function(e){return y.call(m,e)||{}},o=function(e){return f.call(m,e)}}else{var h=d("state");c[h]=!0,a=function(e,t){return l(e,h,t),t},n=function(e){return p(e,h)?e[h]:{}},o=function(e){return p(e,h)}}e.exports={set:a,get:n,has:o,enforce:function(e){return o(e)?n(e):a(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=n(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return r}}}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t){e.exports={}},function(e,t,r){"use strict";var a=r(14),n=function(e){var t,r;this.promise=new e((function(e,a){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=a})),this.resolve=a(t),this.reject=a(r)};e.exports.f=function(e){return new n(e)}},function(e,t,r){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,r,a){void 0===a&&(a=r),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||a(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Helper=void 0;var o=r(38);t.Helper=o,n(r(2),t),n(r(176),t),n(r(40),t)},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){var a=r(85),n=r(32);e.exports=function(e){return a(n(e))}},function(e,t,r){var a=r(4),n=r(106),o=r(52),s=r(58),i=r(107),u=r(108),l=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,r,p,d){var c,g,m,y,f,T,h,P=s(t,r,p?2:1);if(d)c=e;else{if("function"!=typeof(g=i(e)))throw TypeError("Target is not iterable");if(n(g)){for(m=0,y=o(e.length);y>m;m++)if((f=p?P(a(h=e[m])[0],h[1]):P(e[m]))&&f instanceof l)return f;return new l(!1)}c=g.call(e)}for(T=c.next;!(h=T.call(c)).done;)if("object"==typeof(f=u(c,P,h.value,p))&&f&&f instanceof l)return f;return new l(!1)}).stop=function(e){return new l(!0,e)}},function(e,t){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},function(e,t,r){var a={};a[r(3)("toStringTag")]="z",e.exports="[object z]"===String(a)},function(e,t,r){var a=r(1),n=r(6);e.exports=function(e,t){try{n(a,e,t)}catch(r){a[e]=t}return t}},function(e,t,r){var a=r(1),n=r(10),o=a.document,s=n(o)&&n(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},function(e,t,r){var a=r(43),n=Function.toString;"function"!=typeof a.inspectSource&&(a.inspectSource=function(e){return n.call(e)}),e.exports=a.inspectSource},function(e,t,r){var a=r(42),n=r(46),o=a("keys");e.exports=function(e){return o[e]||(o[e]=n(e))}},function(e,t){e.exports={}},function(e,t){var r=Math.ceil,a=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?a:r)(e)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){var a=r(8),n=r(84),o=r(21),s=r(22),i=r(45),u=r(5),l=r(44),p=Object.getOwnPropertyDescriptor;t.f=a?p:function(e,t){if(e=s(e),t=i(t,!0),l)try{return p(e,t)}catch(e){}if(u(e,t))return o(!n.f.call(e,t),e[t])}},function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(e,t,r){var a=r(5),n=r(93),o=r(29),s=r(94),i=o("IE_PROTO"),u=Object.prototype;e.exports=s?Object.getPrototypeOf:function(e){return e=n(e),a(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?u:null}},function(e,t,r){var a,n=r(4),o=r(95),s=r(34),i=r(30),u=r(55),l=r(27),p=r(29),d=p("IE_PROTO"),c=function(){},g=function(e){return"