Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
mutator-keys.ts1.74 kB
import { dequal } from "dequal"; import { Arguments } from "swr"; import { getNodeGetKey, getNodeListKey } from "@/api/openapi-client/nodes"; import { Identifier, NodeGetParams, NodeListParams, Visibility, } from "@/api/openapi-schema"; type NodeKey = ReturnType<typeof getNodeGetKey>; type NodeListKey = ReturnType<typeof getNodeListKey>; // for revalidating all node list queries (published and private) const nodeListKey = getNodeListKey(); const nodeListKeyPath = nodeListKey[0]; // for revalidating only private node list queries const nodeListPrivateKey = getNodeListKey({ // NOTE: The order here matters. visibility: [Visibility.draft, Visibility.review, Visibility.unlisted], }); export const nodeListPrivateKeyFn = (key: Arguments) => { return dequal(key, nodeListPrivateKey); }; export function buildNodeListKey(params?: NodeListParams) { const nodeListKeyFn = (key: Arguments): key is NodeListKey => { if (!key) return false; const path = key[0] as string; const isNodeListKey = path.startsWith(nodeListKeyPath); // Don't pass for /nodes/<slug> keys const notNodeKey = !path.startsWith(nodeListKeyPath + "/"); const paramsEqual = params === undefined ? true : dequal(key[1], params); const matches = isNodeListKey && notNodeKey && paramsEqual; return matches; }; return nodeListKeyFn; } export function buildNodeKey(slug: Identifier, params?: NodeGetParams) { const nodeKey = getNodeGetKey(slug, params); const nodeKeyPath = nodeKey[0]; const nodeKeyFn = (key: Arguments): key is NodeKey => { if (!key) return false; const path = key[0] as string; const pathMatches = path === nodeKeyPath; return pathMatches; }; return nodeKeyFn; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server