| 483 | // is spliced into the operation at invoke time. A real field argument named |
| 484 | // `select` (rare) is left untouched. |
| 485 | const 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 | |
| 502 | const prepareOperations = ( |
| 503 | fields: readonly ExtractedField[], |