UNPKG

@prismatic-io/embedded

Version:

Embed Prismatic's integration marketplace and workflow designer within your existing application.

46 lines (45 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchWorkflowContexts = void 0; const graphqlRequest_1 = require("./utils/graphqlRequest"); const query = ` query workflowContexts($cursor: String) { workflowContexts(after: $cursor) { nodes { stableKey contextSchema } pageInfo { hasNextPage endCursor } } } `; const fetchWorkflowContexts = async () => { const contexts = []; let cursor; do { const data = await (0, graphqlRequest_1.graphqlRequest)({ query, variables: { cursor }, }); for (const node of data.workflowContexts.nodes) { const parsed = JSON.parse(node.contextSchema); if (parsed == null) continue; contexts.push({ stableKey: node.stableKey, contextSchema: parsed, }); } if (data.workflowContexts.pageInfo.hasNextPage) { cursor = data.workflowContexts.pageInfo.endCursor; } else { break; } } while (cursor); return contexts; }; exports.fetchWorkflowContexts = fetchWorkflowContexts;