UNPKG

@corejam/base

Version:

A scaffolding for building progressive GraphQL powered jamstack applications

25 lines 812 B
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 */ export function getDataClient(identifier, initClient, purge = false) { let client = dataClients.get(identifier); if (!client || purge) { client = initClient(); dataClients.set(identifier, client); } return client; } export var DATACLIENTS; (function (DATACLIENTS) { DATACLIENTS["GRAPHQL"] = "graphql"; DATACLIENTS["FAUNA"] = "fauna"; })(DATACLIENTS || (DATACLIENTS = {})); //# sourceMappingURL=PluginManager.js.map