UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

29 lines (28 loc) 1.21 kB
"use strict"; var _internal = require("./_internal.js"); async function listGraphQLApis(args, context) { const { apiClient, output, chalk } = context, client = apiClient({ requireUser: !0, requireProject: !0 }).config({ apiVersion: "2023-08-01" }); let endpoints; try { endpoints = await client.request({ url: "/apis/graphql", method: "GET" }); } catch (err) { throw err; } if (!endpoints || endpoints.length === 0) { output.print("This project doesn't have any GraphQL endpoints deployed."); return; } output.print("Here are the GraphQL endpoints deployed for this project:"), endpoints.forEach((endpoint, index) => { const { dataset, tag } = endpoint, url = _internal.getClientUrl(client, `graphql/${dataset}/${tag}`); output.print(`${index + 1}. ${chalk.bold("Dataset:")} ${dataset}`), output.print(` ${chalk.bold("Tag:")} ${tag}`), output.print(` ${chalk.bold("Generation:")} ${endpoint.generation}`), output.print(` ${chalk.bold("Playground:")} ${endpoint.playgroundEnabled}`), output.print(` ${chalk.bold("URL:")} ${url} `); }); } exports.default = listGraphQLApis; //# sourceMappingURL=listApisAction.js.map