UNPKG

mui-spfx-controls

Version:
53 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGraph = exports.getSp = void 0; var graph_1 = require("@pnp/graph"); require("@pnp/graph/users"); var queryable_1 = require("@pnp/queryable"); var sp_1 = require("@pnp/sp"); require("@pnp/sp/batching"); require("@pnp/sp/fields"); require("@pnp/sp/folders"); require("@pnp/sp/items"); require("@pnp/sp/lists"); require("@pnp/sp/profiles"); require("@pnp/sp/search"); require("@pnp/sp/security"); require("@pnp/sp/site-users/web"); require("@pnp/sp/sites"); require("@pnp/sp/webs"); var _sp; var _graph; /** * Initializes and returns an instance of PnP SPFI (SharePoint Fluent Interface). * Ensures that the SPFI instance is set up with the provided SharePoint context. * * @param {WebPartContext} [context] - The SharePoint WebPart context. * @returns {SPFI} The initialized SPFI instance. */ var getSp = function (context) { if (context) { _sp = (0, sp_1.spfi)() .using((0, sp_1.SPFx)(context)) .using((0, queryable_1.BrowserFetchWithRetry)({ retries: 5 })); } return _sp; }; exports.getSp = getSp; /** * Initializes and returns an instance of PnP GraphFI (Microsoft Graph Fluent Interface). * Ensures that the GraphFI instance is set up with the provided SharePoint context. * * @param {WebPartContext} [context] - The SharePoint WebPart context. * @returns {GraphFI} The initialized GraphFI instance. */ var getGraph = function (context) { if (context) { _graph = (0, graph_1.graphfi)() .using((0, graph_1.SPFx)(context)) .using((0, queryable_1.BrowserFetchWithRetry)({ retries: 5 })); } return _graph; }; exports.getGraph = getGraph; //# sourceMappingURL=pnp.config.js.map