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

Function withSelectInput

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

Source from the content-addressed store, hash-verified

452// is spliced into the operation at invoke time. A real field argument named
453// `select` (rare) is left untouched.
454const withSelectInput = (inputSchema: unknown, returnTypeName: string): unknown => {
455 const base =
456 inputSchema && typeof inputSchema === "object"
457 ? (inputSchema as Record<string, unknown>)
458 : { type: "object", properties: {} };
459 const properties = {
460 ...((base.properties as Record<string, unknown> | undefined) ?? {}),
461 };
462 if (!("select" in properties)) {
463 properties.select = {
464 type: "string",
465 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.`,
466 };
467 }
468 return { ...base, type: "object", properties };
469};
470
471const prepareOperations = (
472 fields: readonly ExtractedField[],

Callers 1

prepareOperationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected