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

Function withSelectInput

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

Source from the content-addressed store, hash-verified

483// is spliced into the operation at invoke time. A real field argument named
484// `select` (rare) is left untouched.
485const withSelectInput = (inputSchema: unknown, returnTypeName: string): unknown => {
486 const base =
487 inputSchema && typeof inputSchema === "object"
488 ? (inputSchema as Record<string, unknown>)
489 : { type: "object", properties: {} };
490 const properties = {
491 ...((base.properties as Record<string, unknown> | undefined) ?? {}),
492 };
493 if (!("select" in properties)) {
494 properties.select = {
495 type: "string",
496 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.`,
497 };
498 }
499 return { ...base, type: "object", properties };
500};
501
502const prepareOperations = (
503 fields: readonly ExtractedField[],

Callers 1

prepareOperationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected