UNPKG

@corejam/base

Version:

A scaffolding for building progressive GraphQL powered jamstack applications

29 lines 998 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DATACLIENTS = exports.getDataClient = void 0; const dataClients = new Map(); /** * Check if we have the data client already initialised and return it. * If we dont, callback is called which returns new client and pushes it onto stack. * * These are the data clients which are called on models.any() in plugins * so the server side resolver fetchers. * * @param identifier * @param initClient */ function getDataClient(identifier, initClient, purge = false) { let client = dataClients.get(identifier); if (!client || purge) { client = initClient(); dataClients.set(identifier, client); } return client; } exports.getDataClient = getDataClient; var DATACLIENTS; (function (DATACLIENTS) { DATACLIENTS["GRAPHQL"] = "graphql"; DATACLIENTS["FAUNA"] = "fauna"; })(DATACLIENTS = exports.DATACLIENTS || (exports.DATACLIENTS = {})); //# sourceMappingURL=PluginManager.js.map