MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / withSelectInput

Function withSelectInput

packages/plugins/graphql/src/sdk/plugin.ts:334–349  ·  view source on GitHub ↗
(inputSchema: unknown, returnTypeName: string)

Source from the content-addressed store, hash-verified

332// is spliced into the operation at invoke time. A real field argument named
333// `select` (rare) is left untouched.
334const withSelectInput = (inputSchema: unknown, returnTypeName: string): unknown => {
335 const base =
336 inputSchema && typeof inputSchema === "object"
337 ? (inputSchema as Record<string, unknown>)
338 : { type: "object", properties: {} };
339 const properties = {
340 ...((base.properties as Record<string, unknown> | undefined) ?? {}),
341 };
342 if (!("select" in properties)) {
343 properties.select = {
344 type: "string",
345 description: `Optional GraphQL selection set for the \`${returnTypeName}\` return type. Overrides the default, which selects only scalar fields. Provide the fields to return, with sub-selections for nested objects and arguments where required, e.g. "id name items { id title }". Omit for the default.`,
346 };
347 }
348 return { ...base, type: "object", properties };
349};
350
351const prepareOperations = (
352 fields: readonly ExtractedField[],

Callers 1

prepareOperationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected